UNPKG

openai

Version:

The official TypeScript library for the OpenAI API

127 lines 3.66 kB
import { APIResource } from "../../../../core/resource.mjs"; import * as RolesAPI from "../roles.mjs"; import { RolesPage } from "../roles.mjs"; import { APIPromise } from "../../../../core/api-promise.mjs"; import { type NextCursorPageParams, PagePromise } from "../../../../core/pagination.mjs"; import { RequestOptions } from "../../../../internal/request-options.mjs"; export declare class Roles extends APIResource { /** * Creates a custom role for a project. * * @example * ```ts * const role = * await client.admin.organization.projects.roles.create( * 'project_id', * { permissions: ['string'], role_name: 'role_name' }, * ); * ``` */ create(projectID: string, body: RoleCreateParams, options?: RequestOptions): APIPromise<RolesAPI.Role>; /** * Updates an existing project role. * * @example * ```ts * const role = * await client.admin.organization.projects.roles.update( * 'role_id', * { project_id: 'project_id' }, * ); * ``` */ update(roleID: string, params: RoleUpdateParams, options?: RequestOptions): APIPromise<RolesAPI.Role>; /** * Lists the roles configured for a project. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const role of client.admin.organization.projects.roles.list( * 'project_id', * )) { * // ... * } * ``` */ list(projectID: string, query?: RoleListParams | null | undefined, options?: RequestOptions): PagePromise<RolesPage, RolesAPI.Role>; /** * Deletes a custom role from a project. * * @example * ```ts * const role = * await client.admin.organization.projects.roles.delete( * 'role_id', * { project_id: 'project_id' }, * ); * ``` */ delete(roleID: string, params: RoleDeleteParams, options?: RequestOptions): APIPromise<RoleDeleteResponse>; } /** * Confirmation payload returned after deleting a role. */ export interface RoleDeleteResponse { /** * Identifier of the deleted role. */ id: string; /** * Whether the role was deleted. */ deleted: boolean; /** * Always `role.deleted`. */ object: 'role.deleted'; } export interface RoleCreateParams { /** * Permissions to grant to the role. */ permissions: Array<string>; /** * Unique name for the role. */ role_name: string; /** * Optional description of the role. */ description?: string | null; } export interface RoleUpdateParams { /** * Path param: The ID of the project to update. */ project_id: string; /** * Body param: New description for the role. */ description?: string | null; /** * Body param: Updated set of permissions for the role. */ permissions?: Array<string> | null; /** * Body param: New name for the role. */ role_name?: string | null; } export interface RoleListParams extends NextCursorPageParams { /** * Sort order for the returned roles. */ order?: 'asc' | 'desc'; } export interface RoleDeleteParams { /** * The ID of the project to update. */ project_id: string; } export declare namespace Roles { export { type RoleDeleteResponse as RoleDeleteResponse, type RoleCreateParams as RoleCreateParams, type RoleUpdateParams as RoleUpdateParams, type RoleListParams as RoleListParams, type RoleDeleteParams as RoleDeleteParams, }; } export { type RolesPage }; //# sourceMappingURL=roles.d.mts.map