// 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'; /** * Teams at the company */ export class Teams extends APIResource { /** * A list of teams. * * - Requires: `API Tier 1` * - Expandable fields: `parent` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /teams/?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", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": {}, * "name": "string" * }, * "name": "string" * } * ], * "next_link": "string" * } * ``` */ list( query: TeamListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/teams/', PageCursorURL, { query, ...options }); } /** * Create a new team * * @example HTTP * Representative request and response shapes. * ``` * POST /teams/ 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", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": {}, * "name": "string" * }, * "name": "string" * }, * "name": "string" * }, * "name": "string" * } * ``` */ create(body: TeamCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/teams/', { body, ...options }); } /** * Retrieve a specific team * * @example HTTP * Representative request and response shapes. * ``` * GET /teams/{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: TeamRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/teams/${id}/`, { query, ...options }); } /** * Update a specific team. * * @example HTTP * Representative request and response shapes. * ``` * PATCH /teams/{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", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "parent_id": "string", * "parent": {}, * "name": "string" * }, * "name": "string" * }, * "name": "string" * }, * "name": "string" * } * ``` */ update( id: string, body: TeamUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/teams/${id}/`, { body, ...options }); } /** * Delete a team * * @example HTTP * Representative request and response shapes. * ``` * DELETE /teams/{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`/teams/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type TeamsPageCursorURL = PageCursorURL; export interface Team { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The name of the team. */ name: string; /** * Record update date */ updated_at: string; /** * The parent team * * Expandable field */ parent?: Team; /** * The parent team */ parent_id?: string; } /** * Meta information for the response. */ export interface TeamRetrieveResponse extends BusinessPartnersAPI.Meta, Team {} export interface TeamListParams { cursor?: string; expand?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface TeamCreateParams { /** * The name of the team. */ name: string; /** * The parent team */ parent_id?: string; } export interface TeamRetrieveParams { expand?: string; } export interface TeamUpdateParams { /** * The name of the team. */ name?: string; /** * The parent team */ parent_id?: string; } export declare namespace Teams { export { type Team as Team, type TeamRetrieveResponse as TeamRetrieveResponse, type TeamsPageCursorURL as TeamsPageCursorURL, type TeamListParams as TeamListParams, type TeamCreateParams as TeamCreateParams, type TeamRetrieveParams as TeamRetrieveParams, type TeamUpdateParams as TeamUpdateParams, }; }