feat: Add draft triggers and actions to twitter app

This commit is contained in:
Faruk AYDIN
2022-01-06 18:00:23 +03:00
committed by Ömer Faruk Aydın
parent c07b377de1
commit b6c7ce96c9
4 changed files with 112 additions and 8 deletions

View File

@@ -227,12 +227,44 @@
{ {
"name": "My Tweet", "name": "My Tweet",
"key": "myTweet", "key": "myTweet",
"description": "Will be triggered when you tweet something new." "description": "Will be triggered when you tweet something new.",
"subSteps": [
{
"name": "Choose app & event"
},
{
"name": "Choose account"
},
{
"name": "Test trigger"
}
]
}, },
{ {
"name": "User Tweet", "name": "User Tweet",
"key": "userTweet", "key": "userTweet",
"description": "Will be triggered when a specific user tweet something new." "description": "Will be triggered when a specific user tweet something new.",
"subSteps": [
{
"name": "Choose app & event"
},
{
"name": "Choose account"
},
{
"name": "Set up a trigger",
"arguments": [
{
"name": "username",
"type": "string",
"required": true
}
]
},
{
"name": "Test trigger"
}
]
} }
], ],
"actions": [ "actions": [
@@ -240,13 +272,27 @@
"name": "Create Tweet", "name": "Create Tweet",
"key": "createTweet", "key": "createTweet",
"description": "Will create a tweet.", "description": "Will create a tweet.",
"parameters" : [ "subSteps": [
{ {
"name": "Message", "name": "Choose app & event"
"key": "message", },
{
"name": "Choose account"
},
{
"name": "Set up action",
"arguments": [
{
"name": "tweet",
"type": "string",
"required": true "required": true
} }
] ]
},
{
"name": "Test action"
}
]
} }
] ]
} }

View File

@@ -0,0 +1,34 @@
import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt, GraphQLBoolean } from 'graphql';
const actionType = new GraphQLObjectType({
name: 'Action',
fields: {
name: { type: GraphQLString },
key: { type: GraphQLString },
description: { type: GraphQLString },
subSteps: {
type: GraphQLList(
new GraphQLObjectType({
name: 'ActionSubStep',
fields: {
name: { type: GraphQLString },
arguments: {
type: GraphQLList(
new GraphQLObjectType({
name: 'ActionSubStepArgument',
fields: {
name: { type: GraphQLString },
type: { type: GraphQLString },
required: { type: GraphQLBoolean }
}
})
)
},
}
}),
)
}
}
})
export default actionType;

View File

@@ -3,6 +3,7 @@ import fieldType from './field';
import authenticationStepType from './authentication-step'; import authenticationStepType from './authentication-step';
import reconnectionStepType from './reconnection-step'; import reconnectionStepType from './reconnection-step';
import triggerType from './trigger'; import triggerType from './trigger';
import actionType from './action';
const appType = new GraphQLObjectType({ const appType = new GraphQLObjectType({
name: 'App', name: 'App',
@@ -20,6 +21,7 @@ const appType = new GraphQLObjectType({
authenticationSteps: { type: GraphQLList(authenticationStepType) }, authenticationSteps: { type: GraphQLList(authenticationStepType) },
reconnectionSteps: { type: GraphQLList(reconnectionStepType) }, reconnectionSteps: { type: GraphQLList(reconnectionStepType) },
triggers: { type: GraphQLList(triggerType) }, triggers: { type: GraphQLList(triggerType) },
actions: { type: GraphQLList(actionType) },
connections: { type: GraphQLList(connectionType) }, connections: { type: GraphQLList(connectionType) },
} }
} }

View File

@@ -1,11 +1,33 @@
import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt } from 'graphql'; import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt, GraphQLBoolean } from 'graphql';
const triggerType = new GraphQLObjectType({ const triggerType = new GraphQLObjectType({
name: 'Trigger', name: 'Trigger',
fields: { fields: {
name: { type: GraphQLString }, name: { type: GraphQLString },
key: { type: GraphQLString }, key: { type: GraphQLString },
description: { type: GraphQLString } description: { type: GraphQLString },
subSteps: {
type: GraphQLList(
new GraphQLObjectType({
name: 'TriggerSubStep',
fields: {
name: { type: GraphQLString },
arguments: {
type: GraphQLList(
new GraphQLObjectType({
name: 'TriggerSubStepArgument',
fields: {
name: { type: GraphQLString },
type: { type: GraphQLString },
required: { type: GraphQLBoolean }
}
})
)
},
}
}),
)
}
} }
}) })