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/Spotify/index.ts | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'src/connections/Spotify/index.ts') diff --git a/src/connections/Spotify/index.ts b/src/connections/Spotify/index.ts index ece404d8..6a456b44 100644 --- a/src/connections/Spotify/index.ts +++ b/src/connections/Spotify/index.ts @@ -63,10 +63,7 @@ export default class SpotifyConnection extends RefreshableConnection { * So to prevent spamming the spotify api we disable the ability to refresh. */ this.refreshEnabled = false; - 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}`); @@ -88,10 +85,7 @@ export default class SpotifyConnection 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(); @@ -101,9 +95,7 @@ export default class SpotifyConnection 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( @@ -111,7 +103,7 @@ export default class SpotifyConnection extends RefreshableConnection { grant_type: "authorization_code", code: code, redirect_uri: this.getRedirectUri(), - }), + }) ) .post() .json() @@ -121,11 +113,8 @@ export default class SpotifyConnection 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(); @@ -134,16 +123,14 @@ export default class SpotifyConnection 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( new URLSearchParams({ grant_type: "refresh_token", refresh_token, - }), + }) ) .post() .unauthorized(async () => { @@ -173,9 +160,7 @@ export default class SpotifyConnection 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