core/api/openapi3.yml

140 lines
3.4 KiB
YAML

openapi: 3.0.0
info:
version: 2.0.0
title: TWHelp API
description: REST API to interact with [TWHelp](https://tribalwarshelp.com).
contact:
name: Dawid Wysokiński
url: https://dwysokinski.me
email: contact@dwysokinski.me
license:
name: MIT
tags:
- name: versions
servers:
- url: "{scheme}://{hostname}/api"
variables:
scheme:
default: http
enum:
- http
- https
hostname:
default: localhost:9234
paths:
/v2/versions:
get:
operationId: listVersions
tags:
- versions
description: List versions
parameters:
- $ref: "#/components/parameters/CursorQueryParam"
- $ref: "#/components/parameters/LimitQueryParam"
responses:
200:
$ref: "#/components/responses/ListVersionsResponse"
default:
$ref: "#/components/responses/ErrorResponse"
components:
schemas:
Error:
type: object
required:
- slug
- message
additionalProperties: false
properties:
slug:
type: string
message:
type: string
params:
type: object
additionalProperties: true
x-go-type-skip-optional-pointer: true
Version:
type: object
required:
- code
- host
- name
- timezone
properties:
code:
type: string
example: pl
host:
type: string
example: www.tribalwars.net
name:
type: string
example: Poland
timezone:
type: string
example: Europe/Warsaw
PaginationResponse:
type: object
properties:
self:
description: Cursor pointing to the current page.
type: string
x-go-type-skip-optional-pointer: true
first:
description: Cursor pointing to the first page.
type: string
x-go-type-skip-optional-pointer: true
prev:
description: Cursor pointing to the previous page.
type: string
x-go-type-skip-optional-pointer: true
next:
description: Cursor pointing to the next page.
type: string
x-go-type-skip-optional-pointer: true
last:
description: Cursor pointing to the last page.
type: string
x-go-type-skip-optional-pointer: true
parameters:
CursorQueryParam:
in: query
name: cursor
schema:
type: string
required: false
LimitQueryParam:
in: query
name: limit
schema:
type: integer
required: false
responses:
ListVersionsResponse:
description: ""
content:
application/json:
schema:
allOf:
- $ref: "#/components/schemas/PaginationResponse"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/Version"
ErrorResponse:
description: Default error response.
content:
application/json:
schema:
type: object
required:
- error
additionalProperties: false
properties:
error:
$ref: "#/components/schemas/Error"