Skip to content

Commit

Permalink
Merge pull request #126 from AnonymusRaccoon/fix/back
Browse files Browse the repository at this point in the history
Fix/back
zoriya authored Mar 6, 2022
2 parents a0228bd + 95a4edd commit 8630d15
Showing 2 changed files with 756 additions and 0 deletions.
392 changes: 392 additions & 0 deletions Aeris.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,392 @@
{
"info": {
"_postman_id": "0e5ce60d-0d09-497d-a3ba-073c8106a175",
"name": "Aeris",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Auth",
"item": [
{
"name": "Signup",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"clément\",\n \"password\": \"wow\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/auth/signup",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"auth",
"signup"
]
}
},
"response": []
},
{
"name": "Login",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"user login\", function () {",
" pm.response.to.have.status(200);",
" const json = pm.response.json();",
" pm.expect(json.jwt);",
" pm.collectionVariables.set(\"jwt\", json.jwt);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"username\": \"clément\",\n \"password\": \"wow\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/auth/login",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"auth",
"login"
]
}
},
"response": []
},
{
"name": "Me",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "eyJhbGciOiJIUzUxMiJ9.eyJkYXQiOnsidXNlck5hbWUiOiJjbMOpbWVudCIsInVzZXJJZCI6MSwidXNlclNsdWciOiJjbMOpbWVudCJ9fQ._rbp20IDz2SM-OxisFUH1Pk14jFem5HD6p-Z6rRKVJMnOWUneKNb5eX3OHLT22YIYP9CKijYgLbI-BLFTvFOZg",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://{{HOST}}/auth/me",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"auth",
"me"
]
}
},
"response": []
},
{
"name": "Get services",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "http://{{HOST}}/auth/services",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"auth",
"services"
]
}
},
"response": []
}
]
},
{
"name": "Pipelines",
"item": [
{
"name": "Create workflow no reactions",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"enabled\": true,\n \"name\": \"my workflow\",\n \"pType\": \"dqwq\",\n \"pParams\": {\n \"author\": \"me\"\n }\n },\n \"reactions\": []\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/workflow",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow"
]
}
},
"response": []
},
{
"name": "Create workflow with one reaction",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"name\": \"my workflow\",\n \"pType\": \"TwitterNewPost\",\n \"pParams\": {\n \"tag\": \"TwitterNewPostP\",\n \"contents\": {\n \"author\": \"me\"\n }\n }\n },\n \"reactions\": [\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"tag\": \"TwitterTweetP\",\n \"contents\": {\n \"body\": \"I love this tweet\"\n }\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/workflow",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow"
]
}
},
"response": []
},
{
"name": "Create workflow with one reaction Copy",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"enabled\": false,\n \"name\": \"my workflow\",\n \"pType\": \"dqwq\",\n \"pParams\": {\n \"author\": \"me\"\n }\n },\n \"reactions\": [\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"body\": \"I love this tweet even more\"\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/workflow/1",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow",
"1"
]
}
},
"response": []
},
{
"name": "Create workflow with multiple reactions",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"enabled\": true,\n \"name\": \"my workflow\",\n \"pType\": \"dqwq\",\n \"pParams\": {\n \"author\": \"me\"\n }\n },\n \"reactions\": [\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"body\": \"I love this tweet\"\n }\n },\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"body\": \"I love this tweet\"\n }\n },\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"body\": \"I love this tweet\"\n }\n },\n {\n \"rType\": \"TwitterTweet\",\n \"rParams\": {\n \"body\": \"I love this tweet\"\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://{{HOST}}/workflow",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow"
]
}
},
"response": []
},
{
"name": "Get workflow",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{HOST}}/workflow/1",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow",
"1"
]
}
},
"response": []
},
{
"name": "Delete workflow",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "http://{{HOST}}/workflow/6",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflow",
"6"
]
}
},
"response": []
},
{
"name": "Get workflows",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{HOST}}/workflows",
"protocol": "http",
"host": [
"{{HOST}}"
],
"path": [
"workflows"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "HOST",
"value": "localhost/api",
"type": "string"
},
{
"key": "PORT",
"value": "",
"type": "string"
},
{
"key": "jwt",
"value": "",
"type": "string"
}
]
}
364 changes: 364 additions & 0 deletions swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,364 @@
swagger: "2.0"
info:
description: "Aeris api"
version: "1.0.0"
title: "Swagger Aeris"
host: "aeris.swagger.io"
basePath: "/"
tags:
- name: "auth"
description: "Authentication related"
- name: "workflow"
description: "Workflows of the user"
- name: "about"
description: "about.json"

