diff --git a/susconecta/Documentação API.md b/susconecta/Documentação API.md index b1b9604..852184d 100644 --- a/susconecta/Documentação API.md +++ b/susconecta/Documentação API.md @@ -1,4 +1,4 @@ -# Listar atribuições de pacientes +# Solicitar reset de senha via email (público) ## OpenAPI Specification @@ -9,563 +9,189 @@ info: description: '' version: 1.0.0 paths: - /rest/v1/patient_assignments: - get: - summary: Listar atribuições de pacientes - deprecated: false - description: '' - tags: - - Atribuições - - Atribuições - parameters: - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string - responses: - '200': - description: Lista de atribuições - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/PatientAssignment' - headers: {} - x-apidog-name: OK - security: - - bearer: [] - x-apidog-folder: Atribuições - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940525-run -components: - schemas: - PatientAssignment: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - patient_id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - user_id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - role: - type: string - enum: - - medico - - enfermeiro - examples: - - medico - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - patient_id - - user_id - - role - - created_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Criar nova atribuição - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patient_assignments: + /request-password-reset: post: - summary: Criar nova atribuição + summary: Solicitar reset de senha via email (público) deprecated: false - description: '' + description: >- + Envia email de reset de senha para o usuário. **Endpoint público** para + integração com sistemas externos (não requer autenticação). + operationId: requestPasswordReset tags: - - Atribuições - - Atribuições - parameters: - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string + - Usuários + - Usuários + parameters: [] requestBody: content: application/json: schema: - $ref: '#/components/schemas/PatientAssignmentInput' - responses: - '201': - description: Atribuição criada - content: - application/json: - schema: - $ref: '#/components/schemas/PatientAssignment' - headers: {} - x-apidog-name: Created - security: - - bearer: [] - x-apidog-folder: Atribuições - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940526-run -components: - schemas: - PatientAssignmentInput: - type: object - required: - - patient_id - - user_id - - role - properties: - patient_id: - type: string - format: uuid - user_id: - type: string - format: uuid - role: - type: string - enum: - - medico - - enfermeiro - x-apidog-orders: - - patient_id - - user_id - - role - x-apidog-ignore-properties: [] - x-apidog-folder: '' - PatientAssignment: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - patient_id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - user_id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - role: - type: string - enum: - - medico - - enfermeiro - examples: - - medico - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - patient_id - - user_id - - role - - created_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Listar roles de usuários - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/user_roles: - get: - summary: Listar roles de usuários - deprecated: false - description: '' - tags: - - Usuários - - Usuários - parameters: [] + type: object + required: + - email + properties: + email: + type: string + format: email + description: Email do usuário + examples: + - usuario@exemplo.com + redirect_url: + type: string + format: uri + description: URL de redirecionamento após clicar no link (opcional) + examples: + - https://mediconnectbrasil.netlify.app/reset-password + x-apidog-orders: + - email + - redirect_url + examples: + basic: + value: + email: usuario@exemplo.com + summary: Reset básico + with_redirect: + value: + email: usuario@exemplo.com + redirect_url: https://mediconnectbrasil.netlify.app/reset-password + summary: Reset com redirect customizado responses: '200': - description: Lista de roles + description: Email de reset enviado com sucesso content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/UserRole' + type: object + properties: + success: + type: boolean + examples: + - true + message: + type: string + examples: + - >- + Email de reset de senha enviado com sucesso. Verifique + sua caixa de entrada. + x-apidog-orders: + - success + - message + example: + success: true + message: >- + Email de reset de senha enviado com sucesso. Verifique sua + caixa de entrada. headers: {} x-apidog-name: OK - security: - - bearer: [] - x-apidog-folder: Usuários - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940524-run -components: - schemas: - UserRole: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - user_id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - role: - type: string - enum: - - admin - - gestor - - medico - examples: - - medico - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - x-apidog-orders: - - id - - user_id - - role - - created_at - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Obter informações completas do usuário - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /functions/v1/user-info: - get: - summary: Obter informações completas do usuário - deprecated: false - description: >- - Retorna dados consolidados do usuário autenticado, incluindo perfil e - roles para controle de permissões. - tags: - - Usuários - parameters: [] - responses: - '200': - description: Informações do usuário retornadas com sucesso + '400': + description: Email inválido ou dados incorretos content: application/json: schema: - $ref: '#/components/schemas/UserInfoResponse' + type: object + properties: + type: + type: string + title: + type: string + status: + type: integer + detail: + type: string + extras: + type: object + x-apidog-orders: [] + x-apidog-orders: + - type + - title + - status + - detail + - extras + examples: + '2': + summary: email_invalido + value: + type: https://docs.mediconnectai.com/errors/validation + title: Validation Error + status: 400 + detail: Email inválido + extras: + field: email + issues: + - code: invalid_string + message: Email inválido + path: + - email + '3': + summary: url_invalida + value: + type: https://docs.mediconnectai.com/errors/validation + title: Validation Error + status: 400 + detail: URL de redirecionamento inválida + extras: + field: redirect_url headers: {} - x-apidog-name: OK - '401': - description: Token inválido ou expirado - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized + x-apidog-name: Bad Request '500': - description: Erro interno do servidor + description: Erro interno ao enviar email content: application/json: - schema: *ref_0 + schema: + type: object + properties: {} + example: + type: https://docs.mediconnectai.com/errors/internal + title: Internal Server Error + status: 500 + detail: Erro ao enviar email de reset de senha headers: {} x-apidog-name: Internal Server Error security: [] x-apidog-folder: Usuários x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21952675-run + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23209845-run components: - schemas: - UserInfoResponse: - type: object - properties: - user: - $ref: '#/components/schemas/User' - profile: - $ref: '#/components/schemas/Profile' - roles: - type: array - items: - type: string - enum: - - admin - - gestor - - medico - - secretaria - - user - examples: - - - medico - - admin - permissions: - $ref: '#/components/schemas/Permissions' - x-apidog-orders: - - user - - profile - - roles - - permissions - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Permissions: - type: object - properties: - isAdmin: - type: boolean - description: Se o usuário tem role de admin - examples: - - true - isManager: - type: boolean - description: Se o usuário tem role de gestor - examples: - - false - isDoctor: - type: boolean - description: Se o usuário tem role de médico - examples: - - true - isSecretary: - type: boolean - description: Se o usuário tem role de secretária - examples: - - false - isAdminOrManager: - type: boolean - description: Se o usuário é admin ou gestor (para controle de permissões) - examples: - - true - x-apidog-orders: - - isAdmin - - isManager - - isDoctor - - isSecretary - - isAdminOrManager - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Profile: - type: object - properties: - id: - type: string - format: uuid - full_name: - type: string - examples: - - Dr. João Silva - nullable: true - email: - type: string - format: email - nullable: true - phone: - type: string - examples: - - '+5511999999999' - nullable: true - avatar_url: - type: string - format: uri - nullable: true - disabled: - type: boolean - examples: - - false - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - x-apidog-orders: - - id - - full_name - - email - - phone - - avatar_url - - disabled - - created_at - - updated_at - x-apidog-ignore-properties: [] - nullable: true - x-apidog-folder: '' - User: - type: object - properties: - id: - type: string - format: uuid - examples: - - 550e8400-e29b-41d4-a716-446655440000 - email: - type: string - format: email - examples: - - usuario@exemplo.com - email_confirmed_at: - type: string - format: date-time - examples: - - '2024-01-01T10:00:00Z' - nullable: true - created_at: - type: string - format: date-time - examples: - - '2024-01-01T00:00:00Z' - last_sign_in_at: - type: string - format: date-time - examples: - - '2024-01-15T09:30:00Z' - nullable: true - x-apidog-orders: - - id - - email - - email_confirmed_at - - created_at - - last_sign_in_at - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' + schemas: {} securitySchemes: - bearerAuth: + BearerAuth: type: jwt scheme: bearer bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - - bearer: [] + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] ``` -# Criar novo usuário +# Criar usuário com role ## OpenAPI Specification @@ -578,254 +204,587 @@ info: paths: /functions/v1/create-user: post: - summary: Criar novo usuário + summary: Criar usuário com role deprecated: false - description: >- - Cria um novo usuário no sistema com papel específico. Apenas usuários - com papel de admin, gestor ou secretaria podem criar novos usuários. + description: Cria usuário completo com profile, role e envio de magic link operationId: createUser tags: - Usuários - - Usuários + - Edge Functions - Usuários parameters: [] requestBody: content: application/json: schema: - $ref: '#/components/schemas/CreateUserRequest' - examples: - admin_user: - value: - email: admin@mediconnect.com - password: senha123! - full_name: João Silva - phone: (11) 99999-9999 - role: admin - summary: Criar administrador - doctor_user: - value: - email: dr.maria@mediconnect.com - password: senha123! - full_name: Dra. Maria Santos - phone: (11) 98888-8888 - role: medico - summary: Criar médico - secretary_user: - value: - email: secretaria@mediconnect.com - password: senha123! - full_name: Ana Costa - phone: (11) 97777-7777 - role: secretaria - summary: Criar secretária + type: object + required: + - email + - full_name + - role + properties: + email: + type: string + format: email + full_name: + type: string + phone: + type: string + role: + type: string + enum: + - admin + - gestor + - medico + - secretaria + - paciente + create_patient_record: + type: boolean + description: Se true, cria registro na tabela patients + cpf: + type: string + pattern: ^\d{11}$ + description: Obrigatório se create_patient_record=true + phone_mobile: + type: string + description: Obrigatório se create_patient_record=true + x-apidog-orders: + - email + - full_name + - phone + - role + - create_patient_record + - cpf + - phone_mobile + example: + email: paciente@exemplo.com + full_name: Maria Santos + phone: (11) 99999-9999 + role: paciente + create_patient_record: true + cpf: '12345678901' + phone_mobile: (11) 99999-9999 responses: '200': description: Usuário criado com sucesso content: application/json: schema: - $ref: '#/components/schemas/CreateUserResponse' - example: - success: true - user: - id: 123e4567-e89b-12d3-a456-426614174000 - email: novo.usuario@mediconnect.com - full_name: Novo Usuário - phone: (11) 99999-9999 - role: medico + type: object + properties: + user: + type: object + x-apidog-orders: [] + profile: + type: object + x-apidog-orders: [] + role: + type: string + x-apidog-orders: + - user + - profile + - role headers: {} x-apidog-name: OK '400': - description: Dados inválidos ou erro de validação - content: - application/json: - schema: - type: object - properties: {} - x-apidog-ignore-properties: [] - x-apidog-orders: [] - examples: - '2': - summary: Campos obrigatórios faltando - value: - error: 'Missing required fields: email, password, full_name, role' - '3': - summary: Papel inválido - value: - error: Invalid role - '4': - summary: Email já existe - value: - error: User with this email already registered - headers: {} - x-apidog-name: Bad Request - '401': - description: Token de autenticação inválido ou ausente - content: - application/json: - schema: - type: object - properties: {} - x-apidog-ignore-properties: [] - x-apidog-orders: [] - example: - error: Unauthorized - headers: {} - x-apidog-name: Unauthorized - '403': - description: Permissões insuficientes - content: - application/json: - schema: - type: object - properties: {} - x-apidog-ignore-properties: [] - x-apidog-orders: [] - example: - error: Insufficient permissions - headers: {} - x-apidog-name: Forbidden - '500': - description: Erro interno do servidor - content: - application/json: - schema: - type: object - properties: {} - x-apidog-ignore-properties: [] - x-apidog-orders: [] - example: - error: Internal server error - headers: {} - x-apidog-name: Internal Server Error - security: [] - x-apidog-folder: Usuários - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21953135-run -components: - schemas: - CreateUserRequest: - type: object - required: - - email - - password - - full_name - - role - properties: - email: - type: string - format: email - description: Email do usuário (deve ser único) - examples: - - usuario@mediconnect.com - password: - type: string - minLength: 6 - description: Senha temporária para o usuário - examples: - - senha123! - full_name: - type: string - minLength: 1 - description: Nome completo do usuário - examples: - - João da Silva - phone: - type: string - description: Telefone do usuário (opcional) - examples: - - (11) 99999-9999 - nullable: true - role: - type: string - enum: - - admin - - gestor - - medico - - secretaria - - user - description: Papel do usuário no sistema - examples: - - medico - x-apidog-orders: - - email - - password - - full_name - - phone - - role - x-apidog-ignore-properties: [] - x-apidog-folder: '' - CreateUserResponse: - type: object - properties: - success: - type: boolean - description: Indica se a operação foi bem-sucedida - examples: - - true - user: type: object properties: - id: + error: type: string - format: uuid - description: ID único do usuário criado - examples: - - 123e4567-e89b-12d3-a456-426614174000 - email: + example: Erro ao processar requisição + details: type: string - format: email - description: Email do usuário - examples: - - usuario@mediconnect.com - full_name: - type: string - description: Nome completo do usuário - examples: - - João da Silva - phone: - type: string - description: Telefone do usuário - examples: - - (11) 99999-9999 - nullable: true - role: - type: string - description: Papel atribuído ao usuário - examples: - - medico - x-apidog-orders: - - id - - email - - full_name - - phone - - role - x-apidog-ignore-properties: [] - x-apidog-orders: - - success - - user - x-apidog-ignore-properties: [] - x-apidog-folder: '' + example: Detalhes técnicos do erro + description: '' + headers: {} + x-apidog-name: Bad Request + security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + x-apidog-folder: Usuários + x-apidog-status: released + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104945-run +components: + schemas: {} securitySchemes: - bearerAuth: + BearerAuth: type: jwt scheme: bearer bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - - bearer: [] + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] ``` -# Obter dados do usuário atual +# Informações do usuário autenticado + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /functions/v1/user-info: + post: + summary: Informações do usuário autenticado + deprecated: false + description: Retorna dados completos do usuário, profile e roles + operationId: getUserInfo + tags: + - Usuários + - Edge Functions - Usuários + parameters: [] + responses: + '200': + description: Informações do usuário + content: + application/json: + schema: + type: object + properties: + user: + type: object + x-apidog-orders: [] + properties: {} + profile: + type: object + x-apidog-orders: [] + properties: {} + roles: + type: array + items: + type: string + x-apidog-orders: + - user + - profile + - roles + headers: {} + x-apidog-name: OK + security: + - Combination: [] + x-apidog: + required: true + schemeGroups: + - id: UyOy9vsDiuzuLFRk_IsgI + schemeIds: + - Combination + use: + id: UyOy9vsDiuzuLFRk_IsgI + x-apidog-folder: Usuários + x-apidog-status: released + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104946-run +components: + schemas: {} + securitySchemes: + BearerAuth: + type: jwt + scheme: bearer + bearerFormat: JWT + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination +servers: + - url: https://yuanqfswhberkoevtmfr.supabase.co + description: Prod Env + - url: '' + description: Cloud Mock +security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + +``` + +# Informações de usuário por ID + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /functions/v1/user-info-by-id: + post: + summary: Informações de usuário por ID + deprecated: false + description: Retorna dados de usuário específico (apenas admin/gestor) + operationId: getUserInfoById + tags: + - Usuários + - Edge Functions - Usuários + parameters: [] + requestBody: + content: + application/json: + schema: + type: object + required: + - user_id + properties: + user_id: + type: string + format: uuid + x-apidog-orders: + - user_id + example: + user_id: 123e4567-e89b-12d3-a456-426614174000 + responses: + '200': + description: Informações do usuário + headers: {} + x-apidog-name: OK + '403': + description: Sem permissão + headers: {} + x-apidog-name: Forbidden + security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + x-apidog-folder: Usuários + x-apidog-status: released + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104947-run +components: + schemas: {} + securitySchemes: + BearerAuth: + type: jwt + scheme: bearer + bearerFormat: JWT + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination +servers: + - url: https://yuanqfswhberkoevtmfr.supabase.co + description: Prod Env + - url: '' + description: Cloud Mock +security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + +``` + +# Enviar SMS via Twilio + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /functions/v1/send-sms: + post: + summary: Enviar SMS via Twilio + deprecated: false + description: Envia SMS usando Twilio (requer configuração de secrets) + operationId: sendSMS + tags: + - SMS + - Edge Functions - Comunicação + parameters: [] + requestBody: + content: + application/json: + schema: + type: object + required: + - phone_number + - message + properties: + phone_number: + type: string + examples: + - '+5511999999999' + message: + type: string + examples: + - 'Lembrete: consulta amanhã às 10h' + patient_id: + type: string + format: uuid + x-apidog-orders: + - phone_number + - message + - patient_id + example: + phone_number: '+5511999999999' + message: 'Lembrete: sua consulta é amanhã às 10h na Clínica MediConnect' + patient_id: 123e4567-e89b-12d3-a456-426614174000 + responses: + '200': + description: SMS enviado com sucesso + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + message_sid: + type: string + x-apidog-orders: + - success + - message_sid + headers: {} + x-apidog-name: OK + '400': + type: object + properties: + error: + type: string + example: Erro ao processar requisição + details: + type: string + example: Detalhes técnicos do erro + description: '' + headers: {} + x-apidog-name: Bad Request + security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + x-apidog-folder: SMS + x-apidog-status: released + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104951-run +components: + schemas: {} + securitySchemes: + BearerAuth: + type: jwt + scheme: bearer + bearerFormat: JWT + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination +servers: + - url: https://yuanqfswhberkoevtmfr.supabase.co + description: Prod Env + - url: '' + description: Cloud Mock +security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + +``` + +# Enviar Magic Link + +## OpenAPI Specification + +```yaml +openapi: 3.0.1 +info: + title: '' + description: '' + version: 1.0.0 +paths: + /auth/v1/otp: + post: + summary: Enviar Magic Link + deprecated: false + description: Envia link de autenticação sem senha por email + operationId: sendMagicLink + tags: + - Autenticação + - Autenticação + parameters: [] + requestBody: + content: + application/json: + schema: + type: object + required: + - email + properties: + email: + type: string + format: email + examples: + - usuario@clinica.com + x-apidog-orders: + - email + example: + email: usuario@clinica.com + responses: + '200': + description: Magic link enviado + headers: {} + x-apidog-name: OK + '429': + description: Limite de envio excedido + headers: {} + x-apidog-name: Too Many Requests + security: [] + x-apidog-folder: Autenticação + x-apidog-status: released + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104942-run +components: + schemas: {} + securitySchemes: + BearerAuth: + type: jwt + scheme: bearer + bearerFormat: JWT + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination +servers: + - url: https://yuanqfswhberkoevtmfr.supabase.co + description: Prod Env + - url: '' + description: Cloud Mock +security: + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] + +``` + +# Dados do usuário autenticado ## OpenAPI Specification @@ -838,12 +797,13 @@ info: paths: /auth/v1/user: get: - summary: Obter dados do usuário atual + summary: Dados do usuário autenticado deprecated: false - description: Retorna informações do usuário autenticado + description: Retorna informações do usuário logado + operationId: getCurrentUser tags: - - Usuários - - Authentication + - Autenticação + - Autenticação parameters: [] responses: '200': @@ -851,96 +811,77 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/User' + type: object + properties: + id: + type: string + format: uuid + email: + type: string + created_at: + type: string + format: date-time + x-apidog-orders: + - id + - email + - created_at headers: {} x-apidog-name: OK - '401': - description: Token inválido - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized security: - - bearer: [] - x-apidog-folder: Usuários + - Combination: [] + x-apidog: + required: true + schemeGroups: + - id: kKVBLauHGBEJJ6qdxv_5M + schemeIds: + - Combination + use: + id: kKVBLauHGBEJJ6qdxv_5M + x-apidog-folder: Autenticação x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940512-run + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104944-run components: - schemas: - User: - type: object - properties: - id: - type: string - format: uuid - examples: - - 550e8400-e29b-41d4-a716-446655440000 - email: - type: string - format: email - examples: - - usuario@exemplo.com - email_confirmed_at: - type: string - format: date-time - examples: - - '2024-01-01T10:00:00Z' - nullable: true - created_at: - type: string - format: date-time - examples: - - '2024-01-01T00:00:00Z' - last_sign_in_at: - type: string - format: date-time - examples: - - '2024-01-15T09:30:00Z' - nullable: true - x-apidog-orders: - - id - - email - - email_confirmed_at - - created_at - - last_sign_in_at - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' + schemas: {} securitySchemes: - bearerAuth: + BearerAuth: type: jwt scheme: bearer bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - - bearer: [] + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] ``` -# Fazer login e obter token JWT + +# Login com email e senha ## OpenAPI Specification @@ -951,170 +892,137 @@ info: description: '' version: 1.0.0 paths: - /auth/v1/token: + /auth/v1/token?grant_type=password: post: - summary: Fazer login e obter token JWT + summary: Login com email e senha deprecated: false - description: >- - Autentica o usuário e retorna um token JWT para usar em outras - requisições. + description: Autentica usuário e retorna JWT + operationId: loginPassword tags: - - Authentication + - Autenticação + - Autenticação parameters: - name: grant_type in: query description: '' required: true + example: password schema: type: string - enum: - - password requestBody: content: application/json: schema: - $ref: '#/components/schemas/LoginRequest' - examples: {} + type: object + required: + - email + - password + properties: + email: + type: string + format: email + examples: + - admin@mediconnect.com + password: + type: string + format: password + examples: + - senha123 + x-apidog-orders: + - email + - password + example: + email: hugo@popcode.com.br + password: hdoria responses: '200': - description: Login realizado com sucesso + description: Login bem-sucedido content: application/json: schema: - $ref: '#/components/schemas/LoginResponse' + type: object + properties: + access_token: + type: string + token_type: + type: string + examples: + - bearer + expires_in: + type: integer + examples: + - 3600 + refresh_token: + type: string + user: + type: object + properties: + id: + type: string + format: uuid + email: + type: string + x-apidog-orders: + - id + - email + x-apidog-orders: + - access_token + - token_type + - expires_in + - refresh_token + - user headers: {} x-apidog-name: OK '400': description: Credenciais inválidas - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' headers: {} x-apidog-name: Bad Request - '401': - description: Email ou senha incorretos - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Unauthorized - security: - - bearer: [] - x-apidog-folder: Authentication + security: [] + x-apidog-folder: Autenticação x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940510-run + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104941-run components: - schemas: - LoginRequest: - type: object - required: - - email - - password - properties: - email: - type: string - format: email - examples: - - usuario@exemplo.com - password: - type: string - minLength: 6 - examples: - - senha123 - x-apidog-orders: - - email - - password - x-apidog-ignore-properties: [] - x-apidog-folder: '' - LoginResponse: - type: object - properties: - access_token: - type: string - description: Token JWT para autenticação - examples: - - eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... - token_type: - type: string - examples: - - bearer - expires_in: - type: integer - description: Tempo de expiração do token em segundos - examples: - - 3600 - refresh_token: - type: string - description: Token para renovar o access_token - user: - $ref: '#/components/schemas/AuthUser' - x-apidog-orders: - - access_token - - token_type - - expires_in - - refresh_token - - user - x-apidog-ignore-properties: [] - x-apidog-folder: '' - AuthUser: - type: object - properties: - id: - type: string - format: uuid - email: - type: string - format: email - email_confirmed_at: - type: string - format: date-time - nullable: true - created_at: - type: string - format: date-time - x-apidog-orders: - - id - - email - - email_confirmed_at - - created_at - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' + schemas: {} securitySchemes: - bearerAuth: + BearerAuth: type: jwt scheme: bearer bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - - bearer: [] + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] ``` -# Logout do usuário +# Enviar Magic Link ## OpenAPI Specification @@ -1125,1441 +1033,84 @@ info: description: '' version: 1.0.0 paths: - /auth/v1/logout: + /auth/v1/otp: post: - summary: Logout do usuário + summary: Enviar Magic Link deprecated: false - description: Encerrar sessão do usuário + description: Envia link de autenticação sem senha por email + operationId: sendMagicLink tags: - - Authentication - - Authentication + - Autenticação + - Autenticação parameters: [] - responses: - '204': - description: Logout realizado com sucesso - headers: {} - x-apidog-name: No Content - '401': - description: Token inválido - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized - security: - - bearer: [] - x-apidog-folder: Authentication - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940511-run -components: - schemas: - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Listar perfis de usuários - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/profiles: - get: - summary: Listar perfis de usuários - deprecated: false - description: '' - tags: - - Perfis - - Perfis - parameters: - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string - responses: - '200': - description: Lista de perfis - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Profile' - headers: {} - x-apidog-name: OK - security: - - bearer: [] - x-apidog-folder: Perfis - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940522-run -components: - schemas: - Profile: - type: object - properties: - id: - type: string - format: uuid - full_name: - type: string - examples: - - Dr. João Silva - nullable: true - email: - type: string - format: email - nullable: true - phone: - type: string - examples: - - '+5511999999999' - nullable: true - avatar_url: - type: string - format: uri - nullable: true - disabled: - type: boolean - examples: - - false - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - x-apidog-orders: - - id - - full_name - - email - - phone - - avatar_url - - disabled - - created_at - - updated_at - x-apidog-ignore-properties: [] - nullable: true - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Atualizar perfil do usuário - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/profiles: - patch: - summary: Atualizar perfil do usuário - deprecated: false - description: '' - tags: - - Perfis - - Perfis - parameters: - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/ProfileInput' - responses: - '200': - description: Perfil atualizado - content: - application/json: - schema: - $ref: '#/components/schemas/Profile' - headers: {} - x-apidog-name: OK - security: - - bearer: [] - x-apidog-folder: Perfis - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940523-run -components: - schemas: - ProfileInput: - type: object - properties: - full_name: - type: string - avatar_url: - type: string - phone: - type: string - x-apidog-orders: - - full_name - - avatar_url - - phone - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Profile: - type: object - properties: - id: - type: string - format: uuid - full_name: - type: string - examples: - - Dr. João Silva - nullable: true - email: - type: string - format: email - nullable: true - phone: - type: string - examples: - - '+5511999999999' - nullable: true - avatar_url: - type: string - format: uri - nullable: true - disabled: - type: boolean - examples: - - false - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - x-apidog-orders: - - id - - full_name - - email - - phone - - avatar_url - - disabled - - created_at - - updated_at - x-apidog-ignore-properties: [] - nullable: true - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Obter paciente por ID - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patients/{id}: - get: - summary: Obter paciente por ID - deprecated: false - description: Retorna dados de um paciente específico - tags: - - Pacientes - - Pacientes - parameters: - - name: id - in: path - description: ID do paciente - required: true - example: '' - schema: - type: string - format: uuid - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string - responses: - '200': - description: Dados do paciente - content: - application/json: - schema: - $ref: '#/components/schemas/Patient' - headers: {} - x-apidog-name: OK - '401': - description: Não autorizado - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized - '404': - description: Paciente não encontrado - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Not Found - security: - - bearer: [] - x-apidog-folder: Pacientes - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940515-run -components: - schemas: - Patient: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - examples: - - Maria Santos - sex: - type: string - examples: - - F - blood_type: - type: string - examples: - - A+ - weight_kg: - type: number - examples: - - 65.5 - height_m: - type: number - examples: - - 1.65 - bmi: - type: number - examples: - - 24.1 - street: - type: string - examples: - - Rua das Flores, 123 - number: - type: string - examples: - - '123' - complement: - type: string - examples: - - Apt 45 - neighborhood: - type: string - examples: - - Centro - city: - type: string - examples: - - São Paulo - state: - type: string - examples: - - SP - cep: - type: string - examples: - - 01234-567 - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - updated_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - bmi - - street - - number - - complement - - neighborhood - - city - - state - - cep - - created_at - - updated_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Atualizar paciente - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patients/{id}: - patch: - summary: Atualizar paciente - deprecated: false - description: Atualizar dados de um paciente existente - tags: - - Pacientes - - Pacientes - parameters: - - name: id - in: path - description: ID do paciente - required: true - example: '' - schema: - type: string - format: uuid - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PatientInput' - responses: - '200': - description: Paciente atualizado com sucesso - content: - application/json: - schema: - $ref: '#/components/schemas/Patient' - headers: {} - x-apidog-name: OK - '401': - description: Não autorizado - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized - '404': - description: Paciente não encontrado - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Not Found - security: - - bearer: [] - x-apidog-folder: Pacientes - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940516-run -components: - schemas: - PatientInput: - type: object - required: - - full_name - - cpf - - email - - phone_mobile - properties: - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - sex: - type: string - examples: - - F - blood_type: - type: string - weight_kg: - type: number - height_m: - type: number - street: - type: string - number: - type: string - complement: - type: string - neighborhood: - type: string - city: - type: string - state: - type: string - cep: - type: string - x-apidog-orders: - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - street - - number - - complement - - neighborhood - - city - - state - - cep - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Patient: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - examples: - - Maria Santos - sex: - type: string - examples: - - F - blood_type: - type: string - examples: - - A+ - weight_kg: - type: number - examples: - - 65.5 - height_m: - type: number - examples: - - 1.65 - bmi: - type: number - examples: - - 24.1 - street: - type: string - examples: - - Rua das Flores, 123 - number: - type: string - examples: - - '123' - complement: - type: string - examples: - - Apt 45 - neighborhood: - type: string - examples: - - Centro - city: - type: string - examples: - - São Paulo - state: - type: string - examples: - - SP - cep: - type: string - examples: - - 01234-567 - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - updated_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - bmi - - street - - number - - complement - - neighborhood - - city - - state - - cep - - created_at - - updated_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Deletar paciente - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patients/{id}: - delete: - summary: Deletar paciente - deprecated: false - description: Remover um paciente do sistema (apenas admins/gestores) - tags: - - Pacientes - - Pacientes - parameters: - - name: id - in: path - description: ID do paciente - required: true - example: '' - schema: - type: string - format: uuid - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '' - schema: - type: string - responses: - '204': - description: Paciente deletado com sucesso - headers: {} - x-apidog-name: No Content - '401': - description: Não autorizado - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Unauthorized - '403': - description: Sem permissão - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Forbidden - '404': - description: Paciente não encontrado - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Not Found - security: - - bearer: [] - x-apidog-folder: Pacientes - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940517-run -components: - schemas: - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Criar novo paciente - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patients: - post: - summary: Criar novo paciente - deprecated: false - description: Cadastrar um novo paciente no sistema - tags: - - Pacientes - - Pacientes - parameters: - - name: apikey - in: header - description: Chave da API Supabase - required: true - example: '{{API_KEY}}' - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PatientInput' + type: object + required: + - email + properties: + email: + type: string + format: email + examples: + - usuario@clinica.com + x-apidog-orders: + - email example: - full_name: Maria Santos - cpf: '12345678901' - email: maria@email.com - phone_mobile: (11) 99999-9999 - birth_date: '1980-01-15' - responses: - '201': - description: Paciente criado com sucesso - content: - application/json: - schema: - $ref: '#/components/schemas/Patient' - headers: {} - x-apidog-name: Created - '400': - description: Dados inválidos - content: - application/json: - schema: &ref_0 - $ref: '#/components/schemas/Error' - headers: {} - x-apidog-name: Bad Request - '401': - description: Não autorizado - content: - application/json: - schema: *ref_0 - headers: {} - x-apidog-name: Unauthorized - security: - - bearer: [] - x-apidog-folder: Pacientes - x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940514-run -components: - schemas: - PatientInput: - type: object - required: - - full_name - - cpf - - email - - phone_mobile - properties: - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - sex: - type: string - examples: - - F - blood_type: - type: string - weight_kg: - type: number - height_m: - type: number - street: - type: string - number: - type: string - complement: - type: string - neighborhood: - type: string - city: - type: string - state: - type: string - cep: - type: string - x-apidog-orders: - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - street - - number - - complement - - neighborhood - - city - - state - - cep - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Patient: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - examples: - - Maria Santos - sex: - type: string - examples: - - F - blood_type: - type: string - examples: - - A+ - weight_kg: - type: number - examples: - - 65.5 - height_m: - type: number - examples: - - 1.65 - bmi: - type: number - examples: - - 24.1 - street: - type: string - examples: - - Rua das Flores, 123 - number: - type: string - examples: - - '123' - complement: - type: string - examples: - - Apt 45 - neighborhood: - type: string - examples: - - Centro - city: - type: string - examples: - - São Paulo - state: - type: string - examples: - - SP - cep: - type: string - examples: - - 01234-567 - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - updated_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - bmi - - street - - number - - complement - - neighborhood - - city - - state - - cep - - created_at - - updated_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' - securitySchemes: - bearerAuth: - type: jwt - scheme: bearer - bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer -servers: - - url: https://yuanqfswhberkoevtmfr.supabase.co - description: Prod Env - - url: '' - description: Cloud Mock -security: - - bearer: [] - -``` - -# Listar pacientes - -## OpenAPI Specification - -```yaml -openapi: 3.0.1 -info: - title: '' - description: '' - version: 1.0.0 -paths: - /rest/v1/patients: - get: - summary: Listar pacientes - deprecated: false - description: Retorna lista de pacientes com base nas permissões do usuário - tags: - - Pacientes - - Pacientes - parameters: - - name: apikey - in: header - description: '' - required: false - example: '{{apikey}}' - schema: - type: string + email: usuario@clinica.com responses: '200': - description: Lista de pacientes - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Patient' + description: Magic link enviado headers: {} x-apidog-name: OK - '401': - description: Não autorizado - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + '429': + description: Limite de envio excedido headers: {} - x-apidog-name: Unauthorized - security: - - bearer: [] - x-apidog-folder: Pacientes + x-apidog-name: Too Many Requests + security: [] + x-apidog-folder: Autenticação x-apidog-status: released - x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-21940513-run + x-run-in-apidog: https://app.apidog.com/web/project/1053378/apis/api-23104942-run components: - schemas: - Patient: - type: object - properties: - id: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - full_name: - type: string - examples: - - Maria Santos Silva - cpf: - type: string - examples: - - '12345678901' - email: - type: string - format: email - examples: - - maria@email.com - phone_mobile: - type: string - examples: - - (11) 99999-9999 - birth_date: - type: string - format: date - examples: - - '1980-01-15' - social_name: - type: string - examples: - - Maria Santos - sex: - type: string - examples: - - F - blood_type: - type: string - examples: - - A+ - weight_kg: - type: number - examples: - - 65.5 - height_m: - type: number - examples: - - 1.65 - bmi: - type: number - examples: - - 24.1 - street: - type: string - examples: - - Rua das Flores, 123 - number: - type: string - examples: - - '123' - complement: - type: string - examples: - - Apt 45 - neighborhood: - type: string - examples: - - Centro - city: - type: string - examples: - - São Paulo - state: - type: string - examples: - - SP - cep: - type: string - examples: - - 01234-567 - created_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - updated_at: - type: string - format: date-time - examples: - - '2024-01-15T10:30:00Z' - created_by: - type: string - format: uuid - examples: - - 12345678-1234-1234-1234-123456789012 - x-apidog-orders: - - id - - full_name - - cpf - - email - - phone_mobile - - birth_date - - social_name - - sex - - blood_type - - weight_kg - - height_m - - bmi - - street - - number - - complement - - neighborhood - - city - - state - - cep - - created_at - - updated_at - - created_by - x-apidog-ignore-properties: [] - x-apidog-folder: '' - Error: - type: object - properties: - error: - type: string - message: - type: string - code: - type: string - x-apidog-orders: - - error - - message - - code - x-apidog-ignore-properties: [] - x-apidog-folder: '' + schemas: {} securitySchemes: - bearerAuth: + BearerAuth: type: jwt scheme: bearer bearerFormat: JWT - description: Token JWT obtido no login - bearer: - type: http - scheme: bearer + description: Token JWT obtido após autenticação no Supabase + ApiKeyAuth: + type: apikey + in: header + name: apikey + description: >- + API Key: + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ + Combination: + group: + - id: 411599 + - id: 411600 + type: combination servers: - url: https://yuanqfswhberkoevtmfr.supabase.co description: Prod Env - url: '' description: Cloud Mock security: - - bearer: [] + - BearerAuth: [] + x-apidog: + schemeGroups: + - id: RFxC7GDggznAKdsvxFeIw + schemeIds: + - BearerAuth + required: true + use: + id: RFxC7GDggznAKdsvxFeIw + scopes: + RFxC7GDggznAKdsvxFeIw: + BearerAuth: [] ``` +