Skip to content

Commit

Permalink
chore: add flag to ignore the SDK's client interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Dec 28, 2024
1 parent 7d0c990 commit 544f464
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion mods/sdk/src/client/AbstractClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ abstract class AbstractClient implements FonosterClient {
this._accessToken = accessToken;
}

async setAccessToken(accessToken: string): Promise<void> {
this._accessToken = accessToken;
}

async sendVerificationCode(
contactType: ContactType,
value: string
Expand All @@ -166,7 +170,7 @@ abstract class AbstractClient implements FonosterClient {
requestPBObjectConstructor: SendVerificationCodeRequestPB,
metadata: {},
request: {
contactType: contactType as ContactType,
contactType,
value
},
enumMapping: [["contactType", ContactTypePB]]
Expand Down
10 changes: 7 additions & 3 deletions mods/sdk/src/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class Client extends AbstractClient {
endpoint?: string;
accessKeyId: string;
allowInsecure?: boolean;
withoutInterceptors?: boolean;
}) {
const channelCredentials = config.allowInsecure
? credentials.createInsecure()
Expand All @@ -58,9 +59,12 @@ export class Client extends AbstractClient {

this.channelCredentials = channelCredentials;
this.endpoint = config?.endpoint || DEFAULT_ENDPOINT;
this.tokenRefresherInterceptor = new TokenRefresherNode(this)
.createInterceptor()
.bind(this);
this.tokenRefresherInterceptor =
config.withoutInterceptors ?
null :
new TokenRefresherNode(this)
.createInterceptor()
.bind(this);
}

getMetadata(): Metadata {
Expand Down

0 comments on commit 544f464

Please sign in to comment.