(Feat): Initial Commit
This commit is contained in:
195
api/definitions/auth.yml
Normal file
195
api/definitions/auth.yml
Normal file
@@ -0,0 +1,195 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
title: allaboutapps.dev/aw/go-starter
|
||||
version: 0.1.0
|
||||
paths: {}
|
||||
definitions:
|
||||
User:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid4
|
||||
description: ID of user
|
||||
example: 891d37d3-c74f-493e-aea8-af73efd92016
|
||||
GetUserInfoResponse:
|
||||
type: object
|
||||
required:
|
||||
- sub
|
||||
- updated_at
|
||||
properties:
|
||||
sub:
|
||||
type: string
|
||||
description: ID of user
|
||||
example: 82ebdfad-c586-4407-a873-4cc1c33d56fc
|
||||
updated_at:
|
||||
type: integer
|
||||
description: Unix timestamp the user's info was last updated at
|
||||
example: 1591960808
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
description: Email address of user, if available
|
||||
maxLength: 255
|
||||
example: user@example.com
|
||||
scopes:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- "app"
|
||||
- "cms"
|
||||
description: Auth-Scopes of the user, if available
|
||||
example: ["app"]
|
||||
PostChangePasswordPayload:
|
||||
type: object
|
||||
required:
|
||||
- currentPassword
|
||||
- newPassword
|
||||
properties:
|
||||
currentPassword:
|
||||
description: Current password of user
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
newPassword:
|
||||
description: New password to set for user
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
PostForgotPasswordCompletePayload:
|
||||
type: object
|
||||
required:
|
||||
- token
|
||||
- password
|
||||
properties:
|
||||
password:
|
||||
description: New password to set for user
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
token:
|
||||
description: Password reset token sent via email
|
||||
type: string
|
||||
format: uuid4
|
||||
example: ec16f032-3c44-4148-bbcc-45557466fa74
|
||||
PostForgotPasswordPayload:
|
||||
type: object
|
||||
required:
|
||||
- username
|
||||
properties:
|
||||
username:
|
||||
description: Username to initiate password reset for
|
||||
type: string
|
||||
format: email
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
example: user@example.com
|
||||
PostLoginPayload:
|
||||
type: object
|
||||
required:
|
||||
- username
|
||||
- password
|
||||
properties:
|
||||
password:
|
||||
description: Password of user to authenticate as
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
username:
|
||||
description: Username of user to authenticate as
|
||||
type: string
|
||||
format: email
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
example: user@example.com
|
||||
PostLoginResponse:
|
||||
type: object
|
||||
required:
|
||||
- access_token
|
||||
- token_type
|
||||
- expires_in
|
||||
- refresh_token
|
||||
properties:
|
||||
access_token:
|
||||
description: Access token required for accessing protected API endpoints
|
||||
type: string
|
||||
format: uuid4
|
||||
example: c1247d8d-0d65-41c4-bc86-ec041d2ac437
|
||||
expires_in:
|
||||
description: Access token expiry in seconds
|
||||
type: integer
|
||||
format: int64
|
||||
example: 86400
|
||||
refresh_token:
|
||||
description: Refresh token for refreshing the access token once it expires
|
||||
type: string
|
||||
format: uuid4
|
||||
example: 1dadb3bd-50d8-485d-83a3-6111392568f0
|
||||
token_type:
|
||||
description: "Type of access token, will always be `bearer`"
|
||||
type: string
|
||||
example: bearer
|
||||
RegisterResponse:
|
||||
type: object
|
||||
required:
|
||||
- requiresConfirmation
|
||||
properties:
|
||||
requiresConfirmation:
|
||||
description: Indicates whether the registration process requires email confirmation
|
||||
type: boolean
|
||||
example: true
|
||||
PostLogoutPayload:
|
||||
type: object
|
||||
properties:
|
||||
refresh_token:
|
||||
description: Optional refresh token to delete while logging out
|
||||
type: string
|
||||
format: uuid4
|
||||
example: 700ebed3-40f7-4211-bc83-a89b22b9875e
|
||||
PostRefreshPayload:
|
||||
type: object
|
||||
required:
|
||||
- refresh_token
|
||||
properties:
|
||||
refresh_token:
|
||||
description: Refresh token to use for retrieving new token set
|
||||
type: string
|
||||
format: uuid4
|
||||
example: 7503cd8a-c921-4368-a32d-6c1d01d86da9
|
||||
PostRegisterPayload:
|
||||
type: object
|
||||
required:
|
||||
- username
|
||||
- password
|
||||
properties:
|
||||
password:
|
||||
description: Password to register with
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
username:
|
||||
description: Username to register with
|
||||
type: string
|
||||
format: email
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
example: user@example.com
|
||||
DeleteUserAccountPayload:
|
||||
type: object
|
||||
required:
|
||||
- currentPassword
|
||||
properties:
|
||||
currentPassword:
|
||||
description: Current password of user
|
||||
type: string
|
||||
maxLength: 500
|
||||
minLength: 1
|
||||
example: correct horse battery staple
|
||||
47
api/definitions/common.yml
Normal file
47
api/definitions/common.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
title: allaboutapps.dev/aw/go-starter
|
||||
version: 0.1.0
|
||||
paths: {}
|
||||
definitions:
|
||||
Paginatable:
|
||||
type: object
|
||||
required:
|
||||
- limit
|
||||
- offset
|
||||
- total
|
||||
properties:
|
||||
limit:
|
||||
type: integer
|
||||
description: Actual limit applied to request
|
||||
offset:
|
||||
type: integer
|
||||
description: Actual offset applied to request
|
||||
total:
|
||||
type: integer
|
||||
description: Total number of records available
|
||||
parameters:
|
||||
offsetParam:
|
||||
type: integer
|
||||
in: query
|
||||
name: offset
|
||||
description: Offset used for pagination, number of records to skip
|
||||
default: 0
|
||||
minimum: 0
|
||||
limitParam:
|
||||
type: integer
|
||||
in: query
|
||||
name: limit
|
||||
description: Limit used for pagination, number of records to retrieve
|
||||
default: 50
|
||||
minimum: 1
|
||||
maximum: 500
|
||||
orderDirParam:
|
||||
type: string
|
||||
in: query
|
||||
name: orderDir
|
||||
description: Direction of order applied, defaults to `asc` if omitted. `asc` will sort `NULL` values at the end of the list.
|
||||
enum:
|
||||
- asc
|
||||
- desc
|
||||
default: asc
|
||||
79
api/definitions/errors.yml
Normal file
79
api/definitions/errors.yml
Normal file
@@ -0,0 +1,79 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
title: allaboutapps.dev/aw/go-starter
|
||||
version: 0.1.0
|
||||
paths: {}
|
||||
definitions:
|
||||
PublicHTTPErrorType:
|
||||
type: string
|
||||
description: Type of error returned, should be used for client-side error handling
|
||||
enum:
|
||||
- generic
|
||||
# push
|
||||
- PUSH_TOKEN_ALREADY_EXISTS
|
||||
- OLD_PUSH_TOKEN_NOT_FOUND
|
||||
# files
|
||||
- ZERO_FILE_SIZE
|
||||
# auth
|
||||
- USER_DEACTIVATED
|
||||
- INVALID_PASSWORD
|
||||
- NOT_LOCAL_USER
|
||||
- TOKEN_NOT_FOUND
|
||||
- TOKEN_EXPIRED
|
||||
- USER_ALREADY_EXISTS
|
||||
- MALFORMED_TOKEN
|
||||
- LAST_AUTHENTICATED_AT_EXCEEDED
|
||||
- MISSING_SCOPES
|
||||
PublicHTTPError:
|
||||
type: object
|
||||
required:
|
||||
- status
|
||||
- type
|
||||
- title
|
||||
properties:
|
||||
detail:
|
||||
description: "More detailed, human-readable, optional explanation of the error"
|
||||
type: string
|
||||
example: User is lacking permission to access this resource
|
||||
status:
|
||||
description: HTTP status code returned for the error
|
||||
type: integer
|
||||
format: int64
|
||||
maximum: 599
|
||||
minimum: 100
|
||||
x-go-name: Code
|
||||
example: 403
|
||||
title:
|
||||
description: "Short, human-readable description of the error"
|
||||
type: string
|
||||
example: Forbidden
|
||||
type:
|
||||
$ref: "#/definitions/PublicHTTPErrorType"
|
||||
PublicHTTPValidationError:
|
||||
allOf:
|
||||
- $ref: "#/definitions/PublicHTTPError"
|
||||
type: object
|
||||
required:
|
||||
- validationErrors
|
||||
properties:
|
||||
validationErrors:
|
||||
description: List of errors received while validating payload against schema
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/HTTPValidationErrorDetail"
|
||||
HTTPValidationErrorDetail:
|
||||
type: object
|
||||
required:
|
||||
- key
|
||||
- in
|
||||
- error
|
||||
properties:
|
||||
error:
|
||||
description: Error describing field validation failure
|
||||
type: string
|
||||
in:
|
||||
description: Indicates how the invalid field was provided
|
||||
type: string
|
||||
key:
|
||||
description: Key of field failing validation
|
||||
type: string
|
||||
28
api/definitions/push.yml
Normal file
28
api/definitions/push.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
title: allaboutapps.dev/aw/go-starter
|
||||
version: 0.1.0
|
||||
paths: {}
|
||||
definitions:
|
||||
PutUpdatePushTokenPayload:
|
||||
type: object
|
||||
required:
|
||||
- newToken
|
||||
- provider
|
||||
properties:
|
||||
newToken:
|
||||
description: New push token for given provider.
|
||||
type: string
|
||||
maxLength: 500
|
||||
example: 1c91e550-8167-439c-8021-dee7de2f7e96
|
||||
oldToken:
|
||||
description: Old token that can be deleted if present.
|
||||
type: string
|
||||
maxLength: 500
|
||||
example: 495179de-b771-48f0-aab2-8d23701b0f02
|
||||
x-nullable: true
|
||||
provider:
|
||||
description: Identifier of the provider the token is for (eg. "fcm", "apn"). Currently only "fcm" is supported.
|
||||
type: string
|
||||
maxLength: 500
|
||||
example: fcm
|
||||
Reference in New Issue
Block a user