Skip to content

Latest commit

 

History

History
681 lines (517 loc) · 23.1 KB

inventory.md

File metadata and controls

681 lines (517 loc) · 23.1 KB

Inventory

const inventoryApi = client.inventoryApi;

Class Name

InventoryApi

Methods

Deprecated Retrieve Inventory Adjustment

This endpoint is deprecated.

Deprecated version of RetrieveInventoryAdjustment after the endpoint URL is updated to conform to the standard convention.

async deprecatedRetrieveInventoryAdjustment(
  adjustmentId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryAdjustmentResponse>>

Parameters

Parameter Type Tags Description
adjustmentId string Template, Required ID of the InventoryAdjustment to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryAdjustmentResponse

Example Usage

const adjustmentId = 'adjustment_id0';
try {
  const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryAdjustment(adjustmentId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Inventory Adjustment

Returns the InventoryAdjustment object with the provided adjustment_id.

async retrieveInventoryAdjustment(
  adjustmentId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryAdjustmentResponse>>

Parameters

Parameter Type Tags Description
adjustmentId string Template, Required ID of the InventoryAdjustment to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryAdjustmentResponse

Example Usage

const adjustmentId = 'adjustment_id0';
try {
  const { result, ...httpResponse } = await inventoryApi.retrieveInventoryAdjustment(adjustmentId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Deprecated Batch Change Inventory

This endpoint is deprecated.

Deprecated version of BatchChangeInventory after the endpoint URL is updated to conform to the standard convention.

async deprecatedBatchChangeInventory(
  body: BatchChangeInventoryRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchChangeInventoryResponse>>

Parameters

Parameter Type Tags Description
body BatchChangeInventoryRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchChangeInventoryResponse

Example Usage

const contentType = null;
const bodyChanges: InventoryChange[] = [];

const bodychanges0PhysicalCount: InventoryPhysicalCount = {};
bodychanges0PhysicalCount.referenceId = '1536bfbf-efed-48bf-b17d-a197141b2a92';
bodychanges0PhysicalCount.catalogObjectId = 'W62UWFY35CWMYGVWK6TWJDNI';
bodychanges0PhysicalCount.state = 'IN_STOCK';
bodychanges0PhysicalCount.locationId = 'C6W5YS5QM06F5';
bodychanges0PhysicalCount.quantity = '53';
bodychanges0PhysicalCount.teamMemberId = 'LRK57NSQ5X7PUD05';
bodychanges0PhysicalCount.occurredAt = '2016-11-16T22:25:24.878Z';

const bodychanges0: InventoryChange = {};
bodychanges0.type = 'PHYSICAL_COUNT';
bodychanges0.physicalCount = bodychanges0PhysicalCount;

bodyChanges[0] = bodychanges0;

const body: BatchChangeInventoryRequest = {
  idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe',
};
body.changes = bodyChanges;
body.ignoreUnchangedCounts = true;

try {
  const { result, ...httpResponse } = await inventoryApi.deprecatedBatchChangeInventory(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Deprecated Batch Retrieve Inventory Changes

This endpoint is deprecated.

Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL is updated to conform to the standard convention.

async deprecatedBatchRetrieveInventoryChanges(
  body: BatchRetrieveInventoryChangesRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchRetrieveInventoryChangesResponse>>

Parameters

Parameter Type Tags Description
body BatchRetrieveInventoryChangesRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchRetrieveInventoryChangesResponse

Example Usage

const contentType = null;
const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI'];
const bodyLocationIds: string[] = ['C6W5YS5QM06F5'];
const bodyTypes: string[] = ['PHYSICAL_COUNT'];
const bodyStates: string[] = ['IN_STOCK'];
const body: BatchRetrieveInventoryChangesRequest = {};
body.catalogObjectIds = bodyCatalogObjectIds;
body.locationIds = bodyLocationIds;
body.types = bodyTypes;
body.states = bodyStates;
body.updatedAfter = '2016-11-01T00:00:00Z';
body.updatedBefore = '2016-12-01T00:00:00Z';

try {
  const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryChanges(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Deprecated Batch Retrieve Inventory Counts

This endpoint is deprecated.

Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL is updated to conform to the standard convention.

async deprecatedBatchRetrieveInventoryCounts(
  body: BatchRetrieveInventoryCountsRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchRetrieveInventoryCountsResponse>>

Parameters

Parameter Type Tags Description
body BatchRetrieveInventoryCountsRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchRetrieveInventoryCountsResponse

Example Usage

const contentType = null;
const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI'];
const bodyLocationIds: string[] = ['59TNP9SA8VGDA'];
const body: BatchRetrieveInventoryCountsRequest = {};
body.catalogObjectIds = bodyCatalogObjectIds;
body.locationIds = bodyLocationIds;
body.updatedAfter = '2016-11-16T00:00:00Z';

try {
  const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryCounts(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Batch Change Inventory

Applies adjustments and counts to the provided item quantities.

On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.

async batchChangeInventory(
  body: BatchChangeInventoryRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchChangeInventoryResponse>>

Parameters

Parameter Type Tags Description
body BatchChangeInventoryRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchChangeInventoryResponse

Example Usage

const contentType = null;
const bodyChanges: InventoryChange[] = [];

const bodychanges0PhysicalCount: InventoryPhysicalCount = {};
bodychanges0PhysicalCount.referenceId = '1536bfbf-efed-48bf-b17d-a197141b2a92';
bodychanges0PhysicalCount.catalogObjectId = 'W62UWFY35CWMYGVWK6TWJDNI';
bodychanges0PhysicalCount.state = 'IN_STOCK';
bodychanges0PhysicalCount.locationId = 'C6W5YS5QM06F5';
bodychanges0PhysicalCount.quantity = '53';
bodychanges0PhysicalCount.teamMemberId = 'LRK57NSQ5X7PUD05';
bodychanges0PhysicalCount.occurredAt = '2016-11-16T22:25:24.878Z';

const bodychanges0: InventoryChange = {};
bodychanges0.type = 'PHYSICAL_COUNT';
bodychanges0.physicalCount = bodychanges0PhysicalCount;

bodyChanges[0] = bodychanges0;

const body: BatchChangeInventoryRequest = {
  idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe',
};
body.changes = bodyChanges;
body.ignoreUnchangedCounts = true;

try {
  const { result, ...httpResponse } = await inventoryApi.batchChangeInventory(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Batch Retrieve Inventory Changes

Returns historical physical counts and adjustments based on the provided filter criteria.

Results are paginated and sorted in ascending order according their occurred_at timestamp (oldest first).

BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.

async batchRetrieveInventoryChanges(
  body: BatchRetrieveInventoryChangesRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchRetrieveInventoryChangesResponse>>

Parameters

Parameter Type Tags Description
body BatchRetrieveInventoryChangesRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchRetrieveInventoryChangesResponse

Example Usage

const contentType = null;
const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI'];
const bodyLocationIds: string[] = ['C6W5YS5QM06F5'];
const bodyTypes: string[] = ['PHYSICAL_COUNT'];
const bodyStates: string[] = ['IN_STOCK'];
const body: BatchRetrieveInventoryChangesRequest = {};
body.catalogObjectIds = bodyCatalogObjectIds;
body.locationIds = bodyLocationIds;
body.types = bodyTypes;
body.states = bodyStates;
body.updatedAfter = '2016-11-01T00:00:00Z';
body.updatedBefore = '2016-12-01T00:00:00Z';

try {
  const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryChanges(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Batch Retrieve Inventory Counts

Returns current counts for the provided CatalogObjects at the requested Locations.

Results are paginated and sorted in descending order according to their calculated_at timestamp (newest first).

When updated_after is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a "sync" operation, for example in response to receiving a Webhook notification.

async batchRetrieveInventoryCounts(
  body: BatchRetrieveInventoryCountsRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<BatchRetrieveInventoryCountsResponse>>

Parameters

Parameter Type Tags Description
body BatchRetrieveInventoryCountsRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

BatchRetrieveInventoryCountsResponse

Example Usage

const contentType = null;
const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI'];
const bodyLocationIds: string[] = ['59TNP9SA8VGDA'];
const body: BatchRetrieveInventoryCountsRequest = {};
body.catalogObjectIds = bodyCatalogObjectIds;
body.locationIds = bodyLocationIds;
body.updatedAfter = '2016-11-16T00:00:00Z';

try {
  const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryCounts(body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Deprecated Retrieve Inventory Physical Count

This endpoint is deprecated.

Deprecated version of RetrieveInventoryPhysicalCount after the endpoint URL is updated to conform to the standard convention.

async deprecatedRetrieveInventoryPhysicalCount(
  physicalCountId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryPhysicalCountResponse>>

Parameters

Parameter Type Tags Description
physicalCountId string Template, Required ID of the
InventoryPhysicalCount to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryPhysicalCountResponse

Example Usage

const physicalCountId = 'physical_count_id2';
try {
  const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryPhysicalCount(physicalCountId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Inventory Physical Count

Returns the InventoryPhysicalCount object with the provided physical_count_id.

async retrieveInventoryPhysicalCount(
  physicalCountId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryPhysicalCountResponse>>

Parameters

Parameter Type Tags Description
physicalCountId string Template, Required ID of the
InventoryPhysicalCount to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryPhysicalCountResponse

Example Usage

const physicalCountId = 'physical_count_id2';
try {
  const { result, ...httpResponse } = await inventoryApi.retrieveInventoryPhysicalCount(physicalCountId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Inventory Transfer

Returns the InventoryTransfer object with the provided transfer_id.

async retrieveInventoryTransfer(
  transferId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryTransferResponse>>

Parameters

Parameter Type Tags Description
transferId string Template, Required ID of the InventoryTransfer to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryTransferResponse

Example Usage

const transferId = 'transfer_id6';
try {
  const { result, ...httpResponse } = await inventoryApi.retrieveInventoryTransfer(transferId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Inventory Count

Retrieves the current calculated stock count for a given CatalogObject at a given set of Locations. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.

async retrieveInventoryCount(
  catalogObjectId: string,
  locationIds?: string,
  cursor?: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryCountResponse>>

Parameters

Parameter Type Tags Description
catalogObjectId string Template, Required ID of the CatalogObject to retrieve.
locationIds string | undefined Query, Optional The Location IDs to look up as a comma-separated
list. An empty list queries all locations.
cursor string | undefined Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the Pagination guide for more information.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryCountResponse

Example Usage

const catalogObjectId = 'catalog_object_id6';
try {
  const { result, ...httpResponse } = await inventoryApi.retrieveInventoryCount(catalogObjectId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Inventory Changes

This endpoint is deprecated.

Returns a set of physical counts and inventory adjustments for the provided CatalogObject at the requested Locations.

You can achieve the same result by calling BatchRetrieveInventoryChanges and having the catalog_object_ids list contain a single element of the CatalogObject ID.

Results are paginated and sorted in descending order according to their occurred_at timestamp (newest first).

There are no limits on how far back the caller can page. This endpoint can be used to display recent changes for a specific item. For more sophisticated queries, use a batch endpoint.

async retrieveInventoryChanges(
  catalogObjectId: string,
  locationIds?: string,
  cursor?: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveInventoryChangesResponse>>

Parameters

Parameter Type Tags Description
catalogObjectId string Template, Required ID of the CatalogObject to retrieve.
locationIds string | undefined Query, Optional The Location IDs to look up as a comma-separated
list. An empty list queries all locations.
cursor string | undefined Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the Pagination guide for more information.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveInventoryChangesResponse

Example Usage

const catalogObjectId = 'catalog_object_id6';
try {
  const { result, ...httpResponse } = await inventoryApi.retrieveInventoryChanges(catalogObjectId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}