diff --git a/src/api/routes/users/@me/connections/#connection_name/#connection_id/access-token.ts b/src/api/routes/users/@me/connections/#connection_name/#connection_id/access-token.ts
index 9031f3c8..789a7878 100644
--- a/src/api/routes/users/@me/connections/#connection_name/#connection_id/access-token.ts
+++ b/src/api/routes/users/@me/connections/#connection_name/#connection_id/access-token.ts
@@ -23,9 +23,9 @@ import {
ConnectionStore,
DiscordApiErrors,
FieldErrors,
+ RefreshableConnection,
} from "@spacebar/util";
import { Request, Response, Router } from "express";
-import RefreshableConnection from "../../../../../../../util/connections/RefreshableConnection";
const router = Router();
// TODO: this route is only used for spotify, twitch, and youtube. (battlenet seems to be able to PUT, maybe others also)
diff --git a/src/connections/BattleNet/index.ts b/src/connections/BattleNet/index.ts
index 7edc2e92..65ee8ab9 100644
--- a/src/connections/BattleNet/index.ts
+++ b/src/connections/BattleNet/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { BattleNetSettings } from "./BattleNetSettings";
interface BattleNetConnectionUser {
@@ -33,10 +33,10 @@ interface BattleNetConnectionUser {
battletag: string;
}
-interface BattleNetErrorResponse {
- error: string;
- error_description: string;
-}
+// interface BattleNetErrorResponse {
+// error: string;
+// error_description: string;
+// }
export default class BattleNetConnection extends Connection {
public readonly id = "battlenet";
diff --git a/src/connections/Discord/index.ts b/src/connections/Discord/index.ts
index 76de33be..098ce999 100644
--- a/src/connections/Discord/index.ts
+++ b/src/connections/Discord/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { DiscordSettings } from "./DiscordSettings";
interface UserResponse {
diff --git a/src/connections/EpicGames/index.ts b/src/connections/EpicGames/index.ts
index bd7c7eef..8521a6f3 100644
--- a/src/connections/EpicGames/index.ts
+++ b/src/connections/EpicGames/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { EpicGamesSettings } from "./EpicGamesSettings";
export interface UserResponse {
diff --git a/src/connections/Facebook/index.ts b/src/connections/Facebook/index.ts
index 6ce722dd..f3c16cf0 100644
--- a/src/connections/Facebook/index.ts
+++ b/src/connections/Facebook/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { FacebookSettings } from "./FacebookSettings";
export interface FacebookErrorResponse {
diff --git a/src/connections/GitHub/index.ts b/src/connections/GitHub/index.ts
index a675873f..101b205c 100644
--- a/src/connections/GitHub/index.ts
+++ b/src/connections/GitHub/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { GitHubSettings } from "./GitHubSettings";
interface UserResponse {
diff --git a/src/connections/Reddit/index.ts b/src/connections/Reddit/index.ts
index 191c6452..6194d251 100644
--- a/src/connections/Reddit/index.ts
+++ b/src/connections/Reddit/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { RedditSettings } from "./RedditSettings";
export interface UserResponse {
diff --git a/src/connections/Spotify/index.ts b/src/connections/Spotify/index.ts
index 61b17366..50f14a38 100644
--- a/src/connections/Spotify/index.ts
+++ b/src/connections/Spotify/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ RefreshableConnection,
} from "@spacebar/util";
import wretch from "wretch";
-import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { SpotifySettings } from "./SpotifySettings";
export interface UserResponse {
diff --git a/src/connections/Twitch/index.ts b/src/connections/Twitch/index.ts
index 6d679aa4..f9412a17 100644
--- a/src/connections/Twitch/index.ts
+++ b/src/connections/Twitch/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ RefreshableConnection,
} from "@spacebar/util";
import wretch from "wretch";
-import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { TwitchSettings } from "./TwitchSettings";
interface TwitchConnectionUserResponse {
diff --git a/src/connections/Twitter/index.ts b/src/connections/Twitter/index.ts
index aa48ca12..4526fdf5 100644
--- a/src/connections/Twitter/index.ts
+++ b/src/connections/Twitter/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ RefreshableConnection,
} from "@spacebar/util";
import wretch from "wretch";
-import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { TwitterSettings } from "./TwitterSettings";
interface TwitterUserResponse {
@@ -40,10 +40,10 @@ interface TwitterUserResponse {
};
}
-interface TwitterErrorResponse {
- error: string;
- error_description: string;
-}
+// interface TwitterErrorResponse {
+// error: string;
+// error_description: string;
+// }
export default class TwitterConnection extends RefreshableConnection {
public readonly id = "twitter";
diff --git a/src/connections/Xbox/index.ts b/src/connections/Xbox/index.ts
index c592fd0b..3df09e27 100644
--- a/src/connections/Xbox/index.ts
+++ b/src/connections/Xbox/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { XboxSettings } from "./XboxSettings";
interface XboxUserResponse {
@@ -44,10 +44,10 @@ interface XboxUserResponse {
};
}
-interface XboxErrorResponse {
- error: string;
- error_description: string;
-}
+// interface XboxErrorResponse {
+// error: string;
+// error_description: string;
+// }
export default class XboxConnection extends Connection {
public readonly id = "xbox";
diff --git a/src/connections/Youtube/index.ts b/src/connections/Youtube/index.ts
index f3a43fcc..faab44c5 100644
--- a/src/connections/Youtube/index.ts
+++ b/src/connections/Youtube/index.ts
@@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
+ Connection,
} from "@spacebar/util";
import wretch from "wretch";
-import Connection from "../../util/connections/Connection";
import { YoutubeSettings } from "./YoutubeSettings";
interface YouTubeConnectionChannelListResult {
diff --git a/src/util/connections/Connection.ts b/src/util/connections/Connection.ts
index becee589..5bdebd47 100644
--- a/src/util/connections/Connection.ts
+++ b/src/util/connections/Connection.ts
@@ -24,7 +24,7 @@ import { Config, DiscordApiErrors } from "../util";
/**
* A connection that can be used to connect to an external service.
*/
-export default abstract class Connection {
+export abstract class Connection {
id: string;
settings: { enabled: boolean };
states: Map<string, string> = new Map();
diff --git a/src/util/connections/ConnectionLoader.ts b/src/util/connections/ConnectionLoader.ts
index 28f1a202..6b27baec 100644
--- a/src/util/connections/ConnectionLoader.ts
+++ b/src/util/connections/ConnectionLoader.ts
@@ -18,7 +18,7 @@
import fs from "fs";
import path from "path";
-import Connection from "./Connection";
+import { Connection } from "@spacebar/util";
import { ConnectionConfig } from "./ConnectionConfig";
import { ConnectionStore } from "./ConnectionStore";
diff --git a/src/util/connections/ConnectionStore.ts b/src/util/connections/ConnectionStore.ts
index 39abfea6..95e54fd9 100644
--- a/src/util/connections/ConnectionStore.ts
+++ b/src/util/connections/ConnectionStore.ts
@@ -16,8 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import Connection from "./Connection";
-import RefreshableConnection from "./RefreshableConnection";
+import { Connection } from "./Connection";
+import { RefreshableConnection } from "./RefreshableConnection";
export class ConnectionStore {
public static connections: Map<string, Connection | RefreshableConnection> =
diff --git a/src/util/connections/RefreshableConnection.ts b/src/util/connections/RefreshableConnection.ts
index fd93adfa..eaa88c1b 100644
--- a/src/util/connections/RefreshableConnection.ts
+++ b/src/util/connections/RefreshableConnection.ts
@@ -18,12 +18,12 @@
import { ConnectedAccount } from "../entities";
import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces";
-import Connection from "./Connection";
+import { Connection } from "./Connection";
/**
* A connection that can refresh its token.
*/
-export default abstract class RefreshableConnection extends Connection {
+export abstract class RefreshableConnection extends Connection {
refreshEnabled = true;
/**
* Refreshes the token for a connected account.
|