diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml index e313afeb..919577d3 100644 --- a/.mock/definition/__package__.yml +++ b/.mock/definition/__package__.yml @@ -1178,7 +1178,7 @@ types: source: openapi: openapi/openapi.json Break: - docs: A record of an employee's break during a shift. + docs: A record of a team member's break on a [timecard](entity:Timecard). properties: id: type: optional @@ -1186,8 +1186,8 @@ types: start_at: type: string docs: >- - RFC 3339; follows the same timezone information as `Shift`. Precision - up to + RFC 3339; follows the same timezone information as the + [timecard](entity:Timecard). Precision up to the minute is respected; seconds are truncated. validation: @@ -1195,13 +1195,13 @@ types: end_at: type: optional> docs: >- - RFC 3339; follows the same timezone information as `Shift`. Precision - up to + RFC 3339; follows the same timezone information as the + [timecard](entity:Timecard). Precision up to the minute is respected; seconds are truncated. break_type_id: type: string - docs: The `BreakType` that this `Break` was templated on. + docs: The [BreakType](entity:BreakType) that this break was templated on. validation: minLength: 1 name: @@ -1214,6 +1214,8 @@ types: docs: |- Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of the break. + + Example for break expected duration of 15 minutes: PT15M validation: minLength: 1 is_paid: @@ -1224,9 +1226,11 @@ types: source: openapi: openapi/openapi.json BreakType: - docs: |- - A defined break template that sets an expectation for possible `Break` - instances on a `Shift`. + docs: >- + A template for a type of [break](entity:Break) that can be added to a + + [timecard](entity:Timecard), including the expected duration and paid + status. properties: id: type: optional @@ -1242,7 +1246,7 @@ types: type: string docs: |- A human-readable name for this type of break. The name is displayed to - employees in Square products. + team members in Square products. validation: minLength: 1 expected_duration: @@ -1251,7 +1255,7 @@ types: Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of this break. Precision less than minutes is truncated. - Example for break expected duration of 15 minutes: T15M + Example for break expected duration of 15 minutes: PT15M validation: minLength: 1 is_paid: @@ -1653,6 +1657,62 @@ types: or an `errors` field. source: openapi: openapi/openapi.json + BulkPublishScheduledShiftsData: + docs: >- + Represents options for an individual publish request in a + + [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) + + operation, provided as the value in a key-value pair. + properties: + version: + type: optional + docs: >- + The current version of the scheduled shift, used to enable [optimistic + concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + + control. If the provided version doesn't match the server version, the + request fails. + + If omitted, Square executes a blind write, potentially overwriting + data from another publish request. + source: + openapi: openapi/openapi.json + BulkPublishScheduledShiftsResponse: + docs: >- + Represents a + [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) + response. + + Either `scheduled_shifts` or `errors` is present in the response. + properties: + responses: + type: optional> + docs: >- + A map of key-value pairs that represent responses for individual + publish requests. + + The order of responses might differ from the order in which the + requests were provided. + + + - Each key is the scheduled shift ID that was specified for a publish + request. + + - Each value is the corresponding response. If the request succeeds, + the value is the + + published scheduled shift. If the request fails, the value is an + `errors` array containing + + any errors that occurred while processing the request. + errors: + type: optional> + docs: >- + Any top-level errors that prevented the bulk operation from + succeeding. + source: + openapi: openapi/openapi.json BulkRetrieveBookingsResponse: docs: Response payload for bulk retrieval of bookings. properties: @@ -4223,13 +4283,13 @@ types: ecom_uri: type: optional> docs: >- - Deprecated; see go/ecomUriUseCases. A URI pointing to a published - e-commerce product page for the Item. + Deprecated. A URI pointing to a published e-commerce product page for + the Item. ecom_image_uris: type: optional>> docs: >- - Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded - URIs pointing to a set of published e-commerce images for the Item. + Deprecated. A comma-separated list of encoded URIs pointing to a set + of published e-commerce images for the Item. image_ids: type: optional>> docs: |- @@ -4454,10 +4514,10 @@ types: openapi: openapi/openapi.json CatalogItemModifierListInfo: docs: >- - References a text-based modifier or a list of non text-based modifiers - applied to a `CatalogItem` instance + Controls how a modifier list is applied to a specific item. This object + allows for item-specific customization of modifier list behavior - and specifies supported behaviors of the application. + and provides the ability to override global modifier list settings. properties: modifier_list_id: type: string @@ -4469,60 +4529,49 @@ types: modifier_overrides: type: optional>> docs: >- - A set of `CatalogModifierOverride` objects that override whether a - given `CatalogModifier` is enabled by default. + A set of `CatalogModifierOverride` objects that override default + modifier settings for this item. min_selected_modifiers: type: optional> docs: >- - If 0 or larger, the smallest number of `CatalogModifier`s that must be - selected from this `CatalogModifierList`. - - The default value is `-1`. + The minimum number of modifiers that must be selected from this + modifier list. + Values: - When `CatalogModifierList.selection_type` is `MULTIPLE`, - `CatalogModifierListInfo.min_selected_modifiers=-1` - and `CatalogModifierListInfo.max_selected_modifier=-1` means that from - zero to the maximum number of modifiers of + - 0: No selection is required. - the `CatalogModifierList` can be selected from the - `CatalogModifierList`. + - -1: Default value, the attribute was not set by the client. When + `max_selected_modifiers` is + also -1, use the minimum and maximum selection values set on the + `CatalogItemModifierList`. - When the `CatalogModifierList.selection_type` is `SINGLE`, - `CatalogModifierListInfo.min_selected_modifiers=-1` + - >0: The required minimum modifier selections. This can be larger + than the total `CatalogModifiers` when `allow_quantities` is enabled. - and `CatalogModifierListInfo.max_selected_modifier=-1` means that - exactly one modifier must be present in - - and can be selected from the `CatalogModifierList` + - < -1: Invalid. Treated as no selection required. max_selected_modifiers: type: optional> docs: >- - If 0 or larger, the largest number of `CatalogModifier`s that can be - selected from this `CatalogModifierList`. - - The default value is `-1`. + The maximum number of modifiers that can be selected. + Values: - When `CatalogModifierList.selection_type` is `MULTIPLE`, - `CatalogModifierListInfo.min_selected_modifiers=-1` - and `CatalogModifierListInfo.max_selected_modifier=-1` means that from - zero to the maximum number of modifiers of + - 0: No maximum limit. - the `CatalogModifierList` can be selected from the - `CatalogModifierList`. + - -1: Default value, the attribute was not set by the client. When + `min_selected_modifiers` is + also -1, use the minimum and maximum selection values set on the + `CatalogItemModifierList`. - When the `CatalogModifierList.selection_type` is `SINGLE`, - `CatalogModifierListInfo.min_selected_modifiers=-1` + - >0: The maximum total modifier selections. This can be larger + than the total `CatalogModifiers` when `allow_quantities` is enabled. - and `CatalogModifierListInfo.max_selected_modifier=-1` means that - exactly one modifier must be present in - - and can be selected from the `CatalogModifierList` + - < -1: Invalid. Treated as no maximum limit. enabled: type: optional> docs: >- @@ -4535,6 +4584,9 @@ types: `modifier_list_info` list applied to a `CatalogItem` instance. + allow_quantities: optional + is_conversational: optional + hidden_from_customer_override: optional source: openapi: openapi/openapi.json CatalogItemOption: @@ -4906,8 +4958,9 @@ types: openapi: openapi/openapi.json CatalogModifier: docs: >- - A modifier applicable to items at the time of sale. An example of a - modifier is a Cheese add-on to a Burger item. + A modifier that can be applied to items at the time of sale. For example, + a cheese modifier for a burger, or a flavor modifier for a serving of ice + cream. properties: name: type: optional> @@ -4920,6 +4973,14 @@ types: price_money: type: optional docs: The modifier price. + on_by_default: + type: optional> + docs: >- + When `true`, this modifier is selected by default when displaying the + modifier list. + + This setting can be overridden at the item level using + `CatalogModifierListInfo.modifier_overrides`. ordinal: type: optional> docs: >- @@ -4938,37 +4999,29 @@ types: Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. + hidden_online: + type: optional> + docs: >- + When `true`, this modifier is hidden from online ordering channels. + This setting can be overridden at the item level using + `CatalogModifierListInfo.modifier_overrides`. source: openapi: openapi/openapi.json CatalogModifierList: docs: >- - For a text-based modifier, this encapsulates the modifier's text when its - `modifier_type` is `TEXT`. - - For example, to sell T-shirts with custom prints, a text-based modifier - can be used to capture the buyer-supplied - - text string to be selected for the T-shirt at the time of sale. - + A container for a list of modifiers, or a text-based modifier. - For non text-based modifiers, this encapsulates a non-empty list of - modifiers applicable to items + For text-based modifiers, this represents text configuration for an item. + (For example, custom text to print on a t-shirt). - at the time of sale. Each element of the modifier list is a - `CatalogObject` instance of the `MODIFIER` type. + For non text-based modifiers, this represents a list of modifiers that can + be applied to items at the time of sale. - For example, a "Condiments" modifier list applicable to a "Hot Dog" item + (For example, a list of condiments for a hot dog, or a list of ice cream + flavors). - may contain "Ketchup", "Mustard", and "Relish" modifiers. - - - A non text-based modifier can be applied to the modified item once or - multiple times, if the `selection_type` field - - is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a - text-based modifier can be applied to the item - - only once and the `selection_type` field is always set to `SINGLE`. + Each element of the modifier list is a `CatalogObject` instance of the + `MODIFIER` type. properties: name: type: optional> @@ -4988,14 +5041,10 @@ types: selection_type: type: optional docs: >- - Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) - modifiers from the list + __Deprecated__: Indicates whether a single (`SINGLE`) modifier or + multiple (`MULTIPLE`) modifiers can be selected. Use - can be applied to a single `CatalogItem`. - - - For text-based modifiers, the `selection_type` attribute is always - `SINGLE`. The other value is ignored. + `min_selected_modifiers` and `max_selected_modifiers` instead. See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) @@ -5032,6 +5081,14 @@ types: Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. + allow_quantities: + type: optional> + docs: >- + When `true`, allows multiple quantities of the same modifier to be + selected. + is_conversational: + type: optional> + docs: True if modifiers belonging to this list can be used conversationally. modifier_type: type: optional docs: >- @@ -5084,6 +5141,52 @@ types: internal use. validation: maxLength: 512 + min_selected_modifiers: + type: optional> + docs: >- + The minimum number of modifiers that must be selected from this list. + The value can be overridden with `CatalogItemModifierListInfo`. + + + Values: + + + - 0: No selection is required. + + - -1: Default value, the attribute was not set by the client. Treated + as no selection required. + + - >0: The required minimum modifier selections. This can be larger + than the total `CatalogModifiers` when `allow_quantities` is enabled. + + - < -1: Invalid. Treated as no selection required. + max_selected_modifiers: + type: optional> + docs: >- + The maximum number of modifiers that must be selected from this list. + The value can be overridden with `CatalogItemModifierListInfo`. + + + Values: + + + - 0: No maximum limit. + + - -1: Default value, the attribute was not set by the client. Treated + as no maximum limit. + + - >0: The maximum total modifier selections. This can be larger + than the total `CatalogModifiers` when `allow_quantities` is enabled. + + - < -1: Invalid. Treated as no maximum limit. + hidden_from_customer: + type: optional> + docs: >- + If `true`, modifiers from this list are hidden from customer receipts. + The default value is `false`. + + This setting can be overridden with + `CatalogItemModifierListInfo.hidden_from_customer_override`. source: openapi: openapi/openapi.json CatalogModifierListModifierType: @@ -5114,9 +5217,9 @@ types: minLength: 1 on_by_default: type: optional> - docs: >- - If `true`, this `CatalogModifier` should be selected by default for - this `CatalogItem`. + docs: '__Deprecated__: Use `on_by_default_override` instead.' + hidden_online_override: optional + on_by_default_override: optional source: openapi: openapi/openapi.json CatalogObject: @@ -5156,25 +5259,16 @@ types: DISCOUNT: CatalogObjectDiscount MODIFIER_LIST: CatalogObjectModifierList MODIFIER: CatalogObjectModifier - DINING_OPTION: CatalogObjectDiningOption - TAX_EXEMPTION: CatalogObjectTaxExemption - SERVICE_CHARGE: CatalogObjectServiceCharge PRICING_RULE: CatalogObjectPricingRule PRODUCT_SET: CatalogObjectProductSet TIME_PERIOD: CatalogObjectTimePeriod MEASUREMENT_UNIT: CatalogObjectMeasurementUnit - SUBSCRIPTION_PLAN: CatalogObjectSubscriptionPlan + SUBSCRIPTION_PLAN_VARIATION: CatalogObjectSubscriptionPlanVariation ITEM_OPTION: CatalogObjectItemOption ITEM_OPTION_VAL: CatalogObjectItemOptionValue CUSTOM_ATTRIBUTE_DEFINITION: CatalogObjectCustomAttributeDefinition QUICK_AMOUNTS_SETTINGS: CatalogObjectQuickAmountsSettings - COMPONENT: CatalogObjectComponent - COMPOSITION: CatalogObjectComposition - RESOURCE: CatalogObjectResource - CHECKOUT_LINK: CatalogObjectCheckoutLink - ADDRESS: CatalogObjectAddress - SUBSCRIPTION_PRODUCT: CatalogObjectSubscriptionProduct - SUBSCRIPTION_PLAN_VARIATION: CatalogObjectSubscriptionPlanVariation + SUBSCRIPTION_PLAN: CatalogObjectSubscriptionPlan AVAILABILITY_PERIOD: CatalogObjectAvailabilityPeriod source: openapi: openapi/openapi.json @@ -7506,6 +7600,28 @@ types: docs: The new gift card. source: openapi: openapi/openapi.json + CreateInvoiceAttachmentRequestData: + docs: >- + Represents a + [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) + request. + properties: + idempotency_key: + type: optional + docs: >- + A unique string that identifies the `CreateInvoiceAttachment` request. + + For more information, see + [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + validation: + maxLength: 128 + description: + type: optional + docs: The description of the attachment to display on the invoice. + validation: + maxLength: 128 + source: + openapi: openapi/openapi.json CreateInvoiceAttachmentResponse: docs: >- Represents a @@ -7751,6 +7867,26 @@ types: docs: The newly created payment. source: openapi: openapi/openapi.json + CreateScheduledShiftResponse: + docs: >- + Represents a + [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response. + + Either `scheduled_shift` or `errors` is present in the response. + properties: + scheduled_shift: + type: optional + docs: >- + The new scheduled shift. To make the shift public, call + + [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or + + [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts). + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json CreateShiftResponse: docs: |- The response to a request to create a `Shift`. The response contains @@ -7855,6 +7991,23 @@ types: docs: The created `TerminalRefund`. source: openapi: openapi/openapi.json + CreateTimecardResponse: + docs: >- + The response to a request to create a `Timecard`. The response contains + + the created `Timecard` object and might contain a set of `Error` objects + if + + the request resulted in errors. + properties: + timecard: + type: optional + docs: The `Timecard` that was created on the request. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json CreateVendorResponse: docs: >- Represents an output from a call to @@ -9607,6 +9760,18 @@ types: docs: The subscription that has the specified action deleted. source: openapi: openapi/openapi.json + DeleteTimecardResponse: + docs: >- + The response to a request to delete a `Timecard`. The response might + contain a set of + + `Error` objects if the request resulted in errors. + properties: + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json DeleteWebhookSubscriptionResponse: docs: >- Defines the fields that are included in the response body of @@ -21373,6 +21538,22 @@ types: docs: Information about errors encountered during the request. source: openapi: openapi/openapi.json + PublishScheduledShiftResponse: + docs: >- + Represents a + [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) + response. + + Either `scheduled_shift` or `errors` is present in the response. + properties: + scheduled_shift: + type: optional + docs: The published scheduled shift. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json QrCodeOptions: docs: Fields to describe the action that displays QR-Codes. properties: @@ -22213,6 +22394,22 @@ types: docs: The payment link that is retrieved. source: openapi: openapi/openapi.json + RetrieveScheduledShiftResponse: + docs: >- + Represents a + [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) + response. + + Either `scheduled_shift` or `errors` is present in the response. + properties: + scheduled_shift: + type: optional + docs: The requested scheduled shift. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json GetSnippetResponse: docs: >- Represents a `RetrieveSnippet` response. The response can include either @@ -22264,6 +22461,23 @@ types: docs: The errors that occurred during the request. source: openapi: openapi/openapi.json + RetrieveTimecardResponse: + docs: >- + A response to a request to get a `Timecard`. The response contains + + the requested `Timecard` object and might contain a set of `Error` objects + if + + the request resulted in errors. + properties: + timecard: + type: optional + docs: The requested `Timecard`. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json RetrieveTokenStatusResponse: docs: |- Defines the fields that are included in the response body of @@ -22432,59 +22646,379 @@ types: maxLength: 128 source: openapi: openapi/openapi.json - SearchAvailabilityFilter: - docs: A query filter to search for buyer-accessible availabilities by. + ScheduledShift: + docs: >- + Represents a specific time slot in a work schedule. This object is used to + manage the + + lifecycle of a scheduled shift from the draft to published state. A + scheduled shift contains + + the latest draft shift details and current published shift details. properties: - start_at_range: - type: TimeRange + id: + type: optional + docs: '**Read only** The Square-issued ID of the scheduled shift.' + validation: + maxLength: 255 + draft_shift_details: + type: optional docs: >- - The query expression to search for buy-accessible availabilities with - their starting times falling within the specified time range. + The latest draft shift details for the scheduled shift. Draft shift + details are used to - The time range must be at least 24 hours and at most 32 days long. + stage and manage shifts before publishing. This field is always + present. + published_shift_details: + type: optional + docs: >- + The current published (public) shift details for the scheduled shift. + This field is - For waitlist availabilities, the time range can be 0 or more up to 367 - days long. - location_id: - type: optional> + present only if the shift was published. + version: + type: optional docs: >- - The query expression to search for buyer-accessible availabilities - with their location IDs matching the specified location ID. + **Read only** The current version of the scheduled shift, which is + incremented with each update. - This query expression cannot be set if `booking_id` is set. - validation: - maxLength: 32 - segment_filters: - type: optional>> + This field is used for [optimistic + concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + + control to ensure that requests don't overwrite data from another + request. + created_at: + type: optional docs: >- - The query expression to search for buyer-accessible availabilities - matching the specified list of segment filters. + The timestamp of when the scheduled shift was created, in RFC 3339 + format presented as UTC. + access: read-only + updated_at: + type: optional + docs: >- + The timestamp of when the scheduled shift was last updated, in RFC + 3339 format presented as UTC. + access: read-only + source: + openapi: openapi/openapi.json + ScheduledShiftDetails: + docs: >- + Represents shift details for draft and published versions of a [scheduled + shift](entity:ScheduledShift), - If the size of the `segment_filters` list is `n`, the search returns - availabilities with `n` segments per availability. + such as job ID, team member assignment, and start and end times. + properties: + team_member_id: + type: optional> + docs: >- + The ID of the [team member](entity:TeamMember) scheduled for the + shift. + validation: + maxLength: 255 + location_id: + type: optional> + docs: The ID of the [location](entity:Location) the shift is scheduled for. + validation: + maxLength: 255 + job_id: + type: optional> + docs: The ID of the [job](entity:Job) the shift is scheduled for. + start_at: + type: optional> + docs: >- + The start time of the shift, in RFC 3339 format in the time zone + + + offset of the shift location specified in `location_id`. Precision up + to the minute - This query expression cannot be set if `booking_id` is set. - booking_id: + is respected; seconds are truncated. + end_at: type: optional> docs: >- - The query expression to search for buyer-accessible availabilities for - an existing booking by matching the specified `booking_id` value. + The end time for the shift, in RFC 3339 format in the time zone + - This is commonly used to reschedule an appointment. + offset of the shift location specified in `location_id`. Precision up + to the minute - If this expression is set, the `location_id` and `segment_filters` - expressions cannot be set. + is respected; seconds are truncated. + notes: + type: optional> + docs: Optional notes for the shift. validation: - maxLength: 36 + maxLength: 1000 + is_deleted: + type: optional> + docs: >- + Indicates whether the draft shift version is deleted. If set to `true` + when the shift + + is published, the entire scheduled shift (including the published + shift) is deleted and + + cannot be accessed using any endpoint. + timezone: + type: optional + docs: >- + The time zone of the shift location, calculated based on the + `location_id`. This field + + is provided for convenience. + access: read-only source: openapi: openapi/openapi.json - SearchAvailabilityQuery: - docs: The query used to search for buyer-accessible availabilities of bookings. + ScheduledShiftFilter: + docs: >- + Defines filter criteria for a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) + + request. Multiple filters in a query are combined as an `AND` operation. properties: - filter: - type: SearchAvailabilityFilter - docs: >- + location_ids: + type: optional>> + docs: >- + Return shifts for the specified locations. When omitted, shifts for + all + + locations are returned. If needed, call + [ListLocations](api-endpoint:Locations-ListLocations) + + to get location IDs. + start: + type: optional + docs: |- + Return shifts whose `start_at` time is within the specified + time range (inclusive). + end: + type: optional + docs: |- + Return shifts whose `end_at` time is within the specified + time range (inclusive). + workday: + type: optional + docs: Return shifts based on a workday date range. + team_member_ids: + type: optional>> + docs: >- + Return shifts assigned to specified team members. If needed, call + + [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get team + member IDs. + + + To return only the shifts assigned to the specified team members, + include the + + `assignment_status` filter in the query. Otherwise, all unassigned + shifts are + + returned along with shifts assigned to the specified team members. + assignment_status: + type: optional + docs: >- + Return shifts based on whether a team member is assigned. A shift is + + assigned if the `team_member_id` field is populated in the + `draft_shift_details` + + or `published_shift details` field of the shift. + + + To return only draft or published shifts, include the + `scheduled_shift_statuses` + + filter in the query. + + See + [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) + for possible values + scheduled_shift_statuses: + type: optional>> + docs: >- + Return shifts based on the draft or published status of the shift. + + A shift is published if the `published_shift_details` field is + present. + + + Note that shifts with `draft_shift_details.is_deleted` set to `true` + are ignored + + with the `DRAFT` filter. + + See + [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) + for possible values + source: + openapi: openapi/openapi.json + ScheduledShiftFilterAssignmentStatus: + enum: + - ASSIGNED + - UNASSIGNED + docs: |- + Defines valid values for the `assignment_status` filter in a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request. + Assignment status is based on the `draft_shift_details.team_member_id` and + `published_shift_details.team_member_id` fields of the scheduled shift. + source: + openapi: openapi/openapi.json + ScheduledShiftFilterScheduledShiftStatus: + enum: + - DRAFT + - PUBLISHED + docs: |- + Defines valid values for the `scheduled_shift_statuses` filter in a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request. + source: + openapi: openapi/openapi.json + ScheduledShiftNotificationAudience: + enum: + - ALL + - AFFECTED + - NONE + docs: >- + Indicates whether Square sends an email notification to team members + + when a scheduled shift is published and which team members receive the + notification. + source: + openapi: openapi/openapi.json + ScheduledShiftQuery: + docs: |- + Represents filter and sort criteria for the `query` field in a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request. + properties: + filter: + type: optional + docs: Filtering options for the query. + sort: + type: optional + docs: Sorting options for the query. + source: + openapi: openapi/openapi.json + ScheduledShiftSort: + docs: >- + Defines sort criteria for a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) + + request. + properties: + field: + type: optional + docs: >- + The field to sort on. The default value is `START_AT`. + + See [ScheduledShiftSortField](#type-scheduledshiftsortfield) for + possible values + order: + type: optional + docs: |- + The order in which results are returned. The default value is `ASC`. + See [SortOrder](#type-sortorder) for possible values + source: + openapi: openapi/openapi.json + ScheduledShiftSortField: + enum: + - START_AT + - END_AT + - CREATED_AT + - UPDATED_AT + docs: |- + Defines valid values for the `field` sort setting in a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request. + source: + openapi: openapi/openapi.json + ScheduledShiftWorkday: + docs: >- + A `ScheduledShift` search query filter parameter that sets a range of days + that + + a `Shift` must start or end in before passing the filter condition. + properties: + date_range: + type: optional + docs: Dates for fetching the scheduled shifts. + match_scheduled_shifts_by: + type: optional + docs: >- + The strategy on which the dates are applied. + + See [ScheduledShiftWorkdayMatcher](#type-scheduledshiftworkdaymatcher) + for possible values + default_timezone: + type: optional> + docs: >- + Location-specific timezones convert workdays to datetime filters. + + Every location included in the query must have a timezone or this + field + + must be provided as a fallback. Format: the IANA timezone database + + identifier for the relevant timezone. + source: + openapi: openapi/openapi.json + ScheduledShiftWorkdayMatcher: + enum: + - START_AT + - END_AT + - INTERSECTION + docs: Defines the logic used to apply a workday filter. + source: + openapi: openapi/openapi.json + SearchAvailabilityFilter: + docs: A query filter to search for buyer-accessible availabilities by. + properties: + start_at_range: + type: TimeRange + docs: >- + The query expression to search for buy-accessible availabilities with + their starting times falling within the specified time range. + + The time range must be at least 24 hours and at most 32 days long. + + For waitlist availabilities, the time range can be 0 or more up to 367 + days long. + location_id: + type: optional> + docs: >- + The query expression to search for buyer-accessible availabilities + with their location IDs matching the specified location ID. + + This query expression cannot be set if `booking_id` is set. + validation: + maxLength: 32 + segment_filters: + type: optional>> + docs: >- + The query expression to search for buyer-accessible availabilities + matching the specified list of segment filters. + + If the size of the `segment_filters` list is `n`, the search returns + availabilities with `n` segments per availability. + + + This query expression cannot be set if `booking_id` is set. + booking_id: + type: optional> + docs: >- + The query expression to search for buyer-accessible availabilities for + an existing booking by matching the specified `booking_id` value. + + This is commonly used to reschedule an appointment. + + If this expression is set, the `location_id` and `segment_filters` + expressions cannot be set. + validation: + maxLength: 36 + source: + openapi: openapi/openapi.json + SearchAvailabilityQuery: + docs: The query used to search for buyer-accessible availabilities of bookings. + properties: + filter: + type: SearchAvailabilityFilter + docs: >- The query filter to search for buyer-accessible availabilities of existing bookings. source: @@ -23088,6 +23622,29 @@ types: type: list source: openapi: openapi/openapi.json + SearchScheduledShiftsResponse: + docs: >- + Represents a + [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) + response. + + Either `scheduled_shifts` or `errors` is present in the response. + properties: + scheduled_shifts: + type: optional> + docs: A paginated list of scheduled shifts that match the query conditions. + cursor: + type: optional + docs: >- + The pagination cursor used to retrieve the next page of results. This + field is present + + only if additional results are available. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json SearchShiftsResponse: docs: >- The response to a request for `Shift` objects. The response contains @@ -23300,6 +23857,26 @@ types: for more information. source: openapi: openapi/openapi.json + SearchTimecardsResponse: + docs: >- + The response to a request for `Timecard` objects. The response contains + + the requested `Timecard` objects and might contain a set of `Error` + objects if + + the request resulted in errors. + properties: + timecards: + type: optional> + docs: Timecards. + cursor: + type: optional + docs: An opaque cursor for fetching the next page. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json SearchVendorsRequestFilter: docs: Defines supported query expressions to search for vendors by. properties: @@ -23442,6 +24019,13 @@ types: for breaks taken during the shift. + + + Deprecated at Square API version 2025-05-21. Replaced by + [Timecard](entity:Timecard). + + See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: id: type: optional @@ -23540,9 +24124,14 @@ types: source: openapi: openapi/openapi.json ShiftFilter: - docs: |- + docs: >- Defines a filter used in a search for `Shift` records. `AND` logic is + used by Square's servers to apply each filter property specified. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: location_ids: type: optional>> @@ -23577,13 +24166,22 @@ types: enum: - OPEN - CLOSED - docs: Specifies the `status` of `Shift` records to be returned. + docs: >- + Specifies the `status` of `Shift` records to be returned. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). source: openapi: openapi/openapi.json ShiftQuery: docs: >- The parameters of a `Shift` search query, which includes filter and sort options. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: filter: type: optional @@ -23594,7 +24192,12 @@ types: source: openapi: openapi/openapi.json ShiftSort: - docs: Sets the sort order of search results. + docs: >- + Sets the sort order of search results. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: field: type: optional @@ -23614,18 +24217,33 @@ types: - END_AT - CREATED_AT - UPDATED_AT - docs: Enumerates the `Shift` fields to sort on. + docs: >- + Enumerates the `Shift` fields to sort on. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). source: openapi: openapi/openapi.json ShiftStatus: enum: - OPEN - CLOSED - docs: Enumerates the possible status of a `Shift`. + docs: >- + Enumerates the possible status of a `Shift`. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). source: openapi: openapi/openapi.json ShiftWage: - docs: The hourly wage rate used to compensate an employee for this shift. + docs: >- + The hourly wage rate used to compensate an employee for this shift. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: title: type: optional> @@ -23637,11 +24255,9 @@ types: wage based on the annual wage and hours worked per week. job_id: type: optional - docs: >- + docs: |- The id of the job performed during this shift. Square - - labor-reporting UIs might group shifts together by id. This cannot be - used to retrieve the job. + labor-reporting UIs might group shifts together by id. access: read-only tip_eligible: type: optional> @@ -23649,9 +24265,14 @@ types: source: openapi: openapi/openapi.json ShiftWorkday: - docs: |- + docs: >- A `Shift` search query filter parameter that sets a range of days that + a `Shift` must start or end in before passing the filter condition. + + + Deprecated at Square API version 2025-05-21. See the [migration + notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). properties: date_range: type: optional @@ -24525,11 +25146,10 @@ types: source: openapi: openapi/openapi.json TeamMemberWage: - docs: >- - The hourly wage rate that a team member earns on a `Shift` for doing the - job - - specified by the `title` property of this object. + docs: |- + Job and wage information for a [team member](entity:TeamMember). + This convenience object provides details needed to specify the `wage` + field for a [timecard](entity:Timecard). properties: id: type: optional @@ -24547,9 +25167,7 @@ types: wage based on the annual wage and hours worked per week. job_id: type: optional> - docs: |- - An identifier for the job that this wage relates to. This cannot be - used to retrieve the job. + docs: An identifier for the [job](entity:Job) that this wage relates to. tip_eligible: type: optional> docs: Whether team members are eligible for tips when working this job. @@ -25466,22 +26084,271 @@ types: ends. source: openapi: openapi/openapi.json - TipSettings: + Timecard: + docs: >- + A record of the hourly rate, start time, and end time of a single timecard + (shift) + + for a team member. This might include a record of the start and end times + of breaks + + taken during the shift. properties: - allow_tipping: - type: optional> - docs: >- - Indicates whether tipping is enabled for this checkout. Defaults to - false. - separate_tip_screen: - type: optional> + id: + type: optional + docs: '**Read only** The Square-issued UUID for this object.' + validation: + maxLength: 255 + location_id: + type: string docs: >- - Indicates whether tip options should be presented on the screen before - presenting + The ID of the [location](entity:Location) for this timecard. The + location should be based on - the signature screen during card payment. Defaults to false. - custom_tip_field: - type: optional> + where the team member clocked in. + validation: + minLength: 1 + timezone: + type: optional> + docs: >- + **Read only** The time zone calculated from the location based on the + `location_id`, + + provided as a convenience value. Format: the IANA time zone database + identifier for the + + location time zone. + start_at: + type: string + docs: >- + The start time of the timecard, in RFC 3339 format and shifted to the + location + + timezone + offset. Precision up to the minute is respected; seconds + are truncated. + validation: + minLength: 1 + end_at: + type: optional> + docs: >- + The end time of the timecard, in RFC 3339 format and shifted to the + location + + timezone + offset. Precision up to the minute is respected; seconds + are truncated. + wage: + type: optional + docs: >- + Job and pay related information. If the wage is not set on create, it + defaults to a wage + + of zero. If the title is not set on create, it defaults to the name of + the role the team member + + is assigned to, if any. + breaks: + type: optional>> + docs: >- + A list of all the paid or unpaid breaks that were taken during this + timecard. + status: + type: optional + docs: |- + Describes the working state of the timecard. + See [TimecardStatus](#type-timecardstatus) for possible values + version: + type: optional + docs: >- + **Read only** The current version of the timecard, which is + incremented with each update. + + This field is used for [optimistic + concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + + control to ensure that requests don't overwrite data from another + request. + created_at: + type: optional + docs: >- + The timestamp of when the timecard was created, in RFC 3339 format + presented as UTC. + access: read-only + updated_at: + type: optional + docs: >- + The timestamp of when the timecard was last updated, in RFC 3339 + format presented as UTC. + access: read-only + team_member_id: + type: string + docs: >- + The ID of the [team member](entity:TeamMember) this timecard belongs + to. + validation: + minLength: 1 + declared_cash_tip_money: + type: optional + docs: The cash tips declared by the team member for this timecard. + source: + openapi: openapi/openapi.json + TimecardFilter: + docs: |- + Defines a filter used in a search for `Timecard` records. `AND` logic is + used by Square's servers to apply each filter property specified. + properties: + location_ids: + type: optional>> + docs: Fetch timecards for the specified location. + status: + type: optional + docs: >- + Fetch a `Timecard` instance by `Timecard.status`. + + See [TimecardFilterStatus](#type-timecardfilterstatus) for possible + values + start: + type: optional + docs: Fetch `Timecard` instances that start in the time range - Inclusive. + end: + type: optional + docs: Fetch the `Timecard` instances that end in the time range - Inclusive. + workday: + type: optional + docs: Fetch the `Timecard` instances based on the workday date range. + team_member_ids: + type: optional>> + docs: Fetch timecards for the specified team members. + source: + openapi: openapi/openapi.json + TimecardFilterStatus: + enum: + - OPEN + - CLOSED + docs: Specifies the `status` of `Timecard` records to be returned. + source: + openapi: openapi/openapi.json + TimecardQuery: + docs: >- + The parameters of a `Timecard` search query, which includes filter and + sort options. + properties: + filter: + type: optional + docs: Query filter options. + sort: + type: optional + docs: Sort order details. + source: + openapi: openapi/openapi.json + TimecardSort: + docs: Sets the sort order of search results. + properties: + field: + type: optional + docs: |- + The field to sort on. + See [TimecardSortField](#type-timecardsortfield) for possible values + order: + type: optional + docs: |- + The order in which results are returned. Defaults to DESC. + See [SortOrder](#type-sortorder) for possible values + source: + openapi: openapi/openapi.json + TimecardSortField: + enum: + - START_AT + - END_AT + - CREATED_AT + - UPDATED_AT + docs: Enumerates the `Timecard` fields to sort on. + source: + openapi: openapi/openapi.json + TimecardStatus: + enum: + - OPEN + - CLOSED + docs: >- + **Read only** Enumerates the possible status of a + [timecard](entity:Timecard). + source: + openapi: openapi/openapi.json + TimecardWage: + docs: >- + The hourly wage rate used to compensate a team member for a + [timecard](entity:Timecard). + properties: + title: + type: optional> + docs: The name of the job performed during this timecard. + hourly_rate: + type: optional + docs: |- + Can be a custom-set hourly wage or the calculated effective hourly + wage based on the annual wage and hours worked per week. + job_id: + type: optional + docs: |- + The ID of the [job](entity:Job) performed for this timecard. Square + labor-reporting UIs might group timecards together by ID. + access: read-only + tip_eligible: + type: optional> + docs: Whether team members are eligible for tips when working this job. + source: + openapi: openapi/openapi.json + TimecardWorkday: + docs: |- + A `Timecard` search query filter parameter that sets a range of days that + a `Timecard` must start or end in before passing the filter condition. + properties: + date_range: + type: optional + docs: Dates for fetching the timecards. + match_timecards_by: + type: optional + docs: >- + The strategy on which the dates are applied. + + See [TimecardWorkdayMatcher](#type-timecardworkdaymatcher) for + possible values + default_timezone: + type: optional> + docs: >- + Location-specific timezones convert workdays to datetime filters. + + Every location included in the query must have a timezone or this + field + + must be provided as a fallback. Format: the IANA timezone database + + identifier for the relevant timezone. + source: + openapi: openapi/openapi.json + TimecardWorkdayMatcher: + enum: + - START_AT + - END_AT + - INTERSECTION + docs: Defines the logic used to apply a workday filter. + source: + openapi: openapi/openapi.json + TipSettings: + properties: + allow_tipping: + type: optional> + docs: >- + Indicates whether tipping is enabled for this checkout. Defaults to + false. + separate_tip_screen: + type: optional> + docs: >- + Indicates whether tip options should be presented on the screen before + presenting + + the signature screen during card payment. Defaults to false. + custom_tip_field: + type: optional> docs: >- Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. @@ -25942,6 +26809,26 @@ types: docs: The updated payment. source: openapi: openapi/openapi.json + UpdateScheduledShiftResponse: + docs: >- + Represents an + [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response. + + Either `scheduled_shift` or `errors` is present in the response. + properties: + scheduled_shift: + type: optional + docs: >- + The updated scheduled shift. To make the changes public, call + + [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or + + [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts). + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json UpdateShiftResponse: docs: |- The response to a request to update a `Shift`. The response contains @@ -26000,6 +26887,23 @@ types: docs: The errors that occurred during the request. source: openapi: openapi/openapi.json + UpdateTimecardResponse: + docs: >- + The response to a request to update a `Timecard`. The response contains + + the updated `Timecard` object and might contain a set of `Error` objects + if + + the request resulted in errors. + properties: + timecard: + type: optional + docs: The updated `Timecard`. + errors: + type: optional> + docs: Any errors that occurred during the request. + source: + openapi: openapi/openapi.json UpdateVendorRequest: docs: >- Represents an input to a call to @@ -26838,6 +27742,17 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json + CatalogObjectImage: + properties: + image_data: + type: optional + docs: >- + Structured data for a `CatalogImage`, set for CatalogObjects of type + `IMAGE`. + extends: + - CatalogObjectBase + source: + openapi: openapi/openapi.json CatalogObjectItemVariation: properties: item_variation_data: @@ -26893,31 +27808,16 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json - CatalogObjectDiningOption: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectTaxExemption: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectServiceCharge: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectTimePeriod: + CatalogObjectPricingRule: properties: - time_period_data: - type: optional + pricing_rule_data: + type: optional docs: >- - Structured data for a `CatalogTimePeriod`, set for CatalogObjects of - type `TIME_PERIOD`. + Structured data for a `CatalogPricingRule`, set for CatalogObjects of + type `PRICING_RULE`. + + A `CatalogPricingRule` object often works with a `CatalogProductSet` + object or a `CatalogTimePeriod` object. extends: - CatalogObjectBase source: @@ -26933,27 +27833,13 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json - CatalogObjectPricingRule: - properties: - pricing_rule_data: - type: optional - docs: >- - Structured data for a `CatalogPricingRule`, set for CatalogObjects of - type `PRICING_RULE`. - - A `CatalogPricingRule` object often works with a `CatalogProductSet` - object or a `CatalogTimePeriod` object. - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectImage: + CatalogObjectTimePeriod: properties: - image_data: - type: optional + time_period_data: + type: optional docs: >- - Structured data for a `CatalogImage`, set for CatalogObjects of type - `IMAGE`. + Structured data for a `CatalogTimePeriod`, set for CatalogObjects of + type `TIME_PERIOD`. extends: - CatalogObjectBase source: @@ -26969,13 +27855,13 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json - CatalogObjectSubscriptionPlan: + CatalogObjectSubscriptionPlanVariation: properties: - subscription_plan_data: - type: optional + subscription_plan_variation_data: + type: optional docs: >- - Structured data for a `CatalogSubscriptionPlan`, set for - CatalogObjects of type `SUBSCRIPTION_PLAN`. + Structured data for a `CatalogSubscriptionPlanVariation`, set for + CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. extends: - CatalogObjectBase source: @@ -27024,13 +27910,13 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json - CatalogObjectSubscriptionPlanVariation: + CatalogObjectSubscriptionPlan: properties: - subscription_plan_variation_data: - type: optional + subscription_plan_data: + type: optional docs: >- - Structured data for a `CatalogSubscriptionPlanVariation`, set for - CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. + Structured data for a `CatalogSubscriptionPlan`, set for + CatalogObjects of type `SUBSCRIPTION_PLAN`. extends: - CatalogObjectBase source: @@ -27046,39 +27932,3 @@ types: - CatalogObjectBase source: openapi: openapi/openapi.json - CatalogObjectComponent: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectComposition: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectResource: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectCheckoutLink: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectAddress: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json - CatalogObjectSubscriptionProduct: - properties: {} - extends: - - CatalogObjectBase - source: - openapi: openapi/openapi.json diff --git a/.mock/definition/api.yml b/.mock/definition/api.yml index 28aa10da..e2b13bab 100644 --- a/.mock/definition/api.yml +++ b/.mock/definition/api.yml @@ -10,7 +10,7 @@ headers: Square-Version: name: version env: VERSION - type: literal<"2025-04-16"> + type: literal<"2025-05-21"> auth-schemes: Bearer: scheme: bearer diff --git a/.mock/definition/invoices.yml b/.mock/definition/invoices.yml index 969d6381..4ca40bd9 100644 --- a/.mock/definition/invoices.yml +++ b/.mock/definition/invoices.yml @@ -854,7 +854,7 @@ service: body: properties: request: - type: optional + type: optional content-type: application/json; charset=utf-8 image_file: type: optional diff --git a/.mock/definition/labor.yml b/.mock/definition/labor.yml new file mode 100644 index 00000000..824f6c0e --- /dev/null +++ b/.mock/definition/labor.yml @@ -0,0 +1,1001 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + CreateScheduledShift: + path: /v2/labor/scheduled-shifts + method: POST + auth: true + docs: >- + Creates a scheduled shift by providing draft shift details such as job + ID, + + team member assignment, and start and end times. + + + The following `draft_shift_details` fields are required: + + - `location_id` + + - `job_id` + + - `start_at` + + - `end_at` + source: + openapi: openapi/openapi.json + display-name: CreateScheduledShift + request: + name: CreateScheduledShiftRequest + body: + properties: + idempotency_key: + type: optional + docs: >- + A unique identifier for the `CreateScheduledShift` request, used + to ensure the + + [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) + + of the operation. + validation: + maxLength: 128 + scheduled_shift: + type: root.ScheduledShift + docs: >- + The scheduled shift with `draft_shift_details`. + + If needed, call + [ListLocations](api-endpoint:Locations-ListLocations) to get + location IDs, + + [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and + [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) + + to get team member IDs and current job assignments. + + + The `start_at` and `end_at` timestamps must be provided in the + time zone + offset of the + + shift location specified in `location_id`. Example for Pacific + Standard Time: 2024-10-31T12:30:00-08:00 + content-type: application/json + response: + docs: Success + type: root.CreateScheduledShiftResponse + status-code: 200 + examples: + - request: + idempotency_key: HIDSNG5KS478L + scheduled_shift: + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + response: + body: + scheduled_shift: + id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + timezone: America/New_York + published_shift_details: + team_member_id: team_member_id + location_id: location_id + job_id: job_id + start_at: start_at + end_at: end_at + notes: notes + is_deleted: true + timezone: timezone + version: 1 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:00-05:00' + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + BulkPublishScheduledShifts: + path: /v2/labor/scheduled-shifts/bulk-publish + method: POST + auth: true + docs: >- + Publishes 1 - 100 scheduled shifts. This endpoint takes a map of + individual publish + + requests and returns a map of responses. When a scheduled shift is + published, Square keeps + + the `draft_shift_details` field as is and copies it to the + `published_shift_details` field. + + + The minimum `start_at` and maximum `end_at` timestamps of all shifts in + a + + `BulkPublishScheduledShifts` request must fall within a two-week period. + source: + openapi: openapi/openapi.json + display-name: BulkPublishScheduledShifts + request: + name: BulkPublishScheduledShiftsRequest + body: + properties: + scheduled_shifts: + type: map + docs: >- + A map of 1 to 100 key-value pairs that represent individual + publish requests. + + + - Each key is the ID of a scheduled shift you want to publish. + + - Each value is a `BulkPublishScheduledShiftsData` object that + contains the + + `version` field or is an empty object. + scheduled_shift_notification_audience: + type: optional + docs: >- + Indicates whether Square should send email notifications to team + members and + + which team members should receive the notifications. This + setting applies to all shifts + + specified in the bulk operation. The default value is + `AFFECTED`. + + See + [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) + for possible values + content-type: application/json + response: + docs: Success + type: root.BulkPublishScheduledShiftsResponse + status-code: 200 + examples: + - request: + scheduled_shifts: + key: {} + scheduled_shift_notification_audience: AFFECTED + response: + body: + responses: + idp_key_1: + scheduled_shift: + id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-03-25T03:11:00-05:00' + end_at: '2019-03-25T13:18:00-05:00' + notes: Don't forget to prep the vegetables + is_deleted: false + timezone: America/New_York + published_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-03-25T03:11:00-05:00' + end_at: '2019-03-25T13:18:00-05:00' + notes: Don't forget to prep the vegetables + is_deleted: false + timezone: America/New_York + version: 3 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:15-05:00' + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + idp_key_2: + errors: + - category: INVALID_REQUEST_ERROR + code: INVALID_VALUE + detail: Scheduled shift with id 'scheduled-shift-2' not found + field: scheduled-shifts.scheduled-shift-2 + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + SearchScheduledShifts: + path: /v2/labor/scheduled-shifts/search + method: POST + auth: true + docs: >- + Returns a paginated list of scheduled shifts, with optional filter and + sort settings. + + By default, results are sorted by `start_at` in ascending order. + source: + openapi: openapi/openapi.json + display-name: SearchScheduledShifts + request: + name: SearchScheduledShiftsRequest + body: + properties: + query: + type: optional + docs: Query conditions used to filter and sort the results. + limit: + type: optional + docs: >- + The maximum number of results to return in a single response + page. The default value is 50. + validation: + min: 1 + max: 50 + cursor: + type: optional + docs: >- + The pagination cursor returned by the previous call to this + endpoint. Provide + + this cursor to retrieve the next page of results for your + original request. For more + + information, see + [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + content-type: application/json + response: + docs: Success + type: root.SearchScheduledShiftsResponse + status-code: 200 + examples: + - request: + query: + filter: + assignment_status: ASSIGNED + sort: + field: CREATED_AT + order: ASC + limit: 2 + cursor: xoxp-1234-5678-90123 + response: + body: + scheduled_shifts: + - id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + timezone: America/New_York + version: 1 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:00-05:00' + cursor: xoxp-123-2123-123232 + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + RetrieveScheduledShift: + path: /v2/labor/scheduled-shifts/{id} + method: GET + auth: true + docs: Retrieves a scheduled shift by ID. + source: + openapi: openapi/openapi.json + display-name: RetrieveScheduledShift + request: + name: RetrieveScheduledShiftRequest + path-parameters: + id: + type: string + docs: The ID of the scheduled shift to retrieve. + response: + docs: Success + type: root.RetrieveScheduledShiftResponse + status-code: 200 + examples: + - path-parameters: + id: id + response: + body: + scheduled_shift: + id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-03-25T03:11:00-05:00' + end_at: '2019-03-25T13:18:00-05:00' + notes: Don't forget to prep the vegetables + is_deleted: false + timezone: America/New_York + published_shift_details: + team_member_id: team_member_id + location_id: location_id + job_id: job_id + start_at: start_at + end_at: end_at + notes: notes + is_deleted: true + timezone: timezone + version: 2 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:15-05:00' + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + UpdateScheduledShift: + path: /v2/labor/scheduled-shifts/{id} + method: PUT + auth: true + docs: >- + Updates the draft shift details for a scheduled shift. This endpoint + supports + + sparse updates, so only new, changed, or removed fields are required in + the request. + + You must publish the shift to make updates public. + + + You can make the following updates to `draft_shift_details`: + + - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields. + + - Add, change, or clear the `team_member_id` and `notes` fields. To + clear these fields, + + set the value to null. + + - Change the `is_deleted` field. To delete a scheduled shift, set + `is_deleted` to true + + and then publish the shift. + source: + openapi: openapi/openapi.json + display-name: UpdateScheduledShift + request: + name: UpdateScheduledShiftRequest + path-parameters: + id: + type: string + docs: The ID of the scheduled shift to update. + body: + properties: + scheduled_shift: + type: root.ScheduledShift + docs: >- + The scheduled shift with any updates in the + `draft_shift_details` field. + + If needed, call + [ListLocations](api-endpoint:Locations-ListLocations) to get + location IDs, + + [ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and + [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) + + to get team member IDs and current job assignments. Updates made + to `published_shift_details` + + are ignored. + + + If provided, the `start_at` and `end_at` timestamps must be in + the time zone + offset of the + + shift location specified in `location_id`. Example for Pacific + Standard Time: 2024-10-31T12:30:00-08:00 + + + To enable [optimistic + concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + + control for the request, provide the current version of the + shift in the `version` field. + + If the provided version doesn't match the server version, the + request fails. If `version` is + + omitted, Square executes a blind write, potentially overwriting + data from another publish request. + content-type: application/json + response: + docs: Success + type: root.UpdateScheduledShiftResponse + status-code: 200 + examples: + - path-parameters: + id: id + request: + scheduled_shift: + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-03-25T03:11:00-05:00' + end_at: '2019-03-25T13:18:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + version: 1 + response: + body: + scheduled_shift: + id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-03-25T03:11:00-05:00' + end_at: '2019-03-25T13:18:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + timezone: America/New_York + published_shift_details: + team_member_id: team_member_id + location_id: location_id + job_id: job_id + start_at: start_at + end_at: end_at + notes: notes + is_deleted: true + timezone: timezone + version: 2 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:15-05:00' + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + PublishScheduledShift: + path: /v2/labor/scheduled-shifts/{id}/publish + method: POST + auth: true + docs: >- + Publishes a scheduled shift. When a scheduled shift is published, Square + keeps the + + `draft_shift_details` field as is and copies it to the + `published_shift_details` field. + source: + openapi: openapi/openapi.json + display-name: PublishScheduledShift + request: + name: PublishScheduledShiftRequest + path-parameters: + id: + type: string + docs: The ID of the scheduled shift to publish. + body: + properties: + idempotency_key: + type: string + docs: >- + A unique identifier for the `PublishScheduledShift` request, + used to ensure the + + [idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) + + of the operation. + validation: + minLength: 1 + maxLength: 128 + version: + type: optional + docs: >- + The current version of the scheduled shift, used to enable + [optimistic + concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + + control. If the provided version doesn't match the server + version, the request fails. + + If omitted, Square executes a blind write, potentially + overwriting data from another publish request. + scheduled_shift_notification_audience: + type: optional + docs: >- + Indicates whether Square should send an email notification to + team members and + + which team members should receive the notification. The default + value is `AFFECTED`. + + See + [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) + for possible values + content-type: application/json + response: + docs: Success + type: root.PublishScheduledShiftResponse + status-code: 200 + examples: + - path-parameters: + id: id + request: + idempotency_key: HIDSNG5KS478L + version: 2 + scheduled_shift_notification_audience: ALL + response: + body: + scheduled_shift: + id: K0YH4CV5462JB + draft_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + timezone: America/New_York + published_shift_details: + team_member_id: ormj0jJJZ5OZIzxrZYJI + location_id: PAA1RJZZKXBFG + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + notes: Dont forget to prep the vegetables + is_deleted: false + timezone: America/New_York + version: 2 + created_at: '2019-02-25T03:11:00-05:00' + updated_at: '2019-02-25T03:11:00-05:00' + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + CreateTimecard: + path: /v2/labor/timecards + method: POST + auth: true + docs: >- + Creates a new `Timecard`. + + + A `Timecard` represents a complete workday for a single team member. + + You must provide the following values in your request to this + + endpoint: + + + - `location_id` + + - `team_member_id` + + - `start_at` + + + An attempt to create a new `Timecard` can result in a `BAD_REQUEST` + error when: + + - The `status` of the new `Timecard` is `OPEN` and the team member has + another + + timecard with an `OPEN` status. + + - The `start_at` date is in the future. + + - The `start_at` or `end_at` date overlaps another timecard for the same + team member. + + - The `Break` instances are set in the request and a break `start_at` + + is before the `Timecard.start_at`, a break `end_at` is after + + the `Timecard.end_at`, or both. + source: + openapi: openapi/openapi.json + display-name: CreateTimecard + request: + name: CreateTimecardRequest + body: + properties: + idempotency_key: + type: optional + docs: >- + A unique string value to ensure the idempotency of the + operation. + validation: + maxLength: 128 + timecard: + type: root.Timecard + docs: The `Timecard` to be created. + content-type: application/json + response: + docs: Success + type: root.CreateTimecardResponse + status-code: 200 + examples: + - request: + idempotency_key: HIDSNG5KS478L + timecard: + location_id: PAA1RJZZKXBFG + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + wage: + title: Barista + hourly_rate: + amount: 1100 + currency: USD + tip_eligible: true + breaks: + - start_at: '2019-01-25T06:11:00-05:00' + end_at: '2019-01-25T06:16:00-05:00' + break_type_id: REGS1EQR1TPZ5 + name: Tea Break + expected_duration: PT5M + is_paid: true + team_member_id: ormj0jJJZ5OZIzxrZYJI + declared_cash_tip_money: + amount: 500 + currency: USD + response: + body: + timecard: + id: K0YH4CV5462JB + location_id: PAA1RJZZKXBFG + timezone: America/New_York + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + wage: + title: Barista + hourly_rate: + amount: 1100 + currency: USD + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + tip_eligible: true + breaks: + - id: X7GAQYVVRRG6P + start_at: '2019-01-25T06:11:00-05:00' + end_at: '2019-01-25T06:16:00-05:00' + break_type_id: REGS1EQR1TPZ5 + name: Tea Break + expected_duration: PT5M + is_paid: true + status: CLOSED + version: 1 + created_at: '2019-02-28T00:39:02Z' + updated_at: '2019-02-28T00:39:02Z' + team_member_id: ormj0jJJZ5OZIzxrZYJI + declared_cash_tip_money: + amount: 500 + currency: USD + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + SearchTimecards: + path: /v2/labor/timecards/search + method: POST + auth: true + docs: |- + Returns a paginated list of `Timecard` records for a business. + The list to be returned can be filtered by: + - Location IDs + - Team member IDs + - Timecard status (`OPEN` or `CLOSED`) + - Timecard start + - Timecard end + - Workday details + + The list can be sorted by: + - `START_AT` + - `END_AT` + - `CREATED_AT` + - `UPDATED_AT` + source: + openapi: openapi/openapi.json + display-name: SearchTimecards + request: + name: SearchTimecardsRequest + body: + properties: + query: + type: optional + docs: Query filters. + limit: + type: optional + docs: The number of resources in a page (200 by default). + validation: + min: 1 + max: 200 + cursor: + type: optional + docs: An opaque cursor for fetching the next page. + content-type: application/json + response: + docs: Success + type: root.SearchTimecardsResponse + status-code: 200 + examples: + - request: + query: + filter: + workday: + date_range: + start_date: '2019-01-20' + end_date: '2019-02-03' + match_timecards_by: START_AT + default_timezone: America/Los_Angeles + limit: 100 + response: + body: + timecards: + - id: X714F3HA6D1PT + location_id: PAA1RJZZKXBFG + timezone: America/New_York + start_at: '2019-01-21T03:11:00-05:00' + end_at: '2019-01-21T13:11:00-05:00' + wage: + title: Barista + hourly_rate: + amount: 1100 + currency: USD + job_id: FzbJAtt9qEWncK1BWgVCxQ6M + tip_eligible: true + breaks: + - id: SJW7X6AKEJQ65 + start_at: '2019-01-21T06:11:00-05:00' + end_at: '2019-01-21T06:11:00-05:00' + break_type_id: REGS1EQR1TPZ5 + name: Tea Break + expected_duration: PT10M + is_paid: true + status: CLOSED + version: 6 + created_at: '2019-01-24T01:12:03Z' + updated_at: '2019-02-07T22:21:08Z' + team_member_id: ormj0jJJZ5OZIzxrZYJI + declared_cash_tip_money: + amount: 500 + currency: USD + - id: GDHYBZYWK0P2V + location_id: PAA1RJZZKXBFG + timezone: America/New_York + start_at: '2019-01-22T12:02:00-05:00' + end_at: '2019-01-22T13:02:00-05:00' + wage: + title: Cook + hourly_rate: + amount: 1600 + currency: USD + job_id: gcbz15vKGnMKmaWJJ152kjim + tip_eligible: true + breaks: + - id: BKS6VR7WR748A + start_at: '2019-01-22T14:30:00-05:00' + end_at: '2019-01-22T14:40:00-05:00' + break_type_id: WQX00VR99F53J + name: Tea Break + expected_duration: PT10M + is_paid: true + - id: BQFEZSHFZSC51 + start_at: '2019-01-22T12:30:00-05:00' + end_at: '2019-01-22T12:44:00-05:00' + break_type_id: P6Q468ZFRN1AC + name: Coffee Break + expected_duration: PT15M + is_paid: false + status: CLOSED + version: 16 + created_at: '2019-01-23T23:32:45Z' + updated_at: '2019-01-24T00:56:25Z' + team_member_id: 33fJchumvVdJwxV0H6L9 + declared_cash_tip_money: + amount: 0 + currency: USD + cursor: cursor + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + RetrieveTimecard: + path: /v2/labor/timecards/{id} + method: GET + auth: true + docs: Returns a single `Timecard` specified by `id`. + source: + openapi: openapi/openapi.json + display-name: RetrieveTimecard + request: + name: RetrieveTimecardRequest + path-parameters: + id: + type: string + docs: The UUID for the `Timecard` being retrieved. + response: + docs: Success + type: root.RetrieveTimecardResponse + status-code: 200 + examples: + - path-parameters: + id: id + response: + body: + timecard: + id: T35HMQSN89SV4 + location_id: PAA1RJZZKXBFG + timezone: America/New_York + start_at: '2019-02-23T18:00:00-05:00' + end_at: '2019-02-23T21:00:00-05:00' + wage: + title: Cashier + hourly_rate: + amount: 1457 + currency: USD + job_id: N4YKVLzFj3oGtNocqoYHYpW3 + tip_eligible: true + breaks: + - id: M9BBKEPQAQD2T + start_at: '2019-02-23T19:00:00-05:00' + end_at: '2019-02-23T20:00:00-05:00' + break_type_id: 92EPDRQKJ5088 + name: Lunch Break + expected_duration: PT1H + is_paid: true + status: CLOSED + version: 1 + created_at: '2019-02-27T00:12:12Z' + updated_at: '2019-02-27T00:12:12Z' + team_member_id: D71KRMQof6cXGUW0aAv7 + declared_cash_tip_money: + amount: 500 + currency: USD + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + UpdateTimecard: + path: /v2/labor/timecards/{id} + method: PUT + auth: true + docs: >- + Updates an existing `Timecard`. + + + When adding a `Break` to a `Timecard`, any earlier `Break` instances in + the `Timecard` have + + the `end_at` property set to a valid RFC-3339 datetime string. + + + When closing a `Timecard`, all `Break` instances in the `Timecard` must + be complete with `end_at` + + set on each `Break`. + source: + openapi: openapi/openapi.json + display-name: UpdateTimecard + request: + name: UpdateTimecardRequest + path-parameters: + id: + type: string + docs: The ID of the object being updated. + body: + properties: + timecard: + type: root.Timecard + docs: The updated `Timecard` object. + content-type: application/json + response: + docs: Success + type: root.UpdateTimecardResponse + status-code: 200 + examples: + - path-parameters: + id: id + request: + timecard: + location_id: PAA1RJZZKXBFG + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + wage: + title: Bartender + hourly_rate: + amount: 1500 + currency: USD + tip_eligible: true + breaks: + - id: X7GAQYVVRRG6P + start_at: '2019-01-25T06:11:00-05:00' + end_at: '2019-01-25T06:16:00-05:00' + break_type_id: REGS1EQR1TPZ5 + name: Tea Break + expected_duration: PT5M + is_paid: true + status: CLOSED + version: 1 + team_member_id: ormj0jJJZ5OZIzxrZYJI + declared_cash_tip_money: + amount: 500 + currency: USD + response: + body: + timecard: + id: K0YH4CV5462JB + location_id: PAA1RJZZKXBFG + timezone: America/New_York + start_at: '2019-01-25T03:11:00-05:00' + end_at: '2019-01-25T13:11:00-05:00' + wage: + title: Bartender + hourly_rate: + amount: 1500 + currency: USD + job_id: dZtrPh5GSDGugyXGByesVp51 + tip_eligible: true + breaks: + - id: X7GAQYVVRRG6P + start_at: '2019-01-25T06:11:00-05:00' + end_at: '2019-01-25T06:16:00-05:00' + break_type_id: REGS1EQR1TPZ5 + name: Tea Break + expected_duration: PT5M + is_paid: true + status: CLOSED + version: 2 + created_at: '2019-02-28T00:39:02Z' + updated_at: '2019-02-28T00:42:41Z' + team_member_id: ormj0jJJZ5OZIzxrZYJI + declared_cash_tip_money: + amount: 500 + currency: USD + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + DeleteTimecard: + path: /v2/labor/timecards/{id} + method: DELETE + auth: true + docs: Deletes a `Timecard`. + source: + openapi: openapi/openapi.json + display-name: DeleteTimecard + request: + name: DeleteTimecardRequest + path-parameters: + id: + type: string + docs: The UUID for the `Timecard` being deleted. + response: + docs: Success + type: root.DeleteTimecardResponse + status-code: 200 + examples: + - path-parameters: + id: id + response: + body: + errors: + - category: API_ERROR + code: INTERNAL_SERVER_ERROR + detail: detail + field: field + source: + openapi: openapi/openapi.json diff --git a/.mock/definition/labor/shifts.yml b/.mock/definition/labor/shifts.yml index 85647a69..93669d62 100644 --- a/.mock/definition/labor/shifts.yml +++ b/.mock/definition/labor/shifts.yml @@ -66,6 +66,7 @@ service: docs: Success type: root.CreateShiftResponse status-code: 200 + availability: deprecated examples: - request: idempotency_key: HIDSNG5KS478L @@ -170,6 +171,7 @@ service: docs: Success type: root.SearchShiftsResponse status-code: 200 + availability: deprecated examples: - request: query: @@ -273,6 +275,7 @@ service: docs: Success type: root.GetShiftResponse status-code: 200 + availability: deprecated examples: - path-parameters: id: id @@ -350,6 +353,7 @@ service: docs: Success type: root.UpdateShiftResponse status-code: 200 + availability: deprecated examples: - path-parameters: id: id @@ -432,6 +436,7 @@ service: docs: Success type: root.DeleteShiftResponse status-code: 200 + availability: deprecated examples: - path-parameters: id: id diff --git a/.mock/openapi/openapi.json b/.mock/openapi/openapi.json index cbb5c9be..bad38922 100644 --- a/.mock/openapi/openapi.json +++ b/.mock/openapi/openapi.json @@ -146,7 +146,7 @@ "name": "Square-Version", "description": "Square Connect API versions", "schema": { - "default": "2025-04-16" + "default": "2025-05-21" } } ], @@ -2734,7 +2734,7 @@ }, "Break": { "type": "object", - "description": "A record of an employee's break during a shift.", + "description": "A record of a team member's break on a [timecard](entity:Timecard).", "x-release-status": "PUBLIC", "required": [ "start_at", @@ -2750,17 +2750,17 @@ }, "start_at": { "type": "string", - "description": "RFC 3339; follows the same timezone information as `Shift`. Precision up to\nthe minute is respected; seconds are truncated.", + "description": "RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to\nthe minute is respected; seconds are truncated.", "minLength": 1 }, "end_at": { "type": "string", - "description": "RFC 3339; follows the same timezone information as `Shift`. Precision up to\nthe minute is respected; seconds are truncated.", + "description": "RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to\nthe minute is respected; seconds are truncated.", "nullable": true }, "break_type_id": { "type": "string", - "description": "The `BreakType` that this `Break` was templated on.", + "description": "The [BreakType](entity:BreakType) that this break was templated on.", "minLength": 1 }, "name": { @@ -2770,7 +2770,7 @@ }, "expected_duration": { "type": "string", - "description": "Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of\nthe break.", + "description": "Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of\nthe break.\n\nExample for break expected duration of 15 minutes: PT15M", "minLength": 1 }, "is_paid": { @@ -2781,7 +2781,7 @@ }, "BreakType": { "type": "object", - "description": "A defined break template that sets an expectation for possible `Break`\ninstances on a `Shift`.", + "description": "A template for a type of [break](entity:Break) that can be added to a\n[timecard](entity:Timecard), including the expected duration and paid status.", "x-release-status": "PUBLIC", "required": [ "location_id", @@ -2802,12 +2802,12 @@ }, "break_name": { "type": "string", - "description": "A human-readable name for this type of break. The name is displayed to\nemployees in Square products.", + "description": "A human-readable name for this type of break. The name is displayed to\nteam members in Square products.", "minLength": 1 }, "expected_duration": { "type": "string", - "description": "Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of\nthis break. Precision less than minutes is truncated.\n\nExample for break expected duration of 15 minutes: T15M", + "description": "Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of\nthis break. Precision less than minutes is truncated.\n\nExample for break expected duration of 15 minutes: PT15M", "minLength": 1 }, "is_paid": { @@ -3659,6 +3659,113 @@ } } }, + "BulkPublishScheduledShiftsData": { + "type": "object", + "description": "Represents options for an individual publish request in a\n[BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts)\noperation, provided as the value in a key-value pair.", + "x-release-status": "BETA", + "properties": { + "version": { + "type": "integer", + "description": "The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)\ncontrol. If the provided version doesn't match the server version, the request fails.\nIf omitted, Square executes a blind write, potentially overwriting data from another publish request." + } + } + }, + "BulkPublishScheduledShiftsRequest": { + "type": "object", + "description": "Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) request.", + "x-release-status": "BETA", + "required": [ + "scheduled_shifts" + ], + "properties": { + "scheduled_shifts": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/BulkPublishScheduledShiftsData" + }, + "description": "A map of 1 to 100 key-value pairs that represent individual publish requests.\n\n- Each key is the ID of a scheduled shift you want to publish.\n- Each value is a `BulkPublishScheduledShiftsData` object that contains the\n`version` field or is an empty object." + }, + "scheduled_shift_notification_audience": { + "$ref": "#/components/schemas/ScheduledShiftNotificationAudience", + "description": "Indicates whether Square should send email notifications to team members and\nwhich team members should receive the notifications. This setting applies to all shifts\nspecified in the bulk operation. The default value is `AFFECTED`.\nSee [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values", + "nullable": true + } + }, + "example": { + "scheduled-shifts": { + "K0YH4CV5462JB": { + "version": 3 + }, + "scheduled-shift-2": { + "version": 2 + } + }, + "scheduled_shift_notification_audience": "AFFECTED" + } + }, + "BulkPublishScheduledShiftsResponse": { + "type": "object", + "description": "Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) response.\nEither `scheduled_shifts` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "responses": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/PublishScheduledShiftResponse" + }, + "description": "A map of key-value pairs that represent responses for individual publish requests.\nThe order of responses might differ from the order in which the requests were provided.\n\n- Each key is the scheduled shift ID that was specified for a publish request.\n- Each value is the corresponding response. If the request succeeds, the value is the\npublished scheduled shift. If the request fails, the value is an `errors` array containing\nany errors that occurred while processing the request." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any top-level errors that prevented the bulk operation from succeeding." + } + }, + "example": { + "responses": { + "idp_key_1": { + "scheduled_shift": { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-03-25T13:18:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Don't forget to prep the vegetables", + "start_at": "2019-03-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "published_shift_details": { + "end_at": "2019-03-25T13:18:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Don't forget to prep the vegetables", + "start_at": "2019-03-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "updated_at": "2019-02-25T03:11:15-05:00", + "version": 3 + } + }, + "idp_key_2": { + "errors": [ + { + "category": "INVALID_REQUEST_ERROR", + "code": "INVALID_VALUE", + "detail": "Scheduled shift with id 'scheduled-shift-2' not found", + "field": "scheduled-shifts.scheduled-shift-2" + } + ] + } + } + } + }, "BulkRetrieveBookingsRequest": { "type": "object", "description": "Request payload for bulk retrieval of bookings.", @@ -7845,7 +7952,7 @@ }, "ecom_uri": { "type": "string", - "description": "Deprecated; see go/ecomUriUseCases. A URI pointing to a published e-commerce product page for the Item.", + "description": "Deprecated. A URI pointing to a published e-commerce product page for the Item.", "x-release-status": "DEPRECATED", "nullable": true }, @@ -7854,7 +7961,7 @@ "items": { "type": "string" }, - "description": "Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item.", + "description": "Deprecated. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item.", "x-release-status": "DEPRECATED", "nullable": true }, @@ -8157,7 +8264,7 @@ }, "CatalogItemModifierListInfo": { "type": "object", - "description": "References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance\nand specifies supported behaviors of the application.", + "description": "Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior\nand provides the ability to override global modifier list settings.", "x-release-status": "PUBLIC", "required": [ "modifier_list_id" @@ -8173,17 +8280,17 @@ "items": { "$ref": "#/components/schemas/CatalogModifierOverride" }, - "description": "A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default.", + "description": "A set of `CatalogModifierOverride` objects that override default modifier settings for this item.", "nullable": true }, "min_selected_modifiers": { "type": "integer", - "description": "If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`.\nThe default value is `-1`.\n\nWhen `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` \nand `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of\nthe `CatalogModifierList` can be selected from the `CatalogModifierList`. \n\nWhen the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`\nand `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in \nand can be selected from the `CatalogModifierList`", + "description": "The minimum number of modifiers that must be selected from this modifier list.\nValues:\n\n- 0: No selection is required.\n- -1: Default value, the attribute was not set by the client. When `max_selected_modifiers` is\nalso -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.\n- \u0026gt;0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.\n- \u0026lt; -1: Invalid. Treated as no selection required.", "nullable": true }, "max_selected_modifiers": { "type": "integer", - "description": "If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`.\nThe default value is `-1`.\n\nWhen `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` \nand `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of\nthe `CatalogModifierList` can be selected from the `CatalogModifierList`. \n\nWhen the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`\nand `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in \nand can be selected from the `CatalogModifierList`", + "description": "The maximum number of modifiers that can be selected.\nValues:\n\n- 0: No maximum limit.\n- -1: Default value, the attribute was not set by the client. When `min_selected_modifiers` is\nalso -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`.\n- \u0026gt;0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.\n- \u0026lt; -1: Invalid. Treated as no maximum limit.", "nullable": true }, "enabled": { @@ -8196,6 +8303,24 @@ "description": "The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied \nto a `CatalogItem` instance.", "x-release-status": "BETA", "nullable": true + }, + "allow_quantities": { + "$ref": "#/components/schemas/CatalogModifierToggleOverrideType", + "description": "Controls whether multiple quantities of the same modifier can be selected for this item.\n- `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities\nselected for this item.\n- `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item.\n- `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed.\nSee [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values", + "x-release-status": "BETA", + "nullable": true + }, + "is_conversational": { + "$ref": "#/components/schemas/CatalogModifierToggleOverrideType", + "description": "Controls whether conversational mode is enabled for modifiers on this item.\n\n- `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`.\n- `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.\n- `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`.\nSee [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values", + "x-release-status": "BETA", + "nullable": true + }, + "hidden_from_customer_override": { + "$ref": "#/components/schemas/CatalogModifierToggleOverrideType", + "description": "Controls whether all modifiers for this item are hidden from customer receipts.\n- `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer\nreceipts for this item.\n- `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item.\n- `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed.\nSee [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values", + "x-release-status": "BETA", + "nullable": true } } }, @@ -8500,7 +8625,7 @@ }, "CatalogModifier": { "type": "object", - "description": "A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item.", + "description": "A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream.", "x-release-status": "PUBLIC", "properties": { "name": { @@ -8514,6 +8639,12 @@ "description": "The modifier price.", "nullable": true }, + "on_by_default": { + "type": "boolean", + "description": "When `true`, this modifier is selected by default when displaying the modifier list.\nThis setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.", + "x-release-status": "BETA", + "nullable": true + }, "ordinal": { "type": "integer", "description": "Determines where this `CatalogModifier` appears in the `CatalogModifierList`.", @@ -8537,6 +8668,12 @@ "description": "The ID of the image associated with this `CatalogModifier` instance.\nCurrently this image is not displayed by Square, but is free to be displayed in 3rd party applications.", "x-release-status": "BETA", "nullable": true + }, + "hidden_online": { + "type": "boolean", + "description": "When `true`, this modifier is hidden from online ordering channels. This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`.", + "x-release-status": "BETA", + "nullable": true } }, "example": { @@ -8555,7 +8692,7 @@ }, "CatalogModifierList": { "type": "object", - "description": "For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. \nFor example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied \ntext string to be selected for the T-shirt at the time of sale.\n\nFor non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items \nat the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. \nFor example, a \"Condiments\" modifier list applicable to a \"Hot Dog\" item\nmay contain \"Ketchup\", \"Mustard\", and \"Relish\" modifiers. \n\nA non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field \nis set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item \nonly once and the `selection_type` field is always set to `SINGLE`.", + "description": "A container for a list of modifiers, or a text-based modifier.\nFor text-based modifiers, this represents text configuration for an item. (For example, custom text to print on a t-shirt).\nFor non text-based modifiers, this represents a list of modifiers that can be applied to items at the time of sale.\n(For example, a list of condiments for a hot dog, or a list of ice cream flavors).\nEach element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type.", "x-release-status": "PUBLIC", "properties": { "name": { @@ -8571,7 +8708,8 @@ }, "selection_type": { "$ref": "#/components/schemas/CatalogModifierListSelectionType", - "description": "Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) modifiers from the list\ncan be applied to a single `CatalogItem`.\n\nFor text-based modifiers, the `selection_type` attribute is always `SINGLE`. The other value is ignored.\nSee [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values", + "description": "__Deprecated__: Indicates whether a single (`SINGLE`) modifier or multiple (`MULTIPLE`) modifiers can be selected. Use\n`min_selected_modifiers` and `max_selected_modifiers` instead.\nSee [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values", + "x-release-status": "DEPRECATED", "nullable": true }, "modifiers": { @@ -8590,6 +8728,18 @@ "description": "The IDs of images associated with this `CatalogModifierList` instance.\nCurrently these images are not displayed on Square products, but may be displayed in 3rd-party applications.", "nullable": true }, + "allow_quantities": { + "type": "boolean", + "description": "When `true`, allows multiple quantities of the same modifier to be selected.", + "x-release-status": "BETA", + "nullable": true + }, + "is_conversational": { + "type": "boolean", + "description": "True if modifiers belonging to this list can be used conversationally.", + "x-release-status": "BETA", + "nullable": true + }, "modifier_type": { "$ref": "#/components/schemas/CatalogModifierListModifierType", "description": "The type of the modifier. \n\nWhen this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier. \nWhen this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects.\nSee [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values", @@ -8614,6 +8764,26 @@ "maxLength": 512, "x-release-status": "BETA", "nullable": true + }, + "min_selected_modifiers": { + "type": "integer", + "description": "The minimum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.\n\nValues:\n\n- 0: No selection is required.\n- -1: Default value, the attribute was not set by the client. Treated as no selection required.\n- \u0026gt;0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.\n- \u0026lt; -1: Invalid. Treated as no selection required.", + "format": "int64", + "x-release-status": "BETA", + "nullable": true + }, + "max_selected_modifiers": { + "type": "integer", + "description": "The maximum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`.\n\nValues:\n\n- 0: No maximum limit.\n- -1: Default value, the attribute was not set by the client. Treated as no maximum limit.\n- \u0026gt;0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled.\n- \u0026lt; -1: Invalid. Treated as no maximum limit.", + "format": "int64", + "x-release-status": "BETA", + "nullable": true + }, + "hidden_from_customer": { + "type": "boolean", + "description": "If `true`, modifiers from this list are hidden from customer receipts. The default value is `false`.\nThis setting can be overridden with `CatalogItemModifierListInfo.hidden_from_customer_override`.", + "x-release-status": "BETA", + "nullable": true } }, "example": { @@ -8715,7 +8885,20 @@ }, "on_by_default": { "type": "boolean", - "description": "If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`.", + "description": "__Deprecated__: Use `on_by_default_override` instead.", + "x-release-status": "DEPRECATED", + "nullable": true + }, + "hidden_online_override": { + "$ref": "#/components/schemas/CatalogModifierToggleOverrideType", + "description": "If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object,\nand the modifier is always hidden from online sales channels.\nIf `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item.\n`NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed.\nSee [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values", + "x-release-status": "BETA", + "nullable": true + }, + "on_by_default_override": { + "$ref": "#/components/schemas/CatalogModifierToggleOverrideType", + "description": "If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object,\nand the modifier is always selected by default for the catalog item.\n\nIf `NO`, the modifier is not selected by default for this catalog item.\n`NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed.\nSee [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values", + "x-release-status": "BETA", "nullable": true } } @@ -15339,10 +15522,79 @@ "ruby": "/sdk_samples/CreateRefund/CreateRefundResponse.ruby" } }, + "CreateScheduledShiftRequest": { + "type": "object", + "description": "Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) request.", + "x-release-status": "BETA", + "required": [ + "scheduled_shift" + ], + "properties": { + "idempotency_key": { + "type": "string", + "description": "A unique identifier for the `CreateScheduledShift` request, used to ensure the\n[idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)\nof the operation.", + "maxLength": 128 + }, + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The scheduled shift with `draft_shift_details`.\nIf needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,\n[ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)\nto get team member IDs and current job assignments.\n\nThe `start_at` and `end_at` timestamps must be provided in the time zone + offset of the\nshift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00" + } + }, + "example": { + "idempotency_key": "HIDSNG5KS478L", + "scheduled_shift": { + "draft_shift_details": { + "end_at": "2019-01-25T13:11:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI" + } + } + } + }, + "CreateScheduledShiftResponse": { + "type": "object", + "description": "Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response.\nEither `scheduled_shift` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The new scheduled shift. To make the shift public, call \n[PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or\n[BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts)." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "scheduled_shift": { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-01-25T13:11:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "updated_at": "2019-02-25T03:11:00-05:00", + "version": 1 + } + } + }, "CreateShiftRequest": { "type": "object", "description": "Represents a request to create a `Shift`.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "required": [ "shift" ], @@ -15392,7 +15644,7 @@ "CreateShiftResponse": { "type": "object", "description": "The response to a request to create a `Shift`. The response contains\nthe created `Shift` object and might contain a set of `Error` objects if\nthe request resulted in errors.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "shift": { "$ref": "#/components/schemas/Shift", @@ -15924,6 +16176,112 @@ } } }, + "CreateTimecardRequest": { + "type": "object", + "description": "Represents a request to create a `Timecard`.", + "x-release-status": "PUBLIC", + "required": [ + "timecard" + ], + "properties": { + "idempotency_key": { + "type": "string", + "description": "A unique string value to ensure the idempotency of the operation.", + "maxLength": 128 + }, + "timecard": { + "$ref": "#/components/schemas/Timecard", + "description": "The `Timecard` to be created." + } + }, + "example": { + "idempotency_key": "HIDSNG5KS478L", + "timecard": { + "breaks": [ + { + "break_type_id": "REGS1EQR1TPZ5", + "end_at": "2019-01-25T06:16:00-05:00", + "expected_duration": "PT5M", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-25T06:11:00-05:00" + } + ], + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-01-25T13:11:00-05:00", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "wage": { + "hourly_rate": { + "amount": 1100, + "currency": "USD" + }, + "tip_eligible": true, + "title": "Barista" + } + } + } + }, + "CreateTimecardResponse": { + "type": "object", + "description": "The response to a request to create a `Timecard`. The response contains\nthe created `Timecard` object and might contain a set of `Error` objects if\nthe request resulted in errors.", + "x-release-status": "PUBLIC", + "properties": { + "timecard": { + "$ref": "#/components/schemas/Timecard", + "description": "The `Timecard` that was created on the request." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "timecard": { + "breaks": [ + { + "break_type_id": "REGS1EQR1TPZ5", + "end_at": "2019-01-25T06:16:00-05:00", + "expected_duration": "PT5M", + "id": "X7GAQYVVRRG6P", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-25T06:11:00-05:00" + } + ], + "created_at": "2019-02-28T00:39:02Z", + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-01-25T13:11:00-05:00", + "id": "K0YH4CV5462JB", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-25T03:11:00-05:00", + "status": "CLOSED", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York", + "updated_at": "2019-02-28T00:39:02Z", + "version": 1, + "wage": { + "hourly_rate": { + "amount": 1100, + "currency": "USD" + }, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "tip_eligible": true, + "title": "Barista" + } + } + } + }, "CreateVendorRequest": { "type": "object", "description": "Represents an input to a call to [CreateVendor](api-endpoint:Vendors-CreateVendor).", @@ -18383,13 +18741,13 @@ "DeleteShiftRequest": { "type": "object", "description": "A request to delete a `Shift`.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": {} }, "DeleteShiftResponse": { "type": "object", "description": "The response to a request to delete a `Shift`. The response might contain a set of \n`Error` objects if the request resulted in errors.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "errors": { "type": "array", @@ -18472,6 +18830,27 @@ } } }, + "DeleteTimecardRequest": { + "type": "object", + "description": "A request to delete a `Timecard`.", + "x-release-status": "PUBLIC", + "properties": {} + }, + "DeleteTimecardResponse": { + "type": "object", + "description": "The response to a request to delete a `Timecard`. The response might contain a set of \n`Error` objects if the request resulted in errors.", + "x-release-status": "PUBLIC", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": {} + }, "DeleteWebhookSubscriptionRequest": { "type": "object", "description": "Deletes a [Subscription](entity:WebhookSubscription).", @@ -22419,13 +22798,13 @@ "GetShiftRequest": { "type": "object", "description": "A request to get a `Shift` by ID.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": {} }, "GetShiftResponse": { "type": "object", "description": "A response to a request to get a `Shift`. The response contains\nthe requested `Shift` object and might contain a set of `Error` objects if\nthe request resulted in errors.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "shift": { "$ref": "#/components/schemas/Shift", @@ -35851,6 +36230,82 @@ } } }, + "PublishScheduledShiftRequest": { + "type": "object", + "description": "Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) request.", + "x-release-status": "BETA", + "required": [ + "idempotency_key" + ], + "properties": { + "idempotency_key": { + "type": "string", + "description": "A unique identifier for the `PublishScheduledShift` request, used to ensure the\n[idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)\nof the operation.", + "minLength": 1, + "maxLength": 128 + }, + "version": { + "type": "integer", + "description": "The current version of the scheduled shift, used to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)\ncontrol. If the provided version doesn't match the server version, the request fails.\nIf omitted, Square executes a blind write, potentially overwriting data from another publish request." + }, + "scheduled_shift_notification_audience": { + "$ref": "#/components/schemas/ScheduledShiftNotificationAudience", + "description": "Indicates whether Square should send an email notification to team members and\nwhich team members should receive the notification. The default value is `AFFECTED`.\nSee [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values", + "nullable": true + } + }, + "example": { + "idempotency_key": "HIDSNG5KS478L", + "scheduled_shift_notification_audience": "ALL", + "version": 2 + } + }, + "PublishScheduledShiftResponse": { + "type": "object", + "description": "Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) response.\nEither `scheduled_shift` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The published scheduled shift." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "scheduled_shift": { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-01-25T13:11:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "published_shift_details": { + "end_at": "2019-01-25T13:11:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "updated_at": "2019-02-25T03:11:00-05:00", + "version": 2 + } + } + }, "QrCodeOptions": { "type": "object", "description": "Fields to describe the action that displays QR-Codes.", @@ -38614,6 +39069,48 @@ } } }, + "RetrieveScheduledShiftRequest": { + "type": "object", + "description": "Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) request.", + "x-release-status": "BETA", + "properties": {} + }, + "RetrieveScheduledShiftResponse": { + "type": "object", + "description": "Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) response.\nEither `scheduled_shift` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The requested scheduled shift." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "scheduled_shift": { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-03-25T13:18:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Don't forget to prep the vegetables", + "start_at": "2019-03-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "updated_at": "2019-02-25T03:11:15-05:00", + "version": 2 + } + } + }, "RetrieveSnippetRequest": { "type": "object", "description": "Represents a `RetrieveSnippet` request.", @@ -38812,6 +39309,68 @@ } } }, + "RetrieveTimecardRequest": { + "type": "object", + "description": "A request to get a `Timecard` by ID.", + "x-release-status": "PUBLIC", + "properties": {} + }, + "RetrieveTimecardResponse": { + "type": "object", + "description": "A response to a request to get a `Timecard`. The response contains\nthe requested `Timecard` object and might contain a set of `Error` objects if\nthe request resulted in errors.", + "x-release-status": "PUBLIC", + "properties": { + "timecard": { + "$ref": "#/components/schemas/Timecard", + "description": "The requested `Timecard`." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "timecard": { + "breaks": [ + { + "break_type_id": "92EPDRQKJ5088", + "end_at": "2019-02-23T20:00:00-05:00", + "expected_duration": "PT1H", + "id": "M9BBKEPQAQD2T", + "is_paid": true, + "name": "Lunch Break", + "start_at": "2019-02-23T19:00:00-05:00" + } + ], + "created_at": "2019-02-27T00:12:12Z", + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-02-23T21:00:00-05:00", + "id": "T35HMQSN89SV4", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-02-23T18:00:00-05:00", + "status": "CLOSED", + "team_member_id": "D71KRMQof6cXGUW0aAv7", + "timezone": "America/New_York", + "updated_at": "2019-02-27T00:12:12Z", + "version": 1, + "wage": { + "hourly_rate": { + "amount": 1457, + "currency": "USD" + }, + "job_id": "N4YKVLzFj3oGtNocqoYHYpW3", + "tip_eligible": true, + "title": "Cashier" + } + } + } + }, "RetrieveTokenStatusRequest": { "type": "object", "description": "Request object for [RetrieveTokenStatus] endpoint.", @@ -39231,6 +39790,314 @@ } } }, + "ScheduledShift": { + "type": "object", + "description": "Represents a specific time slot in a work schedule. This object is used to manage the\nlifecycle of a scheduled shift from the draft to published state. A scheduled shift contains\nthe latest draft shift details and current published shift details.", + "x-release-status": "BETA", + "properties": { + "id": { + "type": "string", + "description": "**Read only** The Square-issued ID of the scheduled shift.", + "maxLength": 255 + }, + "draft_shift_details": { + "$ref": "#/components/schemas/ScheduledShiftDetails", + "description": "The latest draft shift details for the scheduled shift. Draft shift details are used to\nstage and manage shifts before publishing. This field is always present.", + "nullable": true + }, + "published_shift_details": { + "$ref": "#/components/schemas/ScheduledShiftDetails", + "description": "The current published (public) shift details for the scheduled shift. This field is\npresent only if the shift was published.", + "readOnly": true + }, + "version": { + "type": "integer", + "description": "**Read only** The current version of the scheduled shift, which is incremented with each update.\nThis field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)\ncontrol to ensure that requests don't overwrite data from another request." + }, + "created_at": { + "type": "string", + "description": "The timestamp of when the scheduled shift was created, in RFC 3339 format presented as UTC.", + "readOnly": true + }, + "updated_at": { + "type": "string", + "description": "The timestamp of when the scheduled shift was last updated, in RFC 3339 format presented as UTC.", + "readOnly": true + } + } + }, + "ScheduledShiftDetails": { + "type": "object", + "description": "Represents shift details for draft and published versions of a [scheduled shift](entity:ScheduledShift),\nsuch as job ID, team member assignment, and start and end times.", + "x-release-status": "BETA", + "properties": { + "team_member_id": { + "type": "string", + "description": "The ID of the [team member](entity:TeamMember) scheduled for the shift.", + "maxLength": 255, + "nullable": true + }, + "location_id": { + "type": "string", + "description": "The ID of the [location](entity:Location) the shift is scheduled for.", + "maxLength": 255, + "nullable": true + }, + "job_id": { + "type": "string", + "description": "The ID of the [job](entity:Job) the shift is scheduled for.", + "nullable": true + }, + "start_at": { + "type": "string", + "description": "The start time of the shift, in RFC 3339 format in the time zone \u0026plus;\noffset of the shift location specified in `location_id`. Precision up to the minute\nis respected; seconds are truncated.", + "nullable": true + }, + "end_at": { + "type": "string", + "description": "The end time for the shift, in RFC 3339 format in the time zone \u0026plus;\noffset of the shift location specified in `location_id`. Precision up to the minute\nis respected; seconds are truncated.", + "nullable": true + }, + "notes": { + "type": "string", + "description": "Optional notes for the shift.", + "maxLength": 1000, + "nullable": true + }, + "is_deleted": { + "type": "boolean", + "description": "Indicates whether the draft shift version is deleted. If set to `true` when the shift\nis published, the entire scheduled shift (including the published shift) is deleted and\ncannot be accessed using any endpoint.", + "nullable": true + }, + "timezone": { + "type": "string", + "description": "The time zone of the shift location, calculated based on the `location_id`. This field\nis provided for convenience.", + "readOnly": true + } + } + }, + "ScheduledShiftFilter": { + "type": "object", + "description": "Defines filter criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)\nrequest. Multiple filters in a query are combined as an `AND` operation.", + "x-release-status": "BETA", + "properties": { + "location_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Return shifts for the specified locations. When omitted, shifts for all\nlocations are returned. If needed, call [ListLocations](api-endpoint:Locations-ListLocations)\nto get location IDs.", + "nullable": true + }, + "start": { + "$ref": "#/components/schemas/TimeRange", + "description": "Return shifts whose `start_at` time is within the specified\ntime range (inclusive).", + "nullable": true + }, + "end": { + "$ref": "#/components/schemas/TimeRange", + "description": "Return shifts whose `end_at` time is within the specified\ntime range (inclusive).", + "nullable": true + }, + "workday": { + "$ref": "#/components/schemas/ScheduledShiftWorkday", + "description": "Return shifts based on a workday date range.", + "nullable": true + }, + "team_member_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Return shifts assigned to specified team members. If needed, call\n[SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get team member IDs.\n\nTo return only the shifts assigned to the specified team members, include the\n`assignment_status` filter in the query. Otherwise, all unassigned shifts are\nreturned along with shifts assigned to the specified team members.", + "nullable": true + }, + "assignment_status": { + "$ref": "#/components/schemas/ScheduledShiftFilterAssignmentStatus", + "description": "Return shifts based on whether a team member is assigned. A shift is\nassigned if the `team_member_id` field is populated in the `draft_shift_details`\nor `published_shift details` field of the shift.\n\nTo return only draft or published shifts, include the `scheduled_shift_statuses`\nfilter in the query.\nSee [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) for possible values", + "nullable": true + }, + "scheduled_shift_statuses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScheduledShiftFilterScheduledShiftStatus" + }, + "description": "Return shifts based on the draft or published status of the shift.\nA shift is published if the `published_shift_details` field is present.\n\nNote that shifts with `draft_shift_details.is_deleted` set to `true` are ignored\nwith the `DRAFT` filter.\nSee [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) for possible values", + "nullable": true + } + } + }, + "ScheduledShiftFilterAssignmentStatus": { + "type": "string", + "enum": [ + "ASSIGNED", + "UNASSIGNED" + ], + "x-enum-elements": [ + { + "name": "ASSIGNED", + "description": "The shift is assigned to a team member." + }, + { + "name": "UNASSIGNED", + "description": "The shift isn't assigned to a team member." + } + ], + "description": "Defines valid values for the `assignment_status` filter in a\n[SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.\nAssignment status is based on the `draft_shift_details.team_member_id` and\n`published_shift_details.team_member_id` fields of the scheduled shift.", + "x-release-status": "BETA" + }, + "ScheduledShiftFilterScheduledShiftStatus": { + "type": "string", + "enum": [ + "DRAFT", + "PUBLISHED" + ], + "x-enum-elements": [ + { + "name": "DRAFT", + "description": "The scheduled shift has never been published or its draft details were\nupdated after it was published. This means that the shift has no `published_shift_details`\nfield or that `draft_shift_details` has different settings than `published_shift_details`." + }, + { + "name": "PUBLISHED", + "description": "The scheduled shift was published. This means that the shift has a\n`published_shift_details` field." + } + ], + "description": "Defines valid values for the `scheduled_shift_statuses` filter in a\n[SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.", + "x-release-status": "BETA" + }, + "ScheduledShiftNotificationAudience": { + "type": "string", + "enum": [ + "ALL", + "AFFECTED", + "NONE" + ], + "x-enum-elements": [ + { + "name": "ALL", + "description": "Notify all active team members. Note that republishing an unchanged\nshift with this setting resends the notification." + }, + { + "name": "AFFECTED", + "description": "Notify the team member assigned to the shift. If the shift assignment\nchanges, notify both the newly assigned and previously assigned team members." + }, + { + "name": "NONE", + "description": "Do not send a notification." + } + ], + "description": "Indicates whether Square sends an email notification to team members\nwhen a scheduled shift is published and which team members receive the notification.", + "x-release-status": "BETA" + }, + "ScheduledShiftQuery": { + "type": "object", + "description": "Represents filter and sort criteria for the `query` field in a\n[SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.", + "x-release-status": "BETA", + "properties": { + "filter": { + "$ref": "#/components/schemas/ScheduledShiftFilter", + "description": "Filtering options for the query.", + "nullable": true + }, + "sort": { + "$ref": "#/components/schemas/ScheduledShiftSort", + "description": "Sorting options for the query.", + "nullable": true + } + } + }, + "ScheduledShiftSort": { + "type": "object", + "description": "Defines sort criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts)\nrequest.", + "x-release-status": "BETA", + "properties": { + "field": { + "$ref": "#/components/schemas/ScheduledShiftSortField", + "description": "The field to sort on. The default value is `START_AT`.\nSee [ScheduledShiftSortField](#type-scheduledshiftsortfield) for possible values", + "nullable": true + }, + "order": { + "$ref": "#/components/schemas/SortOrder", + "description": "The order in which results are returned. The default value is `ASC`.\nSee [SortOrder](#type-sortorder) for possible values", + "nullable": true + } + } + }, + "ScheduledShiftSortField": { + "type": "string", + "enum": [ + "START_AT", + "END_AT", + "CREATED_AT", + "UPDATED_AT" + ], + "x-enum-elements": [ + { + "name": "START_AT", + "description": "Sort by the start time of the shift." + }, + { + "name": "END_AT", + "description": "Sort by the end time of the shift." + }, + { + "name": "CREATED_AT", + "description": "Sort by the creation date of the shift." + }, + { + "name": "UPDATED_AT", + "description": "Sort by the last updated date of the shift." + } + ], + "description": "Defines valid values for the `field` sort setting in a\n[SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request.", + "x-release-status": "BETA" + }, + "ScheduledShiftWorkday": { + "type": "object", + "description": "A `ScheduledShift` search query filter parameter that sets a range of days that\na `Shift` must start or end in before passing the filter condition.", + "x-release-status": "BETA", + "properties": { + "date_range": { + "$ref": "#/components/schemas/DateRange", + "description": "Dates for fetching the scheduled shifts.", + "nullable": true + }, + "match_scheduled_shifts_by": { + "$ref": "#/components/schemas/ScheduledShiftWorkdayMatcher", + "description": "The strategy on which the dates are applied.\nSee [ScheduledShiftWorkdayMatcher](#type-scheduledshiftworkdaymatcher) for possible values", + "nullable": true + }, + "default_timezone": { + "type": "string", + "description": "Location-specific timezones convert workdays to datetime filters.\nEvery location included in the query must have a timezone or this field\nmust be provided as a fallback. Format: the IANA timezone database\nidentifier for the relevant timezone.", + "nullable": true + } + } + }, + "ScheduledShiftWorkdayMatcher": { + "type": "string", + "enum": [ + "START_AT", + "END_AT", + "INTERSECTION" + ], + "x-enum-elements": [ + { + "name": "START_AT", + "description": "All shifts that start on or after the specified workday" + }, + { + "name": "END_AT", + "description": "All shifts that end on or before the specified workday" + }, + { + "name": "INTERSECTION", + "description": "All shifts that start between the start and end workdays (inclusive)" + } + ], + "description": "Defines the logic used to apply a workday filter.", + "x-release-status": "BETA" + }, "SearchAvailabilityFilter": { "type": "object", "description": "A query filter to search for buyer-accessible availabilities by.", @@ -41118,10 +41985,94 @@ } } }, + "SearchScheduledShiftsRequest": { + "type": "object", + "description": "Represents a [SearchScheduledShift](api-endpoint:Labor-SearchScheduledShift) request.", + "x-release-status": "BETA", + "properties": { + "query": { + "$ref": "#/components/schemas/ScheduledShiftQuery", + "description": "Query conditions used to filter and sort the results." + }, + "limit": { + "type": "integer", + "description": "The maximum number of results to return in a single response page. The default value is 50.", + "minimum": 1, + "maximum": 50 + }, + "cursor": { + "type": "string", + "description": "The pagination cursor returned by the previous call to this endpoint. Provide\nthis cursor to retrieve the next page of results for your original request. For more\ninformation, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination)." + } + }, + "example": { + "cursor": "xoxp-1234-5678-90123", + "limit": 2, + "query": { + "filter": { + "assignment_status": "ASSIGNED", + "scheduled_shift_status": [ + "PUBLISHED", + "DRAFT" + ] + }, + "sort": { + "field": "CREATED_AT", + "order": "ASC" + } + } + } + }, + "SearchScheduledShiftsResponse": { + "type": "object", + "description": "Represents a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) response.\nEither `scheduled_shifts` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "scheduled_shifts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScheduledShift" + }, + "description": "A paginated list of scheduled shifts that match the query conditions." + }, + "cursor": { + "type": "string", + "description": "The pagination cursor used to retrieve the next page of results. This field is present\nonly if additional results are available." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "cursor": "xoxp-123-2123-123232", + "scheduled_shifts": [ + { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-01-25T13:11:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-01-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "updated_at": "2019-02-25T03:11:00-05:00", + "version": 1 + } + ] + } + }, "SearchShiftsRequest": { "type": "object", "description": "A request for a filtered and sorted set of `Shift` objects.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "query": { "$ref": "#/components/schemas/ShiftQuery", @@ -41157,7 +42108,7 @@ "SearchShiftsResponse": { "type": "object", "description": "The response to a request for `Shift` objects. The response contains\nthe requested `Shift` objects and might contain a set of `Error` objects if\nthe request resulted in errors.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "shifts": { "type": "array", @@ -42061,6 +43012,152 @@ ] } }, + "SearchTimecardsRequest": { + "type": "object", + "description": "A request for a filtered and sorted set of `Timecard` objects.", + "x-release-status": "PUBLIC", + "properties": { + "query": { + "$ref": "#/components/schemas/TimecardQuery", + "description": "Query filters." + }, + "limit": { + "type": "integer", + "description": "The number of resources in a page (200 by default).", + "minimum": 1, + "maximum": 200 + }, + "cursor": { + "type": "string", + "description": "An opaque cursor for fetching the next page." + } + }, + "example": { + "limit": 100, + "query": { + "filter": { + "workday": { + "date_range": { + "end_date": "2019-02-03", + "start_date": "2019-01-20" + }, + "default_timezone": "America/Los_Angeles", + "match_timecards_by": "START_AT" + } + } + } + } + }, + "SearchTimecardsResponse": { + "type": "object", + "description": "The response to a request for `Timecard` objects. The response contains\nthe requested `Timecard` objects and might contain a set of `Error` objects if\nthe request resulted in errors.", + "x-release-status": "PUBLIC", + "properties": { + "timecards": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Timecard" + }, + "description": "Timecards." + }, + "cursor": { + "type": "string", + "description": "An opaque cursor for fetching the next page." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "timecards": [ + { + "breaks": [ + { + "break_type_id": "REGS1EQR1TPZ5", + "end_at": "2019-01-21T06:11:00-05:00", + "expected_duration": "PT10M", + "id": "SJW7X6AKEJQ65", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-21T06:11:00-05:00" + } + ], + "created_at": "2019-01-24T01:12:03Z", + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-01-21T13:11:00-05:00", + "id": "X714F3HA6D1PT", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-21T03:11:00-05:00", + "status": "CLOSED", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York", + "updated_at": "2019-02-07T22:21:08Z", + "version": 6, + "wage": { + "hourly_rate": { + "amount": 1100, + "currency": "USD" + }, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "tip_eligible": true, + "title": "Barista" + } + }, + { + "breaks": [ + { + "break_type_id": "WQX00VR99F53J", + "end_at": "2019-01-22T14:40:00-05:00", + "expected_duration": "PT10M", + "id": "BKS6VR7WR748A", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-22T14:30:00-05:00" + }, + { + "break_type_id": "P6Q468ZFRN1AC", + "end_at": "2019-01-22T12:44:00-05:00", + "expected_duration": "PT15M", + "id": "BQFEZSHFZSC51", + "is_paid": false, + "name": "Coffee Break", + "start_at": "2019-01-22T12:30:00-05:00" + } + ], + "created_at": "2019-01-23T23:32:45Z", + "declared_cash_tip_money": { + "amount": 0, + "currency": "USD" + }, + "end_at": "2019-01-22T13:02:00-05:00", + "id": "GDHYBZYWK0P2V", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-22T12:02:00-05:00", + "status": "CLOSED", + "team_member_id": "33fJchumvVdJwxV0H6L9", + "timezone": "America/New_York", + "updated_at": "2019-01-24T00:56:25Z", + "version": 16, + "wage": { + "hourly_rate": { + "amount": 1600, + "currency": "USD" + }, + "job_id": "gcbz15vKGnMKmaWJJ152kjim", + "tip_eligible": true, + "title": "Cook" + } + } + ] + } + }, "SearchVendorsRequest": { "type": "object", "description": "Represents an input into a call to [SearchVendors](api-endpoint:Vendors-SearchVendors).", @@ -42291,8 +43388,8 @@ }, "Shift": { "type": "object", - "description": "A record of the hourly rate, start, and end times for a single work shift\nfor an employee. This might include a record of the start and end times for breaks\ntaken during the shift.", - "x-release-status": "PUBLIC", + "description": "A record of the hourly rate, start, and end times for a single work shift\nfor an employee. This might include a record of the start and end times for breaks\ntaken during the shift.\n\nDeprecated at Square API version 2025-05-21. Replaced by [Timecard](entity:Timecard).\nSee the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "required": [ "location_id", "start_at" @@ -42306,7 +43403,6 @@ "employee_id": { "type": "string", "description": "The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead.", - "x-release-status": "DEPRECATED", "nullable": true }, "location_id": { @@ -42375,8 +43471,8 @@ }, "ShiftFilter": { "type": "object", - "description": "Defines a filter used in a search for `Shift` records. `AND` logic is\nused by Square's servers to apply each filter property specified.", - "x-release-status": "PUBLIC", + "description": "Defines a filter used in a search for `Shift` records. `AND` logic is\nused by Square's servers to apply each filter property specified.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "properties": { "location_ids": { "type": "array", @@ -42392,7 +43488,6 @@ "type": "string" }, "description": "Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead.", - "x-release-status": "DEPRECATED", "nullable": true }, "status": { @@ -42441,13 +43536,13 @@ "description": "Shifts that have been started and ended." } ], - "description": "Specifies the `status` of `Shift` records to be returned.", - "x-release-status": "PUBLIC" + "description": "Specifies the `status` of `Shift` records to be returned.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED" }, "ShiftQuery": { "type": "object", - "description": "The parameters of a `Shift` search query, which includes filter and sort options.", - "x-release-status": "PUBLIC", + "description": "The parameters of a `Shift` search query, which includes filter and sort options.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "properties": { "filter": { "$ref": "#/components/schemas/ShiftFilter", @@ -42463,8 +43558,8 @@ }, "ShiftSort": { "type": "object", - "description": "Sets the sort order of search results.", - "x-release-status": "PUBLIC", + "description": "Sets the sort order of search results.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "properties": { "field": { "$ref": "#/components/schemas/ShiftSortField", @@ -42504,8 +43599,8 @@ "description": "The most recent date/time that a `Shift` is updated" } ], - "description": "Enumerates the `Shift` fields to sort on.", - "x-release-status": "PUBLIC" + "description": "Enumerates the `Shift` fields to sort on.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED" }, "ShiftStatus": { "type": "string", @@ -42523,13 +43618,13 @@ "description": "Employee started and ended a work shift." } ], - "description": "Enumerates the possible status of a `Shift`.", - "x-release-status": "PUBLIC" + "description": "Enumerates the possible status of a `Shift`.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED" }, "ShiftWage": { "type": "object", - "description": "The hourly wage rate used to compensate an employee for this shift.", - "x-release-status": "PUBLIC", + "description": "The hourly wage rate used to compensate an employee for this shift.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "properties": { "title": { "type": "string", @@ -42543,7 +43638,7 @@ }, "job_id": { "type": "string", - "description": "The id of the job performed during this shift. Square\nlabor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job.", + "description": "The id of the job performed during this shift. Square\nlabor-reporting UIs might group shifts together by id.", "readOnly": true }, "tip_eligible": { @@ -42555,8 +43650,8 @@ }, "ShiftWorkday": { "type": "object", - "description": "A `Shift` search query filter parameter that sets a range of days that\na `Shift` must start or end in before passing the filter condition.", - "x-release-status": "PUBLIC", + "description": "A `Shift` search query filter parameter that sets a range of days that\na `Shift` must start or end in before passing the filter condition.\n\nDeprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes).", + "x-release-status": "DEPRECATED", "properties": { "date_range": { "$ref": "#/components/schemas/DateRange", @@ -42597,7 +43692,7 @@ } ], "description": "Defines the logic used to apply a workday filter.", - "x-release-status": "PUBLIC" + "x-release-status": "DEPRECATED" }, "ShippingFee": { "type": "object", @@ -43833,7 +44928,7 @@ }, "TeamMemberWage": { "type": "object", - "description": "The hourly wage rate that a team member earns on a `Shift` for doing the job\nspecified by the `title` property of this object.", + "description": "Job and wage information for a [team member](entity:TeamMember).\nThis convenience object provides details needed to specify the `wage`\nfield for a [timecard](entity:Timecard).", "x-release-status": "PUBLIC", "properties": { "id": { @@ -43857,7 +44952,7 @@ }, "job_id": { "type": "string", - "description": "An identifier for the job that this wage relates to. This cannot be\nused to retrieve the job.", + "description": "An identifier for the [job](entity:Job) that this wage relates to.", "nullable": true }, "tip_eligible": { @@ -44855,6 +45950,302 @@ } } }, + "Timecard": { + "type": "object", + "description": "A record of the hourly rate, start time, and end time of a single timecard (shift)\nfor a team member. This might include a record of the start and end times of breaks\ntaken during the shift.", + "x-release-status": "PUBLIC", + "required": [ + "location_id", + "start_at", + "team_member_id" + ], + "properties": { + "id": { + "type": "string", + "description": "**Read only** The Square-issued UUID for this object.", + "maxLength": 255 + }, + "location_id": { + "type": "string", + "description": "The ID of the [location](entity:Location) for this timecard. The location should be based on\nwhere the team member clocked in.", + "minLength": 1 + }, + "timezone": { + "type": "string", + "description": "**Read only** The time zone calculated from the location based on the `location_id`,\nprovided as a convenience value. Format: the IANA time zone database identifier for the\nlocation time zone.", + "nullable": true + }, + "start_at": { + "type": "string", + "description": "The start time of the timecard, in RFC 3339 format and shifted to the location\ntimezone + offset. Precision up to the minute is respected; seconds are truncated.", + "minLength": 1 + }, + "end_at": { + "type": "string", + "description": "The end time of the timecard, in RFC 3339 format and shifted to the location\ntimezone + offset. Precision up to the minute is respected; seconds are truncated.", + "nullable": true + }, + "wage": { + "$ref": "#/components/schemas/TimecardWage", + "description": "Job and pay related information. If the wage is not set on create, it defaults to a wage\nof zero. If the title is not set on create, it defaults to the name of the role the team member\nis assigned to, if any.", + "nullable": true + }, + "breaks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Break" + }, + "description": "A list of all the paid or unpaid breaks that were taken during this timecard.", + "nullable": true + }, + "status": { + "$ref": "#/components/schemas/TimecardStatus", + "description": "Describes the working state of the timecard.\nSee [TimecardStatus](#type-timecardstatus) for possible values", + "nullable": true + }, + "version": { + "type": "integer", + "description": "**Read only** The current version of the timecard, which is incremented with each update.\nThis field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)\ncontrol to ensure that requests don't overwrite data from another request." + }, + "created_at": { + "type": "string", + "description": "The timestamp of when the timecard was created, in RFC 3339 format presented as UTC.", + "readOnly": true + }, + "updated_at": { + "type": "string", + "description": "The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC.", + "readOnly": true + }, + "team_member_id": { + "type": "string", + "description": "The ID of the [team member](entity:TeamMember) this timecard belongs to.", + "minLength": 1 + }, + "declared_cash_tip_money": { + "$ref": "#/components/schemas/Money", + "description": "The cash tips declared by the team member for this timecard.", + "nullable": true + } + } + }, + "TimecardFilter": { + "type": "object", + "description": "Defines a filter used in a search for `Timecard` records. `AND` logic is\nused by Square's servers to apply each filter property specified.", + "x-release-status": "PUBLIC", + "properties": { + "location_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fetch timecards for the specified location.", + "nullable": true + }, + "status": { + "$ref": "#/components/schemas/TimecardFilterStatus", + "description": "Fetch a `Timecard` instance by `Timecard.status`.\nSee [TimecardFilterStatus](#type-timecardfilterstatus) for possible values", + "nullable": true + }, + "start": { + "$ref": "#/components/schemas/TimeRange", + "description": "Fetch `Timecard` instances that start in the time range - Inclusive.", + "nullable": true + }, + "end": { + "$ref": "#/components/schemas/TimeRange", + "description": "Fetch the `Timecard` instances that end in the time range - Inclusive.", + "nullable": true + }, + "workday": { + "$ref": "#/components/schemas/TimecardWorkday", + "description": "Fetch the `Timecard` instances based on the workday date range.", + "nullable": true + }, + "team_member_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fetch timecards for the specified team members.", + "nullable": true + } + } + }, + "TimecardFilterStatus": { + "type": "string", + "enum": [ + "OPEN", + "CLOSED" + ], + "x-enum-elements": [ + { + "name": "OPEN", + "description": "Timecards that have been started and not ended." + }, + { + "name": "CLOSED", + "description": "Timecards that have been started and ended." + } + ], + "description": "Specifies the `status` of `Timecard` records to be returned.", + "x-release-status": "PUBLIC" + }, + "TimecardQuery": { + "type": "object", + "description": "The parameters of a `Timecard` search query, which includes filter and sort options.", + "x-release-status": "PUBLIC", + "properties": { + "filter": { + "$ref": "#/components/schemas/TimecardFilter", + "description": "Query filter options.", + "nullable": true + }, + "sort": { + "$ref": "#/components/schemas/TimecardSort", + "description": "Sort order details.", + "nullable": true + } + } + }, + "TimecardSort": { + "type": "object", + "description": "Sets the sort order of search results.", + "x-release-status": "PUBLIC", + "properties": { + "field": { + "$ref": "#/components/schemas/TimecardSortField", + "description": "The field to sort on.\nSee [TimecardSortField](#type-timecardsortfield) for possible values", + "nullable": true + }, + "order": { + "$ref": "#/components/schemas/SortOrder", + "description": "The order in which results are returned. Defaults to DESC.\nSee [SortOrder](#type-sortorder) for possible values", + "nullable": true + } + } + }, + "TimecardSortField": { + "type": "string", + "enum": [ + "START_AT", + "END_AT", + "CREATED_AT", + "UPDATED_AT" + ], + "x-enum-elements": [ + { + "name": "START_AT", + "description": "The start date/time of a `Timecard`" + }, + { + "name": "END_AT", + "description": "The end date/time of a `Timecard`" + }, + { + "name": "CREATED_AT", + "description": "The date/time that a `Timecard` is created" + }, + { + "name": "UPDATED_AT", + "description": "The most recent date/time that a `Timecard` is updated" + } + ], + "description": "Enumerates the `Timecard` fields to sort on.", + "x-release-status": "PUBLIC" + }, + "TimecardStatus": { + "type": "string", + "enum": [ + "OPEN", + "CLOSED" + ], + "x-enum-elements": [ + { + "name": "OPEN", + "description": "The timecard has a `start_at` time but no `end_at` time, indicating an ongoing shift." + }, + { + "name": "CLOSED", + "description": "The timecard has both `start_at` and `end_at` times, indicating a completed shift." + } + ], + "description": "**Read only** Enumerates the possible status of a [timecard](entity:Timecard).", + "x-release-status": "PUBLIC" + }, + "TimecardWage": { + "type": "object", + "description": "The hourly wage rate used to compensate a team member for a [timecard](entity:Timecard).", + "x-release-status": "PUBLIC", + "properties": { + "title": { + "type": "string", + "description": "The name of the job performed during this timecard.", + "nullable": true + }, + "hourly_rate": { + "$ref": "#/components/schemas/Money", + "description": "Can be a custom-set hourly wage or the calculated effective hourly\nwage based on the annual wage and hours worked per week.", + "nullable": true + }, + "job_id": { + "type": "string", + "description": "The ID of the [job](entity:Job) performed for this timecard. Square\nlabor-reporting UIs might group timecards together by ID.", + "readOnly": true + }, + "tip_eligible": { + "type": "boolean", + "description": "Whether team members are eligible for tips when working this job.", + "nullable": true + } + } + }, + "TimecardWorkday": { + "type": "object", + "description": "A `Timecard` search query filter parameter that sets a range of days that\na `Timecard` must start or end in before passing the filter condition.", + "x-release-status": "PUBLIC", + "properties": { + "date_range": { + "$ref": "#/components/schemas/DateRange", + "description": "Dates for fetching the timecards.", + "nullable": true + }, + "match_timecards_by": { + "$ref": "#/components/schemas/TimecardWorkdayMatcher", + "description": "The strategy on which the dates are applied.\nSee [TimecardWorkdayMatcher](#type-timecardworkdaymatcher) for possible values", + "nullable": true + }, + "default_timezone": { + "type": "string", + "description": "Location-specific timezones convert workdays to datetime filters.\nEvery location included in the query must have a timezone or this field\nmust be provided as a fallback. Format: the IANA timezone database\nidentifier for the relevant timezone.", + "nullable": true + } + } + }, + "TimecardWorkdayMatcher": { + "type": "string", + "enum": [ + "START_AT", + "END_AT", + "INTERSECTION" + ], + "x-enum-elements": [ + { + "name": "START_AT", + "description": "All timecards that start on or after the specified workday" + }, + { + "name": "END_AT", + "description": "All timecards that end on or before the specified workday" + }, + { + "name": "INTERSECTION", + "description": "All timecards that start between the start and end workdays (inclusive)" + } + ], + "description": "Defines the logic used to apply a workday filter.", + "x-release-status": "PUBLIC" + }, "TipSettings": { "type": "object", "x-release-status": "PUBLIC", @@ -46661,10 +48052,73 @@ } } }, + "UpdateScheduledShiftRequest": { + "type": "object", + "x-release-status": "BETA", + "required": [ + "scheduled_shift" + ], + "properties": { + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The scheduled shift with any updates in the `draft_shift_details` field.\nIf needed, call [ListLocations](api-endpoint:Locations-ListLocations) to get location IDs,\n[ListJobs](api-endpoint:Team-ListJobs) to get job IDs, and [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers)\nto get team member IDs and current job assignments. Updates made to `published_shift_details`\nare ignored.\n\nIf provided, the `start_at` and `end_at` timestamps must be in the time zone + offset of the\nshift location specified in `location_id`. Example for Pacific Standard Time: 2024-10-31T12:30:00-08:00\n\nTo enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)\ncontrol for the request, provide the current version of the shift in the `version` field.\nIf the provided version doesn't match the server version, the request fails. If `version` is\nomitted, Square executes a blind write, potentially overwriting data from another publish request." + } + }, + "example": { + "scheduled_shift": { + "draft_shift_details": { + "end_at": "2019-03-25T13:18:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-03-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI" + }, + "version": 1 + } + } + }, + "UpdateScheduledShiftResponse": { + "type": "object", + "description": "Represents an [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response.\nEither `scheduled_shift` or `errors` is present in the response.", + "x-release-status": "BETA", + "properties": { + "scheduled_shift": { + "$ref": "#/components/schemas/ScheduledShift", + "description": "The updated scheduled shift. To make the changes public, call \n[PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) or\n[BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts)." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "scheduled_shift": { + "created_at": "2019-02-25T03:11:00-05:00", + "draft_shift_details": { + "end_at": "2019-03-25T13:18:00-05:00", + "is_deleted": false, + "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", + "location_id": "PAA1RJZZKXBFG", + "notes": "Dont forget to prep the vegetables", + "start_at": "2019-03-25T03:11:00-05:00", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York" + }, + "id": "K0YH4CV5462JB", + "updated_at": "2019-02-25T03:11:15-05:00", + "version": 2 + } + } + }, "UpdateShiftRequest": { "type": "object", "description": "A request to update a `Shift` object.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "required": [ "shift" ], @@ -46710,7 +48164,7 @@ "UpdateShiftResponse": { "type": "object", "description": "The response to a request to update a `Shift`. The response contains\nthe updated `Shift` object and might contain a set of `Error` objects if\nthe request resulted in errors.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", "properties": { "shift": { "$ref": "#/components/schemas/Shift", @@ -46944,6 +48398,110 @@ } } }, + "UpdateTimecardRequest": { + "type": "object", + "description": "A request to update a `Timecard` object.", + "x-release-status": "PUBLIC", + "required": [ + "timecard" + ], + "properties": { + "timecard": { + "$ref": "#/components/schemas/Timecard", + "description": "The updated `Timecard` object." + } + }, + "example": { + "idempotency_key": "HIDSNG5KS478L", + "timecard": { + "breaks": [ + { + "break_type_id": "REGS1EQR1TPZ5", + "end_at": "2019-01-25T06:16:00-05:00", + "expected_duration": "PT5M", + "id": "X7GAQYVVRRG6P", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-25T06:11:00-05:00" + } + ], + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-01-25T13:11:00-05:00", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-25T03:11:00-05:00", + "status": "CLOSED", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "version": 1, + "wage": { + "hourly_rate": { + "amount": 1500, + "currency": "USD" + }, + "tip_eligible": true, + "title": "Bartender" + } + } + } + }, + "UpdateTimecardResponse": { + "type": "object", + "description": "The response to a request to update a `Timecard`. The response contains\nthe updated `Timecard` object and might contain a set of `Error` objects if\nthe request resulted in errors.", + "x-release-status": "PUBLIC", + "properties": { + "timecard": { + "$ref": "#/components/schemas/Timecard", + "description": "The updated `Timecard`." + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "Any errors that occurred during the request." + } + }, + "example": { + "timecard": { + "breaks": [ + { + "break_type_id": "REGS1EQR1TPZ5", + "end_at": "2019-01-25T06:16:00-05:00", + "expected_duration": "PT5M", + "id": "X7GAQYVVRRG6P", + "is_paid": true, + "name": "Tea Break", + "start_at": "2019-01-25T06:11:00-05:00" + } + ], + "created_at": "2019-02-28T00:39:02Z", + "declared_cash_tip_money": { + "amount": 500, + "currency": "USD" + }, + "end_at": "2019-01-25T13:11:00-05:00", + "id": "K0YH4CV5462JB", + "location_id": "PAA1RJZZKXBFG", + "start_at": "2019-01-25T03:11:00-05:00", + "status": "CLOSED", + "team_member_id": "ormj0jJJZ5OZIzxrZYJI", + "timezone": "America/New_York", + "updated_at": "2019-02-28T00:42:41Z", + "version": 2, + "wage": { + "hourly_rate": { + "amount": 1500, + "currency": "USD" + }, + "job_id": "dZtrPh5GSDGugyXGByesVp51", + "tip_eligible": true, + "title": "Bartender" + } + } + } + }, "UpdateVendorRequest": { "type": "object", "description": "Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor).", @@ -48806,8 +50364,8 @@ }, "Labor": { "name": "Labor", - "summary": "Manage shifts, breaks, and wages for employees in Square Point of Sale.", - "description": "\nThe Labor API allows you to see when employees clocked in and out, how much they worked during different\nperiods, and how many breaks they took. You can also call the API to register a past break, adjust a shift,\nor update a wage.\n\nThis API is used in conjunction with the Team API.\n\nFor more information, see the following guides:\n - [Labor](https://developer.squareup.com/docs/labor-api/what-it-does)\n - [Square Webhooks Overview](https://developer.squareup.com/docs/webhooks-overview)" + "summary": "Manage timecards and schedules for team members.", + "description": "\nThe Labor API allows applications to manage time tracking and shift scheduling workflows.\n\n**Time tracking** - Create and manage timecards (shifts) to track work hours, breaks, and declared cash tips for payroll processing and labor cost calculations. The Labor API provides search capabilities to retrieve timecards by location, time period, status, and team member assignments. It can also be used to access job and wage information for team members, define break types, and configure workweek start times for overtime calculations and reporting periods.\n\n**Scheduling** - Create and manage scheduled shifts with draft and published states to coordinate team member work schedules. The Labor API supports both individual and bulk publishing of scheduled shifts and provides search capabilities to retrieve scheduled shifts by location, time period, status, and team member assignments.\n\nThe Labor API integrates closely with the Team API.\n\nFor more information, see the following guides:\n - [Labor](https://developer.squareup.com/docs/labor-api/what-it-does)\n - [Square Webhooks Overview](https://developer.squareup.com/docs/webhooks-overview)\n" }, "LocationCustomAttributes": { "name": "Location Custom Attributes", @@ -48841,8 +50399,8 @@ }, "OAuth": { "name": "OAuth", - "summary": "Allow your application to gain programmatic access to other seller accounts.", - "description": "\nThe Square OAuth API lets applications request and obtain permission from a Square account to make API\ncalls on behalf of that account. Applications can request individual permissions so that users do not need\nto grant full access to their Square accounts.\n\nFor more information, see the following guides:\n - [OAuth](https://developer.squareup.com/docs/oauth-api/overview)\n - [Square Webhooks Overview](https://developer.squareup.com/docs/webhooks-overview)" + "summary": "Allow your application to gain programmatic access to Square seller accounts.", + "description": "\nApplications use the OAuth API to obtain access tokens that allow them to call Square APIs on behalf of Square sellers. Applications can request scoped permissions to limit their access to only the resources they need. The OAuth flow for obtaining an OAuth access token has three stages:\n\n**Authorization** - Your application directs the seller to the Square authorization page using an authorization URL that specifies your requested permissions. The seller signs in to Square and reviews the permissions.\n\n**Callback** - After approving the permissions, Square redirects the seller back to your application's registered redirect URL with an authorization code appended as a query parameter.\n\n**Token request** - Your application calls the `ObtainToken` endpoint with the authorization code, your application ID, and other information. Square returns an access token and refresh token.\n\nFor more information, see the following guides:\n - [OAuth](https://developer.squareup.com/docs/oauth-api/overview)\n - [Square Webhooks Overview](https://developer.squareup.com/docs/webhooks-overview)" }, "OrderCustomAttributes": { "name": "Order Custom Attributes", @@ -48892,7 +50450,7 @@ "Team": { "name": "Team", "summary": "Manage a roster of team members and pull employee data into accounting and payroll systems.", - "description": "\nThe Team API allows applications to manage team members and job definitions for Square sellers. \nThis includes creating and managing team member profiles, wage settings, and job data. The Team API \nsupports synchronization of team member data with accounting and payroll systems, which is useful \nfor applications that handle payroll, scheduling, and other team member-related activities. \nNote that some operations, such as setting permissions and passcodes, still need to be done directly \nthrough the Square Dashboard.\n\nThe Team API integrates closely with the Labor API for timecard management.\n\nFor more information, see the following guide:\n - [Team](https://developer.squareup.com/docs/team/overview)\n - [Square Webhooks](https://developer.squareup.com/docs/webhooks-overview)\n" + "description": "\nThe Team API allows applications to manage team members and job definitions for Square sellers. \nThis includes creating and managing team member profiles, wage settings, and job data. The Team API \nsupports synchronization of team member data with accounting and payroll systems, which is useful \nfor applications that handle payroll, scheduling, and other team member-related activities. \nNote that some operations, such as setting permissions and passcodes, still need to be done directly \nthrough the Square Dashboard.\n\nThe Team API integrates closely with the Labor API.\n\nFor more information, see the following guide:\n - [Team](https://developer.squareup.com/docs/team/overview)\n - [Square Webhooks](https://developer.squareup.com/docs/webhooks-overview)\n" }, "Terminal": { "name": "Terminal", @@ -48995,7 +50553,7 @@ }, "Staff": { "name": "Staff", - "summary": "Manage team members and jobs, and track shift hours.", + "summary": "Manage team members and jobs, track hours worked, and manage team schedules.", "description": "", "apis": [ "#/components/x-apis/Labor", @@ -56510,6 +58068,329 @@ } } }, + "/v2/labor/scheduled-shifts": { + "post": { + "tags": [ + "Labor" + ], + "summary": "CreateScheduledShift", + "operationId": "CreateScheduledShift", + "description": "Creates a scheduled shift by providing draft shift details such as job ID,\nteam member assignment, and start and end times.\n\nThe following `draft_shift_details` fields are required:\n- `location_id`\n- `job_id`\n- `start_at`\n- `end_at`", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateScheduledShiftRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateScheduledShiftResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + } + ] + } + }, + "/v2/labor/scheduled-shifts/bulk-publish": { + "post": { + "tags": [ + "Labor" + ], + "summary": "BulkPublishScheduledShifts", + "operationId": "BulkPublishScheduledShifts", + "description": "Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish\nrequests and returns a map of responses. When a scheduled shift is published, Square keeps\nthe `draft_shift_details` field as is and copies it to the `published_shift_details` field.\n\nThe minimum `start_at` and maximum `end_at` timestamps of all shifts in a\n`BulkPublishScheduledShifts` request must fall within a two-week period.", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkPublishScheduledShiftsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkPublishScheduledShiftsResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + } + ] + } + }, + "/v2/labor/scheduled-shifts/search": { + "post": { + "tags": [ + "Labor" + ], + "summary": "SearchScheduledShifts", + "operationId": "SearchScheduledShifts", + "description": "Returns a paginated list of scheduled shifts, with optional filter and sort settings.\nBy default, results are sorted by `start_at` in ascending order.", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_READ" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchScheduledShiftsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchScheduledShiftsResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "EXPECTED_STRING" + }, + { + "error-code": "INVALID_VALUE" + }, + { + "error-code": "NOT_FOUND" + } + ] + } + }, + "/v2/labor/scheduled-shifts/{id}": { + "get": { + "tags": [ + "Labor" + ], + "summary": "RetrieveScheduledShift", + "operationId": "RetrieveScheduledShift", + "description": "Retrieves a scheduled shift by ID.", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_READ" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The ID of the scheduled shift to retrieve.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveScheduledShiftResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "NOT_FOUND" + } + ] + }, + "put": { + "tags": [ + "Labor" + ], + "summary": "UpdateScheduledShift", + "operationId": "UpdateScheduledShift", + "description": "Updates the draft shift details for a scheduled shift. This endpoint supports\nsparse updates, so only new, changed, or removed fields are required in the request.\nYou must publish the shift to make updates public.\n\nYou can make the following updates to `draft_shift_details`:\n- Change the `location_id`, `job_id`, `start_at`, and `end_at` fields.\n- Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields,\nset the value to null.\n- Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true\nand then publish the shift.", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The ID of the scheduled shift to update.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateScheduledShiftRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateScheduledShiftResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + }, + { + "error-code": "VERSION_MISMATCH" + } + ] + } + }, + "/v2/labor/scheduled-shifts/{id}/publish": { + "post": { + "tags": [ + "Labor" + ], + "summary": "PublishScheduledShift", + "operationId": "PublishScheduledShift", + "description": "Publishes a scheduled shift. When a scheduled shift is published, Square keeps the\n`draft_shift_details` field as is and copies it to the `published_shift_details` field.", + "x-release-status": "BETA", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The ID of the scheduled shift to publish.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublishScheduledShiftRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublishScheduledShiftResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + } + ] + } + }, "/v2/labor/shifts": { "post": { "tags": [ @@ -56518,7 +58399,14 @@ "summary": "CreateShift", "operationId": "CreateShift", "description": "Creates a new `Shift`.\n\nA `Shift` represents a complete workday for a single team member.\nYou must provide the following values in your request to this\nendpoint:\n\n- `location_id`\n- `team_member_id`\n- `start_at`\n\nAn attempt to create a new `Shift` can result in a `BAD_REQUEST` error when:\n- The `status` of the new `Shift` is `OPEN` and the team member has another\nshift with an `OPEN` status.\n- The `start_at` date is in the future.\n- The `start_at` or `end_at` date overlaps another shift for the same team member.\n- The `Break` instances are set in the request and a break `start_at`\nis before the `Shift.start_at`, a break `end_at` is after\nthe `Shift.end_at`, or both.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", + "deprecated": true, + "x-deprecation": { + "deprecationDate": "2025-05-21", + "retirementDate": "2026-05-21", + "replacedBy": "CreateTimecard", + "guideUrl": "https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes" + }, "security": [ { "oauth2": [ @@ -56560,7 +58448,14 @@ "summary": "SearchShifts", "operationId": "SearchShifts", "description": "Returns a paginated list of `Shift` records for a business.\nThe list to be returned can be filtered by:\n- Location IDs\n- Team member IDs\n- Shift status (`OPEN` or `CLOSED`)\n- Shift start\n- Shift end\n- Workday details\n\nThe list can be sorted by:\n- `START_AT`\n- `END_AT`\n- `CREATED_AT`\n- `UPDATED_AT`", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", + "deprecated": true, + "x-deprecation": { + "deprecationDate": "2025-05-21", + "retirementDate": "2026-05-21", + "replacedBy": "SearchTimecards", + "guideUrl": "https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes" + }, "security": [ { "oauth2": [ @@ -56602,7 +58497,14 @@ "summary": "DeleteShift", "operationId": "DeleteShift", "description": "Deletes a `Shift`.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", + "deprecated": true, + "x-deprecation": { + "deprecationDate": "2025-05-21", + "retirementDate": "2026-05-21", + "replacedBy": "DeleteTimecard", + "guideUrl": "https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes" + }, "security": [ { "oauth2": [ @@ -56641,7 +58543,14 @@ "summary": "GetShift", "operationId": "GetShift", "description": "Returns a single `Shift` specified by `id`.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", + "deprecated": true, + "x-deprecation": { + "deprecationDate": "2025-05-21", + "retirementDate": "2026-05-21", + "replacedBy": "RetrieveTimecard", + "guideUrl": "https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes" + }, "security": [ { "oauth2": [ @@ -56680,7 +58589,14 @@ "summary": "UpdateShift", "operationId": "UpdateShift", "description": "Updates an existing `Shift`.\n\nWhen adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have\nthe `end_at` property set to a valid RFC-3339 datetime string.\n\nWhen closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at`\nset on each `Break`.", - "x-release-status": "PUBLIC", + "x-release-status": "DEPRECATED", + "deprecated": true, + "x-deprecation": { + "deprecationDate": "2025-05-21", + "retirementDate": "2026-05-21", + "replacedBy": "UpdateTimecard", + "guideUrl": "https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes" + }, "security": [ { "oauth2": [ @@ -56825,6 +58741,253 @@ } } }, + "/v2/labor/timecards": { + "post": { + "tags": [ + "Labor" + ], + "summary": "CreateTimecard", + "operationId": "CreateTimecard", + "description": "Creates a new `Timecard`.\n\nA `Timecard` represents a complete workday for a single team member.\nYou must provide the following values in your request to this\nendpoint:\n\n- `location_id`\n- `team_member_id`\n- `start_at`\n\nAn attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when:\n- The `status` of the new `Timecard` is `OPEN` and the team member has another\ntimecard with an `OPEN` status.\n- The `start_at` date is in the future.\n- The `start_at` or `end_at` date overlaps another timecard for the same team member.\n- The `Break` instances are set in the request and a break `start_at`\nis before the `Timecard.start_at`, a break `end_at` is after\nthe `Timecard.end_at`, or both.", + "x-release-status": "PUBLIC", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTimecardRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTimecardResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + }, + { + "error-code": "NOT_FOUND" + } + ] + } + }, + "/v2/labor/timecards/search": { + "post": { + "tags": [ + "Labor" + ], + "summary": "SearchTimecards", + "operationId": "SearchTimecards", + "description": "Returns a paginated list of `Timecard` records for a business.\nThe list to be returned can be filtered by:\n- Location IDs\n- Team member IDs\n- Timecard status (`OPEN` or `CLOSED`)\n- Timecard start\n- Timecard end\n- Workday details\n\nThe list can be sorted by:\n- `START_AT`\n- `END_AT`\n- `CREATED_AT`\n- `UPDATED_AT`", + "x-release-status": "PUBLIC", + "security": [ + { + "oauth2": [ + "TIMECARDS_READ" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchTimecardsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchTimecardsResponse" + } + } + } + } + } + } + }, + "/v2/labor/timecards/{id}": { + "delete": { + "tags": [ + "Labor" + ], + "summary": "DeleteTimecard", + "operationId": "DeleteTimecard", + "description": "Deletes a `Timecard`.", + "x-release-status": "PUBLIC", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The UUID for the `Timecard` being deleted.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteTimecardResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "NOT_FOUND" + } + ] + }, + "get": { + "tags": [ + "Labor" + ], + "summary": "RetrieveTimecard", + "operationId": "RetrieveTimecard", + "description": "Returns a single `Timecard` specified by `id`.", + "x-release-status": "PUBLIC", + "security": [ + { + "oauth2": [ + "TIMECARDS_READ" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The UUID for the `Timecard` being retrieved.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveTimecardResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "NOT_FOUND" + } + ] + }, + "put": { + "tags": [ + "Labor" + ], + "summary": "UpdateTimecard", + "operationId": "UpdateTimecard", + "description": "Updates an existing `Timecard`.\n\nWhen adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have\nthe `end_at` property set to a valid RFC-3339 datetime string.\n\nWhen closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at`\nset on each `Break`.", + "x-release-status": "PUBLIC", + "security": [ + { + "oauth2": [ + "TIMECARDS_WRITE", + "TIMECARDS_READ" + ] + } + ], + "parameters": [ + { + "name": "id", + "description": "The ID of the object being updated.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ], + "requestBody": { + "required": true, + "description": "An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateTimecardRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateTimecardResponse" + } + } + } + } + }, + "x-endpoint-errors": [ + { + "error-code": "BAD_REQUEST" + }, + { + "error-code": "INVALID_VALUE" + }, + { + "error-code": "VERSION_MISMATCH" + } + ] + } + }, "/v2/labor/workweek-configs": { "get": { "tags": [ @@ -64777,7 +66940,7 @@ "name": "version", "optional": true, "env": "VERSION", - "type": "literal\u003c\"2025-04-16\"\u003e" + "type": "literal\u003c\"2025-05-21\"\u003e" } ] } \ No newline at end of file diff --git a/composer.json b/composer.json index e15fff03..6b2b6ccc 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "square/square", - "version": "42.1.0.20250416", + "version": "42.2.0.20250521", "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", "keywords": [ "square", diff --git a/src/Invoices/InvoicesClient.php b/src/Invoices/InvoicesClient.php index 9565dc8e..5e6ba7b0 100644 --- a/src/Invoices/InvoicesClient.php +++ b/src/Invoices/InvoicesClient.php @@ -30,7 +30,6 @@ use Square\Invoices\Requests\CreateInvoiceAttachmentRequest; use Square\Types\CreateInvoiceAttachmentResponse; use Square\Core\Multipart\MultipartFormData; -use Square\Core\Json\JsonEncoder; use Square\Core\Multipart\MultipartApiRequest; use Square\Invoices\Requests\DeleteInvoiceAttachmentRequest; use Square\Types\DeleteInvoiceAttachmentResponse; @@ -433,7 +432,7 @@ public function createInvoiceAttachment(CreateInvoiceAttachmentRequest $request, if ($request->getRequest() != null) { $body->add( name: 'request', - value: JsonEncoder::encode($request->getRequest()), + value: $request->getRequest()->toJson(), contentType: 'application/json; charset=utf-8', ); } diff --git a/src/Invoices/Requests/CreateInvoiceAttachmentRequest.php b/src/Invoices/Requests/CreateInvoiceAttachmentRequest.php index 2ef89200..3162415f 100644 --- a/src/Invoices/Requests/CreateInvoiceAttachmentRequest.php +++ b/src/Invoices/Requests/CreateInvoiceAttachmentRequest.php @@ -3,6 +3,7 @@ namespace Square\Invoices\Requests; use Square\Core\Json\JsonSerializableType; +use Square\Types\CreateInvoiceAttachmentRequestData; use Square\Core\Json\JsonProperty; use Square\Utils\File; @@ -14,10 +15,10 @@ class CreateInvoiceAttachmentRequest extends JsonSerializableType private string $invoiceId; /** - * @var mixed $request + * @var ?CreateInvoiceAttachmentRequestData $request */ #[JsonProperty('request')] - private mixed $request; + private ?CreateInvoiceAttachmentRequestData $request; /** * @var ?File $imageFile @@ -27,7 +28,7 @@ class CreateInvoiceAttachmentRequest extends JsonSerializableType /** * @param array{ * invoiceId: string, - * request?: mixed, + * request?: ?CreateInvoiceAttachmentRequestData, * imageFile?: ?File, * } $values */ @@ -57,17 +58,17 @@ public function setInvoiceId(string $value): self } /** - * @return mixed + * @return ?CreateInvoiceAttachmentRequestData */ - public function getRequest(): mixed + public function getRequest(): ?CreateInvoiceAttachmentRequestData { return $this->request; } /** - * @param mixed $value + * @param ?CreateInvoiceAttachmentRequestData $value */ - public function setRequest(mixed $value = null): self + public function setRequest(?CreateInvoiceAttachmentRequestData $value = null): self { $this->request = $value; return $this; diff --git a/src/Labor/LaborClient.php b/src/Labor/LaborClient.php index ba5be591..168c0486 100644 --- a/src/Labor/LaborClient.php +++ b/src/Labor/LaborClient.php @@ -9,6 +9,36 @@ use Square\Labor\WorkweekConfigs\WorkweekConfigsClient; use GuzzleHttp\ClientInterface; use Square\Core\Client\RawClient; +use Square\Labor\Requests\CreateScheduledShiftRequest; +use Square\Types\CreateScheduledShiftResponse; +use Square\Exceptions\SquareException; +use Square\Exceptions\SquareApiException; +use Square\Core\Json\JsonApiRequest; +use Square\Environments; +use Square\Core\Client\HttpMethod; +use JsonException; +use GuzzleHttp\Exception\RequestException; +use Psr\Http\Client\ClientExceptionInterface; +use Square\Labor\Requests\BulkPublishScheduledShiftsRequest; +use Square\Types\BulkPublishScheduledShiftsResponse; +use Square\Labor\Requests\SearchScheduledShiftsRequest; +use Square\Types\SearchScheduledShiftsResponse; +use Square\Labor\Requests\RetrieveScheduledShiftRequest; +use Square\Types\RetrieveScheduledShiftResponse; +use Square\Labor\Requests\UpdateScheduledShiftRequest; +use Square\Types\UpdateScheduledShiftResponse; +use Square\Labor\Requests\PublishScheduledShiftRequest; +use Square\Types\PublishScheduledShiftResponse; +use Square\Labor\Requests\CreateTimecardRequest; +use Square\Types\CreateTimecardResponse; +use Square\Labor\Requests\SearchTimecardsRequest; +use Square\Types\SearchTimecardsResponse; +use Square\Labor\Requests\RetrieveTimecardRequest; +use Square\Types\RetrieveTimecardResponse; +use Square\Labor\Requests\UpdateTimecardRequest; +use Square\Types\UpdateTimecardResponse; +use Square\Labor\Requests\DeleteTimecardRequest; +use Square\Types\DeleteTimecardResponse; class LaborClient { @@ -75,4 +105,676 @@ public function __construct( $this->teamMemberWages = new TeamMemberWagesClient($this->client, $this->options); $this->workweekConfigs = new WorkweekConfigsClient($this->client, $this->options); } + + /** + * Creates a scheduled shift by providing draft shift details such as job ID, + * team member assignment, and start and end times. + * + * The following `draft_shift_details` fields are required: + * - `location_id` + * - `job_id` + * - `start_at` + * - `end_at` + * + * @param CreateScheduledShiftRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return CreateScheduledShiftResponse + * @throws SquareException + * @throws SquareApiException + */ + public function createScheduledShift(CreateScheduledShiftRequest $request, ?array $options = null): CreateScheduledShiftResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return CreateScheduledShiftResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish + * requests and returns a map of responses. When a scheduled shift is published, Square keeps + * the `draft_shift_details` field as is and copies it to the `published_shift_details` field. + * + * The minimum `start_at` and maximum `end_at` timestamps of all shifts in a + * `BulkPublishScheduledShifts` request must fall within a two-week period. + * + * @param BulkPublishScheduledShiftsRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return BulkPublishScheduledShiftsResponse + * @throws SquareException + * @throws SquareApiException + */ + public function bulkPublishScheduledShifts(BulkPublishScheduledShiftsRequest $request, ?array $options = null): BulkPublishScheduledShiftsResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts/bulk-publish", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return BulkPublishScheduledShiftsResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Returns a paginated list of scheduled shifts, with optional filter and sort settings. + * By default, results are sorted by `start_at` in ascending order. + * + * @param SearchScheduledShiftsRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return SearchScheduledShiftsResponse + * @throws SquareException + * @throws SquareApiException + */ + public function searchScheduledShifts(SearchScheduledShiftsRequest $request = new SearchScheduledShiftsRequest(), ?array $options = null): SearchScheduledShiftsResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts/search", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return SearchScheduledShiftsResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Retrieves a scheduled shift by ID. + * + * @param RetrieveScheduledShiftRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return RetrieveScheduledShiftResponse + * @throws SquareException + * @throws SquareApiException + */ + public function retrieveScheduledShift(RetrieveScheduledShiftRequest $request, ?array $options = null): RetrieveScheduledShiftResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts/{$request->getId()}", + method: HttpMethod::GET, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return RetrieveScheduledShiftResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Updates the draft shift details for a scheduled shift. This endpoint supports + * sparse updates, so only new, changed, or removed fields are required in the request. + * You must publish the shift to make updates public. + * + * You can make the following updates to `draft_shift_details`: + * - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields. + * - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields, + * set the value to null. + * - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true + * and then publish the shift. + * + * @param UpdateScheduledShiftRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return UpdateScheduledShiftResponse + * @throws SquareException + * @throws SquareApiException + */ + public function updateScheduledShift(UpdateScheduledShiftRequest $request, ?array $options = null): UpdateScheduledShiftResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts/{$request->getId()}", + method: HttpMethod::PUT, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return UpdateScheduledShiftResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Publishes a scheduled shift. When a scheduled shift is published, Square keeps the + * `draft_shift_details` field as is and copies it to the `published_shift_details` field. + * + * @param PublishScheduledShiftRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return PublishScheduledShiftResponse + * @throws SquareException + * @throws SquareApiException + */ + public function publishScheduledShift(PublishScheduledShiftRequest $request, ?array $options = null): PublishScheduledShiftResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/scheduled-shifts/{$request->getId()}/publish", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return PublishScheduledShiftResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Creates a new `Timecard`. + * + * A `Timecard` represents a complete workday for a single team member. + * You must provide the following values in your request to this + * endpoint: + * + * - `location_id` + * - `team_member_id` + * - `start_at` + * + * An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when: + * - The `status` of the new `Timecard` is `OPEN` and the team member has another + * timecard with an `OPEN` status. + * - The `start_at` date is in the future. + * - The `start_at` or `end_at` date overlaps another timecard for the same team member. + * - The `Break` instances are set in the request and a break `start_at` + * is before the `Timecard.start_at`, a break `end_at` is after + * the `Timecard.end_at`, or both. + * + * @param CreateTimecardRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return CreateTimecardResponse + * @throws SquareException + * @throws SquareApiException + */ + public function createTimecard(CreateTimecardRequest $request, ?array $options = null): CreateTimecardResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/timecards", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return CreateTimecardResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Returns a paginated list of `Timecard` records for a business. + * The list to be returned can be filtered by: + * - Location IDs + * - Team member IDs + * - Timecard status (`OPEN` or `CLOSED`) + * - Timecard start + * - Timecard end + * - Workday details + * + * The list can be sorted by: + * - `START_AT` + * - `END_AT` + * - `CREATED_AT` + * - `UPDATED_AT` + * + * @param SearchTimecardsRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return SearchTimecardsResponse + * @throws SquareException + * @throws SquareApiException + */ + public function searchTimecards(SearchTimecardsRequest $request = new SearchTimecardsRequest(), ?array $options = null): SearchTimecardsResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/timecards/search", + method: HttpMethod::POST, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return SearchTimecardsResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Returns a single `Timecard` specified by `id`. + * + * @param RetrieveTimecardRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return RetrieveTimecardResponse + * @throws SquareException + * @throws SquareApiException + */ + public function retrieveTimecard(RetrieveTimecardRequest $request, ?array $options = null): RetrieveTimecardResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/timecards/{$request->getId()}", + method: HttpMethod::GET, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return RetrieveTimecardResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Updates an existing `Timecard`. + * + * When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have + * the `end_at` property set to a valid RFC-3339 datetime string. + * + * When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at` + * set on each `Break`. + * + * @param UpdateTimecardRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return UpdateTimecardResponse + * @throws SquareException + * @throws SquareApiException + */ + public function updateTimecard(UpdateTimecardRequest $request, ?array $options = null): UpdateTimecardResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/timecards/{$request->getId()}", + method: HttpMethod::PUT, + body: $request, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return UpdateTimecardResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } + + /** + * Deletes a `Timecard`. + * + * @param DeleteTimecardRequest $request + * @param ?array{ + * baseUrl?: string, + * maxRetries?: int, + * timeout?: float, + * headers?: array, + * queryParameters?: array, + * bodyProperties?: array, + * } $options + * @return DeleteTimecardResponse + * @throws SquareException + * @throws SquareApiException + */ + public function deleteTimecard(DeleteTimecardRequest $request, ?array $options = null): DeleteTimecardResponse + { + $options = array_merge($this->options, $options ?? []); + try { + $response = $this->client->sendRequest( + new JsonApiRequest( + baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Production->value, + path: "v2/labor/timecards/{$request->getId()}", + method: HttpMethod::DELETE, + ), + $options, + ); + $statusCode = $response->getStatusCode(); + if ($statusCode >= 200 && $statusCode < 400) { + $json = $response->getBody()->getContents(); + return DeleteTimecardResponse::fromJson($json); + } + } catch (JsonException $e) { + throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); + } catch (RequestException $e) { + $response = $e->getResponse(); + if ($response === null) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: "API request failed", + statusCode: $response->getStatusCode(), + body: $response->getBody()->getContents(), + ); + } catch (ClientExceptionInterface $e) { + throw new SquareException(message: $e->getMessage(), previous: $e); + } + throw new SquareApiException( + message: 'API request failed', + statusCode: $statusCode, + body: $response->getBody()->getContents(), + ); + } } diff --git a/src/Labor/Requests/BulkPublishScheduledShiftsRequest.php b/src/Labor/Requests/BulkPublishScheduledShiftsRequest.php new file mode 100644 index 00000000..1640d668 --- /dev/null +++ b/src/Labor/Requests/BulkPublishScheduledShiftsRequest.php @@ -0,0 +1,82 @@ + $scheduledShifts + */ + #[JsonProperty('scheduled_shifts'), ArrayType(['string' => BulkPublishScheduledShiftsData::class])] + private array $scheduledShifts; + + /** + * Indicates whether Square should send email notifications to team members and + * which team members should receive the notifications. This setting applies to all shifts + * specified in the bulk operation. The default value is `AFFECTED`. + * See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudience) for possible values + * + * @var ?value-of $scheduledShiftNotificationAudience + */ + #[JsonProperty('scheduled_shift_notification_audience')] + private ?string $scheduledShiftNotificationAudience; + + /** + * @param array{ + * scheduledShifts: array, + * scheduledShiftNotificationAudience?: ?value-of, + * } $values + */ + public function __construct( + array $values, + ) { + $this->scheduledShifts = $values['scheduledShifts']; + $this->scheduledShiftNotificationAudience = $values['scheduledShiftNotificationAudience'] ?? null; + } + + /** + * @return array + */ + public function getScheduledShifts(): array + { + return $this->scheduledShifts; + } + + /** + * @param array $value + */ + public function setScheduledShifts(array $value): self + { + $this->scheduledShifts = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getScheduledShiftNotificationAudience(): ?string + { + return $this->scheduledShiftNotificationAudience; + } + + /** + * @param ?value-of $value + */ + public function setScheduledShiftNotificationAudience(?string $value = null): self + { + $this->scheduledShiftNotificationAudience = $value; + return $this; + } +} diff --git a/src/Labor/Requests/CreateScheduledShiftRequest.php b/src/Labor/Requests/CreateScheduledShiftRequest.php new file mode 100644 index 00000000..b1547a42 --- /dev/null +++ b/src/Labor/Requests/CreateScheduledShiftRequest.php @@ -0,0 +1,81 @@ +idempotencyKey = $values['idempotencyKey'] ?? null; + $this->scheduledShift = $values['scheduledShift']; + } + + /** + * @return ?string + */ + public function getIdempotencyKey(): ?string + { + return $this->idempotencyKey; + } + + /** + * @param ?string $value + */ + public function setIdempotencyKey(?string $value = null): self + { + $this->idempotencyKey = $value; + return $this; + } + + /** + * @return ScheduledShift + */ + public function getScheduledShift(): ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ScheduledShift $value + */ + public function setScheduledShift(ScheduledShift $value): self + { + $this->scheduledShift = $value; + return $this; + } +} diff --git a/src/Labor/Requests/CreateTimecardRequest.php b/src/Labor/Requests/CreateTimecardRequest.php new file mode 100644 index 00000000..674bbb84 --- /dev/null +++ b/src/Labor/Requests/CreateTimecardRequest.php @@ -0,0 +1,69 @@ +idempotencyKey = $values['idempotencyKey'] ?? null; + $this->timecard = $values['timecard']; + } + + /** + * @return ?string + */ + public function getIdempotencyKey(): ?string + { + return $this->idempotencyKey; + } + + /** + * @param ?string $value + */ + public function setIdempotencyKey(?string $value = null): self + { + $this->idempotencyKey = $value; + return $this; + } + + /** + * @return Timecard + */ + public function getTimecard(): Timecard + { + return $this->timecard; + } + + /** + * @param Timecard $value + */ + public function setTimecard(Timecard $value): self + { + $this->timecard = $value; + return $this; + } +} diff --git a/src/Labor/Requests/DeleteTimecardRequest.php b/src/Labor/Requests/DeleteTimecardRequest.php new file mode 100644 index 00000000..0bca6773 --- /dev/null +++ b/src/Labor/Requests/DeleteTimecardRequest.php @@ -0,0 +1,41 @@ +id = $values['id']; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } +} diff --git a/src/Labor/Requests/PublishScheduledShiftRequest.php b/src/Labor/Requests/PublishScheduledShiftRequest.php new file mode 100644 index 00000000..2e09512b --- /dev/null +++ b/src/Labor/Requests/PublishScheduledShiftRequest.php @@ -0,0 +1,130 @@ + $scheduledShiftNotificationAudience + */ + #[JsonProperty('scheduled_shift_notification_audience')] + private ?string $scheduledShiftNotificationAudience; + + /** + * @param array{ + * id: string, + * idempotencyKey: string, + * version?: ?int, + * scheduledShiftNotificationAudience?: ?value-of, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id']; + $this->idempotencyKey = $values['idempotencyKey']; + $this->version = $values['version'] ?? null; + $this->scheduledShiftNotificationAudience = $values['scheduledShiftNotificationAudience'] ?? null; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } + + /** + * @return string + */ + public function getIdempotencyKey(): string + { + return $this->idempotencyKey; + } + + /** + * @param string $value + */ + public function setIdempotencyKey(string $value): self + { + $this->idempotencyKey = $value; + return $this; + } + + /** + * @return ?int + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * @param ?int $value + */ + public function setVersion(?int $value = null): self + { + $this->version = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getScheduledShiftNotificationAudience(): ?string + { + return $this->scheduledShiftNotificationAudience; + } + + /** + * @param ?value-of $value + */ + public function setScheduledShiftNotificationAudience(?string $value = null): self + { + $this->scheduledShiftNotificationAudience = $value; + return $this; + } +} diff --git a/src/Labor/Requests/RetrieveScheduledShiftRequest.php b/src/Labor/Requests/RetrieveScheduledShiftRequest.php new file mode 100644 index 00000000..abce2348 --- /dev/null +++ b/src/Labor/Requests/RetrieveScheduledShiftRequest.php @@ -0,0 +1,41 @@ +id = $values['id']; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } +} diff --git a/src/Labor/Requests/RetrieveTimecardRequest.php b/src/Labor/Requests/RetrieveTimecardRequest.php new file mode 100644 index 00000000..da53e128 --- /dev/null +++ b/src/Labor/Requests/RetrieveTimecardRequest.php @@ -0,0 +1,41 @@ +id = $values['id']; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } +} diff --git a/src/Labor/Requests/SearchScheduledShiftsRequest.php b/src/Labor/Requests/SearchScheduledShiftsRequest.php new file mode 100644 index 00000000..8ce7e0c8 --- /dev/null +++ b/src/Labor/Requests/SearchScheduledShiftsRequest.php @@ -0,0 +1,98 @@ +query = $values['query'] ?? null; + $this->limit = $values['limit'] ?? null; + $this->cursor = $values['cursor'] ?? null; + } + + /** + * @return ?ScheduledShiftQuery + */ + public function getQuery(): ?ScheduledShiftQuery + { + return $this->query; + } + + /** + * @param ?ScheduledShiftQuery $value + */ + public function setQuery(?ScheduledShiftQuery $value = null): self + { + $this->query = $value; + return $this; + } + + /** + * @return ?int + */ + public function getLimit(): ?int + { + return $this->limit; + } + + /** + * @param ?int $value + */ + public function setLimit(?int $value = null): self + { + $this->limit = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * @param ?string $value + */ + public function setCursor(?string $value = null): self + { + $this->cursor = $value; + return $this; + } +} diff --git a/src/Labor/Requests/SearchTimecardsRequest.php b/src/Labor/Requests/SearchTimecardsRequest.php new file mode 100644 index 00000000..e2513552 --- /dev/null +++ b/src/Labor/Requests/SearchTimecardsRequest.php @@ -0,0 +1,94 @@ +query = $values['query'] ?? null; + $this->limit = $values['limit'] ?? null; + $this->cursor = $values['cursor'] ?? null; + } + + /** + * @return ?TimecardQuery + */ + public function getQuery(): ?TimecardQuery + { + return $this->query; + } + + /** + * @param ?TimecardQuery $value + */ + public function setQuery(?TimecardQuery $value = null): self + { + $this->query = $value; + return $this; + } + + /** + * @return ?int + */ + public function getLimit(): ?int + { + return $this->limit; + } + + /** + * @param ?int $value + */ + public function setLimit(?int $value = null): self + { + $this->limit = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * @param ?string $value + */ + public function setCursor(?string $value = null): self + { + $this->cursor = $value; + return $this; + } +} diff --git a/src/Labor/Requests/UpdateScheduledShiftRequest.php b/src/Labor/Requests/UpdateScheduledShiftRequest.php new file mode 100644 index 00000000..3b6147b0 --- /dev/null +++ b/src/Labor/Requests/UpdateScheduledShiftRequest.php @@ -0,0 +1,82 @@ +id = $values['id']; + $this->scheduledShift = $values['scheduledShift']; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } + + /** + * @return ScheduledShift + */ + public function getScheduledShift(): ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ScheduledShift $value + */ + public function setScheduledShift(ScheduledShift $value): self + { + $this->scheduledShift = $value; + return $this; + } +} diff --git a/src/Labor/Requests/UpdateTimecardRequest.php b/src/Labor/Requests/UpdateTimecardRequest.php new file mode 100644 index 00000000..1d212579 --- /dev/null +++ b/src/Labor/Requests/UpdateTimecardRequest.php @@ -0,0 +1,68 @@ +id = $values['id']; + $this->timecard = $values['timecard']; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $value + */ + public function setId(string $value): self + { + $this->id = $value; + return $this; + } + + /** + * @return Timecard + */ + public function getTimecard(): Timecard + { + return $this->timecard; + } + + /** + * @param Timecard $value + */ + public function setTimecard(Timecard $value): self + { + $this->timecard = $value; + return $this; + } +} diff --git a/src/SquareClient.php b/src/SquareClient.php index a24f00ef..7fa70f0c 100644 --- a/src/SquareClient.php +++ b/src/SquareClient.php @@ -18,6 +18,7 @@ use Square\GiftCards\GiftCardsClient; use Square\Inventory\InventoryClient; use Square\Invoices\InvoicesClient; +use Square\Labor\LaborClient; use Square\Locations\LocationsClient; use Square\Loyalty\LoyaltyClient; use Square\Merchants\MerchantsClient; @@ -34,7 +35,6 @@ use Square\Terminal\TerminalClient; use Square\Vendors\VendorsClient; use Square\CashDrawers\CashDrawersClient; -use Square\Labor\LaborClient; use Square\Webhooks\WebhooksClient; use GuzzleHttp\ClientInterface; use Square\Core\Client\RawClient; @@ -122,6 +122,11 @@ class SquareClient */ public InvoicesClient $invoices; + /** + * @var LaborClient $labor + */ + public LaborClient $labor; + /** * @var LocationsClient $locations */ @@ -202,11 +207,6 @@ class SquareClient */ public CashDrawersClient $cashDrawers; - /** - * @var LaborClient $labor - */ - public LaborClient $labor; - /** * @var WebhooksClient $webhooks */ @@ -247,11 +247,11 @@ public function __construct( $token ??= $this->getFromEnvOrThrow('SQUARE_TOKEN', 'Please pass in token or set the environment variable SQUARE_TOKEN.'); $defaultHeaders = [ 'Authorization' => "Bearer $token", - 'Square-Version' => '2025-04-16', + 'Square-Version' => '2025-05-21', 'X-Fern-Language' => 'PHP', 'X-Fern-SDK-Name' => 'Square', - 'X-Fern-SDK-Version' => '42.1.0.20250416', - 'User-Agent' => 'square/square/42.1.0.20250416', + 'X-Fern-SDK-Version' => '42.2.0.20250521', + 'User-Agent' => 'square/square/42.2.0.20250521', ]; if ($version != null) { $defaultHeaders['Square-Version'] = $version; @@ -283,6 +283,7 @@ public function __construct( $this->giftCards = new GiftCardsClient($this->client, $this->options); $this->inventory = new InventoryClient($this->client, $this->options); $this->invoices = new InvoicesClient($this->client, $this->options); + $this->labor = new LaborClient($this->client, $this->options); $this->locations = new LocationsClient($this->client, $this->options); $this->loyalty = new LoyaltyClient($this->client, $this->options); $this->merchants = new MerchantsClient($this->client, $this->options); @@ -299,7 +300,6 @@ public function __construct( $this->terminal = new TerminalClient($this->client, $this->options); $this->vendors = new VendorsClient($this->client, $this->options); $this->cashDrawers = new CashDrawersClient($this->client, $this->options); - $this->labor = new LaborClient($this->client, $this->options); $this->webhooks = new WebhooksClient($this->client, $this->options); } diff --git a/src/Types/BreakType.php b/src/Types/BreakType.php index 9e177120..df58d08b 100644 --- a/src/Types/BreakType.php +++ b/src/Types/BreakType.php @@ -6,8 +6,8 @@ use Square\Core\Json\JsonProperty; /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. + * A template for a type of [break](entity:Break) that can be added to a + * [timecard](entity:Timecard), including the expected duration and paid status. */ class BreakType extends JsonSerializableType { @@ -25,7 +25,7 @@ class BreakType extends JsonSerializableType /** * A human-readable name for this type of break. The name is displayed to - * employees in Square products. + * team members in Square products. * * @var string $breakName */ @@ -36,7 +36,7 @@ class BreakType extends JsonSerializableType * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of * this break. Precision less than minutes is truncated. * - * Example for break expected duration of 15 minutes: T15M + * Example for break expected duration of 15 minutes: PT15M * * @var string $expectedDuration */ diff --git a/src/Types/Break_.php b/src/Types/Break_.php index 4b39e9a2..deca724a 100644 --- a/src/Types/Break_.php +++ b/src/Types/Break_.php @@ -6,7 +6,7 @@ use Square\Core\Json\JsonProperty; /** - * A record of an employee's break during a shift. + * A record of a team member's break on a [timecard](entity:Timecard). */ class Break_ extends JsonSerializableType { @@ -17,7 +17,7 @@ class Break_ extends JsonSerializableType private ?string $id; /** - * RFC 3339; follows the same timezone information as `Shift`. Precision up to + * RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to * the minute is respected; seconds are truncated. * * @var string $startAt @@ -26,7 +26,7 @@ class Break_ extends JsonSerializableType private string $startAt; /** - * RFC 3339; follows the same timezone information as `Shift`. Precision up to + * RFC 3339; follows the same timezone information as the [timecard](entity:Timecard). Precision up to * the minute is respected; seconds are truncated. * * @var ?string $endAt @@ -35,7 +35,7 @@ class Break_ extends JsonSerializableType private ?string $endAt; /** - * @var string $breakTypeId The `BreakType` that this `Break` was templated on. + * @var string $breakTypeId The [BreakType](entity:BreakType) that this break was templated on. */ #[JsonProperty('break_type_id')] private string $breakTypeId; @@ -50,6 +50,8 @@ class Break_ extends JsonSerializableType * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of * the break. * + * Example for break expected duration of 15 minutes: PT15M + * * @var string $expectedDuration */ #[JsonProperty('expected_duration')] diff --git a/src/Types/BulkPublishScheduledShiftsData.php b/src/Types/BulkPublishScheduledShiftsData.php new file mode 100644 index 00000000..13fadd82 --- /dev/null +++ b/src/Types/BulkPublishScheduledShiftsData.php @@ -0,0 +1,60 @@ +version = $values['version'] ?? null; + } + + /** + * @return ?int + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * @param ?int $value + */ + public function setVersion(?int $value = null): self + { + $this->version = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/BulkPublishScheduledShiftsResponse.php b/src/Types/BulkPublishScheduledShiftsResponse.php new file mode 100644 index 00000000..ba6b45f1 --- /dev/null +++ b/src/Types/BulkPublishScheduledShiftsResponse.php @@ -0,0 +1,89 @@ + $responses + */ + #[JsonProperty('responses'), ArrayType(['string' => PublishScheduledShiftResponse::class])] + private ?array $responses; + + /** + * @var ?array $errors Any top-level errors that prevented the bulk operation from succeeding. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * responses?: ?array, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->responses = $values['responses'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?array + */ + public function getResponses(): ?array + { + return $this->responses; + } + + /** + * @param ?array $value + */ + public function setResponses(?array $value = null): self + { + $this->responses = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CatalogItem.php b/src/Types/CatalogItem.php index 4cfa4696..43b56c5b 100644 --- a/src/Types/CatalogItem.php +++ b/src/Types/CatalogItem.php @@ -127,13 +127,13 @@ class CatalogItem extends JsonSerializableType private ?array $itemOptions; /** - * @var ?string $ecomUri Deprecated; see go/ecomUriUseCases. A URI pointing to a published e-commerce product page for the Item. + * @var ?string $ecomUri Deprecated. A URI pointing to a published e-commerce product page for the Item. */ #[JsonProperty('ecom_uri')] private ?string $ecomUri; /** - * @var ?array $ecomImageUris Deprecated; see go/ecomUriUseCases. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item. + * @var ?array $ecomImageUris Deprecated. A comma-separated list of encoded URIs pointing to a set of published e-commerce images for the Item. */ #[JsonProperty('ecom_image_uris'), ArrayType(['string'])] private ?array $ecomImageUris; diff --git a/src/Types/CatalogItemModifierListInfo.php b/src/Types/CatalogItemModifierListInfo.php index aa6d0f60..6e4a16e6 100644 --- a/src/Types/CatalogItemModifierListInfo.php +++ b/src/Types/CatalogItemModifierListInfo.php @@ -7,8 +7,8 @@ use Square\Core\Types\ArrayType; /** - * References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance - * and specifies supported behaviors of the application. + * Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior + * and provides the ability to override global modifier list settings. */ class CatalogItemModifierListInfo extends JsonSerializableType { @@ -19,22 +19,20 @@ class CatalogItemModifierListInfo extends JsonSerializableType private string $modifierListId; /** - * @var ?array $modifierOverrides A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. + * @var ?array $modifierOverrides A set of `CatalogModifierOverride` objects that override default modifier settings for this item. */ #[JsonProperty('modifier_overrides'), ArrayType([CatalogModifierOverride::class])] private ?array $modifierOverrides; /** - * If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. - * The default value is `-1`. + * The minimum number of modifiers that must be selected from this modifier list. + * Values: * - * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - * the `CatalogModifierList` can be selected from the `CatalogModifierList`. - * - * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - * and can be selected from the `CatalogModifierList` + * - 0: No selection is required. + * - -1: Default value, the attribute was not set by the client. When `max_selected_modifiers` is + * also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`. + * - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. + * - < -1: Invalid. Treated as no selection required. * * @var ?int $minSelectedModifiers */ @@ -42,16 +40,14 @@ class CatalogItemModifierListInfo extends JsonSerializableType private ?int $minSelectedModifiers; /** - * If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. - * The default value is `-1`. - * - * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - * the `CatalogModifierList` can be selected from the `CatalogModifierList`. + * The maximum number of modifiers that can be selected. + * Values: * - * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - * and can be selected from the `CatalogModifierList` + * - 0: No maximum limit. + * - -1: Default value, the attribute was not set by the client. When `min_selected_modifiers` is + * also -1, use the minimum and maximum selection values set on the `CatalogItemModifierList`. + * - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. + * - < -1: Invalid. Treated as no maximum limit. * * @var ?int $maxSelectedModifiers */ @@ -73,6 +69,24 @@ class CatalogItemModifierListInfo extends JsonSerializableType #[JsonProperty('ordinal')] private ?int $ordinal; + /** + * @var mixed $allowQuantities + */ + #[JsonProperty('allow_quantities')] + private mixed $allowQuantities; + + /** + * @var mixed $isConversational + */ + #[JsonProperty('is_conversational')] + private mixed $isConversational; + + /** + * @var mixed $hiddenFromCustomerOverride + */ + #[JsonProperty('hidden_from_customer_override')] + private mixed $hiddenFromCustomerOverride; + /** * @param array{ * modifierListId: string, @@ -81,6 +95,9 @@ class CatalogItemModifierListInfo extends JsonSerializableType * maxSelectedModifiers?: ?int, * enabled?: ?bool, * ordinal?: ?int, + * allowQuantities?: mixed, + * isConversational?: mixed, + * hiddenFromCustomerOverride?: mixed, * } $values */ public function __construct( @@ -92,6 +109,9 @@ public function __construct( $this->maxSelectedModifiers = $values['maxSelectedModifiers'] ?? null; $this->enabled = $values['enabled'] ?? null; $this->ordinal = $values['ordinal'] ?? null; + $this->allowQuantities = $values['allowQuantities'] ?? null; + $this->isConversational = $values['isConversational'] ?? null; + $this->hiddenFromCustomerOverride = $values['hiddenFromCustomerOverride'] ?? null; } /** @@ -196,6 +216,57 @@ public function setOrdinal(?int $value = null): self return $this; } + /** + * @return mixed + */ + public function getAllowQuantities(): mixed + { + return $this->allowQuantities; + } + + /** + * @param mixed $value + */ + public function setAllowQuantities(mixed $value = null): self + { + $this->allowQuantities = $value; + return $this; + } + + /** + * @return mixed + */ + public function getIsConversational(): mixed + { + return $this->isConversational; + } + + /** + * @param mixed $value + */ + public function setIsConversational(mixed $value = null): self + { + $this->isConversational = $value; + return $this; + } + + /** + * @return mixed + */ + public function getHiddenFromCustomerOverride(): mixed + { + return $this->hiddenFromCustomerOverride; + } + + /** + * @param mixed $value + */ + public function setHiddenFromCustomerOverride(mixed $value = null): self + { + $this->hiddenFromCustomerOverride = $value; + return $this; + } + /** * @return string */ diff --git a/src/Types/CatalogModifier.php b/src/Types/CatalogModifier.php index 4d0b1aea..716713ef 100644 --- a/src/Types/CatalogModifier.php +++ b/src/Types/CatalogModifier.php @@ -7,7 +7,7 @@ use Square\Core\Types\ArrayType; /** - * A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. + * A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream. */ class CatalogModifier extends JsonSerializableType { @@ -23,6 +23,15 @@ class CatalogModifier extends JsonSerializableType #[JsonProperty('price_money')] private ?Money $priceMoney; + /** + * When `true`, this modifier is selected by default when displaying the modifier list. + * This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`. + * + * @var ?bool $onByDefault + */ + #[JsonProperty('on_by_default')] + private ?bool $onByDefault; + /** * @var ?int $ordinal Determines where this `CatalogModifier` appears in the `CatalogModifierList`. */ @@ -50,14 +59,22 @@ class CatalogModifier extends JsonSerializableType #[JsonProperty('image_id')] private ?string $imageId; + /** + * @var ?bool $hiddenOnline When `true`, this modifier is hidden from online ordering channels. This setting can be overridden at the item level using `CatalogModifierListInfo.modifier_overrides`. + */ + #[JsonProperty('hidden_online')] + private ?bool $hiddenOnline; + /** * @param array{ * name?: ?string, * priceMoney?: ?Money, + * onByDefault?: ?bool, * ordinal?: ?int, * modifierListId?: ?string, * locationOverrides?: ?array, * imageId?: ?string, + * hiddenOnline?: ?bool, * } $values */ public function __construct( @@ -65,10 +82,12 @@ public function __construct( ) { $this->name = $values['name'] ?? null; $this->priceMoney = $values['priceMoney'] ?? null; + $this->onByDefault = $values['onByDefault'] ?? null; $this->ordinal = $values['ordinal'] ?? null; $this->modifierListId = $values['modifierListId'] ?? null; $this->locationOverrides = $values['locationOverrides'] ?? null; $this->imageId = $values['imageId'] ?? null; + $this->hiddenOnline = $values['hiddenOnline'] ?? null; } /** @@ -105,6 +124,23 @@ public function setPriceMoney(?Money $value = null): self return $this; } + /** + * @return ?bool + */ + public function getOnByDefault(): ?bool + { + return $this->onByDefault; + } + + /** + * @param ?bool $value + */ + public function setOnByDefault(?bool $value = null): self + { + $this->onByDefault = $value; + return $this; + } + /** * @return ?int */ @@ -173,6 +209,23 @@ public function setImageId(?string $value = null): self return $this; } + /** + * @return ?bool + */ + public function getHiddenOnline(): ?bool + { + return $this->hiddenOnline; + } + + /** + * @param ?bool $value + */ + public function setHiddenOnline(?bool $value = null): self + { + $this->hiddenOnline = $value; + return $this; + } + /** * @return string */ diff --git a/src/Types/CatalogModifierList.php b/src/Types/CatalogModifierList.php index 6899105a..876faea5 100644 --- a/src/Types/CatalogModifierList.php +++ b/src/Types/CatalogModifierList.php @@ -7,18 +7,11 @@ use Square\Core\Types\ArrayType; /** - * For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. - * For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied - * text string to be selected for the T-shirt at the time of sale. - * - * For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items - * at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. - * For example, a "Condiments" modifier list applicable to a "Hot Dog" item - * may contain "Ketchup", "Mustard", and "Relish" modifiers. - * - * A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field - * is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item - * only once and the `selection_type` field is always set to `SINGLE`. + * A container for a list of modifiers, or a text-based modifier. + * For text-based modifiers, this represents text configuration for an item. (For example, custom text to print on a t-shirt). + * For non text-based modifiers, this represents a list of modifiers that can be applied to items at the time of sale. + * (For example, a list of condiments for a hot dog, or a list of ice cream flavors). + * Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. */ class CatalogModifierList extends JsonSerializableType { @@ -38,10 +31,8 @@ class CatalogModifierList extends JsonSerializableType private ?int $ordinal; /** - * Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) modifiers from the list - * can be applied to a single `CatalogItem`. - * - * For text-based modifiers, the `selection_type` attribute is always `SINGLE`. The other value is ignored. + * __Deprecated__: Indicates whether a single (`SINGLE`) modifier or multiple (`MULTIPLE`) modifiers can be selected. Use + * `min_selected_modifiers` and `max_selected_modifiers` instead. * See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values * * @var ?value-of $selectionType @@ -75,6 +66,18 @@ class CatalogModifierList extends JsonSerializableType #[JsonProperty('image_ids'), ArrayType(['string'])] private ?array $imageIds; + /** + * @var ?bool $allowQuantities When `true`, allows multiple quantities of the same modifier to be selected. + */ + #[JsonProperty('allow_quantities')] + private ?bool $allowQuantities; + + /** + * @var ?bool $isConversational True if modifiers belonging to this list can be used conversationally. + */ + #[JsonProperty('is_conversational')] + private ?bool $isConversational; + /** * The type of the modifier. * @@ -120,6 +123,45 @@ class CatalogModifierList extends JsonSerializableType #[JsonProperty('internal_name')] private ?string $internalName; + /** + * The minimum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`. + * + * Values: + * + * - 0: No selection is required. + * - -1: Default value, the attribute was not set by the client. Treated as no selection required. + * - >0: The required minimum modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. + * - < -1: Invalid. Treated as no selection required. + * + * @var ?int $minSelectedModifiers + */ + #[JsonProperty('min_selected_modifiers')] + private ?int $minSelectedModifiers; + + /** + * The maximum number of modifiers that must be selected from this list. The value can be overridden with `CatalogItemModifierListInfo`. + * + * Values: + * + * - 0: No maximum limit. + * - -1: Default value, the attribute was not set by the client. Treated as no maximum limit. + * - >0: The maximum total modifier selections. This can be larger than the total `CatalogModifiers` when `allow_quantities` is enabled. + * - < -1: Invalid. Treated as no maximum limit. + * + * @var ?int $maxSelectedModifiers + */ + #[JsonProperty('max_selected_modifiers')] + private ?int $maxSelectedModifiers; + + /** + * If `true`, modifiers from this list are hidden from customer receipts. The default value is `false`. + * This setting can be overridden with `CatalogItemModifierListInfo.hidden_from_customer_override`. + * + * @var ?bool $hiddenFromCustomer + */ + #[JsonProperty('hidden_from_customer')] + private ?bool $hiddenFromCustomer; + /** * @param array{ * name?: ?string, @@ -127,10 +169,15 @@ class CatalogModifierList extends JsonSerializableType * selectionType?: ?value-of, * modifiers?: ?array, * imageIds?: ?array, + * allowQuantities?: ?bool, + * isConversational?: ?bool, * modifierType?: ?value-of, * maxLength?: ?int, * textRequired?: ?bool, * internalName?: ?string, + * minSelectedModifiers?: ?int, + * maxSelectedModifiers?: ?int, + * hiddenFromCustomer?: ?bool, * } $values */ public function __construct( @@ -141,10 +188,15 @@ public function __construct( $this->selectionType = $values['selectionType'] ?? null; $this->modifiers = $values['modifiers'] ?? null; $this->imageIds = $values['imageIds'] ?? null; + $this->allowQuantities = $values['allowQuantities'] ?? null; + $this->isConversational = $values['isConversational'] ?? null; $this->modifierType = $values['modifierType'] ?? null; $this->maxLength = $values['maxLength'] ?? null; $this->textRequired = $values['textRequired'] ?? null; $this->internalName = $values['internalName'] ?? null; + $this->minSelectedModifiers = $values['minSelectedModifiers'] ?? null; + $this->maxSelectedModifiers = $values['maxSelectedModifiers'] ?? null; + $this->hiddenFromCustomer = $values['hiddenFromCustomer'] ?? null; } /** @@ -232,6 +284,40 @@ public function setImageIds(?array $value = null): self return $this; } + /** + * @return ?bool + */ + public function getAllowQuantities(): ?bool + { + return $this->allowQuantities; + } + + /** + * @param ?bool $value + */ + public function setAllowQuantities(?bool $value = null): self + { + $this->allowQuantities = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getIsConversational(): ?bool + { + return $this->isConversational; + } + + /** + * @param ?bool $value + */ + public function setIsConversational(?bool $value = null): self + { + $this->isConversational = $value; + return $this; + } + /** * @return ?value-of */ @@ -300,6 +386,57 @@ public function setInternalName(?string $value = null): self return $this; } + /** + * @return ?int + */ + public function getMinSelectedModifiers(): ?int + { + return $this->minSelectedModifiers; + } + + /** + * @param ?int $value + */ + public function setMinSelectedModifiers(?int $value = null): self + { + $this->minSelectedModifiers = $value; + return $this; + } + + /** + * @return ?int + */ + public function getMaxSelectedModifiers(): ?int + { + return $this->maxSelectedModifiers; + } + + /** + * @param ?int $value + */ + public function setMaxSelectedModifiers(?int $value = null): self + { + $this->maxSelectedModifiers = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getHiddenFromCustomer(): ?bool + { + return $this->hiddenFromCustomer; + } + + /** + * @param ?bool $value + */ + public function setHiddenFromCustomer(?bool $value = null): self + { + $this->hiddenFromCustomer = $value; + return $this; + } + /** * @return string */ diff --git a/src/Types/CatalogModifierOverride.php b/src/Types/CatalogModifierOverride.php index 07506a16..30bb4297 100644 --- a/src/Types/CatalogModifierOverride.php +++ b/src/Types/CatalogModifierOverride.php @@ -17,15 +17,29 @@ class CatalogModifierOverride extends JsonSerializableType private string $modifierId; /** - * @var ?bool $onByDefault If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. + * @var ?bool $onByDefault __Deprecated__: Use `on_by_default_override` instead. */ #[JsonProperty('on_by_default')] private ?bool $onByDefault; + /** + * @var mixed $hiddenOnlineOverride + */ + #[JsonProperty('hidden_online_override')] + private mixed $hiddenOnlineOverride; + + /** + * @var mixed $onByDefaultOverride + */ + #[JsonProperty('on_by_default_override')] + private mixed $onByDefaultOverride; + /** * @param array{ * modifierId: string, * onByDefault?: ?bool, + * hiddenOnlineOverride?: mixed, + * onByDefaultOverride?: mixed, * } $values */ public function __construct( @@ -33,6 +47,8 @@ public function __construct( ) { $this->modifierId = $values['modifierId']; $this->onByDefault = $values['onByDefault'] ?? null; + $this->hiddenOnlineOverride = $values['hiddenOnlineOverride'] ?? null; + $this->onByDefaultOverride = $values['onByDefaultOverride'] ?? null; } /** @@ -69,6 +85,40 @@ public function setOnByDefault(?bool $value = null): self return $this; } + /** + * @return mixed + */ + public function getHiddenOnlineOverride(): mixed + { + return $this->hiddenOnlineOverride; + } + + /** + * @param mixed $value + */ + public function setHiddenOnlineOverride(mixed $value = null): self + { + $this->hiddenOnlineOverride = $value; + return $this; + } + + /** + * @return mixed + */ + public function getOnByDefaultOverride(): mixed + { + return $this->onByDefaultOverride; + } + + /** + * @param mixed $value + */ + public function setOnByDefaultOverride(mixed $value = null): self + { + $this->onByDefaultOverride = $value; + return $this; + } + /** * @return string */ diff --git a/src/Types/CatalogObject.php b/src/Types/CatalogObject.php index c4be09b5..041b1790 100644 --- a/src/Types/CatalogObject.php +++ b/src/Types/CatalogObject.php @@ -30,25 +30,16 @@ class CatalogObject extends JsonSerializableType * |'DISCOUNT' * |'MODIFIER_LIST' * |'MODIFIER' - * |'DINING_OPTION' - * |'TAX_EXEMPTION' - * |'SERVICE_CHARGE' * |'PRICING_RULE' * |'PRODUCT_SET' * |'TIME_PERIOD' * |'MEASUREMENT_UNIT' - * |'SUBSCRIPTION_PLAN' + * |'SUBSCRIPTION_PLAN_VARIATION' * |'ITEM_OPTION' * |'ITEM_OPTION_VAL' * |'CUSTOM_ATTRIBUTE_DEFINITION' * |'QUICK_AMOUNTS_SETTINGS' - * |'COMPONENT' - * |'COMPOSITION' - * |'RESOURCE' - * |'CHECKOUT_LINK' - * |'ADDRESS' - * |'SUBSCRIPTION_PRODUCT' - * |'SUBSCRIPTION_PLAN_VARIATION' + * |'SUBSCRIPTION_PLAN' * |'AVAILABILITY_PERIOD' * |'_unknown' * ) $type @@ -65,25 +56,16 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectDiscount * |CatalogObjectModifierList * |CatalogObjectModifier - * |CatalogObjectDiningOption - * |CatalogObjectTaxExemption - * |CatalogObjectServiceCharge * |CatalogObjectPricingRule * |CatalogObjectProductSet * |CatalogObjectTimePeriod * |CatalogObjectMeasurementUnit - * |CatalogObjectSubscriptionPlan + * |CatalogObjectSubscriptionPlanVariation * |CatalogObjectItemOption * |CatalogObjectItemOptionValue * |CatalogObjectCustomAttributeDefinition * |CatalogObjectQuickAmountsSettings - * |CatalogObjectComponent - * |CatalogObjectComposition - * |CatalogObjectResource - * |CatalogObjectCheckoutLink - * |CatalogObjectAddress - * |CatalogObjectSubscriptionProduct - * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectSubscriptionPlan * |CatalogObjectAvailabilityPeriod * |mixed * ) $value @@ -101,25 +83,16 @@ class CatalogObject extends JsonSerializableType * |'DISCOUNT' * |'MODIFIER_LIST' * |'MODIFIER' - * |'DINING_OPTION' - * |'TAX_EXEMPTION' - * |'SERVICE_CHARGE' * |'PRICING_RULE' * |'PRODUCT_SET' * |'TIME_PERIOD' * |'MEASUREMENT_UNIT' - * |'SUBSCRIPTION_PLAN' + * |'SUBSCRIPTION_PLAN_VARIATION' * |'ITEM_OPTION' * |'ITEM_OPTION_VAL' * |'CUSTOM_ATTRIBUTE_DEFINITION' * |'QUICK_AMOUNTS_SETTINGS' - * |'COMPONENT' - * |'COMPOSITION' - * |'RESOURCE' - * |'CHECKOUT_LINK' - * |'ADDRESS' - * |'SUBSCRIPTION_PRODUCT' - * |'SUBSCRIPTION_PLAN_VARIATION' + * |'SUBSCRIPTION_PLAN' * |'AVAILABILITY_PERIOD' * |'_unknown' * ), @@ -132,25 +105,16 @@ class CatalogObject extends JsonSerializableType * |CatalogObjectDiscount * |CatalogObjectModifierList * |CatalogObjectModifier - * |CatalogObjectDiningOption - * |CatalogObjectTaxExemption - * |CatalogObjectServiceCharge * |CatalogObjectPricingRule * |CatalogObjectProductSet * |CatalogObjectTimePeriod * |CatalogObjectMeasurementUnit - * |CatalogObjectSubscriptionPlan + * |CatalogObjectSubscriptionPlanVariation * |CatalogObjectItemOption * |CatalogObjectItemOptionValue * |CatalogObjectCustomAttributeDefinition * |CatalogObjectQuickAmountsSettings - * |CatalogObjectComponent - * |CatalogObjectComposition - * |CatalogObjectResource - * |CatalogObjectCheckoutLink - * |CatalogObjectAddress - * |CatalogObjectSubscriptionProduct - * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectSubscriptionPlan * |CatalogObjectAvailabilityPeriod * |mixed * ), @@ -173,25 +137,16 @@ private function __construct( * |'DISCOUNT' * |'MODIFIER_LIST' * |'MODIFIER' - * |'DINING_OPTION' - * |'TAX_EXEMPTION' - * |'SERVICE_CHARGE' * |'PRICING_RULE' * |'PRODUCT_SET' * |'TIME_PERIOD' * |'MEASUREMENT_UNIT' - * |'SUBSCRIPTION_PLAN' + * |'SUBSCRIPTION_PLAN_VARIATION' * |'ITEM_OPTION' * |'ITEM_OPTION_VAL' * |'CUSTOM_ATTRIBUTE_DEFINITION' * |'QUICK_AMOUNTS_SETTINGS' - * |'COMPONENT' - * |'COMPOSITION' - * |'RESOURCE' - * |'CHECKOUT_LINK' - * |'ADDRESS' - * |'SUBSCRIPTION_PRODUCT' - * |'SUBSCRIPTION_PLAN_VARIATION' + * |'SUBSCRIPTION_PLAN' * |'AVAILABILITY_PERIOD' * |'_unknown' * ) @@ -211,25 +166,16 @@ public function getType(): string * |CatalogObjectDiscount * |CatalogObjectModifierList * |CatalogObjectModifier - * |CatalogObjectDiningOption - * |CatalogObjectTaxExemption - * |CatalogObjectServiceCharge * |CatalogObjectPricingRule * |CatalogObjectProductSet * |CatalogObjectTimePeriod * |CatalogObjectMeasurementUnit - * |CatalogObjectSubscriptionPlan + * |CatalogObjectSubscriptionPlanVariation * |CatalogObjectItemOption * |CatalogObjectItemOptionValue * |CatalogObjectCustomAttributeDefinition * |CatalogObjectQuickAmountsSettings - * |CatalogObjectComponent - * |CatalogObjectComposition - * |CatalogObjectResource - * |CatalogObjectCheckoutLink - * |CatalogObjectAddress - * |CatalogObjectSubscriptionProduct - * |CatalogObjectSubscriptionPlanVariation + * |CatalogObjectSubscriptionPlan * |CatalogObjectAvailabilityPeriod * |mixed * ) @@ -335,42 +281,6 @@ public static function modifier(CatalogObjectModifier $modifier): CatalogObject ]); } - /** - * @param CatalogObjectDiningOption $diningOption - * @return CatalogObject - */ - public static function diningOption(CatalogObjectDiningOption $diningOption): CatalogObject - { - return new CatalogObject([ - 'type' => 'DINING_OPTION', - 'value' => $diningOption, - ]); - } - - /** - * @param CatalogObjectTaxExemption $taxExemption - * @return CatalogObject - */ - public static function taxExemption(CatalogObjectTaxExemption $taxExemption): CatalogObject - { - return new CatalogObject([ - 'type' => 'TAX_EXEMPTION', - 'value' => $taxExemption, - ]); - } - - /** - * @param CatalogObjectServiceCharge $serviceCharge - * @return CatalogObject - */ - public static function serviceCharge(CatalogObjectServiceCharge $serviceCharge): CatalogObject - { - return new CatalogObject([ - 'type' => 'SERVICE_CHARGE', - 'value' => $serviceCharge, - ]); - } - /** * @param CatalogObjectPricingRule $pricingRule * @return CatalogObject @@ -420,14 +330,14 @@ public static function measurementUnit(CatalogObjectMeasurementUnit $measurement } /** - * @param CatalogObjectSubscriptionPlan $subscriptionPlan + * @param CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation * @return CatalogObject */ - public static function subscriptionPlan(CatalogObjectSubscriptionPlan $subscriptionPlan): CatalogObject + public static function subscriptionPlanVariation(CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation): CatalogObject { return new CatalogObject([ - 'type' => 'SUBSCRIPTION_PLAN', - 'value' => $subscriptionPlan, + 'type' => 'SUBSCRIPTION_PLAN_VARIATION', + 'value' => $subscriptionPlanVariation, ]); } @@ -480,86 +390,14 @@ public static function quickAmountsSettings(CatalogObjectQuickAmountsSettings $q } /** - * @param CatalogObjectComponent $component - * @return CatalogObject - */ - public static function component(CatalogObjectComponent $component): CatalogObject - { - return new CatalogObject([ - 'type' => 'COMPONENT', - 'value' => $component, - ]); - } - - /** - * @param CatalogObjectComposition $composition - * @return CatalogObject - */ - public static function composition(CatalogObjectComposition $composition): CatalogObject - { - return new CatalogObject([ - 'type' => 'COMPOSITION', - 'value' => $composition, - ]); - } - - /** - * @param CatalogObjectResource $resource - * @return CatalogObject - */ - public static function resource(CatalogObjectResource $resource): CatalogObject - { - return new CatalogObject([ - 'type' => 'RESOURCE', - 'value' => $resource, - ]); - } - - /** - * @param CatalogObjectCheckoutLink $checkoutLink - * @return CatalogObject - */ - public static function checkoutLink(CatalogObjectCheckoutLink $checkoutLink): CatalogObject - { - return new CatalogObject([ - 'type' => 'CHECKOUT_LINK', - 'value' => $checkoutLink, - ]); - } - - /** - * @param CatalogObjectAddress $address - * @return CatalogObject - */ - public static function address(CatalogObjectAddress $address): CatalogObject - { - return new CatalogObject([ - 'type' => 'ADDRESS', - 'value' => $address, - ]); - } - - /** - * @param CatalogObjectSubscriptionProduct $subscriptionProduct - * @return CatalogObject - */ - public static function subscriptionProduct(CatalogObjectSubscriptionProduct $subscriptionProduct): CatalogObject - { - return new CatalogObject([ - 'type' => 'SUBSCRIPTION_PRODUCT', - 'value' => $subscriptionProduct, - ]); - } - - /** - * @param CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation + * @param CatalogObjectSubscriptionPlan $subscriptionPlan * @return CatalogObject */ - public static function subscriptionPlanVariation(CatalogObjectSubscriptionPlanVariation $subscriptionPlanVariation): CatalogObject + public static function subscriptionPlan(CatalogObjectSubscriptionPlan $subscriptionPlan): CatalogObject { return new CatalogObject([ - 'type' => 'SUBSCRIPTION_PLAN_VARIATION', - 'value' => $subscriptionPlanVariation, + 'type' => 'SUBSCRIPTION_PLAN', + 'value' => $subscriptionPlan, ]); } @@ -751,72 +589,6 @@ public function asModifier(): CatalogObjectModifier return $this->value; } - /** - * @return bool - */ - public function isDiningOption(): bool - { - return $this->value instanceof CatalogObjectDiningOption && $this->type === 'DINING_OPTION'; - } - - /** - * @return CatalogObjectDiningOption - */ - public function asDiningOption(): CatalogObjectDiningOption - { - if (!($this->value instanceof CatalogObjectDiningOption && $this->type === 'DINING_OPTION')) { - throw new Exception( - "Expected DINING_OPTION; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isTaxExemption(): bool - { - return $this->value instanceof CatalogObjectTaxExemption && $this->type === 'TAX_EXEMPTION'; - } - - /** - * @return CatalogObjectTaxExemption - */ - public function asTaxExemption(): CatalogObjectTaxExemption - { - if (!($this->value instanceof CatalogObjectTaxExemption && $this->type === 'TAX_EXEMPTION')) { - throw new Exception( - "Expected TAX_EXEMPTION; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isServiceCharge(): bool - { - return $this->value instanceof CatalogObjectServiceCharge && $this->type === 'SERVICE_CHARGE'; - } - - /** - * @return CatalogObjectServiceCharge - */ - public function asServiceCharge(): CatalogObjectServiceCharge - { - if (!($this->value instanceof CatalogObjectServiceCharge && $this->type === 'SERVICE_CHARGE')) { - throw new Exception( - "Expected SERVICE_CHARGE; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - /** * @return bool */ @@ -908,19 +680,19 @@ public function asMeasurementUnit(): CatalogObjectMeasurementUnit /** * @return bool */ - public function isSubscriptionPlan(): bool + public function isSubscriptionPlanVariation(): bool { - return $this->value instanceof CatalogObjectSubscriptionPlan && $this->type === 'SUBSCRIPTION_PLAN'; + return $this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION'; } /** - * @return CatalogObjectSubscriptionPlan + * @return CatalogObjectSubscriptionPlanVariation */ - public function asSubscriptionPlan(): CatalogObjectSubscriptionPlan + public function asSubscriptionPlanVariation(): CatalogObjectSubscriptionPlanVariation { - if (!($this->value instanceof CatalogObjectSubscriptionPlan && $this->type === 'SUBSCRIPTION_PLAN')) { + if (!($this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION')) { throw new Exception( - "Expected SUBSCRIPTION_PLAN; got " . $this->type . " with value of type " . get_debug_type($this->value), + "Expected SUBSCRIPTION_PLAN_VARIATION; got " . $this->type . " with value of type " . get_debug_type($this->value), ); } @@ -1018,151 +790,19 @@ public function asQuickAmountsSettings(): CatalogObjectQuickAmountsSettings /** * @return bool */ - public function isComponent(): bool - { - return $this->value instanceof CatalogObjectComponent && $this->type === 'COMPONENT'; - } - - /** - * @return CatalogObjectComponent - */ - public function asComponent(): CatalogObjectComponent - { - if (!($this->value instanceof CatalogObjectComponent && $this->type === 'COMPONENT')) { - throw new Exception( - "Expected COMPONENT; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isComposition(): bool - { - return $this->value instanceof CatalogObjectComposition && $this->type === 'COMPOSITION'; - } - - /** - * @return CatalogObjectComposition - */ - public function asComposition(): CatalogObjectComposition - { - if (!($this->value instanceof CatalogObjectComposition && $this->type === 'COMPOSITION')) { - throw new Exception( - "Expected COMPOSITION; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isResource(): bool - { - return $this->value instanceof CatalogObjectResource && $this->type === 'RESOURCE'; - } - - /** - * @return CatalogObjectResource - */ - public function asResource(): CatalogObjectResource - { - if (!($this->value instanceof CatalogObjectResource && $this->type === 'RESOURCE')) { - throw new Exception( - "Expected RESOURCE; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isCheckoutLink(): bool - { - return $this->value instanceof CatalogObjectCheckoutLink && $this->type === 'CHECKOUT_LINK'; - } - - /** - * @return CatalogObjectCheckoutLink - */ - public function asCheckoutLink(): CatalogObjectCheckoutLink - { - if (!($this->value instanceof CatalogObjectCheckoutLink && $this->type === 'CHECKOUT_LINK')) { - throw new Exception( - "Expected CHECKOUT_LINK; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isAddress(): bool - { - return $this->value instanceof CatalogObjectAddress && $this->type === 'ADDRESS'; - } - - /** - * @return CatalogObjectAddress - */ - public function asAddress(): CatalogObjectAddress - { - if (!($this->value instanceof CatalogObjectAddress && $this->type === 'ADDRESS')) { - throw new Exception( - "Expected ADDRESS; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isSubscriptionProduct(): bool - { - return $this->value instanceof CatalogObjectSubscriptionProduct && $this->type === 'SUBSCRIPTION_PRODUCT'; - } - - /** - * @return CatalogObjectSubscriptionProduct - */ - public function asSubscriptionProduct(): CatalogObjectSubscriptionProduct - { - if (!($this->value instanceof CatalogObjectSubscriptionProduct && $this->type === 'SUBSCRIPTION_PRODUCT')) { - throw new Exception( - "Expected SUBSCRIPTION_PRODUCT; got " . $this->type . " with value of type " . get_debug_type($this->value), - ); - } - - return $this->value; - } - - /** - * @return bool - */ - public function isSubscriptionPlanVariation(): bool + public function isSubscriptionPlan(): bool { - return $this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION'; + return $this->value instanceof CatalogObjectSubscriptionPlan && $this->type === 'SUBSCRIPTION_PLAN'; } /** - * @return CatalogObjectSubscriptionPlanVariation + * @return CatalogObjectSubscriptionPlan */ - public function asSubscriptionPlanVariation(): CatalogObjectSubscriptionPlanVariation + public function asSubscriptionPlan(): CatalogObjectSubscriptionPlan { - if (!($this->value instanceof CatalogObjectSubscriptionPlanVariation && $this->type === 'SUBSCRIPTION_PLAN_VARIATION')) { + if (!($this->value instanceof CatalogObjectSubscriptionPlan && $this->type === 'SUBSCRIPTION_PLAN')) { throw new Exception( - "Expected SUBSCRIPTION_PLAN_VARIATION; got " . $this->type . " with value of type " . get_debug_type($this->value), + "Expected SUBSCRIPTION_PLAN; got " . $this->type . " with value of type " . get_debug_type($this->value), ); } @@ -1243,18 +883,6 @@ public function jsonSerialize(): array $value = $this->asModifier()->jsonSerialize(); $result = array_merge($value, $result); break; - case 'DINING_OPTION': - $value = $this->asDiningOption()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'TAX_EXEMPTION': - $value = $this->asTaxExemption()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'SERVICE_CHARGE': - $value = $this->asServiceCharge()->jsonSerialize(); - $result = array_merge($value, $result); - break; case 'PRICING_RULE': $value = $this->asPricingRule()->jsonSerialize(); $result = array_merge($value, $result); @@ -1271,8 +899,8 @@ public function jsonSerialize(): array $value = $this->asMeasurementUnit()->jsonSerialize(); $result = array_merge($value, $result); break; - case 'SUBSCRIPTION_PLAN': - $value = $this->asSubscriptionPlan()->jsonSerialize(); + case 'SUBSCRIPTION_PLAN_VARIATION': + $value = $this->asSubscriptionPlanVariation()->jsonSerialize(); $result = array_merge($value, $result); break; case 'ITEM_OPTION': @@ -1291,32 +919,8 @@ public function jsonSerialize(): array $value = $this->asQuickAmountsSettings()->jsonSerialize(); $result = array_merge($value, $result); break; - case 'COMPONENT': - $value = $this->asComponent()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'COMPOSITION': - $value = $this->asComposition()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'RESOURCE': - $value = $this->asResource()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'CHECKOUT_LINK': - $value = $this->asCheckoutLink()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'ADDRESS': - $value = $this->asAddress()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'SUBSCRIPTION_PRODUCT': - $value = $this->asSubscriptionProduct()->jsonSerialize(); - $result = array_merge($value, $result); - break; - case 'SUBSCRIPTION_PLAN_VARIATION': - $value = $this->asSubscriptionPlanVariation()->jsonSerialize(); + case 'SUBSCRIPTION_PLAN': + $value = $this->asSubscriptionPlan()->jsonSerialize(); $result = array_merge($value, $result); break; case 'AVAILABILITY_PERIOD': @@ -1395,15 +999,6 @@ public static function jsonDeserialize(array $data): static case 'MODIFIER': $args['value'] = CatalogObjectModifier::jsonDeserialize($data); break; - case 'DINING_OPTION': - $args['value'] = CatalogObjectDiningOption::jsonDeserialize($data); - break; - case 'TAX_EXEMPTION': - $args['value'] = CatalogObjectTaxExemption::jsonDeserialize($data); - break; - case 'SERVICE_CHARGE': - $args['value'] = CatalogObjectServiceCharge::jsonDeserialize($data); - break; case 'PRICING_RULE': $args['value'] = CatalogObjectPricingRule::jsonDeserialize($data); break; @@ -1416,8 +1011,8 @@ public static function jsonDeserialize(array $data): static case 'MEASUREMENT_UNIT': $args['value'] = CatalogObjectMeasurementUnit::jsonDeserialize($data); break; - case 'SUBSCRIPTION_PLAN': - $args['value'] = CatalogObjectSubscriptionPlan::jsonDeserialize($data); + case 'SUBSCRIPTION_PLAN_VARIATION': + $args['value'] = CatalogObjectSubscriptionPlanVariation::jsonDeserialize($data); break; case 'ITEM_OPTION': $args['value'] = CatalogObjectItemOption::jsonDeserialize($data); @@ -1431,26 +1026,8 @@ public static function jsonDeserialize(array $data): static case 'QUICK_AMOUNTS_SETTINGS': $args['value'] = CatalogObjectQuickAmountsSettings::jsonDeserialize($data); break; - case 'COMPONENT': - $args['value'] = CatalogObjectComponent::jsonDeserialize($data); - break; - case 'COMPOSITION': - $args['value'] = CatalogObjectComposition::jsonDeserialize($data); - break; - case 'RESOURCE': - $args['value'] = CatalogObjectResource::jsonDeserialize($data); - break; - case 'CHECKOUT_LINK': - $args['value'] = CatalogObjectCheckoutLink::jsonDeserialize($data); - break; - case 'ADDRESS': - $args['value'] = CatalogObjectAddress::jsonDeserialize($data); - break; - case 'SUBSCRIPTION_PRODUCT': - $args['value'] = CatalogObjectSubscriptionProduct::jsonDeserialize($data); - break; - case 'SUBSCRIPTION_PLAN_VARIATION': - $args['value'] = CatalogObjectSubscriptionPlanVariation::jsonDeserialize($data); + case 'SUBSCRIPTION_PLAN': + $args['value'] = CatalogObjectSubscriptionPlan::jsonDeserialize($data); break; case 'AVAILABILITY_PERIOD': $args['value'] = CatalogObjectAvailabilityPeriod::jsonDeserialize($data); diff --git a/src/Types/CatalogObjectAddress.php b/src/Types/CatalogObjectAddress.php deleted file mode 100644 index 12567988..00000000 --- a/src/Types/CatalogObjectAddress.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectCheckoutLink.php b/src/Types/CatalogObjectCheckoutLink.php deleted file mode 100644 index 96378b04..00000000 --- a/src/Types/CatalogObjectCheckoutLink.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectComponent.php b/src/Types/CatalogObjectComponent.php deleted file mode 100644 index d5554063..00000000 --- a/src/Types/CatalogObjectComponent.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectComposition.php b/src/Types/CatalogObjectComposition.php deleted file mode 100644 index 0a461432..00000000 --- a/src/Types/CatalogObjectComposition.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectDiningOption.php b/src/Types/CatalogObjectDiningOption.php deleted file mode 100644 index 825343c6..00000000 --- a/src/Types/CatalogObjectDiningOption.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectResource.php b/src/Types/CatalogObjectResource.php deleted file mode 100644 index d11b4641..00000000 --- a/src/Types/CatalogObjectResource.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectServiceCharge.php b/src/Types/CatalogObjectServiceCharge.php deleted file mode 100644 index 681b1221..00000000 --- a/src/Types/CatalogObjectServiceCharge.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectSubscriptionProduct.php b/src/Types/CatalogObjectSubscriptionProduct.php deleted file mode 100644 index 91a31e96..00000000 --- a/src/Types/CatalogObjectSubscriptionProduct.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CatalogObjectTaxExemption.php b/src/Types/CatalogObjectTaxExemption.php deleted file mode 100644 index 5fbbadf2..00000000 --- a/src/Types/CatalogObjectTaxExemption.php +++ /dev/null @@ -1,49 +0,0 @@ -, - * catalogV1Ids?: ?array, - * presentAtAllLocations?: ?bool, - * presentAtLocationIds?: ?array, - * absentAtLocationIds?: ?array, - * imageId?: ?string, - * } $values - */ - public function __construct( - array $values, - ) { - $this->id = $values['id']; - $this->updatedAt = $values['updatedAt'] ?? null; - $this->version = $values['version'] ?? null; - $this->isDeleted = $values['isDeleted'] ?? null; - $this->customAttributeValues = $values['customAttributeValues'] ?? null; - $this->catalogV1Ids = $values['catalogV1Ids'] ?? null; - $this->presentAtAllLocations = $values['presentAtAllLocations'] ?? null; - $this->presentAtLocationIds = $values['presentAtLocationIds'] ?? null; - $this->absentAtLocationIds = $values['absentAtLocationIds'] ?? null; - $this->imageId = $values['imageId'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/CreateInvoiceAttachmentRequestData.php b/src/Types/CreateInvoiceAttachmentRequestData.php new file mode 100644 index 00000000..7b502d5f --- /dev/null +++ b/src/Types/CreateInvoiceAttachmentRequestData.php @@ -0,0 +1,82 @@ +idempotencyKey = $values['idempotencyKey'] ?? null; + $this->description = $values['description'] ?? null; + } + + /** + * @return ?string + */ + public function getIdempotencyKey(): ?string + { + return $this->idempotencyKey; + } + + /** + * @param ?string $value + */ + public function setIdempotencyKey(?string $value = null): self + { + $this->idempotencyKey = $value; + return $this; + } + + /** + * @return ?string + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * @param ?string $value + */ + public function setDescription(?string $value = null): self + { + $this->description = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CreateScheduledShiftResponse.php b/src/Types/CreateScheduledShiftResponse.php new file mode 100644 index 00000000..3c3e80e9 --- /dev/null +++ b/src/Types/CreateScheduledShiftResponse.php @@ -0,0 +1,85 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * scheduledShift?: ?ScheduledShift, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->scheduledShift = $values['scheduledShift'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?ScheduledShift + */ + public function getScheduledShift(): ?ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ?ScheduledShift $value + */ + public function setScheduledShift(?ScheduledShift $value = null): self + { + $this->scheduledShift = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/CreateTimecardResponse.php b/src/Types/CreateTimecardResponse.php new file mode 100644 index 00000000..fceaab12 --- /dev/null +++ b/src/Types/CreateTimecardResponse.php @@ -0,0 +1,82 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * timecard?: ?Timecard, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->timecard = $values['timecard'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?Timecard + */ + public function getTimecard(): ?Timecard + { + return $this->timecard; + } + + /** + * @param ?Timecard $value + */ + public function setTimecard(?Timecard $value = null): self + { + $this->timecard = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/DeleteTimecardResponse.php b/src/Types/DeleteTimecardResponse.php new file mode 100644 index 00000000..cef81e43 --- /dev/null +++ b/src/Types/DeleteTimecardResponse.php @@ -0,0 +1,56 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/PublishScheduledShiftResponse.php b/src/Types/PublishScheduledShiftResponse.php new file mode 100644 index 00000000..9e5d9b1d --- /dev/null +++ b/src/Types/PublishScheduledShiftResponse.php @@ -0,0 +1,81 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * scheduledShift?: ?ScheduledShift, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->scheduledShift = $values['scheduledShift'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?ScheduledShift + */ + public function getScheduledShift(): ?ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ?ScheduledShift $value + */ + public function setScheduledShift(?ScheduledShift $value = null): self + { + $this->scheduledShift = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/RetrieveScheduledShiftResponse.php b/src/Types/RetrieveScheduledShiftResponse.php new file mode 100644 index 00000000..b64525b6 --- /dev/null +++ b/src/Types/RetrieveScheduledShiftResponse.php @@ -0,0 +1,81 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * scheduledShift?: ?ScheduledShift, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->scheduledShift = $values['scheduledShift'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?ScheduledShift + */ + public function getScheduledShift(): ?ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ?ScheduledShift $value + */ + public function setScheduledShift(?ScheduledShift $value = null): self + { + $this->scheduledShift = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/RetrieveTimecardResponse.php b/src/Types/RetrieveTimecardResponse.php new file mode 100644 index 00000000..aea2e234 --- /dev/null +++ b/src/Types/RetrieveTimecardResponse.php @@ -0,0 +1,82 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * timecard?: ?Timecard, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->timecard = $values['timecard'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?Timecard + */ + public function getTimecard(): ?Timecard + { + return $this->timecard; + } + + /** + * @param ?Timecard $value + */ + public function setTimecard(?Timecard $value = null): self + { + $this->timecard = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShift.php b/src/Types/ScheduledShift.php new file mode 100644 index 00000000..05570d1a --- /dev/null +++ b/src/Types/ScheduledShift.php @@ -0,0 +1,191 @@ +id = $values['id'] ?? null; + $this->draftShiftDetails = $values['draftShiftDetails'] ?? null; + $this->publishedShiftDetails = $values['publishedShiftDetails'] ?? null; + $this->version = $values['version'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; + $this->updatedAt = $values['updatedAt'] ?? null; + } + + /** + * @return ?string + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * @param ?string $value + */ + public function setId(?string $value = null): self + { + $this->id = $value; + return $this; + } + + /** + * @return ?ScheduledShiftDetails + */ + public function getDraftShiftDetails(): ?ScheduledShiftDetails + { + return $this->draftShiftDetails; + } + + /** + * @param ?ScheduledShiftDetails $value + */ + public function setDraftShiftDetails(?ScheduledShiftDetails $value = null): self + { + $this->draftShiftDetails = $value; + return $this; + } + + /** + * @return ?ScheduledShiftDetails + */ + public function getPublishedShiftDetails(): ?ScheduledShiftDetails + { + return $this->publishedShiftDetails; + } + + /** + * @param ?ScheduledShiftDetails $value + */ + public function setPublishedShiftDetails(?ScheduledShiftDetails $value = null): self + { + $this->publishedShiftDetails = $value; + return $this; + } + + /** + * @return ?int + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * @param ?int $value + */ + public function setVersion(?int $value = null): self + { + $this->version = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCreatedAt(): ?string + { + return $this->createdAt; + } + + /** + * @param ?string $value + */ + public function setCreatedAt(?string $value = null): self + { + $this->createdAt = $value; + return $this; + } + + /** + * @return ?string + */ + public function getUpdatedAt(): ?string + { + return $this->updatedAt; + } + + /** + * @param ?string $value + */ + public function setUpdatedAt(?string $value = null): self + { + $this->updatedAt = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftDetails.php b/src/Types/ScheduledShiftDetails.php new file mode 100644 index 00000000..dda2955d --- /dev/null +++ b/src/Types/ScheduledShiftDetails.php @@ -0,0 +1,245 @@ +teamMemberId = $values['teamMemberId'] ?? null; + $this->locationId = $values['locationId'] ?? null; + $this->jobId = $values['jobId'] ?? null; + $this->startAt = $values['startAt'] ?? null; + $this->endAt = $values['endAt'] ?? null; + $this->notes = $values['notes'] ?? null; + $this->isDeleted = $values['isDeleted'] ?? null; + $this->timezone = $values['timezone'] ?? null; + } + + /** + * @return ?string + */ + public function getTeamMemberId(): ?string + { + return $this->teamMemberId; + } + + /** + * @param ?string $value + */ + public function setTeamMemberId(?string $value = null): self + { + $this->teamMemberId = $value; + return $this; + } + + /** + * @return ?string + */ + public function getLocationId(): ?string + { + return $this->locationId; + } + + /** + * @param ?string $value + */ + public function setLocationId(?string $value = null): self + { + $this->locationId = $value; + return $this; + } + + /** + * @return ?string + */ + public function getJobId(): ?string + { + return $this->jobId; + } + + /** + * @param ?string $value + */ + public function setJobId(?string $value = null): self + { + $this->jobId = $value; + return $this; + } + + /** + * @return ?string + */ + public function getStartAt(): ?string + { + return $this->startAt; + } + + /** + * @param ?string $value + */ + public function setStartAt(?string $value = null): self + { + $this->startAt = $value; + return $this; + } + + /** + * @return ?string + */ + public function getEndAt(): ?string + { + return $this->endAt; + } + + /** + * @param ?string $value + */ + public function setEndAt(?string $value = null): self + { + $this->endAt = $value; + return $this; + } + + /** + * @return ?string + */ + public function getNotes(): ?string + { + return $this->notes; + } + + /** + * @param ?string $value + */ + public function setNotes(?string $value = null): self + { + $this->notes = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getIsDeleted(): ?bool + { + return $this->isDeleted; + } + + /** + * @param ?bool $value + */ + public function setIsDeleted(?bool $value = null): self + { + $this->isDeleted = $value; + return $this; + } + + /** + * @return ?string + */ + public function getTimezone(): ?string + { + return $this->timezone; + } + + /** + * @param ?string $value + */ + public function setTimezone(?string $value = null): self + { + $this->timezone = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftFilter.php b/src/Types/ScheduledShiftFilter.php new file mode 100644 index 00000000..c8a64fa4 --- /dev/null +++ b/src/Types/ScheduledShiftFilter.php @@ -0,0 +1,238 @@ + $locationIds + */ + #[JsonProperty('location_ids'), ArrayType(['string'])] + private ?array $locationIds; + + /** + * Return shifts whose `start_at` time is within the specified + * time range (inclusive). + * + * @var ?TimeRange $start + */ + #[JsonProperty('start')] + private ?TimeRange $start; + + /** + * Return shifts whose `end_at` time is within the specified + * time range (inclusive). + * + * @var ?TimeRange $end + */ + #[JsonProperty('end')] + private ?TimeRange $end; + + /** + * @var ?ScheduledShiftWorkday $workday Return shifts based on a workday date range. + */ + #[JsonProperty('workday')] + private ?ScheduledShiftWorkday $workday; + + /** + * Return shifts assigned to specified team members. If needed, call + * [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) to get team member IDs. + * + * To return only the shifts assigned to the specified team members, include the + * `assignment_status` filter in the query. Otherwise, all unassigned shifts are + * returned along with shifts assigned to the specified team members. + * + * @var ?array $teamMemberIds + */ + #[JsonProperty('team_member_ids'), ArrayType(['string'])] + private ?array $teamMemberIds; + + /** + * Return shifts based on whether a team member is assigned. A shift is + * assigned if the `team_member_id` field is populated in the `draft_shift_details` + * or `published_shift details` field of the shift. + * + * To return only draft or published shifts, include the `scheduled_shift_statuses` + * filter in the query. + * See [ScheduledShiftFilterAssignmentStatus](#type-scheduledshiftfilterassignmentstatus) for possible values + * + * @var ?value-of $assignmentStatus + */ + #[JsonProperty('assignment_status')] + private ?string $assignmentStatus; + + /** + * Return shifts based on the draft or published status of the shift. + * A shift is published if the `published_shift_details` field is present. + * + * Note that shifts with `draft_shift_details.is_deleted` set to `true` are ignored + * with the `DRAFT` filter. + * See [ScheduledShiftFilterScheduledShiftStatus](#type-scheduledshiftfilterscheduledshiftstatus) for possible values + * + * @var ?array> $scheduledShiftStatuses + */ + #[JsonProperty('scheduled_shift_statuses'), ArrayType(['string'])] + private ?array $scheduledShiftStatuses; + + /** + * @param array{ + * locationIds?: ?array, + * start?: ?TimeRange, + * end?: ?TimeRange, + * workday?: ?ScheduledShiftWorkday, + * teamMemberIds?: ?array, + * assignmentStatus?: ?value-of, + * scheduledShiftStatuses?: ?array>, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->locationIds = $values['locationIds'] ?? null; + $this->start = $values['start'] ?? null; + $this->end = $values['end'] ?? null; + $this->workday = $values['workday'] ?? null; + $this->teamMemberIds = $values['teamMemberIds'] ?? null; + $this->assignmentStatus = $values['assignmentStatus'] ?? null; + $this->scheduledShiftStatuses = $values['scheduledShiftStatuses'] ?? null; + } + + /** + * @return ?array + */ + public function getLocationIds(): ?array + { + return $this->locationIds; + } + + /** + * @param ?array $value + */ + public function setLocationIds(?array $value = null): self + { + $this->locationIds = $value; + return $this; + } + + /** + * @return ?TimeRange + */ + public function getStart(): ?TimeRange + { + return $this->start; + } + + /** + * @param ?TimeRange $value + */ + public function setStart(?TimeRange $value = null): self + { + $this->start = $value; + return $this; + } + + /** + * @return ?TimeRange + */ + public function getEnd(): ?TimeRange + { + return $this->end; + } + + /** + * @param ?TimeRange $value + */ + public function setEnd(?TimeRange $value = null): self + { + $this->end = $value; + return $this; + } + + /** + * @return ?ScheduledShiftWorkday + */ + public function getWorkday(): ?ScheduledShiftWorkday + { + return $this->workday; + } + + /** + * @param ?ScheduledShiftWorkday $value + */ + public function setWorkday(?ScheduledShiftWorkday $value = null): self + { + $this->workday = $value; + return $this; + } + + /** + * @return ?array + */ + public function getTeamMemberIds(): ?array + { + return $this->teamMemberIds; + } + + /** + * @param ?array $value + */ + public function setTeamMemberIds(?array $value = null): self + { + $this->teamMemberIds = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getAssignmentStatus(): ?string + { + return $this->assignmentStatus; + } + + /** + * @param ?value-of $value + */ + public function setAssignmentStatus(?string $value = null): self + { + $this->assignmentStatus = $value; + return $this; + } + + /** + * @return ?array> + */ + public function getScheduledShiftStatuses(): ?array + { + return $this->scheduledShiftStatuses; + } + + /** + * @param ?array> $value + */ + public function setScheduledShiftStatuses(?array $value = null): self + { + $this->scheduledShiftStatuses = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftFilterAssignmentStatus.php b/src/Types/ScheduledShiftFilterAssignmentStatus.php new file mode 100644 index 00000000..40f84bc3 --- /dev/null +++ b/src/Types/ScheduledShiftFilterAssignmentStatus.php @@ -0,0 +1,9 @@ +filter = $values['filter'] ?? null; + $this->sort = $values['sort'] ?? null; + } + + /** + * @return ?ScheduledShiftFilter + */ + public function getFilter(): ?ScheduledShiftFilter + { + return $this->filter; + } + + /** + * @param ?ScheduledShiftFilter $value + */ + public function setFilter(?ScheduledShiftFilter $value = null): self + { + $this->filter = $value; + return $this; + } + + /** + * @return ?ScheduledShiftSort + */ + public function getSort(): ?ScheduledShiftSort + { + return $this->sort; + } + + /** + * @param ?ScheduledShiftSort $value + */ + public function setSort(?ScheduledShiftSort $value = null): self + { + $this->sort = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftSort.php b/src/Types/ScheduledShiftSort.php new file mode 100644 index 00000000..6210002f --- /dev/null +++ b/src/Types/ScheduledShiftSort.php @@ -0,0 +1,86 @@ + $field + */ + #[JsonProperty('field')] + private ?string $field; + + /** + * The order in which results are returned. The default value is `ASC`. + * See [SortOrder](#type-sortorder) for possible values + * + * @var ?value-of $order + */ + #[JsonProperty('order')] + private ?string $order; + + /** + * @param array{ + * field?: ?value-of, + * order?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->field = $values['field'] ?? null; + $this->order = $values['order'] ?? null; + } + + /** + * @return ?value-of + */ + public function getField(): ?string + { + return $this->field; + } + + /** + * @param ?value-of $value + */ + public function setField(?string $value = null): self + { + $this->field = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getOrder(): ?string + { + return $this->order; + } + + /** + * @param ?value-of $value + */ + public function setOrder(?string $value = null): self + { + $this->order = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftSortField.php b/src/Types/ScheduledShiftSortField.php new file mode 100644 index 00000000..c5ec8c88 --- /dev/null +++ b/src/Types/ScheduledShiftSortField.php @@ -0,0 +1,11 @@ + $matchScheduledShiftsBy + */ + #[JsonProperty('match_scheduled_shifts_by')] + private ?string $matchScheduledShiftsBy; + + /** + * Location-specific timezones convert workdays to datetime filters. + * Every location included in the query must have a timezone or this field + * must be provided as a fallback. Format: the IANA timezone database + * identifier for the relevant timezone. + * + * @var ?string $defaultTimezone + */ + #[JsonProperty('default_timezone')] + private ?string $defaultTimezone; + + /** + * @param array{ + * dateRange?: ?DateRange, + * matchScheduledShiftsBy?: ?value-of, + * defaultTimezone?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->dateRange = $values['dateRange'] ?? null; + $this->matchScheduledShiftsBy = $values['matchScheduledShiftsBy'] ?? null; + $this->defaultTimezone = $values['defaultTimezone'] ?? null; + } + + /** + * @return ?DateRange + */ + public function getDateRange(): ?DateRange + { + return $this->dateRange; + } + + /** + * @param ?DateRange $value + */ + public function setDateRange(?DateRange $value = null): self + { + $this->dateRange = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getMatchScheduledShiftsBy(): ?string + { + return $this->matchScheduledShiftsBy; + } + + /** + * @param ?value-of $value + */ + public function setMatchScheduledShiftsBy(?string $value = null): self + { + $this->matchScheduledShiftsBy = $value; + return $this; + } + + /** + * @return ?string + */ + public function getDefaultTimezone(): ?string + { + return $this->defaultTimezone; + } + + /** + * @param ?string $value + */ + public function setDefaultTimezone(?string $value = null): self + { + $this->defaultTimezone = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ScheduledShiftWorkdayMatcher.php b/src/Types/ScheduledShiftWorkdayMatcher.php new file mode 100644 index 00000000..c886ce37 --- /dev/null +++ b/src/Types/ScheduledShiftWorkdayMatcher.php @@ -0,0 +1,10 @@ + $scheduledShifts A paginated list of scheduled shifts that match the query conditions. + */ + #[JsonProperty('scheduled_shifts'), ArrayType([ScheduledShift::class])] + private ?array $scheduledShifts; + + /** + * The pagination cursor used to retrieve the next page of results. This field is present + * only if additional results are available. + * + * @var ?string $cursor + */ + #[JsonProperty('cursor')] + private ?string $cursor; + + /** + * @var ?array $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * scheduledShifts?: ?array, + * cursor?: ?string, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->scheduledShifts = $values['scheduledShifts'] ?? null; + $this->cursor = $values['cursor'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?array + */ + public function getScheduledShifts(): ?array + { + return $this->scheduledShifts; + } + + /** + * @param ?array $value + */ + public function setScheduledShifts(?array $value = null): self + { + $this->scheduledShifts = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * @param ?string $value + */ + public function setCursor(?string $value = null): self + { + $this->cursor = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/SearchTimecardsResponse.php b/src/Types/SearchTimecardsResponse.php new file mode 100644 index 00000000..031106ca --- /dev/null +++ b/src/Types/SearchTimecardsResponse.php @@ -0,0 +1,107 @@ + $timecards Timecards. + */ + #[JsonProperty('timecards'), ArrayType([Timecard::class])] + private ?array $timecards; + + /** + * @var ?string $cursor An opaque cursor for fetching the next page. + */ + #[JsonProperty('cursor')] + private ?string $cursor; + + /** + * @var ?array $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * timecards?: ?array, + * cursor?: ?string, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->timecards = $values['timecards'] ?? null; + $this->cursor = $values['cursor'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?array + */ + public function getTimecards(): ?array + { + return $this->timecards; + } + + /** + * @param ?array $value + */ + public function setTimecards(?array $value = null): self + { + $this->timecards = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCursor(): ?string + { + return $this->cursor; + } + + /** + * @param ?string $value + */ + public function setCursor(?string $value = null): self + { + $this->cursor = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/Shift.php b/src/Types/Shift.php index 73140c1b..2a86f1b6 100644 --- a/src/Types/Shift.php +++ b/src/Types/Shift.php @@ -10,6 +10,9 @@ * A record of the hourly rate, start, and end times for a single work shift * for an employee. This might include a record of the start and end times for breaks * taken during the shift. + * + * Deprecated at Square API version 2025-05-21. Replaced by [Timecard](entity:Timecard). + * See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class Shift extends JsonSerializableType { diff --git a/src/Types/ShiftFilter.php b/src/Types/ShiftFilter.php index 89ccc3a5..7dd6f20b 100644 --- a/src/Types/ShiftFilter.php +++ b/src/Types/ShiftFilter.php @@ -9,6 +9,8 @@ /** * Defines a filter used in a search for `Shift` records. `AND` logic is * used by Square's servers to apply each filter property specified. + * + * Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class ShiftFilter extends JsonSerializableType { diff --git a/src/Types/ShiftQuery.php b/src/Types/ShiftQuery.php index e3b9a93c..ac352072 100644 --- a/src/Types/ShiftQuery.php +++ b/src/Types/ShiftQuery.php @@ -7,6 +7,8 @@ /** * The parameters of a `Shift` search query, which includes filter and sort options. + * + * Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class ShiftQuery extends JsonSerializableType { diff --git a/src/Types/ShiftSort.php b/src/Types/ShiftSort.php index 6c764d7d..7cda7907 100644 --- a/src/Types/ShiftSort.php +++ b/src/Types/ShiftSort.php @@ -7,6 +7,8 @@ /** * Sets the sort order of search results. + * + * Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class ShiftSort extends JsonSerializableType { diff --git a/src/Types/ShiftWage.php b/src/Types/ShiftWage.php index 9965f8a3..3f44bfd0 100644 --- a/src/Types/ShiftWage.php +++ b/src/Types/ShiftWage.php @@ -7,6 +7,8 @@ /** * The hourly wage rate used to compensate an employee for this shift. + * + * Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class ShiftWage extends JsonSerializableType { @@ -27,7 +29,7 @@ class ShiftWage extends JsonSerializableType /** * The id of the job performed during this shift. Square - * labor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job. + * labor-reporting UIs might group shifts together by id. * * @var ?string $jobId */ diff --git a/src/Types/ShiftWorkday.php b/src/Types/ShiftWorkday.php index 4aee1dc9..3a3eae17 100644 --- a/src/Types/ShiftWorkday.php +++ b/src/Types/ShiftWorkday.php @@ -8,6 +8,8 @@ /** * A `Shift` search query filter parameter that sets a range of days that * a `Shift` must start or end in before passing the filter condition. + * + * Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). */ class ShiftWorkday extends JsonSerializableType { diff --git a/src/Types/TeamMemberWage.php b/src/Types/TeamMemberWage.php index 2638d2a3..7a7ed0c8 100644 --- a/src/Types/TeamMemberWage.php +++ b/src/Types/TeamMemberWage.php @@ -6,8 +6,9 @@ use Square\Core\Json\JsonProperty; /** - * The hourly wage rate that a team member earns on a `Shift` for doing the job - * specified by the `title` property of this object. + * Job and wage information for a [team member](entity:TeamMember). + * This convenience object provides details needed to specify the `wage` + * field for a [timecard](entity:Timecard). */ class TeamMemberWage extends JsonSerializableType { @@ -39,10 +40,7 @@ class TeamMemberWage extends JsonSerializableType private ?Money $hourlyRate; /** - * An identifier for the job that this wage relates to. This cannot be - * used to retrieve the job. - * - * @var ?string $jobId + * @var ?string $jobId An identifier for the [job](entity:Job) that this wage relates to. */ #[JsonProperty('job_id')] private ?string $jobId; diff --git a/src/Types/Timecard.php b/src/Types/Timecard.php new file mode 100644 index 00000000..ac44e4e6 --- /dev/null +++ b/src/Types/Timecard.php @@ -0,0 +1,381 @@ + $breaks A list of all the paid or unpaid breaks that were taken during this timecard. + */ + #[JsonProperty('breaks'), ArrayType([Break_::class])] + private ?array $breaks; + + /** + * Describes the working state of the timecard. + * See [TimecardStatus](#type-timecardstatus) for possible values + * + * @var ?value-of $status + */ + #[JsonProperty('status')] + private ?string $status; + + /** + * **Read only** The current version of the timecard, which is incremented with each update. + * This field is used for [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control to ensure that requests don't overwrite data from another request. + * + * @var ?int $version + */ + #[JsonProperty('version')] + private ?int $version; + + /** + * @var ?string $createdAt The timestamp of when the timecard was created, in RFC 3339 format presented as UTC. + */ + #[JsonProperty('created_at')] + private ?string $createdAt; + + /** + * @var ?string $updatedAt The timestamp of when the timecard was last updated, in RFC 3339 format presented as UTC. + */ + #[JsonProperty('updated_at')] + private ?string $updatedAt; + + /** + * @var string $teamMemberId The ID of the [team member](entity:TeamMember) this timecard belongs to. + */ + #[JsonProperty('team_member_id')] + private string $teamMemberId; + + /** + * @var ?Money $declaredCashTipMoney The cash tips declared by the team member for this timecard. + */ + #[JsonProperty('declared_cash_tip_money')] + private ?Money $declaredCashTipMoney; + + /** + * @param array{ + * locationId: string, + * startAt: string, + * teamMemberId: string, + * id?: ?string, + * timezone?: ?string, + * endAt?: ?string, + * wage?: ?TimecardWage, + * breaks?: ?array, + * status?: ?value-of, + * version?: ?int, + * createdAt?: ?string, + * updatedAt?: ?string, + * declaredCashTipMoney?: ?Money, + * } $values + */ + public function __construct( + array $values, + ) { + $this->id = $values['id'] ?? null; + $this->locationId = $values['locationId']; + $this->timezone = $values['timezone'] ?? null; + $this->startAt = $values['startAt']; + $this->endAt = $values['endAt'] ?? null; + $this->wage = $values['wage'] ?? null; + $this->breaks = $values['breaks'] ?? null; + $this->status = $values['status'] ?? null; + $this->version = $values['version'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; + $this->updatedAt = $values['updatedAt'] ?? null; + $this->teamMemberId = $values['teamMemberId']; + $this->declaredCashTipMoney = $values['declaredCashTipMoney'] ?? null; + } + + /** + * @return ?string + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * @param ?string $value + */ + public function setId(?string $value = null): self + { + $this->id = $value; + return $this; + } + + /** + * @return string + */ + public function getLocationId(): string + { + return $this->locationId; + } + + /** + * @param string $value + */ + public function setLocationId(string $value): self + { + $this->locationId = $value; + return $this; + } + + /** + * @return ?string + */ + public function getTimezone(): ?string + { + return $this->timezone; + } + + /** + * @param ?string $value + */ + public function setTimezone(?string $value = null): self + { + $this->timezone = $value; + return $this; + } + + /** + * @return string + */ + public function getStartAt(): string + { + return $this->startAt; + } + + /** + * @param string $value + */ + public function setStartAt(string $value): self + { + $this->startAt = $value; + return $this; + } + + /** + * @return ?string + */ + public function getEndAt(): ?string + { + return $this->endAt; + } + + /** + * @param ?string $value + */ + public function setEndAt(?string $value = null): self + { + $this->endAt = $value; + return $this; + } + + /** + * @return ?TimecardWage + */ + public function getWage(): ?TimecardWage + { + return $this->wage; + } + + /** + * @param ?TimecardWage $value + */ + public function setWage(?TimecardWage $value = null): self + { + $this->wage = $value; + return $this; + } + + /** + * @return ?array + */ + public function getBreaks(): ?array + { + return $this->breaks; + } + + /** + * @param ?array $value + */ + public function setBreaks(?array $value = null): self + { + $this->breaks = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getStatus(): ?string + { + return $this->status; + } + + /** + * @param ?value-of $value + */ + public function setStatus(?string $value = null): self + { + $this->status = $value; + return $this; + } + + /** + * @return ?int + */ + public function getVersion(): ?int + { + return $this->version; + } + + /** + * @param ?int $value + */ + public function setVersion(?int $value = null): self + { + $this->version = $value; + return $this; + } + + /** + * @return ?string + */ + public function getCreatedAt(): ?string + { + return $this->createdAt; + } + + /** + * @param ?string $value + */ + public function setCreatedAt(?string $value = null): self + { + $this->createdAt = $value; + return $this; + } + + /** + * @return ?string + */ + public function getUpdatedAt(): ?string + { + return $this->updatedAt; + } + + /** + * @param ?string $value + */ + public function setUpdatedAt(?string $value = null): self + { + $this->updatedAt = $value; + return $this; + } + + /** + * @return string + */ + public function getTeamMemberId(): string + { + return $this->teamMemberId; + } + + /** + * @param string $value + */ + public function setTeamMemberId(string $value): self + { + $this->teamMemberId = $value; + return $this; + } + + /** + * @return ?Money + */ + public function getDeclaredCashTipMoney(): ?Money + { + return $this->declaredCashTipMoney; + } + + /** + * @param ?Money $value + */ + public function setDeclaredCashTipMoney(?Money $value = null): self + { + $this->declaredCashTipMoney = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardFilter.php b/src/Types/TimecardFilter.php new file mode 100644 index 00000000..35ffa76a --- /dev/null +++ b/src/Types/TimecardFilter.php @@ -0,0 +1,184 @@ + $locationIds Fetch timecards for the specified location. + */ + #[JsonProperty('location_ids'), ArrayType(['string'])] + private ?array $locationIds; + + /** + * Fetch a `Timecard` instance by `Timecard.status`. + * See [TimecardFilterStatus](#type-timecardfilterstatus) for possible values + * + * @var ?value-of $status + */ + #[JsonProperty('status')] + private ?string $status; + + /** + * @var ?TimeRange $start Fetch `Timecard` instances that start in the time range - Inclusive. + */ + #[JsonProperty('start')] + private ?TimeRange $start; + + /** + * @var ?TimeRange $end Fetch the `Timecard` instances that end in the time range - Inclusive. + */ + #[JsonProperty('end')] + private ?TimeRange $end; + + /** + * @var ?TimecardWorkday $workday Fetch the `Timecard` instances based on the workday date range. + */ + #[JsonProperty('workday')] + private ?TimecardWorkday $workday; + + /** + * @var ?array $teamMemberIds Fetch timecards for the specified team members. + */ + #[JsonProperty('team_member_ids'), ArrayType(['string'])] + private ?array $teamMemberIds; + + /** + * @param array{ + * locationIds?: ?array, + * status?: ?value-of, + * start?: ?TimeRange, + * end?: ?TimeRange, + * workday?: ?TimecardWorkday, + * teamMemberIds?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->locationIds = $values['locationIds'] ?? null; + $this->status = $values['status'] ?? null; + $this->start = $values['start'] ?? null; + $this->end = $values['end'] ?? null; + $this->workday = $values['workday'] ?? null; + $this->teamMemberIds = $values['teamMemberIds'] ?? null; + } + + /** + * @return ?array + */ + public function getLocationIds(): ?array + { + return $this->locationIds; + } + + /** + * @param ?array $value + */ + public function setLocationIds(?array $value = null): self + { + $this->locationIds = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getStatus(): ?string + { + return $this->status; + } + + /** + * @param ?value-of $value + */ + public function setStatus(?string $value = null): self + { + $this->status = $value; + return $this; + } + + /** + * @return ?TimeRange + */ + public function getStart(): ?TimeRange + { + return $this->start; + } + + /** + * @param ?TimeRange $value + */ + public function setStart(?TimeRange $value = null): self + { + $this->start = $value; + return $this; + } + + /** + * @return ?TimeRange + */ + public function getEnd(): ?TimeRange + { + return $this->end; + } + + /** + * @param ?TimeRange $value + */ + public function setEnd(?TimeRange $value = null): self + { + $this->end = $value; + return $this; + } + + /** + * @return ?TimecardWorkday + */ + public function getWorkday(): ?TimecardWorkday + { + return $this->workday; + } + + /** + * @param ?TimecardWorkday $value + */ + public function setWorkday(?TimecardWorkday $value = null): self + { + $this->workday = $value; + return $this; + } + + /** + * @return ?array + */ + public function getTeamMemberIds(): ?array + { + return $this->teamMemberIds; + } + + /** + * @param ?array $value + */ + public function setTeamMemberIds(?array $value = null): self + { + $this->teamMemberIds = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardFilterStatus.php b/src/Types/TimecardFilterStatus.php new file mode 100644 index 00000000..1c67cb8b --- /dev/null +++ b/src/Types/TimecardFilterStatus.php @@ -0,0 +1,9 @@ +filter = $values['filter'] ?? null; + $this->sort = $values['sort'] ?? null; + } + + /** + * @return ?TimecardFilter + */ + public function getFilter(): ?TimecardFilter + { + return $this->filter; + } + + /** + * @param ?TimecardFilter $value + */ + public function setFilter(?TimecardFilter $value = null): self + { + $this->filter = $value; + return $this; + } + + /** + * @return ?TimecardSort + */ + public function getSort(): ?TimecardSort + { + return $this->sort; + } + + /** + * @param ?TimecardSort $value + */ + public function setSort(?TimecardSort $value = null): self + { + $this->sort = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardSort.php b/src/Types/TimecardSort.php new file mode 100644 index 00000000..06c4771f --- /dev/null +++ b/src/Types/TimecardSort.php @@ -0,0 +1,85 @@ + $field + */ + #[JsonProperty('field')] + private ?string $field; + + /** + * The order in which results are returned. Defaults to DESC. + * See [SortOrder](#type-sortorder) for possible values + * + * @var ?value-of $order + */ + #[JsonProperty('order')] + private ?string $order; + + /** + * @param array{ + * field?: ?value-of, + * order?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->field = $values['field'] ?? null; + $this->order = $values['order'] ?? null; + } + + /** + * @return ?value-of + */ + public function getField(): ?string + { + return $this->field; + } + + /** + * @param ?value-of $value + */ + public function setField(?string $value = null): self + { + $this->field = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getOrder(): ?string + { + return $this->order; + } + + /** + * @param ?value-of $value + */ + public function setOrder(?string $value = null): self + { + $this->order = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardSortField.php b/src/Types/TimecardSortField.php new file mode 100644 index 00000000..23db6531 --- /dev/null +++ b/src/Types/TimecardSortField.php @@ -0,0 +1,11 @@ +title = $values['title'] ?? null; + $this->hourlyRate = $values['hourlyRate'] ?? null; + $this->jobId = $values['jobId'] ?? null; + $this->tipEligible = $values['tipEligible'] ?? null; + } + + /** + * @return ?string + */ + public function getTitle(): ?string + { + return $this->title; + } + + /** + * @param ?string $value + */ + public function setTitle(?string $value = null): self + { + $this->title = $value; + return $this; + } + + /** + * @return ?Money + */ + public function getHourlyRate(): ?Money + { + return $this->hourlyRate; + } + + /** + * @param ?Money $value + */ + public function setHourlyRate(?Money $value = null): self + { + $this->hourlyRate = $value; + return $this; + } + + /** + * @return ?string + */ + public function getJobId(): ?string + { + return $this->jobId; + } + + /** + * @param ?string $value + */ + public function setJobId(?string $value = null): self + { + $this->jobId = $value; + return $this; + } + + /** + * @return ?bool + */ + public function getTipEligible(): ?bool + { + return $this->tipEligible; + } + + /** + * @param ?bool $value + */ + public function setTipEligible(?bool $value = null): self + { + $this->tipEligible = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardWorkday.php b/src/Types/TimecardWorkday.php new file mode 100644 index 00000000..924bb8c3 --- /dev/null +++ b/src/Types/TimecardWorkday.php @@ -0,0 +1,113 @@ + $matchTimecardsBy + */ + #[JsonProperty('match_timecards_by')] + private ?string $matchTimecardsBy; + + /** + * Location-specific timezones convert workdays to datetime filters. + * Every location included in the query must have a timezone or this field + * must be provided as a fallback. Format: the IANA timezone database + * identifier for the relevant timezone. + * + * @var ?string $defaultTimezone + */ + #[JsonProperty('default_timezone')] + private ?string $defaultTimezone; + + /** + * @param array{ + * dateRange?: ?DateRange, + * matchTimecardsBy?: ?value-of, + * defaultTimezone?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->dateRange = $values['dateRange'] ?? null; + $this->matchTimecardsBy = $values['matchTimecardsBy'] ?? null; + $this->defaultTimezone = $values['defaultTimezone'] ?? null; + } + + /** + * @return ?DateRange + */ + public function getDateRange(): ?DateRange + { + return $this->dateRange; + } + + /** + * @param ?DateRange $value + */ + public function setDateRange(?DateRange $value = null): self + { + $this->dateRange = $value; + return $this; + } + + /** + * @return ?value-of + */ + public function getMatchTimecardsBy(): ?string + { + return $this->matchTimecardsBy; + } + + /** + * @param ?value-of $value + */ + public function setMatchTimecardsBy(?string $value = null): self + { + $this->matchTimecardsBy = $value; + return $this; + } + + /** + * @return ?string + */ + public function getDefaultTimezone(): ?string + { + return $this->defaultTimezone; + } + + /** + * @param ?string $value + */ + public function setDefaultTimezone(?string $value = null): self + { + $this->defaultTimezone = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TimecardWorkdayMatcher.php b/src/Types/TimecardWorkdayMatcher.php new file mode 100644 index 00000000..83f2d476 --- /dev/null +++ b/src/Types/TimecardWorkdayMatcher.php @@ -0,0 +1,10 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * scheduledShift?: ?ScheduledShift, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->scheduledShift = $values['scheduledShift'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?ScheduledShift + */ + public function getScheduledShift(): ?ScheduledShift + { + return $this->scheduledShift; + } + + /** + * @param ?ScheduledShift $value + */ + public function setScheduledShift(?ScheduledShift $value = null): self + { + $this->scheduledShift = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/UpdateTimecardResponse.php b/src/Types/UpdateTimecardResponse.php new file mode 100644 index 00000000..0d755ff8 --- /dev/null +++ b/src/Types/UpdateTimecardResponse.php @@ -0,0 +1,82 @@ + $errors Any errors that occurred during the request. + */ + #[JsonProperty('errors'), ArrayType([Error::class])] + private ?array $errors; + + /** + * @param array{ + * timecard?: ?Timecard, + * errors?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->timecard = $values['timecard'] ?? null; + $this->errors = $values['errors'] ?? null; + } + + /** + * @return ?Timecard + */ + public function getTimecard(): ?Timecard + { + return $this->timecard; + } + + /** + * @param ?Timecard $value + */ + public function setTimecard(?Timecard $value = null): self + { + $this->timecard = $value; + return $this; + } + + /** + * @return ?array + */ + public function getErrors(): ?array + { + return $this->errors; + } + + /** + * @param ?array $value + */ + public function setErrors(?array $value = null): self + { + $this->errors = $value; + return $this; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Utils/WebhooksHelper.php b/src/Utils/WebhooksHelper.php index 659f6a14..ef10a6c4 100644 --- a/src/Utils/WebhooksHelper.php +++ b/src/Utils/WebhooksHelper.php @@ -1,4 +1,5 @@