basePath: /api/v1 definitions: requests.CreatePostRequest: properties: category: type: string content: minLength: 36 type: string description: maxLength: 255 minLength: 8 type: string tags: items: type: string type: array title: maxLength: 255 minLength: 8 type: string userId: type: string required: - content - description - title - userId type: object requests.CreateUserRequest: properties: password: maxLength: 32 minLength: 6 type: string username: maxLength: 32 minLength: 3 type: string required: - password - username type: object requests.LoginUserRequest: properties: password: maxLength: 32 minLength: 6 type: string username: maxLength: 32 minLength: 3 type: string required: - password - username type: object requests.PutPostRequest: properties: content: type: string description: type: string title: type: string type: object requests.PutUserRequest: properties: password: maxLength: 32 minLength: 6 type: string username: maxLength: 32 minLength: 3 type: string required: - password - username type: object responses.ErrorResponse: properties: error_code: type: integer message: type: string type: object responses.GetListPostResponseItem: properties: category: type: string description: type: string id: type: string tags: items: type: string type: array title: type: string updatedAt: type: string userId: type: string username: type: string type: object responses.ImageResponse: properties: id: type: string path: type: string type: object responses.PostResponse: properties: category: type: string content: type: string createdAt: type: string description: type: string id: type: string tags: items: type: string type: array title: type: string updatedAt: type: string userId: type: string username: type: string type: object responses.UserResponse: properties: id: type: string username: type: string type: object host: localhost:8080 info: contact: email: support@swagger.io name: API Support url: http://www.swagger.io/support description: 58team blog's backend license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html termsOfService: http://swagger.io/terms/ title: 58team blog backend version: "1.0" paths: /images/: post: description: Upload new image and returns uploaded image json object parameters: - description: image file in: formData name: file required: true type: file produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/responses.ImageResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Upload new image tags: - images /images/{path}: delete: description: Delete image from server by given path parameters: - description: Path to image in: path name: filename required: true type: string produces: - image/png - image/jpeg responses: "200": description: OK "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Delete image by path tags: - images get: description: get image by path parameters: - description: Path to image in: path name: path required: true type: string produces: - application/octet-stream - application/json responses: "200": description: OK schema: type: file "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Get an image by path tags: - images /login: post: consumes: - application/json description: Login user into system parameters: - description: User login data in: body name: request required: true schema: $ref: '#/definitions/requests.LoginUserRequest' produces: - application/json responses: "200": description: OK "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "401": description: Unauthorized schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Login tags: - user /logout: get: description: Creates new user in system produces: - application/json responses: "200": description: OK "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Create new user tags: - user /post: get: description: Return first 5 posts produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/responses.GetListPostResponseItem' type: array "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Get all posts tags: - post post: consumes: - application/json description: Create new post in blog parameters: - description: Post data in: body name: request required: true schema: $ref: '#/definitions/requests.CreatePostRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/responses.PostResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Create new post tags: - post /post/{id}: delete: description: Delete post by id parameters: - description: Id of post in: path name: id required: true type: string produces: - application/json responses: "200": description: OK "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Delete post tags: - post get: description: get post by id parameters: - description: Id of post in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/responses.PostResponse' type: array "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Get post by id tags: - post put: description: update post content parameters: - description: Id of post in: path name: id required: true type: string - description: Post data in: body name: request required: true schema: $ref: '#/definitions/requests.PutPostRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/responses.PostResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Update post content tags: - post /post/offset/{offset}: get: description: return 5 posts after first offset posts parameters: - description: Offset of posts in: path name: offset required: true type: integer produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/responses.GetListPostResponseItem' type: array "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Get posts after offset tags: - post /user/: get: description: Return all registered users produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/responses.UserResponse' type: array "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Get all users tags: - user post: consumes: - application/json description: Creates new user in system parameters: - description: User data in: body name: request required: true schema: $ref: '#/definitions/requests.CreateUserRequest' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/responses.UserResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "409": description: Conflict schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Create new user tags: - user /user/{id}: delete: description: Delete user parameters: - description: User id in: path name: id required: true type: string produces: - application/json responses: "200": description: OK "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Delete user tags: - user get: consumes: - application/json description: Find user by id parameters: - description: user id in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/responses.UserResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Find user by id tags: - user put: consumes: - application/json description: Change the user's name and password parameters: - description: User id in: path name: id required: true type: string - description: User data in: body name: request required: true schema: $ref: '#/definitions/requests.PutUserRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/responses.UserResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Change user tags: - user /user/name/{name}: get: consumes: - application/json description: Find user by username parameters: - description: User name in: path name: name required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/responses.UserResponse' "400": description: Bad Request schema: $ref: '#/definitions/responses.ErrorResponse' "404": description: Not Found schema: $ref: '#/definitions/responses.ErrorResponse' "500": description: Internal Server Error schema: $ref: '#/definitions/responses.ErrorResponse' summary: Find user by username tags: - user securityDefinitions: BasicAuth: type: basic swagger: "2.0"