basePath: / definitions: dto.AccessTokenOutput: properties: access_token: type: string type: object dto.CreateProductInputDTO: properties: name: type: string price: type: number type: object dto.CreateUserInput: properties: email: type: string name: type: string password: type: string type: object dto.GetJWTInput: properties: email: type: string password: type: string type: object entity.Product: properties: created_at: type: string id: type: string name: type: string price: type: number updated_at: type: string type: object handlers.Error: properties: message: type: string type: object host: localhost:8000 info: contact: email: robson.curitibapr@gmail.com name: Robson Alves url: https://www.robsonalvesdev.dev.br description: API Go - Example of a simple API in Go with JWT authentication and SQLite database. license: name: MIT url: https://opensource.org/licenses/MIT title: API Go version: "1.0" paths: /products: get: consumes: - application/json description: Retrieve a list of products with optional pagination and sorting parameters parameters: - description: Page number in: query name: page type: integer - description: Number of items per page in: query name: limit type: integer - description: Sort by field (e.g., name, price) in: query name: sort type: string produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/entity.Product' type: array "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' security: - ApiKeyAuth: [] summary: List products with pagination and sorting tags: - products post: consumes: - application/json description: Create a new product with the provided information parameters: - description: Product information in: body name: request required: true schema: $ref: '#/definitions/dto.CreateProductInputDTO' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/entity.Product' "400": description: Bad Request schema: $ref: '#/definitions/handlers.Error' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' security: - ApiKeyAuth: [] summary: Create a new product tags: - products /products/{id}: delete: consumes: - application/json description: Delete a product by its unique ID parameters: - description: Product ID in: path name: id required: true type: string produces: - application/json responses: "204": description: No Content "400": description: Bad Request schema: $ref: '#/definitions/handlers.Error' "404": description: Not Found schema: $ref: '#/definitions/handlers.Error' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' security: - ApiKeyAuth: [] summary: Delete a product by ID tags: - products get: consumes: - application/json description: Retrieve a product by its unique ID parameters: - description: Product ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/entity.Product' "400": description: Bad Request schema: $ref: '#/definitions/handlers.Error' "404": description: Not Found schema: $ref: '#/definitions/handlers.Error' security: - ApiKeyAuth: [] summary: Get a product by ID tags: - products put: consumes: - application/json description: Update a product's information by its unique ID parameters: - description: Product ID in: path name: id required: true type: string - description: Updated product information in: body name: request required: true schema: $ref: '#/definitions/dto.CreateProductInputDTO' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/entity.Product' "400": description: Bad Request schema: $ref: '#/definitions/handlers.Error' "404": description: Not Found schema: $ref: '#/definitions/handlers.Error' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' security: - ApiKeyAuth: [] summary: Update a product by ID tags: - products /users: post: consumes: - application/json description: Create a new user with the provided information parameters: - description: User information in: body name: request required: true schema: $ref: '#/definitions/dto.CreateUserInput' produces: - application/json responses: "201": description: Created "400": description: Bad Request "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' summary: Create a new user tags: - users /users/generate-token: post: consumes: - application/json description: Authenticate user and return a JWT token parameters: - description: User credentials in: body name: request required: true schema: $ref: '#/definitions/dto.GetJWTInput' produces: - application/json responses: "200": description: JWT token schema: $ref: '#/definitions/dto.AccessTokenOutput' "400": description: Bad Request schema: $ref: '#/definitions/handlers.Error' "401": description: Unauthorized schema: $ref: '#/definitions/handlers.Error' "500": description: Internal Server Error schema: $ref: '#/definitions/handlers.Error' summary: Get a new JWT token tags: - users securityDefinitions: ApiKeyAuth: in: header name: Authorization type: apiKey swagger: "2.0"