diff --git a/packages/backend/src/apps/twitter/info.json b/packages/backend/src/apps/twitter/info.json index 799efc4a..71fc83af 100644 --- a/packages/backend/src/apps/twitter/info.json +++ b/packages/backend/src/apps/twitter/info.json @@ -111,5 +111,75 @@ } ] } + ], + "reconnectionSteps": [ + { + "step": 1, + "type": "mutation", + "name": "updateConnection", + "fields": [ + { + "name": "id", + "value": "{connection.id}" + }, + { + "name": "data", + "value": null, + "fields": [ + { + "name": "consumerKey", + "value": "{fields.consumerKey}" + }, + { + "name": "consumerSecret", + "value": "{fields.consumerSecret}" + } + ] + } + ] + }, + { + "step": 2, + "type": "mutation", + "name": "createAuthLink", + "fields": [ + { + "name": "id", + "value": "{connection.id}" + } + ] + }, + { + "step": 3, + "type": "openWithPopup", + "name": "openTwitterAuthPopup", + "fields": [ + { + "name": "url", + "value": "{createAuthLink.url}" + } + ] + }, + { + "step": 4, + "type": "mutation", + "name": "updateConnection", + "fields": [ + { + "name": "id", + "value": "{connection.id}" + }, + { + "name": "data", + "value": null, + "fields": [ + { + "name": "oauthVerifier", + "value": "{openTwitterAuthPopup.oauth_verifier}" + } + ] + } + ] + } ] } diff --git a/packages/backend/src/graphql/types/app.ts b/packages/backend/src/graphql/types/app.ts index 535eb048..5e43cf65 100644 --- a/packages/backend/src/graphql/types/app.ts +++ b/packages/backend/src/graphql/types/app.ts @@ -1,6 +1,7 @@ import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt } from 'graphql'; import fieldType from './field'; import authenticationStepType from './authentication-step'; +import reconnectionStepType from './reconnection-step'; const appType = new GraphQLObjectType({ name: 'App', @@ -16,6 +17,7 @@ const appType = new GraphQLObjectType({ primaryColor: { type: GraphQLString }, fields: { type: GraphQLList(fieldType) }, authenticationSteps: { type: GraphQLList(authenticationStepType) }, + reconnectionSteps: { type: GraphQLList(reconnectionStepType) }, connections: { type: GraphQLList(connectionType) }, } } diff --git a/packages/backend/src/graphql/types/authentication-step.ts b/packages/backend/src/graphql/types/authentication-step.ts index 4ac120d0..68150978 100644 --- a/packages/backend/src/graphql/types/authentication-step.ts +++ b/packages/backend/src/graphql/types/authentication-step.ts @@ -9,14 +9,14 @@ const authenticationStepType = new GraphQLObjectType({ fields: { type: GraphQLList( new GraphQLObjectType({ - name: 'authenticationStepFields', + name: 'AuthenticationStepFields', fields: { name: { type: GraphQLString }, value: { type: GraphQLString }, fields: { type: GraphQLList( new GraphQLObjectType({ - name: 'twitterAuthenticationStepFields', + name: 'TwitterAuthenticationStepFields', fields: { name: { type: GraphQLString }, value: { type: GraphQLString } diff --git a/packages/backend/src/graphql/types/reconnection-step.ts b/packages/backend/src/graphql/types/reconnection-step.ts new file mode 100644 index 00000000..bae72393 --- /dev/null +++ b/packages/backend/src/graphql/types/reconnection-step.ts @@ -0,0 +1,34 @@ +import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt } from 'graphql'; + +const reconnectionStepType = new GraphQLObjectType({ + name: 'ReconnectionStep', + fields: { + step: { type: GraphQLInt }, + type: { type: GraphQLString }, + name: { type: GraphQLString }, + fields: { + type: GraphQLList( + new GraphQLObjectType({ + name: 'ReconnectionStepFields', + fields: { + name: { type: GraphQLString }, + value: { type: GraphQLString }, + fields: { + type: GraphQLList( + new GraphQLObjectType({ + name: 'TwitterReconnectionStepFields', + fields: { + name: { type: GraphQLString }, + value: { type: GraphQLString } + } + }) + ) + }, + } + }), + ) + } + } +}) + +export default reconnectionStepType;