ordercloud-javascript-sdk
Version:
The offical Javascript SDK for the Ordercloud ecommerce API
223 lines (222 loc) • 15.7 kB
TypeScript
import { ListPage } from '../models/ListPage';
import { Searchable } from '../models/Searchable';
import { Sortable } from '../models/Sortable';
import { Filters } from '../models/Filters';
import { Catalog } from '../models/Catalog';
import { CatalogAssignment } from '../models/CatalogAssignment';
import { BundleCatalogAssignment } from '../models/BundleCatalogAssignment';
import { ProductCatalogAssignment } from '../models/ProductCatalogAssignment';
import { PartialDeep } from '../models/PartialDeep';
import { RequiredDeep } from '../models/RequiredDeep';
import { RequestOptions } from '../models/RequestOptions';
declare class Catalogs {
private impersonating;
/**
* @ignore
* not part of public api, don't include in generated docs
*/
constructor();
/**
* List catalogs
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/list|api docs} for more info
*
* @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 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<TCatalog extends Catalog>(listOptions?: {
search?: string;
searchOn?: Searchable<'Catalogs.List'>;
sortBy?: Sortable<'Catalogs.List'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TCatalog>>>;
/**
* Create a catalog
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/create|api docs} for more info
*
* @param catalog Required fields: Name
* @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<TCatalog extends Catalog>(catalog: Catalog, requestOptions?: RequestOptions): Promise<RequiredDeep<TCatalog>>;
/**
* Retrieve a catalog
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/get|api docs} for more info
*
* @param catalogID ID of the catalog.
* @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<TCatalog extends Catalog>(catalogID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TCatalog>>;
/**
* Create or update a catalog If an object with the same ID already exists, it will be overwritten.
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/save|api docs} for more info
*
* @param catalogID ID of the catalog.
* @param catalog Required fields: Name
* @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<TCatalog extends Catalog>(catalogID: string, catalog: Catalog, requestOptions?: RequestOptions): Promise<RequiredDeep<TCatalog>>;
/**
* Delete a catalog
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/delete|api docs} for more info
*
* @param catalogID ID of the catalog.
* @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(catalogID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* Partially update a catalog
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/patch|api docs} for more info
*
* @param catalogID ID of the catalog.
* @param catalog
* @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<TCatalog extends Catalog>(catalogID: string, catalog: PartialDeep<Catalog>, requestOptions?: RequestOptions): Promise<RequiredDeep<TCatalog>>;
/**
* Delete a catalog assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/delete-assignment|api docs} for more info
*
* @param catalogID ID of the catalog.
* @param listOptions.buyerID ID of the buyer.
* @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(catalogID: string, listOptions?: {
buyerID?: string;
}, requestOptions?: RequestOptions): Promise<void>;
/**
* Delete a catalog bundle assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/delete-bundle-assignment|api docs} for more info
*
* @param catalogID ID of the catalog.
* @param bundleID ID of the bundle.
* @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.
*/
DeleteBundleAssignment(catalogID: string, bundleID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* Delete a catalog product assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/delete-product-assignment|api docs} for more info
*
* @param catalogID ID of the catalog.
* @param productID ID of the product.
* @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.
*/
DeleteProductAssignment(catalogID: string, productID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* List catalog assignments
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/list-assignments|api docs} for more info
*
* @param listOptions.catalogID ID of the catalog.
* @param listOptions.buyerID ID of the buyer.
* @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<TCatalogAssignment extends CatalogAssignment>(listOptions?: {
catalogID?: string;
buyerID?: string;
page?: number;
pageSize?: number;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TCatalogAssignment>>>;
/**
* Create or update a catalog assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/save-assignment|api docs} for more info
*
* @param catalogAssignment Required fields: CatalogID, 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(catalogAssignment: CatalogAssignment, requestOptions?: RequestOptions): Promise<void>;
/**
* List catalog bundle assignments
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/list-bundle-assignments|api docs} for more info
*
* @param listOptions.catalogID ID of the catalog.
* @param listOptions.bundleID ID of the bundle.
* @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.
*/
ListBundleAssignments<TBundleCatalogAssignment extends BundleCatalogAssignment>(listOptions?: {
catalogID?: string;
bundleID?: string;
page?: number;
pageSize?: number;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TBundleCatalogAssignment>>>;
/**
* Create or update a catalog bundle assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/save-bundle-assignment|api docs} for more info
*
* @param bundleCatalogAssignment Required fields: CatalogID, BundleID
* @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.
*/
SaveBundleAssignment(bundleCatalogAssignment: BundleCatalogAssignment, requestOptions?: RequestOptions): Promise<void>;
/**
* List catalog product assignments
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/list-product-assignments|api docs} for more info
*
* @param listOptions.catalogID ID of the catalog.
* @param listOptions.productID ID of the product.
* @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.
*/
ListProductAssignments<TProductCatalogAssignment extends ProductCatalogAssignment>(listOptions?: {
catalogID?: string;
productID?: string;
page?: number;
pageSize?: number;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TProductCatalogAssignment>>>;
/**
* Create or update a catalog product assignment
* Check out the {@link https://ordercloud.io/api-reference/product-catalogs/catalogs/save-product-assignment|api docs} for more info
*
* @param productCatalogAssignment Required fields: CatalogID, ProductID
* @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.
*/
SaveProductAssignment(productCatalogAssignment: ProductCatalogAssignment, requestOptions?: RequestOptions): Promise<void>;
/**
* @description
* enables impersonation by calling the subsequent method with the stored impersonation token
*
* @example
* Catalogs.As().List() // lists Catalogs using the impersonated users' token
*/
As(): this;
}
declare const _default: Catalogs;
export default _default;