// 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 WorkersAPI from './workers'; import { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Schedules used by the company */ export class Schedules extends APIResource { /** * A list of schedules. * * - Requires: `API Tier 2` * - Expandable fields: `managers`, `observers`, `members` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: ScheduleListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/schedules/', PageCursorURL, { query, ...options }); } /** * Create a new schedule */ create( body: ScheduleCreateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post('/schedules/', { body, ...options }); } /** * Retrieve a specific schedule */ retrieve( id: string, query: ScheduleRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/schedules/${id}/`, { query, ...options }); } /** * Update a specific schedule. */ update( id: string, body: ScheduleUpdateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/schedules/${id}/`, { body, ...options }); } } export type ScheduleListResponsesPageCursorURL = PageCursorURL; export interface ScheduleListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Whether the requesting role can edit the schedule. */ can_edit?: boolean; /** * The managers of the schedule. * * Expandable field */ managers?: Array; /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The members of the schedule. * * Expandable field */ members?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The observers of the schedule. * * Expandable field */ observers?: Array; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleListResponse.Settings; } export namespace ScheduleListResponse { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } export interface ScheduleCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Whether the requesting role can edit the schedule. */ can_edit?: boolean; /** * The managers of the schedule. * * Expandable field */ managers?: Array; /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The members of the schedule. * * Expandable field */ members?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The observers of the schedule. * * Expandable field */ observers?: Array; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleCreateResponse.Settings; } export namespace ScheduleCreateResponse { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } /** * Meta information for the response. */ export interface ScheduleRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Whether the requesting role can edit the schedule. */ can_edit?: boolean; /** * The managers of the schedule. * * Expandable field */ managers?: Array; /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The members of the schedule. * * Expandable field */ members?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The observers of the schedule. * * Expandable field */ observers?: Array; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleRetrieveResponse.Settings; } export namespace ScheduleRetrieveResponse { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } export interface ScheduleUpdateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Whether the requesting role can edit the schedule. */ can_edit?: boolean; /** * The managers of the schedule. * * Expandable field */ managers?: Array; /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The members of the schedule. * * Expandable field */ members?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The observers of the schedule. * * Expandable field */ observers?: Array; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleUpdateResponse.Settings; } export namespace ScheduleUpdateResponse { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } export interface ScheduleListParams { cursor?: string; expand?: string; order_by?: string; } export interface ScheduleCreateParams { /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleCreateParams.Settings; } export namespace ScheduleCreateParams { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } export interface ScheduleRetrieveParams { expand?: string; } export interface ScheduleUpdateParams { /** * The IDs of the managers of the schedule. */ managers_id?: Array; /** * The IDs of the members of the schedule. */ members_id?: Array; /** * The name of the schedule. */ name?: string; /** * The IDs of the observers of the schedule. */ observers_id?: Array; /** * The settings of the schedule. */ settings?: ScheduleUpdateParams.Settings; } export namespace ScheduleUpdateParams { /** * The settings of the schedule. */ export interface Settings { /** * The IANA timezone identifier for the schedule (e.g., 'America/New_York'). * Accepted values are defined by the tz database, listed here: * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ timezone?: string; } } export declare namespace Schedules { export { type ScheduleListResponse as ScheduleListResponse, type ScheduleCreateResponse as ScheduleCreateResponse, type ScheduleRetrieveResponse as ScheduleRetrieveResponse, type ScheduleUpdateResponse as ScheduleUpdateResponse, type ScheduleListResponsesPageCursorURL as ScheduleListResponsesPageCursorURL, type ScheduleListParams as ScheduleListParams, type ScheduleCreateParams as ScheduleCreateParams, type ScheduleRetrieveParams as ScheduleRetrieveParams, type ScheduleUpdateParams as ScheduleUpdateParams, }; }