ordercloud-javascript-sdk
Version:
The offical Javascript SDK for the Ordercloud ecommerce API
159 lines (158 loc) • 10.5 kB
TypeScript
import { ListPage } from '../models/ListPage';
import { Searchable } from '../models/Searchable';
import { Sortable } from '../models/Sortable';
import { Filters } from '../models/Filters';
import { CreditCard } from '../models/CreditCard';
import { CreditCardAssignment } from '../models/CreditCardAssignment';
import { PartyType } from '../models/PartyType';
import { PartialDeep } from '../models/PartialDeep';
import { RequiredDeep } from '../models/RequiredDeep';
import { RequestOptions } from '../models/RequestOptions';
declare class CreditCards {
private impersonating;
/**
* @ignore
* not part of public api, don't include in generated docs
*/
constructor();
/**
* List credit cards
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/list|api docs} for more info
*
* @param buyerID ID of the buyer.
* @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<TCreditCard extends CreditCard>(buyerID: string, listOptions?: {
search?: string;
searchOn?: Searchable<'CreditCards.List'>;
sortBy?: Sortable<'CreditCards.List'>;
page?: number;
pageSize?: number;
filters?: Filters;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TCreditCard>>>;
/**
* Create a credit card
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/create|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCard
* @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<TCreditCard extends CreditCard>(buyerID: string, creditCard: CreditCard, requestOptions?: RequestOptions): Promise<RequiredDeep<TCreditCard>>;
/**
* Retrieve a credit card
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/get|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardID ID of the credit card.
* @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<TCreditCard extends CreditCard>(buyerID: string, creditCardID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TCreditCard>>;
/**
* Create or update a credit card If an object with the same ID already exists, it will be overwritten.
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/save|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardID ID of the credit card.
* @param creditCard
* @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<TCreditCard extends CreditCard>(buyerID: string, creditCardID: string, creditCard: CreditCard, requestOptions?: RequestOptions): Promise<RequiredDeep<TCreditCard>>;
/**
* Delete a credit card
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/delete|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardID ID of the credit card.
* @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(buyerID: string, creditCardID: string, requestOptions?: RequestOptions): Promise<void>;
/**
* Partially update a credit card
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/patch|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardID ID of the credit card.
* @param creditCard
* @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<TCreditCard extends CreditCard>(buyerID: string, creditCardID: string, creditCard: PartialDeep<CreditCard>, requestOptions?: RequestOptions): Promise<RequiredDeep<TCreditCard>>;
/**
* Delete a credit card assignment
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/delete-assignment|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardID ID of the credit card.
* @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(buyerID: string, creditCardID: string, listOptions?: {
userID?: string;
userGroupID?: string;
}, requestOptions?: RequestOptions): Promise<void>;
/**
* List credit card assignments
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/list-assignments|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param listOptions.creditCardID ID of the credit card.
* @param listOptions.userID ID of the user.
* @param listOptions.userGroupID ID of the user group.
* @param listOptions.level Level of the credit card assignment. Possible values: User, 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<TCreditCardAssignment extends CreditCardAssignment>(buyerID: string, listOptions?: {
creditCardID?: string;
userID?: string;
userGroupID?: string;
level?: PartyType;
page?: number;
pageSize?: number;
}, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TCreditCardAssignment>>>;
/**
* Create or update a credit card assignment
* Check out the {@link https://ordercloud.io/api-reference/buyer/credit-cards/save-assignment|api docs} for more info
*
* @param buyerID ID of the buyer.
* @param creditCardAssignment Required fields: CreditCardID
* @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(buyerID: string, creditCardAssignment: CreditCardAssignment, requestOptions?: RequestOptions): Promise<void>;
/**
* @description
* enables impersonation by calling the subsequent method with the stored impersonation token
*
* @example
* CreditCards.As().List() // lists CreditCards using the impersonated users' token
*/
As(): this;
}
declare const _default: CreditCards;
export default _default;