import { runtime , services } from 'ask-smapi-model' ; import AuthenticationConfiguration = runtime . AuthenticationConfiguration ; import { AccessTokenConfig , RefreshTokenConfig } from './authMethods/AuthMethods' ; export class export class SmapiClientBuilder { protected customUserAgent : string ; protected accessTokenConfig : AccessTokenConfig ; protected refreshTokenConfig : RefreshTokenConfig ; public withCustomUserAgent ( userAgent ) { this . customUserAgent = userAgent ; return this ; } public withAccessTokenConfig ( accessTokenConfig ) { this . accessTokenConfig = accessTokenConfig ; return this ; } public withRefreshTokenConfig ( refreshTokenConfig ) { this . refreshTokenConfig = refreshTokenConfig ; return this ; } public client ( ) { throw new Error ( 'client function is not implemented' ) ; } protected getAuthenticationConfiguration ( ) { const authenticationConfiguration = { clientId : this . refreshTokenConfig ? this . refreshTokenConfig . clientId : this . accessTokenConfig . clientId , clientSecret : this . refreshTokenConfig ? this . refreshTokenConfig . clientSecret : this . accessTokenConfig . clientSecret , accessToken : this . accessTokenConfig ? this . accessTokenConfig . accessToken : undefined , refreshToken : this . refreshTokenConfig ? this . refreshTokenConfig . refreshToken : undefined } ; return authenticationConfiguration ; } }