chore: Rename credentials as connections

This commit is contained in:
Faruk AYDIN
2021-10-17 13:26:58 +02:00
committed by Ali BARIN
parent 3a44cf5f86
commit 8fa0178e08
10 changed files with 68 additions and 59 deletions

View File

@@ -4,18 +4,18 @@ import Field from '../../types/field';
export default class Twitter {
client: any
credentialsData: any
connectionData: any
appData: any
constructor(credentialsData: any) {
constructor(connectionData: any) {
this.client = new TwitterApi({
appKey: credentialsData.consumerKey,
appSecret: credentialsData.consumerSecret,
accessToken: credentialsData.accessToken,
accessSecret: credentialsData.accessSecret
appKey: connectionData.consumerKey,
appSecret: connectionData.consumerSecret,
accessToken: connectionData.accessToken,
accessSecret: connectionData.accessSecret
});
this.credentialsData = credentialsData;
this.connectionData = connectionData;
this.appData = App.findOneByName('twitter');
}
@@ -27,11 +27,11 @@ export default class Twitter {
}
async verifyCredentials() {
const verifiedCredentials = await this.client.login(this.credentialsData.oauthVerifier)
const verifiedCredentials = await this.client.login(this.connectionData.oauthVerifier)
return {
consumerKey: this.credentialsData.consumerKey,
consumerSecret: this.credentialsData.consumerSecret,
consumerKey: this.connectionData.consumerKey,
consumerSecret: this.connectionData.consumerSecret,
accessToken: verifiedCredentials.accessToken,
accessSecret: verifiedCredentials.accessSecret,
userId: verifiedCredentials.userId,