UNPKG

@anthropic-ai/sdk

Version:
125 lines • 3.96 kB
import { APIResource } from "../../core/resource.mjs"; import * as OrganizationAPI from "./organization.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { Page, type PageParams, PagePromise } from "../../core/pagination.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class Users extends APIResource { /** * Retrieve a member of the organization by user ID. * * @example * ```ts * const organizationUser = * await client.organization.users.retrieve('user_id'); * ``` */ retrieve(userID: string, options?: RequestOptions): APIPromise<OrganizationUser>; /** * Update a member's organization role. * * @example * ```ts * const organizationUser = * await client.organization.users.update('user_id', { * role: 'user', * }); * ``` */ update(userID: string, body: UserUpdateParams, options?: RequestOptions): APIPromise<OrganizationUser>; /** * List the organization's members. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const organizationUser of client.organization.users.list()) { * // ... * } * ``` */ list(query?: UserListParams | null | undefined, options?: RequestOptions): PagePromise<OrganizationUsersPage, OrganizationUser>; /** * Remove a member from the organization. * * @example * ```ts * const user = await client.organization.users.remove( * 'user_id', * ); * ``` */ remove(userID: string, options?: RequestOptions): APIPromise<UserRemoveResponse>; } export type OrganizationUsersPage = Page<OrganizationUser>; export interface OrganizationUser { /** * ID of the User. */ id: string; /** * RFC 3339 datetime string indicating when the User joined the Organization. */ added_at: string; /** * Email of the User. */ email: string; /** * Name of the User. */ name: string; /** * Organization role of the User. */ role: OrganizationAPI.OrganizationRole; /** * Object type. * * For Users, this is always `"user"`. */ type: 'user'; } export interface UserRemoveResponse { /** * ID of the User. */ id: string; /** * Deleted object type. * * For Users, this is always `"user_deleted"`. */ type: 'user_deleted'; } export interface UserUpdateParams { /** * New role for the User. * * The accepted values depend on the organization type. Console and API * organizations accept `user`, `developer`, `billing`, and `claude_code_user`; * `admin` cannot be assigned through the API. Claude Enterprise organizations * accept `user` and `managed`; changing a User's role to `managed` requires the * `write:rbac_groups` scope in addition to `write:members`. */ role: 'billing' | 'claude_code_user' | 'developer' | 'managed' | 'user'; } export interface UserListParams extends PageParams { /** * Filter by user email. */ email?: string; /** * Filter to items whose `role` equals one of the supplied values. Repeatable; * values are OR'ed together. * * Accepted values depend on the organization type: Console and API organizations * accept `user`, `developer`, `billing`, `admin`, and `claude_code_user`; Claude * Enterprise organizations accept `user`, `owner`, `primary_owner`, * `membership_admin`, and `managed`. */ roles?: Array<string>; } export declare namespace Users { export { type OrganizationUser as OrganizationUser, type UserRemoveResponse as UserRemoveResponse, type OrganizationUsersPage as OrganizationUsersPage, type UserUpdateParams as UserUpdateParams, type UserListParams as UserListParams, }; } //# sourceMappingURL=users.d.mts.map