import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Applies adjustments and counts to the provided item quantities. */ export const batchChangeSquareInventory = defineSquareOperation< Square.BatchChangeInventoryRequest, Square.BatchChangeInventoryResponse >({ allowedKeys: ["idempotencyKey", "changes", "ignoreUnchangedCounts"], description: "Applies adjustments and counts to the provided item quantities.", execute: (api, input) => api.inventory.batchCreateChanges(input), name: "Batch Square Change Inventory", replaySafety: "safe", requiredKeys: ["idempotencyKey"], scopes: ["INVENTORY_WRITE"], }) /** * Returns historical physical counts and adjustments based on the provided * filter criteria. */ export const batchRetrieveSquareInventoryChanges = defineSquareOperation< Square.BatchRetrieveInventoryChangesRequest, Square.BatchGetInventoryChangesResponse >({ allowedKeys: [ "catalogObjectIds", "locationIds", "types", "states", "updatedAfter", "updatedBefore", "cursor", "limit", "sort", "reasonIds", ], description: "Returns historical physical counts and adjustments based on the provided filter criteria.", execute: (api, input) => api.inventory.batchGetChanges(input), name: "Batch Square Retrieve Inventory Changes", replaySafety: "safe", requiredKeys: [], scopes: ["INVENTORY_READ"], }) /** * Returns current counts for the provided * [CatalogObject](entity:CatalogObject)s at the requested * [Location](entity:Location)s. */ export const batchRetrieveSquareInventoryCounts = defineSquareOperation< Square.BatchGetInventoryCountsRequest, Square.BatchGetInventoryCountsResponse >({ allowedKeys: [ "catalogObjectIds", "locationIds", "updatedAfter", "cursor", "states", "limit", ], description: "Returns current counts for the provided [CatalogObject](entity:CatalogObject)s at the requested [Location](entity:Location)s.", execute: (api, input) => api.inventory.batchGetCounts(input), name: "Batch Square Retrieve Inventory Counts", replaySafety: "safe", requiredKeys: [], scopes: ["INVENTORY_READ"], }) /** Creates a custom inventory adjustment reason. */ export const createSquareInventoryAdjustmentReason = defineSquareOperation< Square.CreateInventoryAdjustmentReasonRequest, Square.CreateInventoryAdjustmentReasonResponse >({ allowedKeys: ["idempotencyKey", "adjustmentReason"], description: "Creates a custom inventory adjustment reason.", execute: (api, input) => api.inventory.createInventoryAdjustmentReason(input), name: "Create Square Inventory Adjustment Reason", replaySafety: "safe", requiredKeys: ["idempotencyKey", "adjustmentReason"], scopes: ["INVENTORY_WRITE"], }) /** Soft deletes a custom inventory adjustment reason. */ export const deleteSquareInventoryAdjustmentReason = defineSquareOperation< Square.DeleteInventoryAdjustmentReasonRequest, Square.DeleteInventoryAdjustmentReasonResponse >({ allowedKeys: ["reasonId"], description: "Soft deletes a custom inventory adjustment reason.", execute: (api, input) => api.inventory.deleteInventoryAdjustmentReason(input), name: "Delete Square Inventory Adjustment Reason", replaySafety: "unsafe", requiredKeys: ["reasonId"], scopes: ["INVENTORY_WRITE"], }) /** * Returns the standard and custom inventory adjustment reasons available to the * seller. */ export const listSquareInventoryAdjustmentReasons = defineSquareOperation< Square.ListInventoryAdjustmentReasonsRequest, Square.ListInventoryAdjustmentReasonsResponse >({ allowedKeys: ["includeDeleted", "includeSystemCodes"], description: "Returns the standard and custom inventory adjustment reasons available to the seller.", execute: (api, input) => api.inventory.listInventoryAdjustmentReasons(input), name: "List Square Inventory Adjustment Reasons", replaySafety: "safe", requiredKeys: [], scopes: ["INVENTORY_READ"], }) /** Restores a soft-deleted custom inventory adjustment reason. */ export const restoreSquareInventoryAdjustmentReason = defineSquareOperation< Square.RestoreInventoryAdjustmentReasonRequest, Square.RestoreInventoryAdjustmentReasonResponse >({ allowedKeys: ["reasonId"], description: "Restores a soft-deleted custom inventory adjustment reason.", execute: (api, input) => api.inventory.restoreInventoryAdjustmentReason(input), name: "Restore Square Inventory Adjustment Reason", replaySafety: "unsafe", requiredKeys: ["reasonId"], scopes: ["INVENTORY_WRITE"], }) /** * Returns the [InventoryAdjustment](entity:InventoryAdjustment) object with the * provided `adjustment_id`. */ export const retrieveSquareInventoryAdjustment = defineSquareOperation< Square.GetAdjustmentInventoryRequest, Square.GetInventoryAdjustmentResponse >({ allowedKeys: ["adjustmentId"], description: "Returns the [InventoryAdjustment](entity:InventoryAdjustment) object with the provided `adjustment_id`.", execute: (api, input) => api.inventory.getAdjustment(input), name: "Retrieve Square Inventory Adjustment", replaySafety: "safe", requiredKeys: ["adjustmentId"], scopes: ["INVENTORY_READ"], }) /** * Returns the inventory adjustment reason identified by the provided * `reason_id`. */ export const retrieveSquareInventoryAdjustmentReason = defineSquareOperation< Square.RetrieveInventoryAdjustmentReasonRequest, Square.RetrieveInventoryAdjustmentReasonResponse >({ allowedKeys: ["reasonId"], description: "Returns the inventory adjustment reason identified by the provided `reason_id`.", execute: (api, input) => api.inventory.retrieveInventoryAdjustmentReason(input), name: "Retrieve Square Inventory Adjustment Reason", replaySafety: "safe", requiredKeys: ["reasonId"], scopes: ["INVENTORY_READ"], }) /** * Retrieves the current calculated stock count for a given * [CatalogObject](entity:CatalogObject) at a given set of * [Location](entity:Location)s. */ export const retrieveSquareInventoryCount = defineSquareOperation< Square.GetInventoryRequest, Square.GetInventoryCountResponse >({ allowedKeys: ["catalogObjectId", "locationIds", "cursor"], description: "Retrieves the current calculated stock count for a given [CatalogObject](entity:CatalogObject) at a given set of [Location](entity:Location)s.", execute: (api, input) => api.inventory.get(input), name: "Retrieve Square Inventory Count", replaySafety: "safe", requiredKeys: ["catalogObjectId"], scopes: ["INVENTORY_READ"], }) /** * Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) object * with the provided `physical_count_id`. */ export const retrieveSquareInventoryPhysicalCount = defineSquareOperation< Square.GetPhysicalCountInventoryRequest, Square.GetInventoryPhysicalCountResponse >({ allowedKeys: ["physicalCountId"], description: "Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) object with the provided `physical_count_id`.", execute: (api, input) => api.inventory.getPhysicalCount(input), name: "Retrieve Square Inventory Physical Count", replaySafety: "safe", requiredKeys: ["physicalCountId"], scopes: ["INVENTORY_READ"], }) /** Applies an update to the provided adjustment. */ export const updateSquareInventoryAdjustment = defineSquareOperation< Square.UpdateInventoryAdjustmentRequest, Square.UpdateInventoryAdjustmentResponse >({ allowedKeys: ["idempotencyKey", "adjustment"], description: "Applies an update to the provided adjustment.", execute: (api, input) => api.inventory.updateInventoryAdjustment(input), name: "Update Square Inventory Adjustment", replaySafety: "safe", requiredKeys: ["idempotencyKey", "adjustment"], scopes: ["INVENTORY_WRITE"], }) /** Updates a custom inventory adjustment reason. */ export const updateSquareInventoryAdjustmentReason = defineSquareOperation< Square.UpdateInventoryAdjustmentReasonRequest, Square.UpdateInventoryAdjustmentReasonResponse >({ allowedKeys: ["reasonId", "adjustmentReason"], description: "Updates a custom inventory adjustment reason.", execute: (api, input) => api.inventory.updateInventoryAdjustmentReason(input), name: "Update Square Inventory Adjustment Reason", replaySafety: "safe", requiredKeys: ["reasonId", "adjustmentReason"], scopes: ["INVENTORY_WRITE"], })