Skip to content

Commit

Permalink
Add start of bcup server datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Apr 24, 2021
1 parent aa43a26 commit dec217b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions source/datasources/ButtercupServerDatasource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { fireInstantiationHandlers, registerDatasource } from "./register";
import TextDatasource from "./TextDatasource";
import Credentials from "../credentials/Credentials";
import { getCredentials } from "../credentials/channel";

export default class ButtercupServerDatasource extends TextDatasource {
_accessToken: string;
_client: any;
_clientID: string;
_clientSecret: string;
_refreshToken: string;
_updateID: number;
_url: string;
_vaultID: number;

constructor(credentials: Credentials) {
super(credentials);
const { data: credentialData } = getCredentials(credentials.id);
const { datasource: datasourceConfig } = credentialData;
const { accessToken, clientID, clientSecret, refreshToken, vaultID } = datasourceConfig;
this._accessToken = accessToken;
this._refreshToken = refreshToken;
this._clientID = clientID;
this._clientSecret = clientSecret;
this._client = null;
this._vaultID = vaultID;
this._updateID = null;
// this._createNewClient();
this.type = "bcupserver";
fireInstantiationHandlers("bcupserver", this);
}
}
1 change: 1 addition & 0 deletions source/index.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export { default as DropboxDatasource } from "./datasources/DropboxDatasource";
export { default as GoogleDriveDatasource } from "./datasources/GoogleDriveDatasource";
export { default as MyButtercupDatasource } from "./datasources/MyButtercupDatasource";
export { default as MyButtercupClient } from "./myButtercup/MyButtercupClient";
export { default as ButtercupServerDatasource } from "./datasources/ButtercupServerDatasource";
export { default as DatasourceAuthManager } from "./datasources/DatasourceAuthManager";
export { registerDatasource } from "./datasources/register";

Expand Down

0 comments on commit dec217b

Please sign in to comment.