import type { GraphQLClient } from '../client.js'; import { type OrganizationQuery, type OrganizationBySlugQuery, type MyOrganizationsQuery, type OrgMembersQuery, type OrgRolesQuery, type MemberRolesQuery, type OrgPermissionsQuery, type OrgTokensQuery, type CreateOrganizationMutation, type SetOrgStatusMutation, type CreateOrgTokenMutation, type UpdateOrgTokenMutation, type RevokeOrgTokenMutation, type InviteOrgMemberMutation, type RemoveOrgMemberMutation, type UpdateOrgMemberRolesMutation, type CreateOrgRoleMutation, type UpdateOrgRoleMutation, type DeleteOrgRoleMutation, type CreateOrganizationInput, type CreateOrgTokenInput, type UpdateOrgTokenInput, type InviteOrgMemberInput, type CreateOrgRoleInput, type UpdateOrgRoleInput } from '../generated/graphql.js'; /** * Organizations, members, roles (RBAC), and org API tokens — exposed as * `client.organizations` (and grouped under `client.admin`). * * Part of the management surface. This is the studio-admin surface: an * organization owns apps, billing, quotas, and environments, and its RBAC * grants (`manage_members`, `manage_tokens`, ...) gate the rest of the admin * APIs. Most operations require an authenticated caller who is an active member * of the org with the relevant permission; reads such as {@link permissions} * and {@link bySlug} are public. * * `BigInt` ids (`orgId`, `userId`, `orgRoleId`, `orgTokenId`) are decimal * strings. * * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, `FORBIDDEN` * / `SCOPE_MISSING` when the caller lacks the required org permission. */ export declare class OrganizationsAPI { private readonly api; constructor(api: GraphQLClient); /** * Fetch a single organization by numeric id. Requires authentication. * * @param orgId - Numeric org id (`BigInt` as a decimal string). * @returns The {@link Organization}, or `null` if it does not exist. */ get(orgId: string): Promise; /** * Resolve an organization by its URL slug. **Public** — no session required. * * @param slug - The org's URL slug (e.g. `"acme"`). * @returns The {@link Organization}, or `null` if no match. */ bySlug(slug: string): Promise; /** * List the organizations the authenticated caller is an active member of, * with their per-org permissions and roles. * * @returns An array of {@link OrgMembership} (empty if the caller belongs to * no orgs). */ mine(): Promise; /** * List members of an organization. Requires the `manage_members` org * permission. * * @param orgId - Numeric org id. * @returns The org's members with their roles. */ members(orgId: string): Promise; /** * List the custom + system roles defined for an organization. Requires the * `manage_members` org permission. * * @param orgId - Numeric org id. * @returns The org's roles. */ roles(orgId: string): Promise; /** * List the roles currently assigned to one organization member. Requires the * `manage_members` org permission. * * @param orgMemberId - Numeric org-member id (`BigInt` as a decimal string). * @returns The member's roles. */ memberRoles(orgMemberId: string): Promise; /** * List every assignable org permission key with its description. **Public** — * useful for building a role editor UI. * * @returns The catalog of org permissions. */ permissions(): Promise; /** * List the API tokens issued for an organization (metadata only; the secret * is shown once at creation). Requires the `manage_tokens` org permission. * * @param orgId - Numeric org id. * @returns The org's API tokens. */ tokens(orgId: string): Promise; /** * Create a new organization owned by the authenticated caller. The caller * becomes the owner with full permissions. * * @param input - {@link CreateOrganizationInput}: `name` and a unique `slug`. * @returns The created {@link Organization}. */ create(input: CreateOrganizationInput): Promise; /** * Set an organization's lifecycle status. **Super-admin only.** * * @param orgId - Numeric org id. * @param status - The new status (e.g. `"active"`, `"suspended"`). * @returns The updated {@link Organization}. */ setStatus(orgId: string, status: string): Promise; /** * Mint a new org API token (for server-side studio backends). Requires the * `manage_tokens` org permission. The plaintext secret is returned **once**. * * @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and * `expiresAt`. * @returns The created token including its one-time plaintext secret. */ createToken(input: CreateOrgTokenInput): Promise; /** * Update an org token's metadata (label / active flag / expiry). Requires the * `manage_tokens` org permission. * * @param orgTokenId - Numeric token id. * @param input - {@link UpdateOrgTokenInput} fields to change. * @returns The updated token metadata. */ updateToken(orgTokenId: string, input: UpdateOrgTokenInput): Promise; /** * Revoke (disable) an org token. Requires the `manage_tokens` org permission. * * @param orgTokenId - Numeric token id. * @returns `true` on success. */ revokeToken(orgTokenId: string): Promise; /** * Invite a user to an organization (by email or user id), optionally with * initial roles. Requires the `manage_members` org permission. * * @param input - {@link InviteOrgMemberInput}. * @returns The created membership. */ inviteMember(input: InviteOrgMemberInput): Promise; /** * Remove a member from an organization. Requires the `manage_members` org * permission. * * @param orgId - Numeric org id. * @param userId - Numeric id of the member to remove. * @returns `true` on success. */ removeMember(orgId: string, userId: string): Promise; /** * Replace a member's role assignments. Requires the `manage_members` org * permission. * * @param orgId - Numeric org id. * @param userId - Numeric id of the member. * @param roleIds - The full set of role ids the member should hold. * @returns The updated membership. */ setMemberRoles(orgId: string, userId: string, roleIds: string[]): Promise; /** * Create a custom org role with a set of permissions. Requires the * `manage_members` org permission. * * @param input - {@link CreateOrgRoleInput}: `orgId`, `roleName`, * `permissions`. * @returns The created {@link OrgRole}. */ createRole(input: CreateOrgRoleInput): Promise; /** * Update a custom org role's name/permissions. Requires the `manage_members` * org permission. System roles cannot be edited. * * @param orgRoleId - Numeric role id. * @param input - {@link UpdateOrgRoleInput} fields to change. * @returns The updated {@link OrgRole}. */ updateRole(orgRoleId: string, input: UpdateOrgRoleInput): Promise; /** * Delete a custom org role. Requires the `manage_members` org permission. * System roles cannot be deleted. * * @param orgRoleId - Numeric role id. * @returns `true` on success. */ deleteRole(orgRoleId: string): Promise; } //# sourceMappingURL=organizations.d.ts.map