// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; 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 CustomFields extends APIResource { /** * Create a custom field */ create(body: CustomFieldCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/custom-fields', { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Get a custom field by its ID */ retrieve(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/custom-fields/${id}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Update a custom field */ update(id: string, body: CustomFieldUpdateParams, options?: RequestOptions): APIPromise { return this._client.patch(path`/custom-fields/${id}`, { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Get all custom fields */ retrieveAll( query: CustomFieldRetrieveAllParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/custom-fields', { query, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export interface CustomFieldCreateParams { /** * The label of the custom field */ label: string; /** * The object type of the custom field */ object_type: 'account' | 'issue' | 'contact'; /** * The slug of the custom field */ slug: string; /** * The type of the custom field */ type: | 'text' | 'number' | 'decimal' | 'boolean' | 'date' | 'datetime' | 'user' | 'url' | 'select' | 'multiselect'; /** * The default value for single-valued custom fields */ default_value?: string; /** * The default values for multi-valued custom fields */ default_values?: Array; /** * The description of the custom field */ description?: string; } export interface CustomFieldUpdateParams { /** * The default value for single-valued custom fields */ default_value?: string; /** * The default values for multi-valued custom fields */ default_values?: Array; /** * The description of the custom field */ description?: string; /** * The label of the custom field */ label?: string; /** * The slug of the custom field */ slug?: string; } export interface CustomFieldRetrieveAllParams { /** * The object type of the custom fields */ object_type?: 'account' | 'issue' | 'contact'; } export declare namespace CustomFields { export { type CustomFieldCreateParams as CustomFieldCreateParams, type CustomFieldUpdateParams as CustomFieldUpdateParams, type CustomFieldRetrieveAllParams as CustomFieldRetrieveAllParams, }; }