Closes #35 Reviewed-on: phoenix/textsender-auth#38 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
422 lines
10 KiB
YAML
422 lines
10 KiB
YAML
basePath: /api/v1
|
|
definitions:
|
|
git_kundeng_us_phoenix_textsender-models_tx0_user.User:
|
|
properties:
|
|
created:
|
|
type: string
|
|
first_name:
|
|
type: string
|
|
id:
|
|
type: string
|
|
last_login:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
password:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.LoginAccount:
|
|
properties:
|
|
password:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.LoginResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/token.Login'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.RefreshRequest:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
type: object
|
|
handler.RefreshResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/token.Login'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.RegisterResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/handler.RegisterResponseItem'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.RegisterResponseItem:
|
|
properties:
|
|
id:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.RegisterUser:
|
|
properties:
|
|
password:
|
|
type: string
|
|
phone_number:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.ServiceCreationRequest:
|
|
properties:
|
|
passphrase:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.ServiceCreationResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/user.ServiceUser'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.ServiceLoginRequest:
|
|
properties:
|
|
passphrase:
|
|
type: string
|
|
username:
|
|
type: string
|
|
type: object
|
|
handler.ServiceLoginResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/token.Login'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.UpdateNameRequest:
|
|
properties:
|
|
first_name:
|
|
type: string
|
|
last_name:
|
|
type: string
|
|
user_id:
|
|
type: string
|
|
type: object
|
|
handler.UpdateNameResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/git_kundeng_us_phoenix_textsender-models_tx0_user.User'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
handler.UpdatePasswordRequest:
|
|
properties:
|
|
confirmed_password:
|
|
type: string
|
|
current_password:
|
|
type: string
|
|
updated_password:
|
|
type: string
|
|
user_id:
|
|
type: string
|
|
type: object
|
|
handler.UpdatePasswordResponse:
|
|
properties:
|
|
data:
|
|
items:
|
|
$ref: '#/definitions/git_kundeng_us_phoenix_textsender-models_tx0_user.User'
|
|
type: array
|
|
message:
|
|
type: string
|
|
type: object
|
|
token.Login:
|
|
properties:
|
|
access_token:
|
|
type: string
|
|
expires_in:
|
|
type: integer
|
|
issued_at:
|
|
type: integer
|
|
token_type:
|
|
type: string
|
|
user_id:
|
|
type: string
|
|
type: object
|
|
user.ServiceUser:
|
|
properties:
|
|
created:
|
|
type: string
|
|
id:
|
|
type: string
|
|
last_login:
|
|
type: string
|
|
passphrase:
|
|
type: string
|
|
username:
|
|
description: 'TODO: Remove the omitempty tags at a later point'
|
|
type: string
|
|
type: object
|
|
host: localhost:9080
|
|
info:
|
|
contact: {}
|
|
description: Auth API to send text messages
|
|
title: textsender-auth
|
|
version: "1.0"
|
|
paths:
|
|
/login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Login and be given an access token (requires JWT)
|
|
parameters:
|
|
- description: Data to obtain a token
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.LoginAccount'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.LoginResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.LoginResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.LoginResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Login
|
|
tags:
|
|
- users
|
|
/register:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Create a user that can send texts (requires JWT)
|
|
parameters:
|
|
- description: Data to add user
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.RegisterUser'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.RegisterResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.RegisterResponse'
|
|
"403":
|
|
description: Forbidden
|
|
schema:
|
|
$ref: '#/definitions/handler.RegisterResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.RegisterResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Register user
|
|
tags:
|
|
- users
|
|
/service/login:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Servce login and be given an access token (requires JWT)
|
|
parameters:
|
|
- description: Data to obtain a service token
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceLoginRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceLoginResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceLoginResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Service login
|
|
tags:
|
|
- service users
|
|
/service/register:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Create a service user that can send texts (requires JWT)
|
|
parameters:
|
|
- description: Data to add user
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceCreationRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceCreationResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceCreationResponse'
|
|
"403":
|
|
description: Forbidden
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceCreationResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.ServiceCreationResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Register service user
|
|
tags:
|
|
- service users
|
|
/token/refresh:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Refresh token endpoint (requires JWT)
|
|
parameters:
|
|
- description: Data to refresh token
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.RefreshRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.RefreshResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.RefreshResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.RefreshResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Obtain a refresh token
|
|
tags:
|
|
- refresh
|
|
/user/name/update:
|
|
patch:
|
|
consumes:
|
|
- application/json
|
|
description: Update the first or last name of a user (requires JWT)
|
|
parameters:
|
|
- description: Data to update name of user
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdateNameRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdateNameResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdateNameResponse'
|
|
"403":
|
|
description: Forbidden
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdateNameResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdateNameResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Update name of user
|
|
tags:
|
|
- users
|
|
/user/password/update:
|
|
patch:
|
|
consumes:
|
|
- application/json
|
|
description: Update the password of a regular account (requires JWT)
|
|
parameters:
|
|
- description: Needed data to update password
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdatePasswordRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/handler.UpdatePasswordResponse'
|
|
security:
|
|
- BearerAuth: []
|
|
summary: Update Password
|
|
tags:
|
|
- users
|
|
securityDefinitions:
|
|
BearerAuth:
|
|
description: JWT Bearer Token
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|