// 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 { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Shift assignments assigned to workers */ export class ShiftAssignments extends APIResource { /** * Update custom fields for a shift assignment. The request body should contain a * dictionary mapping custom field names to their values. * * - Requires: `API Tier 2` * * @example * ```ts * const response = * await client.shiftAssignments.updateCustomfields('id'); * ``` */ updateCustomfields( id: string, body: ShiftAssignmentUpdateCustomfieldsParams, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/shiftassignments/${id}/customfields/`, { body, ...options }); } } /** * Meta information for the response. */ export interface ShiftAssignmentUpdateCustomfieldsResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the shift assignment is published. If true, the published_version will * be the same as the shift_data */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: ShiftAssignmentUpdateCustomfieldsResponse.ShiftData; /** * Record update date */ updated_at: string; /** * The ID of the worker. Empty string '' to unassign if shift is from an open/empty * shift. */ worker_id: string; /** * Whether the shift assignment can be edited */ can_edit?: boolean; /** * Custom fields for the shift assignment */ custom_fields?: Array; /** * The published version of the shift assignment, if it exists. If filled but * is_published is false, the shift_data is the latest version. */ published_version?: ShiftAssignmentUpdateCustomfieldsResponse.PublishedVersion; /** * The schedule * * Expandable field */ schedule?: ShiftAssignmentUpdateCustomfieldsResponse.Schedule; /** * The worker * * Expandable field */ worker?: WorkersAPI.Worker; } export namespace ShiftAssignmentUpdateCustomfieldsResponse { /** * The data of the shift */ export interface ShiftData { /** * The end time of the shift */ end_time: string; /** * The start time of the shift */ start_time: string; /** * Notes for the shift, max length 256 characters */ notes?: string; /** * The breaks of the shift */ shift_breaks?: Array; /** * The segments of the shift */ shift_segments?: Array; } export namespace ShiftData { export interface ShiftBreak { /** * The duration of the shift break in minutes (input only for creation) */ duration_minutes: number; /** * The start time of the shift break */ start_time: string; /** * The type of the shift break */ type: 'MEAL' | 'REST'; /** * The end time of the shift break (calculated from start_time + duration_minutes) */ end_time?: string; } export interface ShiftSegment { /** * The duration of the shift segment in minutes (input only for creation) */ duration_minutes: number; /** * The start time of the shift segment */ start_time: string; /** * The end time of the shift segment (calculated from start_time + * duration_minutes) */ end_time?: string; /** * The IDs of the job codes associated with the shift segment */ job_codes_id?: Array; } } /** * The published version of the shift assignment, if it exists. If filled but * is_published is false, the shift_data is the latest version. */ export interface PublishedVersion { /** * The end time of the shift */ end_time: string; /** * The start time of the shift */ start_time: string; /** * Notes for the shift, max length 256 characters */ notes?: string; /** * The breaks of the shift */ shift_breaks?: Array; /** * The segments of the shift */ shift_segments?: Array; } export namespace PublishedVersion { export interface ShiftBreak { /** * The duration of the shift break in minutes (input only for creation) */ duration_minutes: number; /** * The start time of the shift break */ start_time: string; /** * The type of the shift break */ type: 'MEAL' | 'REST'; /** * The end time of the shift break (calculated from start_time + duration_minutes) */ end_time?: string; } export interface ShiftSegment { /** * The duration of the shift segment in minutes (input only for creation) */ duration_minutes: number; /** * The start time of the shift segment */ start_time: string; /** * The end time of the shift segment (calculated from start_time + * duration_minutes) */ end_time?: string; /** * The IDs of the job codes associated with the shift segment */ job_codes_id?: Array; } } /** * The schedule * * Expandable field */ export interface Schedule { /** * 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?: Schedule.Settings; } export namespace Schedule { /** * 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 ShiftAssignmentUpdateCustomfieldsParams { /** * Example custom field name. Replace with your actual custom field names. */ FieldName1?: string; [k: string]: unknown; } export declare namespace ShiftAssignments { export { type ShiftAssignmentUpdateCustomfieldsResponse as ShiftAssignmentUpdateCustomfieldsResponse, type ShiftAssignmentUpdateCustomfieldsParams as ShiftAssignmentUpdateCustomfieldsParams, }; }