// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as FieldsAPI from './fields'; import { CustomObjectField, CustomObjectFieldsPageCursorURL, FieldCreateParams, FieldUpdateParams, Fields, } from './fields'; import * as RecordsAPI from './records'; import { CustomObjectDataRow, CustomObjectDataRowsPageCursorURL, RecordBulkCreateParams, RecordBulkCreateResponse, RecordBulkDeleteParams, RecordBulkUpdateParams, RecordBulkUpdateResponse, RecordCreateParams, RecordCreateResponse, RecordQueryParams, RecordQueryResponse, RecordUpdateParams, RecordUpdateResponse, Records, } from './records'; import { APIPromise } from '../../core/api-promise'; import { PageCursorURL, PagePromise } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Custom objects defined by the company */ export class CustomObjects extends APIResource { fields: FieldsAPI.Fields = new FieldsAPI.Fields(this._client); records: RecordsAPI.Records = new RecordsAPI.Records(this._client); /** * A list of custom objects. * * - Requires: `API Tier 1` */ list(options?: RequestOptions): PagePromise { return this._client.getAPIList('/custom-objects/', PageCursorURL, options); } /** * Create a new custom object. */ create( body: CustomObjectCreateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post('/custom-objects/', { body, ...options }); } /** * Retrieve a specific custom object. */ retrieve(customObjectAPIName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/custom-objects/${customObjectAPIName}/`, options); } /** * Update a specific custom object. */ update( customObjectAPIName: string, body: CustomObjectUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/custom-objects/${customObjectAPIName}/`, { body, ...options }); } /** * Delete a custom object. */ delete(customObjectAPIName: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/custom-objects/${customObjectAPIName}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type CustomObjectsPageCursorURL = PageCursorURL; export interface CustomObject { /** * Identifier field */ id: string; /** * The category of the custom object */ category_id: string; /** * Record creation date */ created_at: string; /** * Whether to record the history of the custom object */ enable_history: boolean; /** * The name of the custom object */ name: string; /** * The plural label of the custom object */ plural_label: string; /** * Record update date */ updated_at: string; /** * The api name of the custom object */ api_name?: string; /** * The description of the custom object */ description?: string; /** * The id of the package which the custom object belongs to */ managed_package_install_id?: string; /** * The native category of the custom object if belongs to */ native_category_id?: string; /** * The id of the owner for the custom object */ owner_id?: string; } export interface CustomObjectCreateParams { /** * The category that this custom object belongs to. */ category?: string; /** * A description of the custom object. */ description?: string; /** * The name of the custom object. */ name?: string; } export interface CustomObjectUpdateParams { /** * The category that this custom object belongs to. */ category?: string; /** * A description of the custom object. */ description?: string; /** * The name of the custom object. */ name?: string; /** * The role that owns this custom object. */ owner_role?: string; /** * The plural label for the custom object. */ plural_label?: string; } CustomObjects.Fields = Fields; CustomObjects.Records = Records; export declare namespace CustomObjects { export { type CustomObject as CustomObject, type CustomObjectsPageCursorURL as CustomObjectsPageCursorURL, type CustomObjectCreateParams as CustomObjectCreateParams, type CustomObjectUpdateParams as CustomObjectUpdateParams, }; export { Fields as Fields, type CustomObjectField as CustomObjectField, type CustomObjectFieldsPageCursorURL as CustomObjectFieldsPageCursorURL, type FieldCreateParams as FieldCreateParams, type FieldUpdateParams as FieldUpdateParams, }; export { Records as Records, type CustomObjectDataRow as CustomObjectDataRow, type RecordCreateResponse as RecordCreateResponse, type RecordQueryResponse as RecordQueryResponse, type RecordUpdateResponse as RecordUpdateResponse, type RecordBulkCreateResponse as RecordBulkCreateResponse, type RecordBulkUpdateResponse as RecordBulkUpdateResponse, type CustomObjectDataRowsPageCursorURL as CustomObjectDataRowsPageCursorURL, type RecordCreateParams as RecordCreateParams, type RecordQueryParams as RecordQueryParams, type RecordUpdateParams as RecordUpdateParams, type RecordBulkCreateParams as RecordBulkCreateParams, type RecordBulkUpdateParams as RecordBulkUpdateParams, type RecordBulkDeleteParams as RecordBulkDeleteParams, }; }