-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,560 additions
and
11 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,306 @@ | ||
definitions: | ||
dto.LoginRequest: | ||
properties: | ||
email: | ||
type: string | ||
password: | ||
type: string | ||
type: object | ||
dto.LoginResponse: | ||
properties: | ||
token: | ||
type: string | ||
type: object | ||
dto.PostCreateRequest: | ||
properties: | ||
content: | ||
type: string | ||
title: | ||
type: string | ||
type: object | ||
dto.PostResponse: | ||
properties: | ||
content: | ||
type: string | ||
id: | ||
type: integer | ||
title: | ||
type: string | ||
type: object | ||
dto.PostUpdateRequest: | ||
properties: | ||
content: | ||
type: string | ||
title: | ||
type: string | ||
type: object | ||
dto.PostsResponse: | ||
properties: | ||
count: | ||
type: integer | ||
posts: | ||
items: | ||
$ref: '#/definitions/dto.PostResponse' | ||
type: array | ||
type: object | ||
dto.UserCreateRequest: | ||
properties: | ||
email: | ||
type: string | ||
name: | ||
type: string | ||
password: | ||
type: string | ||
type: object | ||
dto.UserResponse: | ||
properties: | ||
email: | ||
type: string | ||
id: | ||
type: integer | ||
name: | ||
type: string | ||
type: object | ||
dto.UserUpdateRequest: | ||
properties: | ||
name: | ||
type: string | ||
password: | ||
type: string | ||
type: object | ||
info: | ||
contact: | ||
email: sic61695@gmail.com | ||
name: Inchul Song | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
termsOfService: http://swagger.io/terms/ | ||
title: Simple Blog CRUD API | ||
version: "1.0" | ||
paths: | ||
/v1/auth/login: | ||
post: | ||
consumes: | ||
- application/json | ||
parameters: | ||
- description: Login | ||
in: body | ||
name: request | ||
required: true | ||
schema: | ||
$ref: '#/definitions/dto.LoginRequest' | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.LoginResponse' | ||
security: [] | ||
summary: User Login | ||
tags: | ||
- auth | ||
/v1/posts: | ||
post: | ||
consumes: | ||
- application/json | ||
parameters: | ||
- description: Create a Post Request Body | ||
in: body | ||
name: request | ||
required: true | ||
schema: | ||
$ref: '#/definitions/dto.PostCreateRequest' | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.PostResponse' | ||
summary: Create a Post | ||
tags: | ||
- Post | ||
/v1/posts/{id}: | ||
delete: | ||
parameters: | ||
- description: Post ID | ||
in: path | ||
name: id | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
type: string | ||
security: | ||
- Bearer: [] | ||
summary: Delete a post | ||
tags: | ||
- Post | ||
get: | ||
parameters: | ||
- description: Post ID | ||
in: path | ||
name: id | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.PostResponse' | ||
summary: Get a Post By ID | ||
tags: | ||
- Post | ||
put: | ||
consumes: | ||
- application/json | ||
parameters: | ||
- description: Update Post Request Body | ||
in: body | ||
name: request | ||
required: true | ||
schema: | ||
$ref: '#/definitions/dto.PostUpdateRequest' | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.PostResponse' | ||
security: | ||
- Bearer: [] | ||
summary: Update Post | ||
tags: | ||
- Post | ||
/v1/posts/users/{userId}: | ||
get: | ||
parameters: | ||
- description: User ID | ||
in: path | ||
name: userId | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.PostsResponse' | ||
security: | ||
- Bearer: [] | ||
summary: Get Posts By User ID | ||
tags: | ||
- Post | ||
/v1/users/{id}: | ||
delete: | ||
parameters: | ||
- description: User ID | ||
in: path | ||
name: id | ||
required: true | ||
type: integer | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
type: string | ||
security: | ||
- Bearer: [] | ||
summary: Delete a user | ||
tags: | ||
- User | ||
get: | ||
parameters: | ||
- description: User ID | ||
in: path | ||
name: id | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.UserResponse' | ||
summary: Get a User By ID | ||
tags: | ||
- User | ||
put: | ||
consumes: | ||
- application/json | ||
parameters: | ||
- description: Update User Request Body | ||
in: body | ||
name: request | ||
required: true | ||
schema: | ||
$ref: '#/definitions/dto.UserUpdateRequest' | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.UserResponse' | ||
security: | ||
- Bearer: [] | ||
summary: Update a User | ||
tags: | ||
- User | ||
/v1/users/{name}: | ||
get: | ||
parameters: | ||
- description: Username | ||
in: path | ||
name: name | ||
required: true | ||
type: string | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.UserResponse' | ||
summary: Get a User By Name | ||
tags: | ||
- User | ||
/v1/users/signIn: | ||
post: | ||
consumes: | ||
- application/json | ||
parameters: | ||
- description: Create a User Request Body | ||
in: body | ||
name: request | ||
required: true | ||
schema: | ||
$ref: '#/definitions/dto.UserCreateRequest' | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/dto.UserResponse' | ||
summary: Create a Post | ||
tags: | ||
- User | ||
securityDefinitions: | ||
Bearer: | ||
description: Type "Bearer" followed by a space and JWT token. | ||
in: header | ||
name: Authorization | ||
type: apiKey | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dto | ||
|
||
type LoginResponse struct { | ||
Token string `json:"token"` | ||
} | ||
|
||
func NewLoginResponse(token string) LoginResponse { | ||
return LoginResponse{ | ||
Token: token, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.