feat: initial commit
This commit is contained in:
@@ -0,0 +1,725 @@
|
||||
basePath: /v1
|
||||
definitions:
|
||||
main.CreatePostPayload:
|
||||
properties:
|
||||
content:
|
||||
maxLength: 1000
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
maxLength: 100
|
||||
type: string
|
||||
required:
|
||||
- content
|
||||
- title
|
||||
type: object
|
||||
main.CredentialsPayload:
|
||||
properties:
|
||||
email:
|
||||
maxLength: 255
|
||||
type: string
|
||||
password:
|
||||
maxLength: 72
|
||||
minLength: 3
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
type: object
|
||||
main.RegisterUserPayload:
|
||||
properties:
|
||||
email:
|
||||
maxLength: 255
|
||||
type: string
|
||||
first_name:
|
||||
maxLength: 100
|
||||
type: string
|
||||
last_name:
|
||||
maxLength: 100
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
username:
|
||||
maxLength: 100
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- first_name
|
||||
- last_name
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
main.UpdatePostPayload:
|
||||
properties:
|
||||
content:
|
||||
maxLength: 1000
|
||||
type: string
|
||||
title:
|
||||
maxLength: 100
|
||||
type: string
|
||||
type: object
|
||||
main.UserWithToken:
|
||||
properties:
|
||||
created_at:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
first_name:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
is_active:
|
||||
type: boolean
|
||||
last_name:
|
||||
type: string
|
||||
role:
|
||||
$ref: '#/definitions/store.Role'
|
||||
role_id:
|
||||
type: integer
|
||||
token:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
main.updateUserPasswordPayload:
|
||||
properties:
|
||||
current_password:
|
||||
type: string
|
||||
new_password:
|
||||
type: string
|
||||
required:
|
||||
- current_password
|
||||
- new_password
|
||||
type: object
|
||||
main.updateUserPayload:
|
||||
properties:
|
||||
email:
|
||||
maxLength: 255
|
||||
type: string
|
||||
first_name:
|
||||
maxLength: 100
|
||||
type: string
|
||||
last_name:
|
||||
maxLength: 100
|
||||
type: string
|
||||
username:
|
||||
maxLength: 100
|
||||
type: string
|
||||
type: object
|
||||
store.Comment:
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
post_id:
|
||||
type: integer
|
||||
updated_at:
|
||||
type: string
|
||||
user:
|
||||
$ref: '#/definitions/store.User'
|
||||
user_id:
|
||||
type: integer
|
||||
type: object
|
||||
store.Post:
|
||||
properties:
|
||||
comments:
|
||||
items:
|
||||
$ref: '#/definitions/store.Comment'
|
||||
type: array
|
||||
content:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
user:
|
||||
$ref: '#/definitions/store.User'
|
||||
user_id:
|
||||
type: integer
|
||||
version:
|
||||
type: integer
|
||||
type: object
|
||||
store.PostWithMetadata:
|
||||
properties:
|
||||
comment_count:
|
||||
type: integer
|
||||
comments:
|
||||
items:
|
||||
$ref: '#/definitions/store.Comment'
|
||||
type: array
|
||||
content:
|
||||
type: string
|
||||
created_at:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
tags:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
user:
|
||||
$ref: '#/definitions/store.User'
|
||||
user_id:
|
||||
type: integer
|
||||
version:
|
||||
type: integer
|
||||
type: object
|
||||
store.Role:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
level:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
store.User:
|
||||
properties:
|
||||
created_at:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
first_name:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
is_active:
|
||||
type: boolean
|
||||
last_name:
|
||||
type: string
|
||||
role:
|
||||
$ref: '#/definitions/store.Role'
|
||||
role_id:
|
||||
type: integer
|
||||
updated_at:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact:
|
||||
email: [email protected]
|
||||
name: API Support
|
||||
url: http://www.swagger.io/support
|
||||
description: This is a template for building APIs with Go, Chi, and Swagger.
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
termsOfService: http://swagger.io/terms/
|
||||
title: LK API Template
|
||||
paths:
|
||||
/authentication/token:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new token for the user
|
||||
parameters:
|
||||
- description: User Credentials
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.CredentialsPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Token Created
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
summary: Create a new token
|
||||
tags:
|
||||
- authentication
|
||||
/authentication/user:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Register a new User
|
||||
parameters:
|
||||
- description: User Credentials
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.RegisterUserPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: User Registered
|
||||
schema:
|
||||
$ref: '#/definitions/main.UserWithToken'
|
||||
"400":
|
||||
description: User payload error
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
summary: Register a new User
|
||||
tags:
|
||||
- authentication
|
||||
/health:
|
||||
get:
|
||||
description: Health Check
|
||||
responses:
|
||||
"204":
|
||||
description: ok
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
summary: Health Check
|
||||
tags:
|
||||
- ops
|
||||
/posts:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new Post
|
||||
parameters:
|
||||
- description: Post Payload
|
||||
in: body
|
||||
name: in
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.CreatePostPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.Post'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Creates a new Post
|
||||
tags:
|
||||
- posts
|
||||
/posts/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Deletse a Post by ID
|
||||
parameters:
|
||||
- description: Post ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Deletes a Post
|
||||
tags:
|
||||
- posts
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Fetches a Post by ID
|
||||
parameters:
|
||||
- description: Post ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.Post'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Fetches a Post
|
||||
tags:
|
||||
- posts
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update a Post by ID
|
||||
parameters:
|
||||
- description: Post ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Post Payload
|
||||
in: body
|
||||
name: in
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.UpdatePostPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.Post'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Update a Post
|
||||
tags:
|
||||
- posts
|
||||
/posts/{id}/comments:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new Comment
|
||||
parameters:
|
||||
- description: Post ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.Comment'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Creates a new Comment
|
||||
tags:
|
||||
- comments
|
||||
/users/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Fetches a user Profile by ID
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.User'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Fetches a user Profile
|
||||
tags:
|
||||
- users
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update a user Profile by ID
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: User Profile
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.updateUserPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/store.User'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"404":
|
||||
description: Not Found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Update a user Profile
|
||||
tags:
|
||||
- users
|
||||
/users/{id}/follow:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Follows a user by ID
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: User followed
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: User not found
|
||||
schema: {}
|
||||
summary: Follows a user
|
||||
tags:
|
||||
- users
|
||||
/users/{id}/password:
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: |-
|
||||
Update user password with verification
|
||||
Password must:
|
||||
- Be at least 8 characters long
|
||||
- Contain at least one uppercase letter
|
||||
- Contain at least one lowercase letter
|
||||
- Contain at least one number
|
||||
- Contain at least one special character
|
||||
- Be different from the current password
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Password Update
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.updateUserPasswordPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: Password updated successfully
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: Invalid request
|
||||
schema: {}
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema: {}
|
||||
"404":
|
||||
description: User not found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Update user password
|
||||
tags:
|
||||
- users
|
||||
/users/{id}/unfollow:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Unfollows a user by ID
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: User unfollowed
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: User payload error
|
||||
schema: {}
|
||||
"404":
|
||||
description: User not found
|
||||
schema: {}
|
||||
summary: Unfollows a user
|
||||
tags:
|
||||
- users
|
||||
/users/activate/{token}:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Activate/Register a user by invitation token
|
||||
parameters:
|
||||
- description: Invitation Token
|
||||
in: path
|
||||
name: token
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: User activated
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: User not found
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Activate/Register a user
|
||||
tags:
|
||||
- users
|
||||
/users/feed:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Fetches the user feed
|
||||
parameters:
|
||||
- description: Limit
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
- description: Offset
|
||||
in: query
|
||||
name: offset
|
||||
type: integer
|
||||
- description: Sort
|
||||
in: query
|
||||
name: sort
|
||||
type: string
|
||||
- description: Tags
|
||||
in: query
|
||||
name: tags
|
||||
type: string
|
||||
- description: Search
|
||||
in: query
|
||||
name: search
|
||||
type: string
|
||||
- description: Since
|
||||
in: query
|
||||
name: since
|
||||
type: string
|
||||
- description: Until
|
||||
in: query
|
||||
name: until
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/store.PostWithMetadata'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema: {}
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema: {}
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Fetches the user feed
|
||||
tags:
|
||||
- feed
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user