-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yml
167 lines (156 loc) · 4.09 KB
/
swagger.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
swagger: "2.0"
info:
description: "Wallet API para realização de transferências de forma simples."
version: "1.0.0"
title: "Wallet API"
termsOfService: ""
contact:
email: "echoclaudio@icloud.com"
host: "127.0.0.1:8000"
basePath: "/api"
# Groups
tags:
- name: "authentication"
description: "Rotas para cadastro e login na API"
- name: "transaction"
description: "Rota para iniciar transação de valores"
schemes:
- "http"
# Routes
paths:
# Public routes
/register:
post:
tags:
- "authentication"
summary: "Criar um usuário para logar na aplicação"
description: "Cria um usuário na API para logar e poder efetuar a transação de valores"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Cria um usuário"
required: true
schema:
$ref: "#/definitions/User"
responses:
"200":
description: "Sucesso ao criar usuário"
"500":
description: "Erro ao criar usuário"
/login:
post:
tags:
- "authentication"
summary: "Loga na aplicação"
description: "Ao logar na aplicação irá ser retornado o token de autenticação do usuário para fazer a transação de valores na API"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "email"
in: "formData"
description: "Email do usuário"
required: true
type: "string"
format: "string"
- name: "password"
in: "formData"
description: "Senha do usuário"
required: true
type: "string"
format: "string"
responses:
"200":
description: "Recebe o access token via header (Authorization)"
"401":
description: "Credenciais inválidas"
"500":
description: "Falha ao logar na API"
# Private routes
/transaction:
post:
tags:
- "transaction"
summary: "Executa uma transação de valores"
description: "Efetua a transação de valores de um usuário comum para usuário comum ou para loja. Usuários lojistas não podem efetuar a transação apenas recebem."
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Cria uma transação"
required: true
schema:
$ref: "#/definitions/Transactions"
responses:
"200":
description: "Sucesso ao criar transação"
"500":
description: "Erro ao criar transação"
security:
- ApiKeyAuth: []
# Models
definitions:
User:
type: "object"
properties:
id:
type: "integer"
format: "int64"
user_type_id:
$ref: "#/definitions/UserTypes"
name:
type: "string"
description: "Nome do usuário"
maxLength: 100
example: "Claudio Emmanuel de Araujo Souza"
cpf_cnpj:
type: "string"
description: "CPF ou CNPJ do usuário"
maxLength: 18
example: "094.312.736-08"
email:
type: "string"
description: "Email do usuário"
example: "echoclaudio@icloud.com"
password:
type: "string"
description: "Senha do usuário"
xml:
name: "User"
UserTypes:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
description: "Nome do tipo de usuário"
maxLength: 100
example: "Common"
xml:
name: "UserTypes"
Transactions:
type: "object"
properties:
id:
type: "integer"
format: "int64"
user_id:
$ref: "#/definitions/User"
payee_id:
$ref: "#/definitions/User"
value:
type: "number"
description: "Valor da transação entre os usuários"
xml:
name: "Transactions"
securityDefinitions:
ApiKeyAuth:
type: apiKey
in: header
name: "Authorization"