schemes:
- "https"
- "http"
paths:
/about.json:
get:
tags:
- "about"
responses:
"200":
description: "LE JSON QUOI"
/auth/signup:
post:
tags:
- "auth"
summary: "Create a new account"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Workflow object with types and params of the action and reactions"
required: true
schema:
$ref: "#/definitions/AuthBody"
responses:
"200":
description: "Success"
"400":
description: "Failure"

/auth/login:
post:
tags:
- "auth"
summary: "Login and get JWT"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Workflow object with types and params of the action and reactions"
required: true
schema:
$ref: "#/definitions/AuthBody"
responses:
"200":
description: "Success"
schema:
type: "object"
properties:
jwt:
type: "string"
"401":
description: "Wrong creds"

/auth/me:
get:
security:
- JWT: []
tags:
- "auth"
summary: "Check JWT validity"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
responses:
"200":
description: "Connected"
"401":
description: "Wrong creds"

/auth/services:
get:
security:
- JWT: []
tags:
- "auth"
summary: "Get the connected services of user"
responses:
"200":
description: "Connected"
schema:
type: "array"
items:
type: "string"
enum:
- "github"
- "twitter"
- "spotify"
- "discord"
- "google"
"401":
description: "Unauthorized"


/auth/{service}:
get:
security:
- JWT: []
tags:
- "auth"
summary: "Add a service connection"
parameters:
- name: "service"
in: "path"
description: "Id of the workflow targeted"
required: true
type: "string"
enum:
- "github"
- "twitter"
- "spotify"
- "discord"
- "google"
- name: "code"
in: "query"
description: "oauth2 code"
type: "string"
responses:
"200":
description: "Added the service"

"400":
description: "Service conn failed"
"401":
description: "Unauthorized"
delete:
security:
- JWT: []
tags:
- "auth"
summary: "Remove a service connection"
parameters:
- name: "service"
in: "path"
description: "Id of the workflow targeted"
required: true
type: "string"
enum:
- "github"
- "twitter"
- "spotify"
- "discord"
- "google"
responses:
"200":
description: "Removed the service"
"400":
description: "Failed to remove this service"
"401":
description: "Unauthorized"

/workflow:
post:
security:
- JWT: []
tags:
- "workflow"
summary: "Add a new workflow"
description: ""
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Workflow object with types and params of the action and reactions"
required: true
schema:
$ref: "#/definitions/Workflow"
responses:
"200":
description: "Success"
"401":
description: "Unauthorized"
"400":
description: "Failure"
/workflow/{id}:
get:
security:
- JWT: []
tags:
- "workflow"
summary: "Get workflow info"
description: ""
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Id of the workflow targeted"
required: true
type: "integer"
- name: "workflow"
in: "body"
description: "workflow values"
schema:
$ref: "#/definitions/Workflow"
responses:
"200":
description: "Workflow created"
"400":
description: "Workflow creation failed"
"401":
description: "Unauthorized"
put:
security:
- JWT: []
tags:
- "workflow"
summary: "Update a workflow"
description: ""
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Id of the workflow targeted"
required: true
type: "integer"
- name: "workflow"
in: "body"
description: "workflow values"
schema:
$ref: "#/definitions/Workflow"
responses:
"200":
description: "Workflow updated"
"400":
description: "Workflow update failed"
"401":
description: "Unauthorized"
delete:
security:
- JWT: []
tags:
- "workflow"
summary: "Delete a workflow"
description: ""
produces:
- "application/json"
parameters:
- name: "id"
in: "path"
description: "Id of the workflow targeted"
required: true
type: "integer"
responses:
"200":
description: "Workflow created"
"400":
description: "Workflow creation failed"
"401":
description: "Unauthorized"
/workflows:
get:
security:
- JWT: []
tags:
- "workflow"
summary: "Get all of the users workflow"
description: ""
produces:
- "application/json"
responses:
"200":
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Workflow"
"401":
description: "Unauthorized"
securityDefinitions:
JWT:
type: apiKey
in: header
name: Authorization
definitions:
Workflow:
type: "object"
properties:
action:
$ref: "#/definitions/Action"
reactions:
$ref: "#/definitions/Reactions"
Action:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
example: "doggie"
pType:
type: "string"
enum:
- "TwitterNewTweet"
- "ActionName"
pParams:
type: "object"
properties:
tag:
type: "string"
enum:
- "TwitterNewTweetP"
- "ActionName"
contents:
type: "object"
Reaction:
type: "object"
properties:
rType:
type: "string"
enum:
- "TwitterNewTweet"
- "ActionName"
rParams:
type: "object"
properties:
tag:
type: "string"
enum:
- "TwitterNewTweetP"
- "ActionName"
contents:
type: "object"
Reactions:
type: "array"
items:
$ref: "#/definitions/Reaction"
AuthBody:
type: "object"
properties:
username:
type: "string"
password:
type: "string"

0 comments on commit 8630d15

Please sign in to comment.