// 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'; /** * Unassigned shifts that are part of a schedule */ export class Unassignedshifts extends APIResource { /** * A list of unassigned shifts. * * - Requires: `API Tier 2` * - Filterable fields: `schedule_id`, `shift_data.start_time`, * `shift_data.end_time` * - Expandable fields: `schedule` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: UnassignedshiftListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/unassignedshifts/', PageCursorURL, { query, ...options, }); } /** * Create a new unassigned shift */ create( body: UnassignedshiftCreateParams, options?: RequestOptions, ): APIPromise { return this._client.post('/unassignedshifts/', { body, ...options }); } /** * Retrieve a specific unassigned shift */ retrieve( id: string, query: UnassignedshiftRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/unassignedshifts/${id}/`, { query, ...options }); } /** * Update a specific unassigned shift. */ update( id: string, body: UnassignedshiftUpdateParams, options?: RequestOptions, ): APIPromise { return this._client.patch(path`/unassignedshifts/${id}/`, { body, ...options }); } } export type UnassignedshiftListResponsesPageCursorURL = PageCursorURL; export interface UnassignedshiftListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the shift is published */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: UnassignedshiftListResponse.ShiftData; /** * The target count of the shift */ target_count: number; /** * Record update date */ updated_at: string; /** * The number of assigned shifts */ assigned_count?: number; /** * The IDs of the assigned shifts that are part of this unassigned shift */ assigned_shift_ids?: Array; /** * Custom fields for the unassigned shift */ custom_fields?: Array; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; /** * The published version of the shift */ published_version?: UnassignedshiftListResponse.PublishedVersion; /** * The schedule * * Expandable field */ schedule?: UnassignedshiftListResponse.Schedule; } export namespace UnassignedshiftListResponse { /** * 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 */ 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 UnassignedshiftCreateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the shift is published */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: UnassignedshiftCreateResponse.ShiftData; /** * The target count of the shift */ target_count: number; /** * Record update date */ updated_at: string; /** * The number of assigned shifts */ assigned_count?: number; /** * The IDs of the assigned shifts that are part of this unassigned shift */ assigned_shift_ids?: Array; /** * Custom fields for the unassigned shift */ custom_fields?: Array; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; /** * The published version of the shift */ published_version?: UnassignedshiftCreateResponse.PublishedVersion; /** * The schedule * * Expandable field */ schedule?: UnassignedshiftCreateResponse.Schedule; } export namespace UnassignedshiftCreateResponse { /** * 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 */ 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; } } } /** * Meta information for the response. */ export interface UnassignedshiftRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the shift is published */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: UnassignedshiftRetrieveResponse.ShiftData; /** * The target count of the shift */ target_count: number; /** * Record update date */ updated_at: string; /** * The number of assigned shifts */ assigned_count?: number; /** * The IDs of the assigned shifts that are part of this unassigned shift */ assigned_shift_ids?: Array; /** * Custom fields for the unassigned shift */ custom_fields?: Array; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; /** * The published version of the shift */ published_version?: UnassignedshiftRetrieveResponse.PublishedVersion; /** * The schedule * * Expandable field */ schedule?: UnassignedshiftRetrieveResponse.Schedule; } export namespace UnassignedshiftRetrieveResponse { /** * 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 */ 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 UnassignedshiftUpdateResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the shift is published */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: UnassignedshiftUpdateResponse.ShiftData; /** * The target count of the shift */ target_count: number; /** * Record update date */ updated_at: string; /** * The number of assigned shifts */ assigned_count?: number; /** * The IDs of the assigned shifts that are part of this unassigned shift */ assigned_shift_ids?: Array; /** * Custom fields for the unassigned shift */ custom_fields?: Array; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; /** * The published version of the shift */ published_version?: UnassignedshiftUpdateResponse.PublishedVersion; /** * The schedule * * Expandable field */ schedule?: UnassignedshiftUpdateResponse.Schedule; } export namespace UnassignedshiftUpdateResponse { /** * 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 */ 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 UnassignedshiftListParams { cursor?: string; expand?: string; filter?: string; order_by?: string; } export interface UnassignedshiftCreateParams { /** * Whether the shift is published */ is_published: boolean; /** * The ID of the schedule */ schedule_id: string; /** * The data of the shift */ shift_data: UnassignedshiftCreateParams.ShiftData; /** * The target count of the shift */ target_count: number; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; } export namespace UnassignedshiftCreateParams { /** * 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'; } 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 IDs of the job codes associated with the shift segment */ job_codes_id?: Array; } } } export interface UnassignedshiftRetrieveParams { expand?: string; } export interface UnassignedshiftUpdateParams { /** * Whether the shift is published */ is_published: boolean; /** * The data of the shift */ shift_data: UnassignedshiftUpdateParams.ShiftData; /** * The target count of the shift */ target_count: number; /** * Configuration for an open shift. If present, this is an open shift (workers can * sign up). If absent/None, this is an empty shift (placeholder). */ open_shift_config?: unknown; } export namespace UnassignedshiftUpdateParams { /** * 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'; } 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 IDs of the job codes associated with the shift segment */ job_codes_id?: Array; } } } export declare namespace Unassignedshifts { export { type UnassignedshiftListResponse as UnassignedshiftListResponse, type UnassignedshiftCreateResponse as UnassignedshiftCreateResponse, type UnassignedshiftRetrieveResponse as UnassignedshiftRetrieveResponse, type UnassignedshiftUpdateResponse as UnassignedshiftUpdateResponse, type UnassignedshiftListResponsesPageCursorURL as UnassignedshiftListResponsesPageCursorURL, type UnassignedshiftListParams as UnassignedshiftListParams, type UnassignedshiftCreateParams as UnassignedshiftCreateParams, type UnassignedshiftRetrieveParams as UnassignedshiftRetrieveParams, type UnassignedshiftUpdateParams as UnassignedshiftUpdateParams, }; }