openapi: 3.1.0
info:
  title: 7 Days To Die WebAPI
  version: '1.0.0'
servers:
  - url: /

components:
  schemas:
    ResultEnvelopeMeta:
      type: object
      properties:
        serverTime:
          type: string
          format: date-time
        requestMethod:
          type: string
          examples:
            - GET
            - POST
        requestSubpath:
          type: string
          examples:
            - search
          description: >-
            URL path (without query arguments) starting from after the API name,
            excluding the initial slash '/'
        requestBody:
          type:
            - object
            - 'null'
          examples:
            - id: a
              filter: 123
          description: If erroneous request had a valid JSON body it is included here
        errorCode:
          type: string
          examples:
            - GET_WITH_BODY
            - INVALID_COMMAND
          description: Custom error identifier
        exceptionMessage:
          type: string
          description: Message (If API execution threw an exception)
        exceptionTrace:
          type: string
          description: Stack trace (If API execution threw an exception)
      required:
        - serverTime
        - requestMethod
        - requestSubpath
        - requestBody
        - errorCode

    TypeEntityId:
      type: integer
      minimum: 0
      examples:
        - 171
      description: World-unique EntityID

    TypeVector3i:
      type: object
      properties:
        x:
          type: integer
          examples:
            - -123
        y:
          type: integer
          examples:
            - 61
        z:
          type: integer
          examples:
            - 734
      required:
        - x
        - 'y'
        - z
      description: 3D vector in full blocks

    TypeUserIdString:
      type: string
      pattern: '^\[a-zA-Z]+_[\w]+$'
      examples:
        - 'Steam_76561198021925107'
      description: User ID including platform

    TypeUserIdObject:
      anyOf:
        - type: object
          properties:
            combinedString:
              $ref: '#/components/schemas/TypeUserIdString'
            platformId:
              type: string
              examples:
                - Steam
                - XBL
              description: Gaming platform the ID references
            userId:
              type: string
              examples:
                - '76561198021925107'
              description: Unique ID of the user within the given gaming platform
          required:
            - combinedString
            - platformId
            - userId
          description: User ID
        - type: 'null'
      
    TypeGameTimeObject:
      type: object
      properties:
        days:
          type: integer
          minimum: 1
        hours:
          type: integer
          minimum: 0
          maximum: 23
        minutes:
          type: integer
          minimum: 0
          maximum: 59
      required:
        - days
        - hours
        - minutes
        

  parameters:
    UserIdPathParameter:
      name: id
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/TypeUserIdString'


  responses:
    HttpEmptyEnvelopedResponse:
      description: Empty result
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  type: 'null'
                maxItems: 0
                examples:
                  - []
              meta:
                $ref: '#/components/schemas/ResultEnvelopeMeta'
            required:
              - data
              - meta

    Unauthorized:
      description: Not authorized to call this operation


  securitySchemes:
    apiTokenName:
      type: apiKey
      in: header
      name: X-SDTD-API-TOKENNAME
      description: Authentication by a "WebToken" with token name and token secret, passed in as header fields. This specifies the token name.
    apiTokenSecret:
      type: apiKey
      in: header
      name: X-SDTD-API-SECRET
      description: Authentication by a "WebToken" with token name and token secret, passed in as header fields. This specifies the token secret.
    sessionCookie:
      type: apiKey
      in: cookie
      name: sid
      description: Authentication by session cookie. A cookie can be received from the session endpoints.


paths:
