fix: Backend eslint warnings

This commit is contained in:
Faruk AYDIN
2022-03-07 16:18:29 +03:00
committed by Ömer Faruk Aydın
parent ecc9239bfe
commit 775ac7a8b1
20 changed files with 144 additions and 71 deletions

View File

@@ -1,9 +1,10 @@
import CreateTweet from './actions/create-tweet';
import { IJSONObject } from '@automatisch/types';
export default class Actions {
createTweet: any
createTweet: CreateTweet;
constructor(connectionData: any, parameters: any) {
this.createTweet = new CreateTweet(connectionData, parameters)
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.createTweet = new CreateTweet(connectionData, parameters);
}
}

View File

@@ -1,22 +1,23 @@
import TwitterApi from 'twitter-api-v2';
import TwitterApi, { TwitterApiTokens } from 'twitter-api-v2';
import { IJSONObject } from '@automatisch/types';
export default class CreateTweet {
client: any;
parameters: any;
client: TwitterApi;
parameters: IJSONObject;
constructor(connectionData: any, parameters: any) {
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
this.client = new TwitterApi({
appKey: connectionData.consumerKey,
appSecret: connectionData.consumerSecret,
accessToken: connectionData.accessToken,
accessSecret: connectionData.accessSecret,
});
} as TwitterApiTokens);
this.parameters = parameters;
}
async run() {
const tweet = await this.client.v1.tweet(this.parameters.tweet);
const tweet = await this.client.v1.tweet(this.parameters.tweet as string);
return tweet;
}
}

View File

@@ -1,13 +1,23 @@
import {
IService,
IAuthentication,
IApp,
IJSONObject,
} from '@automatisch/types';
import Authentication from './authentication';
import Triggers from './triggers';
import Actions from './actions';
export default class Twitter {
authenticationClient: any;
triggers: any;
actions: any;
export default class Twitter implements IService {
authenticationClient: IAuthentication;
triggers: Triggers;
actions: Actions;
constructor(appData: any, connectionData: any, parameters: any) {
constructor(
appData: IApp,
connectionData: IJSONObject,
parameters: IJSONObject
) {
this.authenticationClient = new Authentication(appData, connectionData);
this.triggers = new Triggers(connectionData);
this.actions = new Actions(connectionData, parameters);

View File

@@ -1,9 +1,10 @@
import MyTweet from './triggers/my-tweet';
import { IJSONObject } from '@automatisch/types';
export default class Triggers {
myTweet: any
myTweet: MyTweet;
constructor(connectionData: any) {
this.myTweet = new MyTweet(connectionData)
constructor(connectionData: IJSONObject) {
this.myTweet = new MyTweet(connectionData);
}
}

View File

@@ -1,15 +1,16 @@
import TwitterApi from 'twitter-api-v2';
import TwitterApi, { TwitterApiTokens } from 'twitter-api-v2';
import { IJSONObject } from '@automatisch/types';
export default class MyTweet {
client: any
client: TwitterApi;
constructor(connectionData: any) {
constructor(connectionData: IJSONObject) {
this.client = new TwitterApi({
appKey: connectionData.consumerKey,
appSecret: connectionData.consumerSecret,
accessToken: connectionData.accessToken,
accessSecret: connectionData.accessSecret
});
accessSecret: connectionData.accessSecret,
} as TwitterApiTokens);
}
async run() {