openapi: 3.0.0 info: title: AlgaCalendar version: '1.0' description: >- REST API AlgaCalendar. contact: email: contato@algaworks.com name: AlgaWorks url: 'https://www.algaworks.com' servers: - description: Ambiente de produção url: 'http://calendar.algaworks.com' - description: Ambiente local de desenvolvimento url: 'http://localhost:8080' paths: /api-key: post: operationId: createApiKey summary: Gera token de acesso tags: - Token security: [ ] responses: '201': description: Token de acesso criado. content: application/json: schema: $ref: '#/components/schemas/Token' /reminders/{reminderId}: parameters: - schema: type: integer format: int64 name: reminderId in: path required: true get: operationId: getReminderById summary: Busca um lembrete por ID tags: - Reminders responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Reminder' '404': $ref: '#/components/responses/NotFound' put: operationId: updateReminder summary: Atualiza um lembrete tags: - Reminders requestBody: content: application/json: schema: $ref: '#/components/schemas/ReminderInput' responses: '200': description: Lembrete atualizado content: application/json: schema: $ref: '#/components/schemas/Reminder' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' delete: operationId: removeReminder summary: Remove um lembrete tags: - Reminders responses: '204': description: Lembrete removido '404': $ref: '#/components/responses/NotFound' /reminders: get: operationId: getReminders summary: Consulta os lembretes tags: - Reminders parameters: - schema: type: string example: '2022-01' name: yearMonth description: Ano-Mês in: query required: true responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Reminder' post: operationId: createReminder summary: Cria um novo lembrete tags: - Reminders requestBody: content: application/json: schema: $ref: '#/components/schemas/ReminderInput' responses: '201': description: Lembrete criado content: application/json: schema: $ref: '#/components/schemas/Reminder' '400': $ref: '#/components/responses/BadRequest' security: - ApiKey: [] components: securitySchemes: ApiKey: type: apiKey name: X-Authorization in: header description: 'Token de autenticação.' responses: NotFound: description: Recurso não encontrado content: application/json: schema: $ref: '#/components/schemas/Problem' BadRequest: description: Requisição inválida content: application/json: schema: $ref: '#/components/schemas/Problem' schemas: Reminder: description: 'Lembrete.' type: object required: - id - title - description - date properties: id: type: integer format: int64 example: 29 title: type: string example: 'Reunião semanal com o Thiago.' description: type: string example: 'Reunião semanal com o Thiago para entender sobre o projeto.' date: type: string format: date example: '2022-01-01' ReminderInput: description: 'Lembrete.' type: object required: - title - description - date properties: title: type: string example: 'Reunião semanal com o Thiago.' description: type: string example: 'Reunião semanal com o Thiago para entender sobre o projeto.' date: type: string format: date example: '2022-01-01' Token: description: 'Token de acesso.' type: object required: - apiKey properties: apiKey: type: string example: '5750bc15-e6c2-4d76-8b5b-07d62f1a76f1' ProblemObject: type: object required: - type - userMessage properties: name: type: string example: amount userMessage: type: string example: O valor é obrigatório title: ProblemObject Problem: title: Problem type: object required: - status - timestamp - type - title - detail description: Representa um problema na comunicação com a API. Este modelo de representação é baseado na RFC 7807 (Problem Details for HTTP APIs) properties: status: type: integer format: int32 example: 400 timestamp: type: string format: date-time example: '2022-11-01T18:09:02Z' type: type: string example: 'https://algaworks.com/dados-invalidos' title: type: string example: Dados inválidos detail: type: string example: Um ou mais campos estão inválidos. Faça o preenchimento correto e tente novamente. objects: type: array description: Lista de objetos ou campos que geraram o erro (opcional) items: $ref: '#/components/schemas/ProblemObject' tags: - name: Reminders description: Lembretes - name: Token description: Token