UNPKG

ordercloud-javascript-sdk

Version:

The offical Javascript SDK for the Ordercloud ecommerce API

86 lines (85 loc) 5.55 kB
import { CancelToken } from 'axios'; import { AccessToken } from '../models/AccessToken'; import { ApiRole } from '../models/ApiRole'; import { RequiredDeep } from '../models/RequiredDeep'; declare class Auth { constructor(); /** * @description this workflow is most appropriate for client apps where user is a human, ie a registered user * * @param username of the user logging in * @param password of the user logging in * @param client_id of the application the user is logging into * @param scope optional roles being requested, if omitted will return all assigned roles * @param customRoles optional custom roles being requested - string array * @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. */ Login(username: string, password: string, clientID: string, scope?: ApiRole[], customRoles?: string[], requestOptions?: { cancelToken?: CancelToken; requestType?: string; }): Promise<RequiredDeep<AccessToken>>; /** * @description similar to login except client secret is also required, adding another level of security * * @param clientSecret of the application * @param username of the user logging in * @param password of the user logging in * @param clientID of the application the user is logging into * @param scope roles being requested - space delimited string or array * @param customRoles optional custom roles being requested - string array * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. * @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. */ ElevatedLogin(clientSecret: string, username: string, password: string, clientID: string, scope?: ApiRole[], customRoles?: string[], requestOptions?: { cancelToken?: CancelToken; requestType?: string; }): Promise<RequiredDeep<AccessToken>>; /** * @description this workflow is best suited for a backend system * * @param clientSecret of the application * @param clientID of the application the user is logging into * @param scope roles being requested - space delimited string or array * @param customRoles optional custom roles being requested - string array * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. * @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. */ ClientCredentials(clientSecret: string, clientID: string, scope?: ApiRole[], customRoles?: string[], requestOptions?: { cancelToken?: CancelToken; requestType?: string; }): Promise<RequiredDeep<AccessToken>>; /** * @description extend your users' session by getting a new access token with a refresh token. refresh tokens must be enabled in the dashboard * * @param refreshToken of the application * @param clientID of the application the user is logging into * @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. */ RefreshToken(refreshToken: string, clientID: string, requestOptions?: { cancelToken?: CancelToken; requestType?: string; }): Promise<RequiredDeep<AccessToken>>; /** * @description allow users to browse your catalog without signing in - must have anonymous template user set in dashboard * * @param clientID of the application the user is logging into * @param scope roles being requested - space delimited string or array * @param customRoles optional custom roles being requested - string array * @param requestOptions.anonuserid Provide an externally generated id to track this user session, used specifically for the tracking events feature for integrating with Send and Discover * @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. */ Anonymous(clientID: string, scope?: ApiRole[], customRoles?: string[], requestOptions?: { anonuserid?: string; cancelToken?: CancelToken; requestType?: string; }): Promise<RequiredDeep<AccessToken>>; } declare const _default: Auth; export default _default;