UNPKG

ordercloud-javascript-sdk

Version:

The offical Javascript SDK for the Ordercloud ecommerce API

305 lines (304 loc) 22.2 kB
import { ListPage } from '../models/ListPage'; import { Searchable } from '../models/Searchable'; import { Sortable } from '../models/Sortable'; import { Filters } from '../models/Filters'; import { InventoryRecord } from '../models/InventoryRecord'; import { InventoryRecordAssignment } from '../models/InventoryRecordAssignment'; import { PartialDeep } from '../models/PartialDeep'; import { RequiredDeep } from '../models/RequiredDeep'; import { RequestOptions } from '../models/RequestOptions'; declare class InventoryRecords { private impersonating; /** * @ignore * not part of public api, don't include in generated docs */ constructor(); /** * List inventory records * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/list|api docs} for more info * * @param productID ID of the product. * @param listOptions.search Word or phrase to search for. * @param listOptions.searchOn Comma-delimited list of fields to search on. * @param listOptions.sortBy Comma-delimited list of fields to sort by. * @param listOptions.page Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation. * @param listOptions.pageSize Number of results to return per page. * @param listOptions.filters An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???' * @param listOptions.includeAddress Include address of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ List<TInventoryRecord extends InventoryRecord>(productID: string, listOptions?: { search?: string; searchOn?: Searchable<'InventoryRecords.List'>; sortBy?: Sortable<'InventoryRecords.List'>; page?: number; pageSize?: number; filters?: Filters; includeAddress?: boolean; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TInventoryRecord>>>; /** * Create an inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/create|api docs} for more info * * @param productID ID of the product. * @param inventoryRecord Required fields: AddressID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ Create<TInventoryRecord extends InventoryRecord>(productID: string, inventoryRecord: InventoryRecord, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Retrieve an inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/get|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordID ID of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ Get<TInventoryRecord extends InventoryRecord>(productID: string, inventoryRecordID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Create or update an inventory record If an object with the same ID already exists, it will be overwritten. * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/save|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordID ID of the inventory record. * @param inventoryRecord Required fields: AddressID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ Save<TInventoryRecord extends InventoryRecord>(productID: string, inventoryRecordID: string, inventoryRecord: InventoryRecord, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Delete an inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/delete|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordID ID of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ Delete(productID: string, inventoryRecordID: string, requestOptions?: RequestOptions): Promise<void>; /** * Partially update an inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/patch|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordID ID of the inventory record. * @param inventoryRecord * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ Patch<TInventoryRecord extends InventoryRecord>(productID: string, inventoryRecordID: string, inventoryRecord: PartialDeep<InventoryRecord>, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Delete an inventory record assignment * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/delete-assignment|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordID ID of the inventory record. * @param listOptions.buyerID ID of the buyer. * @param listOptions.userID ID of the user. * @param listOptions.userGroupID ID of the user group. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ DeleteAssignment(productID: string, inventoryRecordID: string, listOptions?: { buyerID?: string; userID?: string; userGroupID?: string; }, requestOptions?: RequestOptions): Promise<void>; /** * List inventory record assignments * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/list-assignments|api docs} for more info * * @param productID ID of the product. * @param listOptions.buyerID ID of the buyer. * @param listOptions.inventoryRecordID ID of the inventory record. * @param listOptions.userGroupID ID of the user group. * @param listOptions.level Level of the inventory record assignment. Possible values: Group, Company. * @param listOptions.page Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation. * @param listOptions.pageSize Number of results to return per page. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ ListAssignments<TInventoryRecordAssignment extends InventoryRecordAssignment>(productID: string, listOptions?: { buyerID?: string; inventoryRecordID?: string; userGroupID?: string; level?: 'Group' | 'Company'; page?: number; pageSize?: number; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TInventoryRecordAssignment>>>; /** * Create or update an inventory record assignment * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/save-assignment|api docs} for more info * * @param productID ID of the product. * @param inventoryRecordAssignment Required fields: InventoryRecordID, BuyerID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ SaveAssignment(productID: string, inventoryRecordAssignment: InventoryRecordAssignment, requestOptions?: RequestOptions): Promise<void>; /** * Get a list of variant inventory records * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/list-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param listOptions.search Word or phrase to search for. * @param listOptions.searchOn Comma-delimited list of fields to search on. * @param listOptions.sortBy Comma-delimited list of fields to sort by. * @param listOptions.page Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation. * @param listOptions.pageSize Number of results to return per page. * @param listOptions.filters An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???' * @param listOptions.includeAddress Include address of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ ListVariant<TInventoryRecord extends InventoryRecord>(productID: string, variantID: string, listOptions?: { search?: string; searchOn?: Searchable<'InventoryRecords.ListVariant'>; sortBy?: Sortable<'InventoryRecords.ListVariant'>; page?: number; pageSize?: number; filters?: Filters; includeAddress?: boolean; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TInventoryRecord>>>; /** * Create a new variant inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/create-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecord Required fields: AddressID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ CreateVariant<TInventoryRecord extends InventoryRecord>(productID: string, variantID: string, inventoryRecord: InventoryRecord, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Get a single variant inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/get-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordID ID of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ GetVariant<TInventoryRecord extends InventoryRecord>(productID: string, variantID: string, inventoryRecordID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Create or update a variant inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/save-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordID ID of the inventory record. * @param inventoryRecord Required fields: AddressID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ SaveVariant<TInventoryRecord extends InventoryRecord>(productID: string, variantID: string, inventoryRecordID: string, inventoryRecord: InventoryRecord, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Delete a variant inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/delete-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordID ID of the inventory record. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ DeleteVariant(productID: string, variantID: string, inventoryRecordID: string, requestOptions?: RequestOptions): Promise<void>; /** * Partially update a variant inventory record * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/patch-variant|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordID ID of the inventory record. * @param inventoryRecord * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ PatchVariant<TInventoryRecord extends InventoryRecord>(productID: string, variantID: string, inventoryRecordID: string, inventoryRecord: PartialDeep<InventoryRecord>, requestOptions?: RequestOptions): Promise<RequiredDeep<TInventoryRecord>>; /** * Delete an inventory record variant assignment * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/delete-variant-assignment|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordID ID of the inventory record. * @param listOptions.buyerID ID of the buyer. * @param listOptions.userID ID of the user. * @param listOptions.userGroupID ID of the user group. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ DeleteVariantAssignment(productID: string, variantID: string, inventoryRecordID: string, listOptions?: { buyerID?: string; userID?: string; userGroupID?: string; }, requestOptions?: RequestOptions): Promise<void>; /** * List inventory record variant assignments * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/list-variant-assignments|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param listOptions.buyerID ID of the buyer. * @param listOptions.inventoryRecordID ID of the inventory record. * @param listOptions.userGroupID ID of the user group. * @param listOptions.level Level of the inventory record assignment. Possible values: Group, Company. * @param listOptions.page Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation. * @param listOptions.pageSize Number of results to return per page. * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ ListVariantAssignments<TInventoryRecordAssignment extends InventoryRecordAssignment>(productID: string, variantID: string, listOptions?: { buyerID?: string; inventoryRecordID?: string; userGroupID?: string; level?: 'Group' | 'Company'; page?: number; pageSize?: number; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TInventoryRecordAssignment>>>; /** * Create or update an inventory record variant assignment * Check out the {@link https://ordercloud.io/api-reference/product-catalogs/inventory-records/save-variant-assignment|api docs} for more info * * @param productID ID of the product. * @param variantID ID of the variant. * @param inventoryRecordAssignment Required fields: InventoryRecordID, BuyerID * @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation). * @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request. * @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs. */ SaveVariantAssignment(productID: string, variantID: string, inventoryRecordAssignment: InventoryRecordAssignment, requestOptions?: RequestOptions): Promise<void>; /** * @description * enables impersonation by calling the subsequent method with the stored impersonation token * * @example * InventoryRecords.As().List() // lists InventoryRecords using the impersonated users' token */ As(): this; } declare const _default: InventoryRecords; export default _default;