{
  "openapi": "3.1.1",
  "info": {
    "title": "H5.Auth.Api | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://h5.storytaco.com/"
    }
  ],
  "paths": {
    "/v1/logs/episode-view": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EpisodeViewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EpisodeViewResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/votes/actor": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActorVoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActorVoteResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/votes/ranking": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActorRankingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActorRankingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/video/url": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoUrlRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoUrlResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/video/hls/{gameId}/{contentId}/{playlist}": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "parameters": [
          {
            "name": "gameId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "contentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "playlist",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expires",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "signature",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/live": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/ready": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/auth/platform-login": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/guest-login": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GuestLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/me": {
      "get": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/auth/logout": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/auth/link": {
      "post": {
        "tags": [
          "H5.Auth.Api"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActorRank": {
        "required": [
          "rank",
          "actor_id",
          "vote_count"
        ],
        "type": "object",
        "properties": {
          "rank": {
            "type": "integer",
            "format": "int64"
          },
          "actor_id": {
            "type": "integer",
            "format": "int32"
          },
          "vote_count": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "ActorRankingRequest": {
        "required": [
          "game_id"
        ],
        "type": "object",
        "properties": {
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          }
        },
        "additionalProperties": false
      },
      "ActorRankingResponse": {
        "required": [
          "game_id",
          "total_votes",
          "rankings"
        ],
        "type": "object",
        "properties": {
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          },
          "total_votes": {
            "type": "integer",
            "format": "int64"
          },
          "rankings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActorRank"
            }
          }
        },
        "additionalProperties": false
      },
      "ActorVoteRequest": {
        "required": [
          "access_token",
          "actor_id"
        ],
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "actor_id": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ActorVoteResponse": {
        "required": [
          "game_id",
          "actor_id",
          "voted_at"
        ],
        "type": "object",
        "properties": {
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          },
          "actor_id": {
            "type": "integer",
            "format": "int32"
          },
          "voted_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "Credential": {
        "required": [
          "type",
          "token"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "token": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "EpisodeViewRequest": {
        "required": [
          "access_token",
          "player_unique",
          "episode_index"
        ],
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "player_unique": {
            "type": "integer",
            "format": "int64"
          },
          "episode_index": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "EpisodeViewResponse": {
        "required": [
          "episode_log_unique",
          "viewed_at"
        ],
        "type": "object",
        "properties": {
          "episode_log_unique": {
            "type": "integer",
            "format": "int64"
          },
          "viewed_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "GameTitle": {
        "enum": [
          2001,
          2004,
          2008,
          2009,
          2014
        ],
        "type": "integer",
        "description": "2001=Pc01, 2004=Pc04, 2008=Pc08, 2009=Pc09, 2014=Pc14. Internal game code; distinct from the platform Game ID. Only configured games can log in."
      },
      "GuestLoginRequest": {
        "required": [
          "game_id"
        ],
        "type": "object",
        "properties": {
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          },
          "resume_token": {
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "LoginResponse": {
        "required": [
          "player_unique",
          "game_id",
          "is_guest",
          "is_new_user",
          "access_token",
          "expires_in"
        ],
        "type": "object",
        "properties": {
          "player_unique": {
            "type": "integer",
            "format": "int64"
          },
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          },
          "is_guest": {
            "type": "boolean"
          },
          "is_new_user": {
            "type": "boolean"
          },
          "access_token": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "format": "int32"
          },
          "token_type": {
            "type": "string",
            "default": "Bearer"
          },
          "guest_resume_token": {
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "PlatformLoginRequest": {
        "required": [
          "game_id",
          "store_type",
          "credential"
        ],
        "type": "object",
        "properties": {
          "game_id": {
            "$ref": "#/components/schemas/GameTitle"
          },
          "store_type": {
            "$ref": "#/components/schemas/StoreType"
          },
          "credential": {
            "$ref": "#/components/schemas/Credential"
          }
        },
        "additionalProperties": false
      },
      "StoreType": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          11,
          12,
          13,
          14,
          15,
          16
        ],
        "type": "integer",
        "description": "0=None, 1=PlayStore, 2=AppStore, 3=Steam, 4=MicrosoftStore, 5=PlayStationStore, 6=NintendoEShop, 7=OneStore, 11=CrazyGames, 12=TikTokMiniGame, 13=YandexGames, 14=GamePix, 15=GameloftStore, 16=AppsClube. None is not a login method. Only CrazyGames authentication is currently implemented."
      },
      "VideoUrlRequest": {
        "required": [
          "access_token",
          "content_id"
        ],
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "content_id": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "VideoUrlResponse": {
        "required": [
          "content_id",
          "signed_url",
          "expires_at",
          "expires_in"
        ],
        "type": "object",
        "properties": {
          "content_id": {
            "type": "integer",
            "format": "int32"
          },
          "signed_url": {
            "type": "string"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_in": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      }
    }
  },
  "tags": [
    {
      "name": "H5.Auth.Api"
    }
  ]
}