Files
gatos-tejada/docs/openapi_role_based/openapi_collector.yaml
T

314 lines
8.4 KiB
YAML

openapi: 3.0.3
info:
title: Novias del Gato API - Collector
description: |
Authenticated API contract for collectors and contributors. Contains operations for
social check-ins, location status reporting, and user profiles.
version: 1.0.0
servers:
- url: https://api.gatos.cali.gov.co/v1
description: Production Server
paths:
/auth/login:
post:
summary: Google SSO Authentication
description: Exchange a Google OAuth ID token for a system-issued JWT access token.
operationId: loginUser
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- id_token
properties:
id_token:
type: string
description: The ID token returned by Google OAuth.
responses:
'200':
description: Successful authentication
content:
application/json:
schema:
type: object
required:
- access_token
- token_type
- expires_in
properties:
access_token:
type: string
token_type:
type: string
example: Bearer
expires_in:
type: integer
'401':
description: Invalid token.
/users/me:
get:
summary: Retrieve Current User Profile
description: Get details about the authenticated user, including their community trust score.
operationId: getMyProfile
security:
- BearerAuth: []
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'401':
$ref: '#/components/responses/Unauthorized'
/users/me/collection:
get:
summary: Get User's Unlocked Sculptures
description: Returns the user's progress tracking which cat sculptures they have successfully captured.
operationId: getMyCollection
security:
- BearerAuth: []
responses:
'200':
description: List of check-ins / captures
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CheckInRecord'
'401':
$ref: '#/components/responses/Unauthorized'
/sculptures/{id}/check-in:
post:
summary: Capture / Check-in to a Sculpture
description: |
Perform physical verification by sending the explorer's current GPS location and a freshly captured photo.
The Recognition Service verifies the photo matches the sculpture model embeddings within proximity.
operationId: checkInSculpture
security:
- BearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- photo
- latitude
- longitude
properties:
photo:
type: string
format: binary
latitude:
type: number
format: float
minimum: -90
maximum: 90
example: 3.4501
longitude:
type: number
format: float
minimum: -180
maximum: 180
example: -76.5332
responses:
'200':
description: Verification outcome
content:
application/json:
schema:
type: object
required:
- success
- similarity_score
properties:
success:
type: boolean
similarity_score:
type: number
format: float
unlocked_content:
type: string
reward_badge:
type: string
'400':
description: Invalid coordinates or photo format.
'401':
$ref: '#/components/responses/Unauthorized'
/reports:
post:
summary: Submit a Sculpture Location Report
description: |
Allows citizens to report if a sculpture is missing, undergoing maintenance, or has been relocated.
Supplying GPS coordinates and an optional photo helps update the status map via the weighted consensus engine.
operationId: submitReport
security:
- BearerAuth: []
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- sculpture_id
- latitude
- longitude
- reported_status
properties:
sculpture_id:
type: string
format: uuid
latitude:
type: number
format: float
longitude:
type: number
format: float
reported_status:
type: string
enum: [moved, missing, on-site]
photo:
type: string
format: binary
description:
type: string
maxLength: 500
responses:
'201':
description: Report ticket successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/Ticket'
'401':
$ref: '#/components/responses/Unauthorized'
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
responses:
Unauthorized:
description: Authentication token missing or expired.
schemas:
User:
type: object
required:
- id
- name
- email
- trust_score
- captured_count
properties:
id:
type: string
format: uuid
name:
type: string
example: Juan Perez
email:
type: string
format: email
example: juan.perez@gmail.com
trust_score:
type: number
format: float
example: 0.85
captured_count:
type: integer
example: 12
CheckInRecord:
type: object
required:
- sculpture_id
- unlocked_at
- similarity_score
properties:
sculpture_id:
type: string
format: uuid
unlocked_at:
type: string
format: date-time
example: 2026-05-30T10:15:30Z
checkin_photo_url:
type: string
format: uri
example: https://cdn.gatos.cali.gov.co/uploads/checkin_9823.jpg
similarity_score:
type: number
format: float
example: 0.92
Ticket:
type: object
required:
- id
- reporter_id
- sculpture_id
- latitude
- longitude
- reported_status
- status
- created_at
properties:
id:
type: string
format: uuid
reporter_id:
type: string
format: uuid
sculpture_id:
type: string
format: uuid
latitude:
type: number
format: float
longitude:
type: number
format: float
reported_status:
type: string
enum: [moved, missing, on-site]
photo_url:
type: string
format: uri
nullable: true
description:
type: string
status:
type: string
enum: [pending, approved, rejected]
created_at:
type: string
format: date-time
resolved_at:
type: string
format: date-time
nullable: true
notes:
type: string
nullable: true