feat: Introduce reconnection steps for twitter app

This commit is contained in:
Faruk AYDIN
2021-10-20 18:15:23 +02:00
committed by Ali BARIN
parent bc0fe5323e
commit 258caa81f0
4 changed files with 108 additions and 2 deletions

View File

@@ -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}"
}
]
}
]
}
]
}

View File

@@ -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) },
}
}

View File

@@ -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 }

View File

@@ -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;