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