-
Notifications
You must be signed in to change notification settings - Fork 0
/
socket.yml
109 lines (106 loc) · 2.28 KB
/
socket.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
name: user-auth
description: Basic user auth/register Socket
runtime: nodejs_v8
version: 1.1.2
keywords:
- user
- register
- auth
- authentication
classes:
user:
- name: email
type: string
- name: fullName
type: string
endpoints:
login:
description: Log in user by checking username and password
inputs:
required:
- username
- password
properties:
username:
type: string
minLength: 2
password:
type: string
minLength: 2
response:
success:
exit_code: 200
description: Success
example: |
{
"token": "cb21ff98ac8c7dda8fcd0129b0adb0254dea5c8e",
"username": "username"
}
fail:
exit_code: 400
description: Authentication failed
example: |
{
"message": "Given credentials are invalid."
}
register:
description: Register user
inputs:
required:
- username
- password
properties:
fullName:
type: string
minLength: 2
username:
type: string
minLength: 2
password:
type: string
minLength: 6
response:
success:
description: Success
example: |
{
"token": "cb21ff98ac8c7dda8fcd0129b0adb0254dea5c8e",
"username": "username"
}
wrongEmail:
exit_code: 400
description: Username is not a valid email
example: |
{
"username": "Given email is invalid." }
}
userAlreadyExist:
exit_code: 400
description: Failed
example: |
{
"username": "User already exists." }
}
social-login:
inputs:
required:
- accessToken
properties:
accessToken:
type: string
minLength: 2
response:
success:
description: Success
example: |
{
"token": "cb21ff98ac8c7dda8fcd0129b0adb0254dea5c8e",
"username": "username"
}
fail:
exit_code: 400
description: Authentication failed
example: |
{
"message": "Error!"
}