Fix connection class imports
This commit is contained in:
parent
033e2108e7
commit
5c8359ec45
@ -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)
|
||||
|
@ -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";
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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> =
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user