Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct AuthenticatorInterface type #206

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth/authenticators/authenticator-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface AuthenticatorInterface {
* @param {object.<string, string>} requestOptions.headers The headers the
* authentication information will be added to.
*/
authenticate(requestOptions: AuthenticateOptions): Promise<void | Error>;
authenticate(requestOptions: AuthenticateOptions): Promise<void>;

/**
* Returns a string that indicates the authentication type.
Expand Down
2 changes: 1 addition & 1 deletion auth/authenticators/authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Authenticator implements AuthenticatorInterface {
* @throws {Error} - The authenticate method was not implemented by a
* subclass.
*/
public authenticate(requestOptions: AuthenticateOptions): Promise<void | Error> {
public authenticate(requestOptions: AuthenticateOptions): Promise<void> {
const error = new Error('Should be implemented by subclass!');
return Promise.reject(error);
}
Expand Down
2 changes: 1 addition & 1 deletion auth/authenticators/basic-authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class BasicAuthenticator extends Authenticator {
* @param {object.<string, string>} requestOptions.headers - The headers the
* authentication information will be added too.
*/
public authenticate(requestOptions: AuthenticateOptions): Promise<void | Error> {
public authenticate(requestOptions: AuthenticateOptions): Promise<void> {
return new Promise((resolve) => {
requestOptions.headers = extend(true, {}, requestOptions.headers, this.authHeader);
resolve();
Expand Down
2 changes: 1 addition & 1 deletion auth/authenticators/token-request-based-authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class TokenRequestBasedAuthenticator extends Authenticator {
* authentication information will be added too. Overrides default headers
* where there's conflict.
*/
public authenticate(requestOptions: AuthenticateOptions): Promise<void | Error> {
public authenticate(requestOptions: AuthenticateOptions): Promise<void> {
return this.tokenManager.getToken().then((token) => {
const authHeader = { Authorization: `Bearer ${token}` };
requestOptions.headers = extend(true, {}, requestOptions.headers, authHeader);
Expand Down
8 changes: 4 additions & 4 deletions etc/ibm-cloud-sdk-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function atMostOne(a: any, b: any): boolean;
export class Authenticator implements AuthenticatorInterface {
constructor();
// Warning: (ae-forgotten-export) The symbol "AuthenticateOptions" needs to be exported by the entry point index.d.ts
authenticate(requestOptions: AuthenticateOptions): Promise<void | Error>;
authenticate(requestOptions: AuthenticateOptions): Promise<void>;
authenticationType(): string;
static AUTHTYPE_BASIC: string;
// (undocumented)
Expand All @@ -42,7 +42,7 @@ export class Authenticator implements AuthenticatorInterface {

// @public
export interface AuthenticatorInterface {
authenticate(requestOptions: AuthenticateOptions): Promise<void | Error>;
authenticate(requestOptions: AuthenticateOptions): Promise<void>;
authenticationType(): string;
}

Expand Down Expand Up @@ -72,7 +72,7 @@ export class BaseService {
export class BasicAuthenticator extends Authenticator {
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
constructor(options: Options);
authenticate(requestOptions: AuthenticateOptions): Promise<void | Error>;
authenticate(requestOptions: AuthenticateOptions): Promise<void>;
authenticationType(): string;
// (undocumented)
protected authHeader: {
Expand Down Expand Up @@ -390,7 +390,7 @@ export type TokenManagerOptions = {
export class TokenRequestBasedAuthenticator extends Authenticator {
// Warning: (ae-forgotten-export) The symbol "BaseOptions" needs to be exported by the entry point index.d.ts
constructor(options: BaseOptions);
authenticate(requestOptions: AuthenticateOptions): Promise<void | Error>;
authenticate(requestOptions: AuthenticateOptions): Promise<void>;
// (undocumented)
protected disableSslVerification: boolean;
// (undocumented)
Expand Down