aboutsummaryrefslogtreecommitdiffhomepage
path: root/openapi.yaml
blob: 002b229a654ce3a3add9c0885d1812ef98137324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
openapi: 3.0.0
info:
  title: Albatross internal web API
  version: 0.1.0
paths:
  /login:
    post:
      summary: User login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  example: "john"
                password:
                  type: string
                  example: "password123"
              required:
                - username
                - password
      responses:
        '200':
          description: Successfully authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
                    example: "xxxxx.xxxxx.xxxxx"
                required:
                  - token
        '401':
          description: Invalid username or password
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Invalid credentials"
                required:
                  - message
  /games:
    get:
      summary: List games
      parameters:
        - in: query
          name: player_id
          schema:
            type: integer
          required: false
        - in: header
          name: Authorization
          schema:
            type: string
          required: true
      responses:
        '200':
          description: List of games
          content:
            application/json:
              schema:
                type: object
                properties:
                  games:
                    type: array
                    items:
                      $ref: '#/components/schemas/Game'
                required:
                  - games
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Forbidden operation"
                required:
                  - message
components:
  schemas:
    JwtPayload:
      type: object
      properties:
        user_id:
          type: integer
          example: 123
        username:
          type: string
          example: "john"
        display_name:
          type: string
          example: "John Doe"
        icon_path:
          type: string
          example: "/images/john.jpg"
        is_admin:
          type: boolean
          example: false
      required:
        - user_id
        - username
        - display_name
        - is_admin
    Game:
      type: object
      properties:
        game_id:
          type: integer
          example: 1
        state:
          type: string
          example: "active"
          enum:
            - closed
            - waiting_entries
            - waiting_start
            - prepare
            - starting
            - gaming
            - finished
        display_name:
          type: string
          example: "Game 1"
        duration_seconds:
          type: integer
          example: 360
        started_at:
          type: integer
          example: 946684800
        problem:
          $ref: '#/components/schemas/Problem'
      required:
        - game_id
        - state
        - display_name
        - duration_seconds
    Problem:
      type: object
      properties:
        problem_id:
          type: integer
          example: 1
        title:
          type: string
          example: "Problem 1"
        description:
          type: string
          example: "This is a problem"
      required:
        - problem_id
        - title
        - description