ordercloud-javascript-sdk
Version:
The offical Javascript SDK for the Ordercloud ecommerce API
107 lines (106 loc) • 7.32 kB
TypeScript
import { ListPage } from '../models/ListPage';
import { Searchable } from '../models/Searchable';
import { Sortable } from '../models/Sortable';
import { Filters } from '../models/Filters';
import { LineItem } from '../models/LineItem';
import { PartialDeep } from '../models/PartialDeep';
import { RequiredDeep } from '../models/RequiredDeep';
import { RequestOptions } from '../models/RequestOptions';
declare class SubscriptionItems {
private impersonating;
/**
* @ignore
* not part of public api, don't include in generated docs
*/
constructor();
/**
* List subscription items
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/list|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @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<TLineItem extends LineItem>(subscriptionID: string, listOptions?: {
search?: string;
searchOn?: Searchable<'SubscriptionItems.List'>;
sortBy?: Sortable<'SubscriptionItems.List'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TLineItem>>>;
/**
* Create a subscription item
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/create|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @param lineItem Required fields: 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.
*/
Create<TLineItem extends LineItem>(subscriptionID: string, lineItem: LineItem, requestOptions?: RequestOptions): Promise<RequiredDeep<TLineItem>>;
/**
* Retrieve a subscription item
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/get|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @param subscriptionItemID ID of the subscription item.
* @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<TLineItem extends LineItem>(subscriptionID: string, subscriptionItemID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TLineItem>>;
/**
* Create or update a subscription item If an object with the same ID already exists, it will be overwritten.
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/save|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @param subscriptionItemID ID of the subscription item.
* @param lineItem Required fields: 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.
*/
Save<TLineItem extends LineItem>(subscriptionID: string, subscriptionItemID: string, lineItem: LineItem, requestOptions?: RequestOptions): Promise<RequiredDeep<TLineItem>>;
/**
* Delete a subscription item
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/delete|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @param subscriptionItemID ID of the subscription item.
* @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(subscriptionID: string, subscriptionItemID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* Partially update a subscription item
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/subscription-items/patch|api docs} for more info
*
* @param subscriptionID ID of the subscription.
* @param subscriptionItemID ID of the subscription item.
* @param lineItem
* @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<TLineItem extends LineItem>(subscriptionID: string, subscriptionItemID: string, lineItem: PartialDeep<LineItem>, requestOptions?: RequestOptions): Promise<RequiredDeep<TLineItem>>;
/**
* @description
* enables impersonation by calling the subsequent method with the stored impersonation token
*
* @example
* SubscriptionItems.As().List() // lists SubscriptionItems using the impersonated users' token
*/
As(): this;
}
declare const _default: SubscriptionItems;
export default _default;