-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Redesign SmapiClient class for better extensibility …
…to support other auth methods (#597)
- Loading branch information
1 parent
e1ec8cd
commit a0769b0
Showing
7 changed files
with
165 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
export { SmapiClientBuilder } from './smapiClientBuilder/SmapiClientBuilder'; | ||
export { StandardSmapiClientBuilder, CustomSmapiClientBuilder } from './smapiClientBuilder/SmapiClientBuilderFactory'; | ||
export { SmapiClientBuilder } from './smapiClientBuilder/AbstractSmapiClientBuilder'; | ||
export { StandardSmapiClientBuilder, CustomSmapiClientBuilder } from './smapiClientBuilder/SmapiClientBuilder'; | ||
export { getValueFromHeader } from './util/Util'; | ||
export { RefreshTokenConfig } from './smapiClientBuilder/authMethods/AuthMethods'; |
42 changes: 42 additions & 0 deletions
42
ask-smapi-sdk/lib/smapiClientBuilder/AbstractSmapiClientBuilder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import { services } from 'ask-smapi-model'; | ||
import { RefreshTokenConfig } from './authMethods/AuthMethods'; | ||
|
||
/** | ||
* Abstract Builder class which should be implemented. | ||
* @export | ||
* @class SmapiClientBuilder | ||
*/ | ||
export class SmapiClientBuilder { | ||
|
||
protected customUserAgent : string; | ||
protected refreshTokenConfig : RefreshTokenConfig; | ||
|
||
public withCustomUserAgent(userAgent : string) : SmapiClientBuilder { | ||
this.customUserAgent = userAgent; | ||
|
||
return this; | ||
} | ||
|
||
public withRefreshTokenConfig(refreshTokenConfig : RefreshTokenConfig) : SmapiClientBuilder { | ||
this.refreshTokenConfig = refreshTokenConfig; | ||
|
||
return this; | ||
} | ||
|
||
public client() : services.skillManagement.SkillManagementServiceClient { | ||
throw new Error('client funtion is not implemented'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
ask-smapi-sdk/lib/smapiClientBuilder/SmapiClientBuilderFactory.ts
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
ask-smapi-sdk/lib/smapiClientBuilder/authMethods/AuthMethods.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
export interface RefreshTokenConfig { | ||
clientId : string; | ||
clientSecret : string; | ||
refreshToken : string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters