// 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 TracksAPI from './tracks'; 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 Levels extends APIResource { /** * A list of levels. * * - Requires: `API Tier 1` * - Expandable fields: `parent`, `track` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /levels/?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": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": {}, * "global_level": "string", * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": "string", * "track_id": "string", * "track": {} * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": "string", * "order": "string", * "start_global_level": "string" * } * } * ], * "next_link": "string" * } * ``` */ list( query: LevelListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/levels/', PageCursorURL, { query, ...options }); } /** * Create a new level * * @example HTTP * Representative request and response shapes. * ``` * POST /levels/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "name": "name", * "track_id": "track_id" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": {}, * "global_level": "string", * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": "string", * "track_id": "string", * "track": {} * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": "string", * "order": "string", * "start_global_level": "string" * } * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * } * ``` */ create(body: LevelCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/levels/', { body, ...options }); } /** * Retrieve a specific level * * @example HTTP * Representative request and response shapes. * ``` * GET /levels/{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: LevelRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/levels/${id}/`, { query, ...options }); } /** * Update a specific level. * * @example HTTP * Representative request and response shapes. * ``` * PATCH /levels/{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", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": {}, * "global_level": "string", * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": "string", * "track_id": "string", * "track": {} * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": "string", * "order": "string", * "start_global_level": "string" * } * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": false, * "order": 0, * "start_global_level": 0 * } * } * ``` */ update( id: string, body: LevelUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/levels/${id}/`, { body, ...options }); } /** * Delete a level * * @example HTTP * Representative request and response shapes. * ``` * DELETE /levels/{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`/levels/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type LevelsPageCursorURL = PageCursorURL; export interface Level { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The name of the level. Must be unique within the company or organization. */ name: string; /** * Record update date */ updated_at: string; /** * The description of the level. */ description?: string; /** * The experience requirements for the level. */ experience_requirements?: string; /** * Global level is used to track the seniority of levels. The higher up a level is * placed on the page, the more senior and higher-ranked the level. Global level is * used in workflows, policies, and reports that use the level attribute (e.g., you * can use Level Lookup to set up a workflow that notifies the nearest person in an * worker's management chain at or above the specified level). */ global_level?: number; /** * The parent level. * * Expandable field */ parent?: Level; /** * The parent level. */ parent_id?: string; /** * The rank of the level within its track. */ rank?: number; /** * The scope of responsibilities for the level. */ scope_of_responsibilities?: string; /** * The track associated with the level, if it's not a global level. * * Expandable field */ track?: TracksAPI.Track; /** * The track associated with the level. Required during creation. Include * global_level when changing it. */ track_id?: string; } /** * Meta information for the response. */ export interface LevelRetrieveResponse extends BusinessPartnersAPI.Meta, Level {} export interface LevelListParams { cursor?: string; expand?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface LevelCreateParams { /** * The name of the level. Must be unique within the company or organization. */ name: string; /** * The track associated with the level. Required during creation. Include * global_level when changing it. */ track_id: string; /** * The description of the level. */ description?: string; /** * The experience requirements for the level. */ experience_requirements?: string; /** * Global level is used to track the seniority of levels. The higher up a level is * placed on the page, the more senior and higher-ranked the level. Global level is * used in workflows, policies, and reports that use the level attribute (e.g., you * can use Level Lookup to set up a workflow that notifies the nearest person in an * worker's management chain at or above the specified level). */ global_level?: number; /** * The scope of responsibilities for the level. */ scope_of_responsibilities?: string; } export interface LevelRetrieveParams { expand?: string; } export interface LevelUpdateParams { /** * The description of the level. */ description?: string; /** * The experience requirements for the level. */ experience_requirements?: string; /** * Global level is used to track the seniority of levels. The higher up a level is * placed on the page, the more senior and higher-ranked the level. Global level is * used in workflows, policies, and reports that use the level attribute (e.g., you * can use Level Lookup to set up a workflow that notifies the nearest person in an * worker's management chain at or above the specified level). */ global_level?: number; /** * The name of the level. Must be unique within the company or organization. */ name?: string; /** * The scope of responsibilities for the level. */ scope_of_responsibilities?: string; /** * The track associated with the level. Required during creation. Include * global_level when changing it. */ track_id?: string; } export declare namespace Levels { export { type Level as Level, type LevelRetrieveResponse as LevelRetrieveResponse, type LevelsPageCursorURL as LevelsPageCursorURL, type LevelListParams as LevelListParams, type LevelCreateParams as LevelCreateParams, type LevelRetrieveParams as LevelRetrieveParams, type LevelUpdateParams as LevelUpdateParams, }; }