// 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 { 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'; /** * Compensation associated with workers */ export class VariableCompensationPayoutTypes extends APIResource { /** * List system and custom payout types with per-entity earning mappings. * * - Requires: `Variable Compensation Scheduled Payouts API` * * @example HTTP * Representative request and response shapes. * ``` * GET /variable-compensation-payout-types/ 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", * "key": "string", * "display_name": "string", * "is_system": false, * "created_by": "string", * "mappings": [ * {} * ] * } * ], * "next_link": "string" * } * ``` */ list( options?: RequestOptions, ): PagePromise< VariableCompensationPayoutTypeListResponsesPageCursorURL, VariableCompensationPayoutTypeListResponse > { return this._client.getAPIList( '/variable-compensation-payout-types/', PageCursorURL, options, ); } /** * Create a custom payout type. Omit key; the server assigns one. Use PATCH * /variable-compensation-payout-types/{key}/ to update. * * @example HTTP * Representative request and response shapes. * ``` * POST /variable-compensation-payout-types/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "display_name": "display_name" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "key": "string", * "display_name": "string", * "is_system": false, * "created_by": "string", * "mappings": [ * { * "entity_id": "string", * "entity_name": "string", * "earning_code": "string", * "earning_display_name": "string", * "health": "string" * } * ] * } * ``` */ create( body: VariableCompensationPayoutTypeCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post('/variable-compensation-payout-types/', { body, ...options }); } /** * Retrieve a specific variable compensation payout type by key. * * @example HTTP * Representative request and response shapes. * ``` * GET /variable-compensation-payout-types/{id}/ 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, options?: RequestOptions): APIPromise { return this._client.get(path`/variable-compensation-payout-types/${id}/`, options); } /** * Update a custom payout type's display name or per-entity earning mappings. * * @example HTTP * Representative request and response shapes. * ``` * PATCH /variable-compensation-payout-types/{id}/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "display_name": "display_name" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "key": "string", * "display_name": "string", * "is_system": false, * "created_by": "string", * "mappings": [ * { * "entity_id": "string", * "entity_name": "string", * "earning_code": "string", * "earning_display_name": "string", * "health": "string" * } * ] * } * ``` */ update( id: string, body: VariableCompensationPayoutTypeUpdateParams, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/variable-compensation-payout-types/${id}/`, { body, ...options }); } /** * Delete a custom payout type. Built-in payout types cannot be deleted. Returns * 200 with a null body. * * @example HTTP * Representative request and response shapes. * ``` * DELETE /variable-compensation-payout-types/{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`/variable-compensation-payout-types/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type VariableCompensationPayoutTypeListResponsesPageCursorURL = PageCursorURL; export interface VariableCompensationPayoutTypeListResponse { /** * Unique identifier of the payout type. Same as key. */ id: string; /** * Display name of the payout type. */ display_name: string; /** * Whether this is a built-in payout type. */ is_system: boolean; /** * Stable payout type key assigned by the server on create. */ key: string; /** * ID of the worker who created this custom payout type. */ created_by?: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeListResponse { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } export interface VariableCompensationPayoutTypeCreateResponse { /** * Unique identifier of the payout type. Same as key. */ id: string; /** * Display name of the payout type. */ display_name: string; /** * Whether this is a built-in payout type. */ is_system: boolean; /** * Stable payout type key assigned by the server on create. */ key: string; /** * ID of the worker who created this custom payout type. */ created_by?: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeCreateResponse { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } /** * Meta information for the response. */ export interface VariableCompensationPayoutTypeRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Unique identifier of the payout type. Same as key. */ id: string; /** * Display name of the payout type. */ display_name: string; /** * Whether this is a built-in payout type. */ is_system: boolean; /** * Stable payout type key assigned by the server on create. */ key: string; /** * ID of the worker who created this custom payout type. */ created_by?: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeRetrieveResponse { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } export interface VariableCompensationPayoutTypeUpdateResponse { /** * Unique identifier of the payout type. Same as key. */ id: string; /** * Display name of the payout type. */ display_name: string; /** * Whether this is a built-in payout type. */ is_system: boolean; /** * Stable payout type key assigned by the server on create. */ key: string; /** * ID of the worker who created this custom payout type. */ created_by?: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeUpdateResponse { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } export interface VariableCompensationPayoutTypeCreateParams { /** * Display name of the payout type. */ display_name: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeCreateParams { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } export interface VariableCompensationPayoutTypeUpdateParams { /** * Display name of the payout type. */ display_name: string; /** * Per-entity earning code mappings. */ mappings?: Array; } export namespace VariableCompensationPayoutTypeUpdateParams { export interface Mapping { /** * ID of the payroll entity this mapping applies to. */ entity_id: string; /** * Mapping health status. */ health: string; /** * Mapped earning code for the payroll entity. */ earning_code?: string; /** * Display name of the mapped earning code at response time. Convenience snapshot * for the mapping matrix; authoritative earning metadata lives in payroll, not * this field. */ earning_display_name?: string; /** * Display name of the payroll entity at response time. Convenience snapshot for * the mapping matrix; authoritative entity data lives on payroll entities, not * this field. */ entity_name?: string; } } export declare namespace VariableCompensationPayoutTypes { export { type VariableCompensationPayoutTypeListResponse as VariableCompensationPayoutTypeListResponse, type VariableCompensationPayoutTypeCreateResponse as VariableCompensationPayoutTypeCreateResponse, type VariableCompensationPayoutTypeRetrieveResponse as VariableCompensationPayoutTypeRetrieveResponse, type VariableCompensationPayoutTypeUpdateResponse as VariableCompensationPayoutTypeUpdateResponse, type VariableCompensationPayoutTypeListResponsesPageCursorURL as VariableCompensationPayoutTypeListResponsesPageCursorURL, type VariableCompensationPayoutTypeCreateParams as VariableCompensationPayoutTypeCreateParams, type VariableCompensationPayoutTypeUpdateParams as VariableCompensationPayoutTypeUpdateParams, }; }