summary refs log tree commit diff
path: root/src/util/interfaces
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2022-12-23 18:34:36 -0500
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:27:39 -0400
commit0db1fa5f0b2b9b357c1f96178c0e5df7858a99ab (patch)
treeb045eee5f984a40ae47413bad2458cf65eff3c8e /src/util/interfaces
parentDon't try to upload entire config for each connection loaded (diff)
downloadserver-0db1fa5f0b2b9b357c1f96178c0e5df7858a99ab.tar.xz
Refreshable connections, refactoring, access-token endpoint
- Aded /users/@me/connections/:connection_name/:connection_id/access-token
- Replaced `access_token` property on ConnectedAccount with `token_data` object for refreshing tokens
- Made a common interface for connection things like ComonOAuthTokenResponse
- Added `RefreshableConnection` class
- Added token refresh to Spotify connection (disabled)
Diffstat (limited to 'src/util/interfaces')
-rw-r--r--src/util/interfaces/ConnectedAccount.ts16
-rw-r--r--src/util/interfaces/index.ts5
2 files changed, 19 insertions, 2 deletions
diff --git a/src/util/interfaces/ConnectedAccount.ts b/src/util/interfaces/ConnectedAccount.ts
new file mode 100644
index 00000000..c96e5f79
--- /dev/null
+++ b/src/util/interfaces/ConnectedAccount.ts
@@ -0,0 +1,16 @@
+export interface ConnectedAccountCommonOAuthTokenResponse {
+	access_token: string;
+	token_type: string;
+	scope: string;
+	refresh_token?: string;
+	expires_in?: number;
+}
+
+export interface ConnectedAccountTokenData {
+	access_token: string;
+	token_type?: string;
+	scope?: string;
+	refresh_token?: string;
+	expires_in?: number;
+	expires_at?: number;
+}
diff --git a/src/util/interfaces/index.ts b/src/util/interfaces/index.ts
index fa259ce1..e194d174 100644
--- a/src/util/interfaces/index.ts
+++ b/src/util/interfaces/index.ts
@@ -17,7 +17,8 @@
 */
 
 export * from "./Activity";
-export * from "./Presence";
-export * from "./Interaction";
+export * from "./ConnectedAccount";
 export * from "./Event";
+export * from "./Interaction";
+export * from "./Presence";
 export * from "./Status";