Created
February 3, 2020 17:11
-
-
Save judasane/ccb3fdc677b546315b01b41d0b7df63a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.1 | |
security: | |
- cookieAuth: [] | |
info: | |
title: On My Radar email API | |
description: This is the documentation for On My Radar API. | |
contact: | |
email: jhonjairoroa87@gmail.com | |
license: | |
name: Apache 2.0 | |
url: http://www.apache.org/licenses/LICENSE-2.0.html | |
version: 1.0.0 | |
servers: | |
- url: http://localhost:3030 | |
tags: | |
- name: Check | |
description: Is the API working? | |
- name: Messages | |
description: Messages API | |
paths: | |
/api/emails: | |
get: | |
tags: | |
- Messages | |
summary: Get a list of emails sent by user | |
description: Get a list of emails sent by user in Json format | |
responses: | |
200: | |
description: list of emails | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
$ref: '#/components/schemas/Message' | |
post: | |
tags: | |
- Messages | |
summary: Create a new message | |
description: Create a new message in the app, ready to be sent | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/NewMessage' | |
responses: | |
201: | |
description: Email successfully created | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Message' | |
put: | |
tags: | |
- Messages | |
summary: Edit a message | |
description: For a valid response, send a json object with valid format data | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/NewMessage' | |
responses: | |
200: | |
description: Email successfully edited | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Message' | |
delete: | |
tags: | |
- Messages | |
summary: Delete message by id | |
description: For valid response try strings with uuid format. Other formats or types will generate API errors | |
parameters: | |
- name: messageId | |
in: path | |
description: ID of the order that needs to be deleted | |
required: true | |
schema: | |
type: string | |
format: uuid | |
responses: | |
200: | |
description: The deleted (non existing anymore) message | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Message' | |
400: | |
description: Invalid ID supplied | |
content: {} | |
404: | |
description: Message not found | |
content: {} | |
/api/emails/send: | |
post: | |
tags: | |
- Messages | |
summary: Send an array of emails | |
description: Based on message ids, this method sends a collection of already existing messages to the actual address in "to" field in each one | |
requestBody: | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
messages: | |
type: array | |
items: | |
type: string | |
format: uuid | |
responses: | |
201: | |
description: Emails sent successfully | |
/check: | |
get: | |
tags: | |
- check | |
summary: Checks if the application is running | |
description: Returns a string saying __It's working__ | |
responses: | |
200: | |
description: It's working | |
components: | |
schemas: | |
Message: | |
allOf: | |
- $ref: '#/components/schemas/NewMessage' | |
- type: object | |
properties: | |
id: | |
type: string | |
format: uuid | |
NewMessage: | |
type: object | |
properties: | |
connection_id: | |
type: string | |
format: uuid | |
status: | |
type: integer | |
example: 2 | |
created: | |
type: integer | |
example: 1580504916 | |
sent: | |
type: integer | |
example: 1580504916 | |
to: | |
type: string | |
format: email | |
from: | |
type: string | |
format: email | |
body: | |
type: string | |
subject: | |
type: string | |
securitySchemes: | |
cookieAuth: # arbitrary name for the security scheme; will be used in the "security" key later | |
type: apiKey | |
in: cookie | |
name: session | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment