/**
 * Selling Partner API for Tokens
 * The Selling Partner API for Tokens provides a secure way to access a customer\'s PII (Personally Identifiable Information). You can call the Tokens API to get a Restricted Data Token (RDT) for one or more restricted resources that you specify. The RDT authorizes subsequent calls to restricted operations that correspond to the restricted resources that you specified.  For more information, see the [Tokens API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/tokens-api-use-case-guide/tokens-API-use-case-guide-2021-03-01.md).
 *
 * The version of the OpenAPI document: 2021-03-01
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */ import { Configuration } from './configuration' ; import globalAxios , { AxiosPromise , AxiosInstance } from 'axios' ; import { DUMMY_BASE_URL , assertParamExists , setApiKeyToObject , setBasicAuthToObject , setBearerAuthToObject , setOAuthToObject , setSearchParams , serializeDataIfNeeded , toPathString , createRequestFunction } from './common' ; import { BASE_PATH , COLLECTION_FORMATS , RequestArgs , BaseAPI , RequiredError } from './base' ; export interface export interface CreateRestrictedDataTokenRequest { type { string } memberof targetApplication ? : string ; type { Array < RestrictedResource > } memberof restrictedResources : Array < RestrictedResource > ; } export interface export interface CreateRestrictedDataTokenResponse { type { string } memberof restrictedDataToken ? : string ; type { number } memberof expiresIn ? : number ; } export interface export interface ErrorList { type { Array < Error > } memberof errors ? : Array < Error > ; } export interface export interface ModelError { type { string } memberof code : string ; type { string } memberof message : string ; type { string } memberof details ? : string ; } export interface export interface RestrictedResource { type { string } memberof method : RestrictedResourceMethodEnum | 'GET' | 'PUT' | 'POST' | 'DELETE' ; type { string } memberof path : string ; type { Array < string > } memberof dataElements ? : Array < string > ; } export enum { string } export enum RestrictedResourceMethodEnum { Get = 'GET' , Put = 'PUT' , Post = 'POST' , Delete = 'DELETE' } export export const TokensApiAxiosParamCreator = function ( configuration ? ) { return { param { CreateRestrictedDataTokenRequest } body param { * } options throws createRestrictedDataToken : async ( body , options = { } ) : Promise < RequestArgs > => { assertParamExists ( 'createRestrictedDataToken' , 'body' , body ) ; const localVarPath = `/tokens/2021-03-01/restrictedDataToken` ; const localVarUrlObj = new URL ( localVarPath , DUMMY_BASE_URL ) ; let baseOptions ; if ( configuration ) { baseOptions = configuration . baseOptions ; } const localVarRequestOptions = { method : 'POST' , ... baseOptions , ... options } ; const localVarHeaderParameter = { } as any ; const localVarQueryParameter = { } as any ; localVarHeaderParameter [ 'Content-Type' ] = 'application/json' ; setSearchParams ( localVarUrlObj , localVarQueryParameter , options . query ) ; let headersFromBaseOptions = baseOptions && baseOptions . headers ? baseOptions . headers : { } ; localVarRequestOptions . headers = { ... localVarHeaderParameter , ... headersFromBaseOptions , ... options . headers } ; localVarRequestOptions . data = serializeDataIfNeeded ( body , localVarRequestOptions , configuration ) ; return { url : toPathString ( localVarUrlObj ) , options : localVarRequestOptions , } ; } , } ; } ; export export const TokensApiFp = function ( configuration ? ) { const localVarAxiosParamCreator = TokensApiAxiosParamCreator ( configuration ) ; return { param { CreateRestrictedDataTokenRequest } body param { * } options throws async createRestrictedDataToken ( body , options ? ) { const localVarAxiosArgs = await localVarAxiosParamCreator . createRestrictedDataToken ( body , options ) ; return createRequestFunction ( localVarAxiosArgs , globalAxios , BASE_PATH , configuration ) ; } , } ; } ; export export const TokensApiFactory = function ( configuration ? , basePath ? , axios ? ) { const localVarFp = TokensApiFp ( configuration ) ; return { param { CreateRestrictedDataTokenRequest } body param { * } options throws createRestrictedDataToken ( body , options ? ) { return localVarFp . createRestrictedDataToken ( body , options ) . then ( ( request ) => request ( axios , basePath ) ) ; } , } ; } ; export interface export interface TokensApiCreateRestrictedDataTokenRequest { type { CreateRestrictedDataTokenRequest } memberof readonly body : CreateRestrictedDataTokenRequest ; } export class extends BaseAPI export class TokensApi extends BaseAPI { param { TokensApiCreateRestrictedDataTokenRequest } requestParameters param { * } options throws memberof public createRestrictedDataToken ( requestParameters , options ? ) { return TokensApiFp ( this . configuration ) . createRestrictedDataToken ( requestParameters . body , options ) . then ( ( request ) => request ( this . axios , this . basePath ) ) ; } }