import { runtime , services } from 'ask-smapi-model' ; import ApiConfiguration = runtime . ApiConfiguration ; import ApiClient = runtime . ApiClient ; import AuthenticationConfiguration = runtime . AuthenticationConfiguration ; import DefaultApiClient = runtime . DefaultApiClient ; import { SmapiClientBuilder } from './AbstractSmapiClientBuilder' ; const DEFAULT_API_ENDPOINT = 'https://api.amazonalexa.com' ; /**
 * StandardSmapiClientBuilder class use default ApiClient and default ApiEndpoint
 */ export class StandardSmapiClientBuilder extends SmapiClientBuilder { /**
     * Funtion used to generate SkillManagementService instance.
     */ public client ( ) { if ( this . refreshTokenConfig || this . accessTokenConfig ) { const apiConfiguration = { apiClient : new DefaultApiClient ( ) , apiEndpoint : DEFAULT_API_ENDPOINT , authorizationValue : null , } ; const authenticationConfiguration = this . getAuthenticationConfiguration ( ) ; return new services . skillManagement . SkillManagementServiceClient ( apiConfiguration , authenticationConfiguration , this . customUserAgent ) ; } throw new Error ( 'Please provide accessToken or refreshToken Config to build smapi client' ) ; } } /**
 * CustomSmapiClientBuilder give user ability to configure ApiClient and ApiEndpoint
 */ export class CustomSmapiClientBuilder extends StandardSmapiClientBuilder { private apiClient : ApiClient ; private apiEndpoint : string ; private authEndpoint ? : string ; public withApiEndpoint ( apiEndpoint ) { this . apiEndpoint = apiEndpoint ; return this ; } public withAuthEndpoint ( authEndpoint ) { this . authEndpoint = authEndpoint ; return this ; } public withApiClient ( apiClient ) { this . apiClient = apiClient ; return this ; } /**
     * Function used to generate SkillManagementService instance.
     */ public client ( ) { if ( ! this . apiEndpoint ) { this . apiEndpoint = DEFAULT_API_ENDPOINT ; } if ( ! this . apiClient ) { this . apiClient = new DefaultApiClient ( ) ; } if ( this . refreshTokenConfig || this . accessTokenConfig ) { const apiConfiguration = { apiClient : this . apiClient , apiEndpoint : this . apiEndpoint , authorizationValue : null , } ; const authenticationConfiguration = this . getAuthenticationConfiguration ( ) ; authenticationConfiguration . authEndpoint = this . authEndpoint ; return new services . skillManagement . SkillManagementServiceClient ( apiConfiguration , authenticationConfiguration , this . customUserAgent ) ; } throw new Error ( 'Please provide accessToken or refreshToken Config to build smapi client' ) ; } }