// 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'; /** * Levels and tracks used by the company for workers */ export class Tracks extends APIResource { /** * A list of tracks. * * - Requires: `API Tier 1` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /tracks/?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", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * ], * "next_link": "string" * } * ``` */ list( query: TrackListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/tracks/', PageCursorURL, { query, ...options }); } /** * Create a new track * * @example HTTP * Representative request and response shapes. * ``` * POST /tracks/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "name": "name" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * ``` */ create(body: TrackCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/tracks/', { body, ...options }); } /** * Retrieve a specific track * * @example HTTP * Representative request and response shapes. * ``` * GET /tracks/{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`/tracks/${id}/`, options); } /** * Update a specific track. * * @example HTTP * Representative request and response shapes. * ``` * PATCH /tracks/{id}/ 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", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * ``` */ update( id: string, body: TrackUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/tracks/${id}/`, { body, ...options }); } /** * Delete a track * * @example HTTP * Representative request and response shapes. * ``` * DELETE /tracks/{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`/tracks/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type TracksPageCursorURL = PageCursorURL; export interface Track { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The name of the track. Must be unique within the company or organization. */ name: string; /** * Record update date */ updated_at: string; /** * Whether this is the company's default track. */ is_default?: boolean; /** * The one-based horizontal display order of the track. */ order?: number; /** * The highest global level occupied by this track. Empty tracks return null. */ start_global_level?: number; } /** * Meta information for the response. */ export interface TrackRetrieveResponse extends BusinessPartnersAPI.Meta, Track {} export interface TrackListParams { cursor?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface TrackCreateParams { /** * The name of the track. Must be unique within the company or organization. */ name: string; /** * The one-based horizontal display order of the track. */ order?: number; } export interface TrackUpdateParams { /** * The name of the track. Must be unique within the company or organization. */ name?: string; /** * The one-based horizontal display order of the track. */ order?: number; } export declare namespace Tracks { export { type Track as Track, type TrackRetrieveResponse as TrackRetrieveResponse, type TracksPageCursorURL as TracksPageCursorURL, type TrackListParams as TrackListParams, type TrackCreateParams as TrackCreateParams, type TrackUpdateParams as TrackUpdateParams, }; }