// 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, FieldListParams, FieldUpdateParams, Fields, } from './fields'; import * as RecordActionsAPI from './record-actions'; import { RecordActionListParams, RecordActionListResponse, RecordActionListResponsesPageCursorURL, RecordActions, } from './record-actions'; import * as ListViewsAPI from './list-views/list-views'; import { ListViewCreateParams, ListViewCreateResponse, ListViewListParams, ListViewListResponse, ListViewListResponsesPageCursorURL, ListViewRetrieveResponse, ListViewUpdateParams, ListViewUpdateResponse, ListViews, } from './list-views/list-views'; import * as RecordsAPI from './records/records'; import { CustomObjectDataRow, CustomObjectDataRowsPageCursorURL, RecordBulkCreateParams, RecordBulkCreateResponse, RecordBulkDeleteParams, RecordBulkDeleteResponse, RecordBulkUpdateParams, RecordBulkUpdateResponse, RecordCreateParams, RecordCreateResponse, RecordListParams, RecordQueryParams, RecordQueryResponse, RecordUpdateParams, RecordUpdateResponse, Records, } from './records/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); listViews: ListViewsAPI.ListViews = new ListViewsAPI.ListViews(this._client); recordActions: RecordActionsAPI.RecordActions = new RecordActionsAPI.RecordActions(this._client); /** * A list of custom objects. * * - Requires: `API Tier 1` * * @example SDK usage * ```ts * // Automatically fetches more pages as needed. * for await (const customObject of client.customObjects.list()) { * // ... * } * ``` * * @example HTTP * Representative request and response shapes. * ``` * GET /custom-objects/?limit=50&cursor=cursor HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "results": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "description": "string", * "api_name": "string", * "plural_label": "string", * "category_id": "string", * "native_category_id": "string", * "managed_package_install_id": "string", * "enable_history": false, * "owner_id": "string" * } * ], * "next_link": "string" * } * ``` */ list( query: CustomObjectListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/custom-objects/', PageCursorURL, { query, ...options }); } /** * Create a new custom object. * * @example SDK usage * ```ts * const customObject = await client.customObjects.create(); * ``` * * @example HTTP * Representative request and response shapes. * ``` * POST /custom-objects/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * {} * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "description": "string", * "api_name": "string", * "plural_label": "string", * "category_id": "string", * "native_category_id": "string", * "managed_package_install_id": "string", * "enable_history": false, * "owner_id": "string" * } * ``` */ create( body: CustomObjectCreateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post('/custom-objects/', { body, ...options }); } /** * Retrieve a specific custom object. * * @example SDK usage * ```ts * const customObject = await client.customObjects.retrieve( * 'custom_object_api_name', * ); * ``` * * @example HTTP * Representative request and response shapes. * ``` * GET /custom-objects/{custom_object_api_name}/ HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "description": "string", * "api_name": "string", * "plural_label": "string", * "category_id": "string", * "native_category_id": "string", * "managed_package_install_id": "string", * "enable_history": false, * "owner_id": "string" * } * ``` */ retrieve(customObjectAPIName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/custom-objects/${customObjectAPIName}/`, options); } /** * Update a specific custom object. * * @example SDK usage * ```ts * const customObject = await client.customObjects.update( * 'custom_object_api_name', * ); * ``` * * @example HTTP * Representative request and response shapes. * ``` * PATCH /custom-objects/{custom_object_api_name}/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * {} * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "description": "string", * "api_name": "string", * "plural_label": "string", * "category_id": "string", * "native_category_id": "string", * "managed_package_install_id": "string", * "enable_history": false, * "owner_id": "string" * } * ``` */ update( customObjectAPIName: string, body: CustomObjectUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/custom-objects/${customObjectAPIName}/`, { body, ...options }); } /** * Delete a custom object. * * @example SDK usage * ```ts * await client.customObjects.delete('custom_object_api_name'); * ``` * * @example HTTP * Representative request and response shapes. * ``` * DELETE /custom-objects/{custom_object_api_name}/ HTTP/1.1 * Host: rest.ripplingapis.com * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 204 No Content * ``` */ delete(customObjectAPIName: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/custom-objects/${customObjectAPIName}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type CustomObjectsPageCursorURL = PageCursorURL; /** Public custom-object DTO returned by the REST API. */ 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 CustomObjectListParams { cursor?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; } /** Request payload accepted by `client.customObjects.create(...)`. */ 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; } /** Request payload accepted by `client.customObjects.update(...)`. */ export interface CustomObjectUpdateParams { /** * The category that this custom object belongs to. */ category?: string; /** * A description of the custom object. */ description?: string; /** * Whether to record the history of the custom object. */ enable_history?: boolean; /** * 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; CustomObjects.ListViews = ListViews; CustomObjects.RecordActions = RecordActions; export declare namespace CustomObjects { export { type CustomObject as CustomObject, type CustomObjectsPageCursorURL as CustomObjectsPageCursorURL, type CustomObjectListParams as CustomObjectListParams, type CustomObjectCreateParams as CustomObjectCreateParams, type CustomObjectUpdateParams as CustomObjectUpdateParams, }; export { Fields as Fields, type CustomObjectField as CustomObjectField, type CustomObjectFieldsPageCursorURL as CustomObjectFieldsPageCursorURL, type FieldListParams as FieldListParams, 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 RecordBulkDeleteResponse as RecordBulkDeleteResponse, type CustomObjectDataRowsPageCursorURL as CustomObjectDataRowsPageCursorURL, type RecordListParams as RecordListParams, type RecordCreateParams as RecordCreateParams, type RecordQueryParams as RecordQueryParams, type RecordUpdateParams as RecordUpdateParams, type RecordBulkCreateParams as RecordBulkCreateParams, type RecordBulkUpdateParams as RecordBulkUpdateParams, type RecordBulkDeleteParams as RecordBulkDeleteParams, }; export { ListViews as ListViews, type ListViewListResponse as ListViewListResponse, type ListViewCreateResponse as ListViewCreateResponse, type ListViewRetrieveResponse as ListViewRetrieveResponse, type ListViewUpdateResponse as ListViewUpdateResponse, type ListViewListResponsesPageCursorURL as ListViewListResponsesPageCursorURL, type ListViewListParams as ListViewListParams, type ListViewCreateParams as ListViewCreateParams, type ListViewUpdateParams as ListViewUpdateParams, }; export { RecordActions as RecordActions, type RecordActionListResponse as RecordActionListResponse, type RecordActionListResponsesPageCursorURL as RecordActionListResponsesPageCursorURL, type RecordActionListParams as RecordActionListParams, }; }