ordercloud-javascript-sdk
Version:
The offical Javascript SDK for the Ordercloud ecommerce API
215 lines (214 loc) • 15.8 kB
TypeScript
import { ListPage } from '../models/ListPage';
import { Searchable } from '../models/Searchable';
import { Sortable } from '../models/Sortable';
import { Filters } from '../models/Filters';
import { OrderReturn } from '../models/OrderReturn';
import { OrderReturnApproval } from '../models/OrderReturnApproval';
import { ApprovalInfo } from '../models/ApprovalInfo';
import { User } from '../models/User';
import { PartialDeep } from '../models/PartialDeep';
import { RequiredDeep } from '../models/RequiredDeep';
import { RequestOptions } from '../models/RequestOptions';
declare class OrderReturns {
private impersonating;
/**
* @ignore
* not part of public api, don't include in generated docs
*/
constructor();
/**
* List order returns
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/list|api docs} for more info
*
* @param listOptions.approvable Only returns orders awaiting the user's approval if true.
* @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<TOrderReturn extends OrderReturn>(listOptions?: {
approvable?: boolean;
search?: string;
searchOn?: Searchable<'OrderReturns.List'>;
sortBy?: Sortable<'OrderReturns.List'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TOrderReturn>>>;
/**
* Create an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/create|api docs} for more info
*
* @param orderReturn Required fields: OrderID
* @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<TOrderReturn extends OrderReturn>(orderReturn: OrderReturn, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Retrieve an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/get|api docs} for more info
*
* @param returnID ID of the return.
* @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<TOrderReturn extends OrderReturn>(returnID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Create or update an order return 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/order-returns/save|api docs} for more info
*
* @param returnID ID of the return.
* @param orderReturn Required fields: OrderID
* @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<TOrderReturn extends OrderReturn>(returnID: string, orderReturn: OrderReturn, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Delete an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/delete|api docs} for more info
*
* @param returnID ID of the return.
* @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(returnID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* Partially update an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/patch|api docs} for more info
*
* @param returnID ID of the return.
* @param orderReturn
* @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<TOrderReturn extends OrderReturn>(returnID: string, orderReturn: PartialDeep<OrderReturn>, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* List order return approvals Returns all Approvals associated with the Order Return.
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/list-approvals|api docs} for more info
*
* @param returnID ID of the return.
* @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.
*/
ListApprovals<TOrderReturnApproval extends OrderReturnApproval>(returnID: string, listOptions?: {
search?: string;
searchOn?: Searchable<'OrderReturns.ListApprovals'>;
sortBy?: Sortable<'OrderReturns.ListApprovals'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TOrderReturnApproval>>>;
/**
* Approve an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/approve|api docs} for more info
*
* @param returnID ID of the return.
* @param approvalInfo
* @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.
*/
Approve<TOrderReturn extends OrderReturn>(returnID: string, approvalInfo: ApprovalInfo, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Cancel an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/cancel|api docs} for more info
*
* @param returnID ID of the return.
* @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.
*/
Cancel<TOrderReturn extends OrderReturn>(returnID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Complete an order return Use only when an order return won't have an associated payment. You will not to reopen an order return after completing it.
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/complete|api docs} for more info
*
* @param returnID ID of the return.
* @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.
*/
Complete<TOrderReturn extends OrderReturn>(returnID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Decline an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/decline|api docs} for more info
*
* @param returnID ID of the return.
* @param approvalInfo
* @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.
*/
Decline<TOrderReturn extends OrderReturn>(returnID: string, approvalInfo: ApprovalInfo, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* List order return eligible approvers Returns all Users who can approve or decline this order return (but have not done so).
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/list-eligible-approvers|api docs} for more info
*
* @param returnID ID of the return.
* @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.
*/
ListEligibleApprovers<TUser extends User>(returnID: string, listOptions?: {
search?: string;
searchOn?: Searchable<'OrderReturns.ListEligibleApprovers'>;
sortBy?: Sortable<'OrderReturns.ListEligibleApprovers'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TUser>>>;
/**
* Delete an order return item
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/delete-item|api docs} for more info
*
* @param returnID ID of the return.
* @param lineItemID ID of the line 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.
*/
DeleteItem<TOrderReturn extends OrderReturn>(returnID: string, lineItemID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* Submit an order return
* Check out the {@link https://ordercloud.io/api-reference/orders-and-fulfillment/order-returns/submit|api docs} for more info
*
* @param returnID ID of the return.
* @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.
*/
Submit<TOrderReturn extends OrderReturn>(returnID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TOrderReturn>>;
/**
* @description
* enables impersonation by calling the subsequent method with the stored impersonation token
*
* @example
* OrderReturns.As().List() // lists OrderReturns using the impersonated users' token
*/
As(): this;
}
declare const _default: OrderReturns;
export default _default;