// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as BusinessPartnersAPI from './business-partners'; import * as JobCodesAPI from './job-codes'; 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'; /** * Business structure used for defining hierarchy of company's org attributes */ export class BusinessStructurePaths extends APIResource { /** * A list of business-structure-paths. * * - Requires: `API Tier 1` * - Expandable fields: `parent`, `job_codes` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /business-structure-paths/?expand=expand&order_by=order_by&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 * * { * "__meta": { * "redacted_fields": [ * { * "name": "date_of_birth", * "reason": "Insufficient entitlements" * } * ] * }, * "results": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": null, * "job_codes_id": [ * "string" * ], * "job_codes": [ * {} * ] * } * ], * "next_link": "string" * } * ``` */ list( query: BusinessStructurePathListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList( '/business-structure-paths/', PageCursorURL, { query, ...options }, ); } /** * Create a new business-structure-path * * @example HTTP * Representative request and response shapes. * ``` * POST /business-structure-paths/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "job_code_id": "job_code_id" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": null, * "job_codes_id": [ * "string" * ], * "job_codes": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "job_dimension_id": "string", * "job_dimension": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "external_id": "string", * "includes_custom_location": "string", * "roster_type": "PER_DIMENSION", * "group_id": "string", * "org_attribute_associations": [] * }, * "external_id": "string", * "group_id": "string", * "custom_location": { * "address": {} * }, * "work_location_id": "string", * "work_location": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "address": {} * }, * "department_id": "string", * "department": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": {}, * "reference_code": "string", * "department_hierarchy_id": [], * "department_hierarchy": [] * }, * "pay_rate": 0, * "pay_rate_exceptions_id": [ * "string" * ], * "pay_rate_exceptions": [ * {} * ], * "is_archived": false * } * ] * } * ``` */ create( body: BusinessStructurePathCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post('/business-structure-paths/', { body, ...options }); } /** * Retrieve a specific business-structure-path * * @example HTTP * Representative request and response shapes. * ``` * GET /business-structure-paths/{id}/?expand=expand 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 * * { * "__meta": { * "redacted_fields": [ * {} * ] * } * } * ``` */ retrieve( id: string, query: BusinessStructurePathRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/business-structure-paths/${id}/`, { query, ...options }); } /** * Delete a Business Structure path and all of its descendant paths. * * @example HTTP * Representative request and response shapes. * ``` * DELETE /business-structure-paths/{id}/ HTTP/1.1 * Host: rest.ripplingapis.com * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 204 No Content * ``` */ delete(id: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/business-structure-paths/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type BusinessStructurePathListResponsesPageCursorURL = PageCursorURL; export interface BusinessStructurePathListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Ordered list of full JobCode objects for each job in the path, top to bottom. * Populate via ?expand=job_codes. Requires both business-structure-paths.read and * job-codes.read scopes. * * Expandable field */ job_codes?: Array; /** * Ordered list of Job code IDs from top to bottom. */ job_codes_id?: Array; /** * Name of the path (e.g. 'SF Office > Coffee > Barista'). */ name?: string; parent?: unknown; /** * Id of the parent BusinessStructurePath. None for root path. */ parent_id?: string; } export interface BusinessStructurePathCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Ordered list of full JobCode objects for each job in the path, top to bottom. * Populate via ?expand=job_codes. Requires both business-structure-paths.read and * job-codes.read scopes. * * Expandable field */ job_codes?: Array; /** * Ordered list of Job code IDs from top to bottom. */ job_codes_id?: Array; /** * Name of the path (e.g. 'SF Office > Coffee > Barista'). */ name?: string; parent?: unknown; /** * Id of the parent BusinessStructurePath. None for root path. */ parent_id?: string; } /** * Meta information for the response. */ export interface BusinessStructurePathRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Ordered list of full JobCode objects for each job in the path, top to bottom. * Populate via ?expand=job_codes. Requires both business-structure-paths.read and * job-codes.read scopes. * * Expandable field */ job_codes?: Array; /** * Ordered list of Job code IDs from top to bottom. */ job_codes_id?: Array; /** * Name of the path (e.g. 'SF Office > Coffee > Barista'). */ name?: string; parent?: unknown; /** * Id of the parent BusinessStructurePath. None for root path. */ parent_id?: string; } export interface BusinessStructurePathListParams { cursor?: string; expand?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface BusinessStructurePathCreateParams { /** * The Job Code to place at this Business Structure path. */ job_code_id: string; /** * Id of the parent BusinessStructurePath. None for root path. */ parent_id?: string; } export interface BusinessStructurePathRetrieveParams { expand?: string; } export declare namespace BusinessStructurePaths { export { type BusinessStructurePathListResponse as BusinessStructurePathListResponse, type BusinessStructurePathCreateResponse as BusinessStructurePathCreateResponse, type BusinessStructurePathRetrieveResponse as BusinessStructurePathRetrieveResponse, type BusinessStructurePathListResponsesPageCursorURL as BusinessStructurePathListResponsesPageCursorURL, type BusinessStructurePathListParams as BusinessStructurePathListParams, type BusinessStructurePathCreateParams as BusinessStructurePathCreateParams, type BusinessStructurePathRetrieveParams as BusinessStructurePathRetrieveParams, }; }