import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Bulk-Retrieves a list of bookings by booking IDs. */ export const bulkRetrieveSquareBookings = defineSquareOperation< Square.BulkRetrieveBookingsRequest, Square.BulkRetrieveBookingsResponse >({ allowedKeys: ["bookingIds"], description: "Bulk-Retrieves a list of bookings by booking IDs.", execute: (api, input) => api.bookings.bulkRetrieveBookings(input), name: "Bulk Square Retrieve Bookings", replaySafety: "safe", requiredKeys: ["bookingIds"], scopes: ["APPOINTMENTS_READ"], }) /** Retrieves one or more team members' booking profiles. */ export const bulkRetrieveSquareTeamMemberBookingProfiles = defineSquareOperation< Square.BulkRetrieveTeamMemberBookingProfilesRequest, Square.BulkRetrieveTeamMemberBookingProfilesResponse >({ allowedKeys: ["teamMemberIds"], description: "Retrieves one or more team members' booking profiles.", execute: (api, input) => api.bookings.bulkRetrieveTeamMemberBookingProfiles(input), name: "Bulk Square Retrieve Team Member Booking Profiles", replaySafety: "safe", requiredKeys: ["teamMemberIds"], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Cancels an existing booking. */ export const cancelSquareBooking = defineSquareOperation< Square.CancelBookingRequest, Square.CancelBookingResponse >({ allowedKeys: ["bookingId", "idempotencyKey", "bookingVersion"], description: "Cancels an existing booking.", execute: (api, input) => api.bookings.cancel(input), name: "Cancel Square Booking", replaySafety: "unsafe", requiredKeys: ["bookingId"], scopes: ["APPOINTMENTS_WRITE"], }) /** Creates a booking. */ export const createSquareBooking = defineSquareOperation< Square.CreateBookingRequest, Square.CreateBookingResponse >({ allowedKeys: ["idempotencyKey", "booking"], description: "Creates a booking.", execute: (api, input) => api.bookings.create(input), name: "Create Square Booking", replaySafety: "unsafe", requiredKeys: ["booking"], scopes: ["APPOINTMENTS_WRITE"], }) /** Retrieve a collection of bookings. */ export const listSquareBookings = defineSquareOperation< Square.ListBookingsRequest, Square.ListBookingsResponse >({ allowedKeys: [ "limit", "cursor", "customerId", "teamMemberId", "locationId", "startAtMin", "startAtMax", ], description: "Retrieve a collection of bookings.", execute: (api, input) => api.bookings.list(input), name: "List Square Bookings", replaySafety: "safe", requiredKeys: [], scopes: ["APPOINTMENTS_READ"], }) /** Lists location booking profiles of a seller. */ export const listSquareLocationBookingProfiles = defineSquareOperation< Square.bookings.ListLocationProfilesRequest, Square.ListLocationBookingProfilesResponse >({ allowedKeys: ["limit", "cursor"], description: "Lists location booking profiles of a seller.", execute: (api, input) => api.bookings.locationProfiles.list(input), name: "List Square Location Booking Profiles", replaySafety: "safe", requiredKeys: [], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Lists booking profiles for team members. */ export const listSquareTeamMemberBookingProfiles = defineSquareOperation< Square.bookings.ListTeamMemberProfilesRequest, Square.ListTeamMemberBookingProfilesResponse >({ allowedKeys: ["bookableOnly", "limit", "cursor", "locationId"], description: "Lists booking profiles for team members.", execute: (api, input) => api.bookings.teamMemberProfiles.list(input), name: "List Square Team Member Booking Profiles", replaySafety: "safe", requiredKeys: [], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Retrieves a booking. */ export const retrieveSquareBooking = defineSquareOperation< Square.GetBookingsRequest, Square.GetBookingResponse >({ allowedKeys: ["bookingId"], description: "Retrieves a booking.", execute: (api, input) => api.bookings.get(input), name: "Retrieve Square Booking", replaySafety: "safe", requiredKeys: ["bookingId"], scopes: ["APPOINTMENTS_READ"], }) /** Retrieves a seller's booking profile. */ export const retrieveSquareBusinessBookingProfile = defineSquareOperation< Record, Square.GetBusinessBookingProfileResponse >({ allowedKeys: [], description: "Retrieves a seller's booking profile.", execute: (api, _input) => api.bookings.getBusinessProfile(), name: "Retrieve Square Business Booking Profile", replaySafety: "safe", requiredKeys: [], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Retrieves a seller's location booking profile. */ export const retrieveSquareLocationBookingProfile = defineSquareOperation< Square.RetrieveLocationBookingProfileRequest, Square.RetrieveLocationBookingProfileResponse >({ allowedKeys: ["locationId"], description: "Retrieves a seller's location booking profile.", execute: (api, input) => api.bookings.retrieveLocationBookingProfile(input), name: "Retrieve Square Location Booking Profile", replaySafety: "safe", requiredKeys: ["locationId"], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Retrieves a team member's booking profile. */ export const retrieveSquareTeamMemberBookingProfile = defineSquareOperation< Square.bookings.GetTeamMemberProfilesRequest, Square.GetTeamMemberBookingProfileResponse >({ allowedKeys: ["teamMemberId"], description: "Retrieves a team member's booking profile.", execute: (api, input) => api.bookings.teamMemberProfiles.get(input), name: "Retrieve Square Team Member Booking Profile", replaySafety: "safe", requiredKeys: ["teamMemberId"], scopes: ["APPOINTMENTS_BUSINESS_SETTINGS_READ"], }) /** Searches for availabilities for booking. */ export const searchSquareAvailability = defineSquareOperation< Square.SearchAvailabilityRequest, Square.SearchAvailabilityResponse >({ allowedKeys: ["query"], description: "Searches for availabilities for booking.", execute: (api, input) => api.bookings.searchAvailability(input), name: "Search Square Availability", replaySafety: "safe", requiredKeys: ["query"], scopes: ["APPOINTMENTS_READ"], }) /** Updates a booking. */ export const updateSquareBooking = defineSquareOperation< Square.UpdateBookingRequest, Square.UpdateBookingResponse >({ allowedKeys: ["bookingId", "idempotencyKey", "booking"], description: "Updates a booking.", execute: (api, input) => api.bookings.update(input), name: "Update Square Booking", replaySafety: "safe", requiredKeys: ["bookingId", "booking"], scopes: ["APPOINTMENTS_WRITE"], })