UNPKG

ordercloud-javascript-sdk

Version:

The offical Javascript SDK for the Ordercloud ecommerce API

224 lines (223 loc) 16.5 kB
import { ListPage } from '../models/ListPage'; import { Searchable } from '../models/Searchable'; import { Sortable } from '../models/Sortable'; import { Filters } from '../models/Filters'; import { ApiClient } from '../models/ApiClient'; import { ApiClientSecret } from '../models/ApiClientSecret'; import { ApiClientSecretCreateResponse } from '../models/ApiClientSecretCreateResponse'; import { ApiClientAssignment } from '../models/ApiClientAssignment'; import { PartialDeep } from '../models/PartialDeep'; import { RequiredDeep } from '../models/RequiredDeep'; import { RequestOptions } from '../models/RequestOptions'; declare class ApiClients { private impersonating; /** * @ignore * not part of public api, don't include in generated docs */ constructor(); /** * List API clients * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/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<TApiClient extends ApiClient>(listOptions?: { search?: string; searchOn?: Searchable<'ApiClients.List'>; sortBy?: Sortable<'ApiClients.List'>; page?: number; pageSize?: number; filters?: Filters; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TApiClient>>>; /** * Create an API client * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/create|api docs} for more info * * @param apiClient Required fields: AccessTokenDuration, AppName * @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<TApiClient extends ApiClient>(apiClient: ApiClient, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClient>>; /** * Retrieve an API client * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/get|api docs} for more info * * @param apiClientID ID of the api client. * @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<TApiClient extends ApiClient>(apiClientID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClient>>; /** * Create or update an API client If an object with the same ID already exists, it will be overwritten. * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/save|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClient Required fields: AccessTokenDuration, AppName * @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<TApiClient extends ApiClient>(apiClientID: string, apiClient: ApiClient, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClient>>; /** * Delete an API client * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/delete|api docs} for more info * * @param apiClientID ID of the api client. * @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(apiClientID: string, requestOptions?: RequestOptions): Promise<void>; /** * Partially update an API client * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/patch|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClient * @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<TApiClient extends ApiClient>(apiClientID: string, apiClient: PartialDeep<ApiClient>, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClient>>; /** * List API client secrets * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/list-secrets|api docs} for more info * * @param apiClientID ID of the api client. * @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. */ ListSecrets<TApiClientSecret extends ApiClientSecret>(apiClientID: string, listOptions?: { search?: string; searchOn?: Searchable<'ApiClients.ListSecrets'>; sortBy?: Sortable<'ApiClients.ListSecrets'>; page?: number; pageSize?: number; filters?: Filters; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TApiClientSecret>>>; /** * Create an API client secret * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/create-secret|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClientSecret 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. */ CreateSecret<TApiClientSecretCreateResponse extends ApiClientSecretCreateResponse>(apiClientID: string, apiClientSecret: ApiClientSecret, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClientSecretCreateResponse>>; /** * Retrieve an API client secret * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/get-secret|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClientSecretID ID of the api client secret. * @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. */ GetSecret<TApiClientSecret extends ApiClientSecret>(apiClientID: string, apiClientSecretID: string, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClientSecret>>; /** * Delete an API client secret * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/delete-secret|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClientSecretID ID of the api client secret. * @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. */ DeleteSecret(apiClientID: string, apiClientSecretID: string, requestOptions?: RequestOptions): Promise<void>; /** * Partially update an API client secret * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/patch-secret|api docs} for more info * * @param apiClientID ID of the api client. * @param apiClientSecretID ID of the api client secret. * @param apiClientSecret * @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. */ PatchSecret<TApiClientSecret extends ApiClientSecret>(apiClientID: string, apiClientSecretID: string, apiClientSecret: PartialDeep<ApiClientSecret>, requestOptions?: RequestOptions): Promise<RequiredDeep<TApiClientSecret>>; /** * List API client assignments * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/list-assignments|api docs} for more info * * @param listOptions.apiClientID ID of the api client. * @param listOptions.buyerID ID of the buyer. * @param listOptions.supplierID ID of the supplier. * @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<TApiClientAssignment extends ApiClientAssignment>(listOptions?: { apiClientID?: string; buyerID?: string; supplierID?: string; page?: number; pageSize?: number; }, requestOptions?: RequestOptions): Promise<RequiredDeep<ListPage<TApiClientAssignment>>>; /** * Create or update an API client assignment * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/save-assignment|api docs} for more info * * @param apiClientAssignment Required fields: ApiClientID * @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(apiClientAssignment: ApiClientAssignment, requestOptions?: RequestOptions): Promise<void>; /** * Delete an API client buyer assignment * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/delete-buyer-assignment|api docs} for more info * * @param apiClientID ID of the api client. * @param 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. */ DeleteBuyerAssignment(apiClientID: string, buyerID: string, requestOptions?: RequestOptions): Promise<void>; /** * Delete an API client supplier assignment * Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/api-clients/delete-supplier-assignment|api docs} for more info * * @param apiClientID ID of the api client. * @param supplierID ID of the supplier. * @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. */ DeleteSupplierAssignment(apiClientID: string, supplierID: string, requestOptions?: RequestOptions): Promise<void>; /** * @description * enables impersonation by calling the subsequent method with the stored impersonation token * * @example * ApiClients.As().List() // lists ApiClients using the impersonated users' token */ As(): this; } declare const _default: ApiClients; export default _default;