From 0a8ceb9e6349284e75545a01ffad608b020f78e2 Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Mon, 11 Dec 2023 01:12:54 +0100 Subject: Actually run prettier --- src/connections/Twitter/index.ts | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'src/connections/Twitter') diff --git a/src/connections/Twitter/index.ts b/src/connections/Twitter/index.ts index 62fd7da1..424fd455 100644 --- a/src/connections/Twitter/index.ts +++ b/src/connections/Twitter/index.ts @@ -55,10 +55,7 @@ export default class TwitterConnection extends RefreshableConnection { settings: TwitterSettings = new TwitterSettings(); init(): void { - const settings = ConnectionLoader.getConnectionConfig( - this.id, - this.settings, - ); + const settings = ConnectionLoader.getConnectionConfig(this.id, this.settings); if (settings.enabled && (!settings.clientId || !settings.clientSecret)) throw new Error(`Invalid settings for connection ${this.id}`); @@ -82,10 +79,7 @@ export default class TwitterConnection extends RefreshableConnection { return this.tokenUrl; } - async exchangeCode( - state: string, - code: string, - ): Promise { + async exchangeCode(state: string, code: string): Promise { this.validateState(state); const url = this.getTokenUrl(); @@ -95,9 +89,7 @@ export default class TwitterConnection extends RefreshableConnection { Accept: "application/json", "Content-Type": "application/x-www-form-urlencoded", Authorization: `Basic ${Buffer.from( - `${this.settings.clientId as string}:${ - this.settings.clientSecret as string - }`, + `${this.settings.clientId as string}:${this.settings.clientSecret as string}` ).toString("base64")}`, }) .body( @@ -107,7 +99,7 @@ export default class TwitterConnection extends RefreshableConnection { client_id: this.settings.clientId as string, redirect_uri: this.getRedirectUri(), code_verifier: "challenge", // TODO: properly use PKCE challenge - }), + }) ) .post() .json() @@ -117,11 +109,8 @@ export default class TwitterConnection extends RefreshableConnection { }); } - async refreshToken( - connectedAccount: ConnectedAccount, - ): Promise { - if (!connectedAccount.token_data?.refresh_token) - throw new Error("No refresh token available."); + async refreshToken(connectedAccount: ConnectedAccount): Promise { + if (!connectedAccount.token_data?.refresh_token) throw new Error("No refresh token available."); const refresh_token = connectedAccount.token_data.refresh_token; const url = this.getTokenUrl(); @@ -131,9 +120,7 @@ export default class TwitterConnection extends RefreshableConnection { Accept: "application/json", "Content-Type": "application/x-www-form-urlencoded", Authorization: `Basic ${Buffer.from( - `${this.settings.clientId as string}:${ - this.settings.clientSecret as string - }`, + `${this.settings.clientId as string}:${this.settings.clientSecret as string}` ).toString("base64")}`, }) .body( @@ -143,7 +130,7 @@ export default class TwitterConnection extends RefreshableConnection { client_id: this.settings.clientId as string, redirect_uri: this.getRedirectUri(), code_verifier: "challenge", // TODO: properly use PKCE challenge - }), + }) ) .post() .json() @@ -167,9 +154,7 @@ export default class TwitterConnection extends RefreshableConnection { }); } - async handleCallback( - params: ConnectionCallbackSchema, - ): Promise { + async handleCallback(params: ConnectionCallbackSchema): Promise { const { state, code } = params; if (!code) throw new Error("No code provided"); -- cgit 1.5.1