// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as DigitalEmployeesAPI from './digital-employees'; import { APIPromise } from '../core/api-promise'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; export class DigitalEmployees extends APIResource { /** * Profile detail backing the DE-active banner, hover card, and toolbar capability * gating. */ retrieve( digitalEmployeeID: string, params: DigitalEmployeeRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...query } = params ?? {}; return this._client.get(path`/digital-employees/${digitalEmployeeID}`, { query, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Org-wide sidebar/mention-picker list, narrowable to one project via chatbot_id. * Excludes inactive Digital Employees. */ retrieveDigitalEmployees( params: DigitalEmployeeRetrieveDigitalEmployeesParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...query } = params ?? {}; return this._client.get('/digital-employees', { query, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Personal, per-project sidebar-ordering preference. Idempotent. */ updatePin( digitalEmployeeID: string, params: DigitalEmployeeUpdatePinParams, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.patch(path`/digital-employees/${digitalEmployeeID}/pin`, { body, ...options, headers: buildHeaders([ { 'Content-Type': 'application/x-www-form-urlencoded', Accept: '*/*', ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * A project a Digital Employee is bound to. * * Attributes: id (str): The project's client-facing chatbot id (the same slug * value `CreateMessageRequest.chatbot_id` takes). name (str): The project's * display name. */ export interface GLChatBeAPIModelDigitalEmployeeDigitalEmployeeProjectRef { id: string; name: string; } /** * Response for `GET /digital-employees/{id}`. * * Attributes: id (str): GLChat's local Digital Employee id. name (str): Display * name. role_title (str | None): Human-readable role/title. avatar_url (str | * None): Avatar image URL. description (str): Short "who this DE is" blurb. * is_active (bool): Whether GL Runner reports this Digital Employee as active. * Unlike the list endpoint, detail does not exclude inactive DEs -- a conversation * may have already activated one that later went inactive upstream. is_pinned * (bool): Whether the calling user has pinned this Digital Employee. projects * (list[DigitalEmployeeProjectRef]): Projects this Digital Employee is bound to. */ export interface DigitalEmployeeRetrieveResponse { id: string; is_active: boolean; name: string; avatar_url?: string | null; description?: string; is_pinned?: boolean; projects?: Array; role_title?: string | null; } /** * Response for `GET /digital-employees`. * * Attributes: digital_employees (list[DigitalEmployeeListItem]): The page of * Digital Employees. total (int): Total count across all pages (after excluding * inactive DEs). limit (int): The page size used. offset (int): The page offset * used. */ export interface DigitalEmployeeRetrieveDigitalEmployeesResponse { digital_employees: Array; limit: number; offset: number; total: number; } export namespace DigitalEmployeeRetrieveDigitalEmployeesResponse { /** * One entry in `GET /digital-employees`. * * Attributes: id (str): GLChat's local Digital Employee id -- never GL Runner's * `runnable_id`. name (str): Display name. role_title (str | None): Human-readable * role/title. avatar_url (str | None): Avatar image URL. description (str): Short * "who this DE is" blurb. is_pinned (bool): Whether the calling user has pinned * this Digital Employee. projects (list[DigitalEmployeeProjectRef]): Projects this * Digital Employee is bound to. */ export interface DigitalEmployee { id: string; name: string; avatar_url?: string | null; description?: string; is_pinned?: boolean; projects?: Array; role_title?: string | null; } } export interface DigitalEmployeeRetrieveParams { /** * Query param: Chatbot slug to scope is_pinned to one project */ chatbot_id?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export interface DigitalEmployeeRetrieveDigitalEmployeesParams { /** * Query param: Chatbot slug to narrow the list to one project's bound Digital * Employees */ chatbot_id?: string | null; /** * Query param */ limit?: number; /** * Query param */ offset?: number; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export interface DigitalEmployeeUpdatePinParams { /** * Body param: Chatbot slug this pin is scoped to */ chatbot_id: string; /** * Body param */ pinned: boolean; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace DigitalEmployees { export { type GLChatBeAPIModelDigitalEmployeeDigitalEmployeeProjectRef as GLChatBeAPIModelDigitalEmployeeDigitalEmployeeProjectRef, type DigitalEmployeeRetrieveResponse as DigitalEmployeeRetrieveResponse, type DigitalEmployeeRetrieveDigitalEmployeesResponse as DigitalEmployeeRetrieveDigitalEmployeesResponse, type DigitalEmployeeRetrieveParams as DigitalEmployeeRetrieveParams, type DigitalEmployeeRetrieveDigitalEmployeesParams as DigitalEmployeeRetrieveDigitalEmployeesParams, type DigitalEmployeeUpdatePinParams as DigitalEmployeeUpdatePinParams, }; }