UNPKG

openai

Version:

The official TypeScript library for the OpenAI API

164 lines 4.71 kB
import { APIResource } from "../../../../core/resource.mjs"; import { APIPromise } from "../../../../core/api-promise.mjs"; import { NextCursorPage, type NextCursorPageParams, PagePromise } from "../../../../core/pagination.mjs"; import { RequestOptions } from "../../../../internal/request-options.mjs"; export declare class Users extends APIResource { /** * Adds a user to a group. * * @example * ```ts * const user = * await client.admin.organization.groups.users.create( * 'group_id', * { user_id: 'user_id' }, * ); * ``` */ create(groupID: string, body: UserCreateParams, options?: RequestOptions): APIPromise<UserCreateResponse>; /** * Retrieves a user in a group. * * @example * ```ts * const user = * await client.admin.organization.groups.users.retrieve( * 'user_id', * { group_id: 'group_id' }, * ); * ``` */ retrieve(userID: string, params: UserRetrieveParams, options?: RequestOptions): APIPromise<UserRetrieveResponse>; /** * Lists the users assigned to a group. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const organizationGroupUser of client.admin.organization.groups.users.list( * 'group_id', * )) { * // ... * } * ``` */ list(groupID: string, query?: UserListParams | null | undefined, options?: RequestOptions): PagePromise<OrganizationGroupUsersPage, OrganizationGroupUser>; /** * Removes a user from a group. * * @example * ```ts * const user = * await client.admin.organization.groups.users.delete( * 'user_id', * { group_id: 'group_id' }, * ); * ``` */ delete(userID: string, params: UserDeleteParams, options?: RequestOptions): APIPromise<UserDeleteResponse>; } export type OrganizationGroupUsersPage = NextCursorPage<OrganizationGroupUser>; /** * Represents an individual user returned when inspecting group membership. */ export interface OrganizationGroupUser { /** * The identifier, which can be referenced in API endpoints */ id: string; /** * The email address of the user. */ email: string | null; /** * The name of the user. */ name: string; } /** * Confirmation payload returned after adding a user to a group. */ export interface UserCreateResponse { /** * Identifier of the group the user was added to. */ group_id: string; /** * Always `group.user`. */ object: 'group.user'; /** * Identifier of the user that was added. */ user_id: string; } /** * Details about a user returned from an organization group membership lookup. */ export interface UserRetrieveResponse { /** * Identifier for the user. */ id: string; /** * Email address of the user, or `null` for users without an email. */ email: string | null; /** * Whether the user is a service account. */ is_service_account: boolean | null; /** * Display name of the user. */ name: string; /** * URL of the user's profile picture, if available. */ picture: string | null; /** * The type of user. */ user_type: 'user' | 'tenant_user'; } /** * Confirmation payload returned after removing a user from a group. */ export interface UserDeleteResponse { /** * Whether the group membership was removed. */ deleted: boolean; /** * Always `group.user.deleted`. */ object: 'group.user.deleted'; } export interface UserCreateParams { /** * Identifier of the user to add to the group. */ user_id: string; } export interface UserRetrieveParams { /** * The ID of the group to inspect. */ group_id: string; } export interface UserListParams extends NextCursorPageParams { /** * Specifies the sort order of users in the list. */ order?: 'asc' | 'desc'; } export interface UserDeleteParams { /** * The ID of the group to update. */ group_id: string; } export declare namespace Users { export { type OrganizationGroupUser as OrganizationGroupUser, type UserCreateResponse as UserCreateResponse, type UserRetrieveResponse as UserRetrieveResponse, type UserDeleteResponse as UserDeleteResponse, type OrganizationGroupUsersPage as OrganizationGroupUsersPage, type UserCreateParams as UserCreateParams, type UserRetrieveParams as UserRetrieveParams, type UserListParams as UserListParams, type UserDeleteParams as UserDeleteParams, }; } //# sourceMappingURL=users.d.mts.map