api v7.0.0-beta.4 not generating types correctly
Closed this issue · 3 comments
I just tried installing my API using the latest v7 beta on a fresh node project:
npx api@next install @hytopia-api-internal/v1.0#u4tl1vlon8r7n2
This is generating the type definitions for my functions correctly, however the return values are all read as any
:
import api from "@api/hytopia-api-internal";
async function test() {
const res = await api.getTags();
res.data.forEach((tag) => {
console.log(tag.name);
});
}
In the above example res
seems for return a FetchResult
type but it's not picking up the expected types when I try to access them. The API does work and return the expected data at runtime though.
Am I doing something wrong of is this a bug?
Node: 18.12.1
npm: 9.5.0
Hi @jahvi! Could you send across the OpenAPI definition for the SDK you're attempting to generate?
EDIT: Apologies, I missed the registry identifier you included in your original comment so I hid your comment below since it's not actually needed!
Sure thing, here you go:
{
"openapi": "3.0.0",
"info": {
"title": "HYTOPIA API",
"version": "1.0.0",
"description": "Complete HYTOPIA internal API",
"termsOfService": "https://hytopia.com",
"contact": {
"name": "HYTOPIA Team",
"email": "braydon@hytopia.com",
"url": "https://hytopia.com"
}
},
"servers": [
{
"description": "HYTOPIA API Server",
"url": "https://api.hytopia.com"
},
{
"description": "Local Development Server",
"url": "http://localhost:8001"
}
],
"components": {
"parameters": {
"headerAuthorizationUser": {
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
},
"headerAuthorizationUserOptional": {
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": false,
"schema": {
"type": "string"
}
},
"headerAuthorityKey": {
"name": "X-Authority-Key",
"in": "header",
"description": "The `authorityKey` of a user.",
"example": "AXNP8MKb+5SbBtHWrZu5KHh5/BomXY/dMRG/BDUn7a4=",
"required": true,
"schema": {
"type": "string"
}
},
"headerMetricProviderKey": {
"name": "X-Metric-Provider-Key",
"in": "header",
"description": "The authorization key of a metric provider.",
"example": "A5KHh5/BomXY/dMRG/BDUn7a4=XNP8MKb+5SbBtHWrZu",
"required": true,
"schema": {
"type": "string"
}
},
"headerReviewProviderKeyOptional": {
"name": "X-Review-Provider-Key",
"in": "header",
"description": "The authorization key of a review provider.",
"example": "A5KHh5/BomXY/dMRG/BDUn7a4=XNP8MKb+5SbBtHWrZu",
"required": false,
"schema": {
"type": "string"
}
},
"pathUserId": {
"name": "userId",
"in": "path",
"description": "Any user id within the MetaFab platform.",
"required": true,
"schema": {
"type": "string"
}
},
"pathUserIdAuthenticated": {
"name": "userId",
"in": "path",
"description": "The user id of the authenticating user.",
"required": true,
"schema": {
"type": "string"
}
},
"pathAssetId": {
"name": "assetId",
"in": "path",
"description": "A valid asset id.",
"required": true,
"schema": {
"type": "string"
}
},
"pathGameId": {
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
"pathGameReviewId": {
"name": "gameReviewId",
"in": "path",
"description": "A valid game review id.",
"required": true,
"schema": {
"type": "string"
}
},
"pathSlugName": {
"name": "slugName",
"in": "path",
"description": "A valid slug name.",
"required": true,
"schema": {
"type": "string"
}
},
"queryCredentialsExpireAt": {
"name": "credentialsExpireAt",
"in": "query",
"description": "An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.",
"example": 1677197460,
"required": false,
"schema": {
"type": "number"
}
},
"queryUsername": {
"name": "username",
"in": "query",
"description": "A user username.",
"example": "arkdev",
"required": false,
"schema": {
"type": "string"
}
},
"queryReferrerId": {
"name": "referrerId",
"in": "query",
"description": "A user id representing the referrer.",
"example": "8beffbb6-1f37-40c8-9656-b0c1097bbf7c",
"required": false,
"schema": {
"type": "string"
}
},
"queryResetCredentials": {
"name": "resetCredentials",
"in": "query",
"description": "Set this query parameter to `true` to reset accessToken and authorityKey.",
"example": "true",
"required": false,
"schema": {
"type": "string"
}
},
"queryRecaptchaToken": {
"name": "recaptchaToken",
"in": "query",
"description": "A Recaptcha2 token generated client-side by completion of a user-facing recaptcha2 request.",
"required": true,
"schema": {
"type": "string"
}
},
"queryGameLogic": {
"name": "logic",
"in": "query",
"description": "If the games must match all provided filter query parameters (and), or at least 1 filter query parameter to be returned (or). Valid values are: `and`, `or`. Defaults to `or`.",
"schema": {
"type": "string"
}
},
"queryGameTagIds": {
"name": "tagIds",
"in": "query",
"description": "A comma separated string of tag ids associated with games.",
"schema": {
"type": "string"
}
},
"queryGameTagNames": {
"name": "tagNames",
"in": "query",
"description": "A comma separated string of tag names associated with games.",
"schema": {
"type": "string"
}
},
"queryGameSearch": {
"name": "search",
"in": "query",
"description": "A search term used to search games with matching names.",
"schema": {
"type": "string"
}
},
"queryGameSort": {
"name": "sort",
"in": "query",
"description": "A top level Game column to sort by as well as the direction to sort (asc/desc) that is comma separated. For example: `name,desc`.",
"schema": {
"type": "string"
}
},
"queryGameLimit": {
"name": "limit",
"in": "query",
"description": "The number of games to return.",
"schema": {
"type": "string"
}
},
"queryGameCursor": {
"name": "cursor",
"in": "query",
"description": "The last game `id` from previous pagination. Will be excluded from the next \"page\" of results.",
"schema": {
"type": "string"
}
}
},
"responses": {
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
},
"schemas": {
"UserModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"referrerId": {
"type": "string",
"description": "This field has not had a description added."
},
"username": {
"type": "string",
"description": "This field has not had a description added."
},
"email": {
"type": "string",
"description": "This field has not had a description added."
},
"accessToken": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"recoveryQuestions": {
"type": "object",
"description": "This field has not had a description added."
},
"emailVerificationCode": {
"type": "string",
"description": "This field has not had a description added."
},
"emailVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isCurator": {
"type": "boolean",
"description": "This field has not had a description added."
},
"credentialsExpireAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"GameModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"submitterId": {
"type": "string",
"description": "This field has not had a description added."
},
"ownerId": {
"type": "string",
"description": "This field has not had a description added."
},
"iconImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"featuredImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"galleryMediaAssetIds": {
"type": "object",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"description": {
"type": "string",
"description": "This field has not had a description added."
},
"host": {
"type": "string",
"description": "This field has not had a description added."
},
"region": {
"type": "string",
"description": "This field has not had a description added."
},
"type": {
"type": "string",
"description": "This field has not had a description added."
},
"websiteUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"discordUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"twitterUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"isPublished": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"lastPlayerCount": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCapacity": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCountAt": {
"type": "string",
"description": "This field has not had a description added."
},
"lastPlayerCapacityAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"TagModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"SlugModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"GameMetricModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"value": {
"type": "object",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"GameReviewModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"content": {
"type": "string",
"description": "This field has not had a description added."
},
"positive": {
"type": "boolean",
"description": "This field has not had a description added."
},
"ip": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"GameToTagModel": {
"type": "object",
"properties": {
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"tagId": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"AssetModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"TransactionModel": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"function": {
"type": "string",
"description": "This field has not had a description added."
},
"args": {
"type": "object",
"description": "This field has not had a description added."
},
"value": {
"type": "string",
"description": "This field has not had a description added."
},
"hash": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"AnyValue": {
"description": "Can be anything. String, number, object, array, boolean, etc."
}
},
"securitySchemes": {
"basicAuth": {
"type": "http",
"scheme": "basic"
}
}
},
"tags": [
{
"name": "Games",
"description": "Game related operations"
},
{
"name": "Slugs",
"description": "Slug related operations"
},
{
"name": "Tags",
"description": "Tag related operations"
},
{
"name": "Transactions",
"description": "Transaction related operations"
},
{
"name": "Users",
"description": "User related operations"
}
],
"paths": {
"/v1/assets": {
"get": {
"operationId": "getAssets",
"summary": "Get assets",
"description": "Returns an array of assets that have been uploaded by the authorized user ordered by most recent creation.",
"tags": [
"Assets"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an array of asset objects.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "createAsset",
"summary": "Create asset",
"description": "Create an asset object by uploading a file in base64. Returns an asset object.",
"tags": [
"Assets"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"fileBase64": {
"type": "string",
"description": "The base64 string of the asset being uploaded. Uploads may not exceed 10mb."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Returns a created asset object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/assets/{assetId}": {
"get": {
"operationId": "getAsset",
"summary": "Get asset",
"description": "Return an asset object that has been uploaded by the authorized user for the provided assetId.",
"tags": [
"Assets"
],
"parameters": [
{
"name": "assetId",
"in": "path",
"description": "A valid asset id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an asset object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games": {
"get": {
"operationId": "getGames",
"summary": "Get games",
"description": "Returns an array of games",
"tags": [
"Games"
],
"parameters": [
{
"name": "logic",
"in": "query",
"description": "If the games must match all provided filter query parameters (and), or at least 1 filter query parameter to be returned (or). Valid values are: `and`, `or`. Defaults to `or`.",
"schema": {
"type": "string"
}
},
{
"name": "tagIds",
"in": "query",
"description": "A comma separated string of tag ids associated with games.",
"schema": {
"type": "string"
}
},
{
"name": "tagNames",
"in": "query",
"description": "A comma separated string of tag names associated with games.",
"schema": {
"type": "string"
}
},
{
"name": "search",
"in": "query",
"description": "A search term used to search games with matching names.",
"schema": {
"type": "string"
}
},
{
"name": "sort",
"in": "query",
"description": "A top level Game column to sort by as well as the direction to sort (asc/desc) that is comma separated. For example: `name,desc`.",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "The number of games to return.",
"schema": {
"type": "string"
}
},
{
"name": "cursor",
"in": "query",
"description": "The last game `id` from previous pagination. Will be excluded from the next \"page\" of results.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an array of game objects.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"submitterId": {
"type": "string",
"description": "This field has not had a description added."
},
"ownerId": {
"type": "string",
"description": "This field has not had a description added."
},
"iconImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"featuredImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"galleryMediaAssetIds": {
"type": "object",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"description": {
"type": "string",
"description": "This field has not had a description added."
},
"host": {
"type": "string",
"description": "This field has not had a description added."
},
"region": {
"type": "string",
"description": "This field has not had a description added."
},
"type": {
"type": "string",
"description": "This field has not had a description added."
},
"websiteUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"discordUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"twitterUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"isPublished": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"lastPlayerCount": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCapacity": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCountAt": {
"type": "string",
"description": "This field has not had a description added."
},
"lastPlayerCapacityAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
{
"type": "object",
"properties": {
"iconImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"featuredImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
},
"slugs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
]
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "createGame",
"summary": "Create game",
"description": "Create a new game. Currently can only be called by users that are marked as `isCurator` in the database.",
"tags": [
"Games"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The display name of the game. Must be at least 3 characters."
},
"description": {
"type": "string",
"description": "The description of the game, supports markdown. Must be at least 20 characters."
},
"slug": {
"type": "string",
"description": "The slug used in the url for seo. Must be a combination of letters, numbers, and/or dashes (-)."
},
"host": {
"type": "string",
"description": "The url/host used to connect to this game or server. Minecraft JAVA/Bedrock or HYTOPIA servers are supported."
},
"region": {
"type": "string",
"description": "An arbitrary field to define a server region (USA, China, etc)"
},
"websiteUrl": {
"type": "string",
"description": "The website url of the game."
},
"discordUrl": {
"type": "string",
"description": "The url to join the discord server of this game."
},
"twitterUrl": {
"type": "string",
"description": "The url of the twitter profile for this game."
},
"isPublished": {
"type": "boolean",
"description": "If the game should be published."
},
"isVerified": {
"type": "boolean",
"description": "If the game is verified."
},
"iconImageAssetId": {
"type": "string",
"description": "The id of an asset the requesting user has uploaded that represents the icon image of the game."
},
"featuredImageAssetId": {
"type": "string",
"description": "The id of an asset the requesting user has uploaded that represents the featured image of the game."
},
"galleryMediaAssetIds": {
"type": "array",
"description": "ids of assets the requesting user has uploaded that represent an image or video shown in the games scrollable gallery of preview media.",
"items": {
"type": "string"
}
},
"tagIds": {
"type": "array",
"description": "The ids of tags associated with this game. These allow players to filter games by assigned tag, etc.",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"description",
"host",
"region",
"iconImageAssetId"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created a new game. Returns a game object.",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"submitterId": {
"type": "string",
"description": "This field has not had a description added."
},
"ownerId": {
"type": "string",
"description": "This field has not had a description added."
},
"iconImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"featuredImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"galleryMediaAssetIds": {
"type": "object",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"description": {
"type": "string",
"description": "This field has not had a description added."
},
"host": {
"type": "string",
"description": "This field has not had a description added."
},
"region": {
"type": "string",
"description": "This field has not had a description added."
},
"type": {
"type": "string",
"description": "This field has not had a description added."
},
"websiteUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"discordUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"twitterUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"isPublished": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"lastPlayerCount": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCapacity": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCountAt": {
"type": "string",
"description": "This field has not had a description added."
},
"lastPlayerCapacityAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
{
"type": "object",
"properties": {
"iconImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"featuredImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
},
"nullable": true
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
},
"slugs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
]
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games/{gameId}": {
"get": {
"operationId": "getGame",
"summary": "Get game",
"description": "Returns a detailed game object that includes galleryMediaAssets.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns a game object that includes galleryMediaAssets",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"submitterId": {
"type": "string",
"description": "This field has not had a description added."
},
"ownerId": {
"type": "string",
"description": "This field has not had a description added."
},
"iconImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"featuredImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"galleryMediaAssetIds": {
"type": "object",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"description": {
"type": "string",
"description": "This field has not had a description added."
},
"host": {
"type": "string",
"description": "This field has not had a description added."
},
"region": {
"type": "string",
"description": "This field has not had a description added."
},
"type": {
"type": "string",
"description": "This field has not had a description added."
},
"websiteUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"discordUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"twitterUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"isPublished": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"lastPlayerCount": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCapacity": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCountAt": {
"type": "string",
"description": "This field has not had a description added."
},
"lastPlayerCapacityAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
{
"type": "object",
"properties": {
"iconImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"featuredImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
},
"nullable": true
},
"galleryMediaAssets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
},
"slugs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
},
"metrics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"value": {
"type": "object",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
]
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"patch": {
"operationId": "updateGame",
"summary": "Update game",
"description": "Update various fields specific to a game.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The display name of the game. Must be at least 3 characters."
},
"description": {
"type": "string",
"description": "The description of the game, supports markdown. Must be at least 20 characters."
},
"slug": {
"type": "string",
"description": "The slug used in the url for seo. Must be a combination of letters, numbers, and/or dashes (-)."
},
"host": {
"type": "string",
"description": "The url/host used to connect to this game or server. Minecraft JAVA/Bedrock or HYTOPIA servers are supported."
},
"region": {
"type": "string",
"description": "An arbitrary field to define a server region (USA, China, etc)"
},
"websiteUrl": {
"type": "string",
"description": "The website url of the game."
},
"discordUrl": {
"type": "string",
"description": "The url to join the discord server of this game."
},
"twitterUrl": {
"type": "string",
"description": "The url of the twitter profile for this game."
},
"isPublished": {
"type": "boolean",
"description": "If the game is published or not."
},
"isVerified": {
"type": "boolean",
"description": "If the game is verified or not."
},
"iconImageAssetId": {
"type": "string",
"description": "The id of an asset the requesting user has uploaded that represents the icon image of the game."
},
"featuredImageAssetId": {
"type": "string",
"description": "The id of an asset the requesting user has uploaded that represents the featured image of the game."
},
"galleryMediaAssetIds": {
"type": "array",
"description": "ids of assets the requesting user has uploaded that represent an image or video shown in the games scrollable gallery of preview media. Provided galleryMediaAssetIds will overwrite all existing galleryMedaiAssets.",
"items": {
"type": "string"
}
},
"tagIds": {
"type": "array",
"description": "The ids of tags associated with this game. These allow players to filter games by assigned tag, etc. Provided tagIds will overwrite all existings tags.",
"items": {
"type": "string"
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Returns the updated user object.",
"content": {
"application/json": {
"schema": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"submitterId": {
"type": "string",
"description": "This field has not had a description added."
},
"ownerId": {
"type": "string",
"description": "This field has not had a description added."
},
"iconImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"featuredImageAssetId": {
"type": "string",
"description": "This field has not had a description added."
},
"galleryMediaAssetIds": {
"type": "object",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"description": {
"type": "string",
"description": "This field has not had a description added."
},
"host": {
"type": "string",
"description": "This field has not had a description added."
},
"region": {
"type": "string",
"description": "This field has not had a description added."
},
"type": {
"type": "string",
"description": "This field has not had a description added."
},
"websiteUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"discordUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"twitterUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"isPublished": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"lastPlayerCount": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCapacity": {
"type": "integer",
"description": "This field has not had a description added."
},
"lastPlayerCountAt": {
"type": "string",
"description": "This field has not had a description added."
},
"lastPlayerCapacityAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
{
"type": "object",
"properties": {
"iconImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
"featuredImageAsset": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"s3Url": {
"type": "string",
"description": "This field has not had a description added."
},
"cdnUrl": {
"type": "string",
"description": "This field has not had a description added."
},
"mime": {
"type": "string",
"description": "This field has not had a description added."
},
"extension": {
"type": "string",
"description": "This field has not had a description added."
},
"checksum": {
"type": "string",
"description": "This field has not had a description added."
},
"size": {
"type": "integer",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
},
"nullable": true
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
]
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games/{gameId}/metrics": {
"post": {
"operationId": "createGameMetric",
"summary": "Create game metric",
"description": "Creates a game metric for the game associated with the provided gameId. Game metrics track game historical data like player counts over time and more.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Metric-Provider-Key",
"in": "header",
"description": "The authorization key of a metric provider.",
"example": "A5KHh5/BomXY/dMRG/BDUn7a4=XNP8MKb+5SbBtHWrZu",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the metric, For example, `PLAYER_COUNT`."
},
"value": {
"description": "A value tied to this specific metric. Type is metric dependent."
}
},
"required": [
"name",
"value"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created a new game metric. Returns a game metric object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"value": {
"type": "object",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games/{gameId}/reviews": {
"get": {
"operationId": "getGameReviews",
"summary": "Get game reviews",
"description": "Get user reviews specific to a game.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an array of game review objects.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"content": {
"type": "string",
"description": "This field has not had a description added."
},
"positive": {
"type": "boolean",
"description": "This field has not had a description added."
},
"ip": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "upsertGameReview",
"summary": "Upsert game review",
"description": "Create or update (upsert) a game review for the game associated with the provided gameId. A user or ip can submit 1 review per game, per 24 hours. This means a user may have multiple reviews for the same game. If a review exists in the last 24 hours for a matching user or user-less ip, it will updated instead of created. If a review provider submits the review, a unique ip of the reviewer must be included.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-Review-Provider-Key",
"in": "header",
"description": "The authorization key of a review provider.",
"example": "A5KHh5/BomXY/dMRG/BDUn7a4=XNP8MKb+5SbBtHWrZu",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The text content of the user review."
},
"positive": {
"type": "boolean",
"description": "Whether the user says this is a positive (true) review, or negative (false) review."
},
"ip": {
"type": "string",
"description": "The IP address of the reviewer. Must be provided if the review is submitted by an authorized review provider."
}
},
"required": [
"positive"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created a new game review. Returns a game review object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"content": {
"type": "string",
"description": "This field has not had a description added."
},
"positive": {
"type": "boolean",
"description": "This field has not had a description added."
},
"ip": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games/{gameId}/review/{gameReviewId}": {
"patch": {
"operationId": "updateGameReview",
"summary": "Update game review",
"description": "Update various fields specific to a game review.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "gameReviewId",
"in": "path",
"description": "A valid game review id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The text content of the user review."
},
"positive": {
"type": "boolean",
"description": "Whether the user says this is a positive (true) review, or negative (false) review."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully updated a game review. Returns the updated game review object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"content": {
"type": "string",
"description": "This field has not had a description added."
},
"positive": {
"type": "boolean",
"description": "This field has not had a description added."
},
"ip": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/games/{gameId}/reviews/{gameReviewId}": {
"delete": {
"operationId": "deleteGameReview",
"summary": "Delete game review",
"description": "Delete a game review.",
"tags": [
"Games"
],
"parameters": [
{
"name": "gameId",
"in": "path",
"description": "A valid game id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "gameReviewId",
"in": "path",
"description": "A valid game review id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Successfully deleted a game review."
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/slugs/{slugName}": {
"get": {
"operationId": "getSlug",
"summary": "Get slug",
"description": "Return a slug object retrieved by name. Slugs are used to attach plaintext name associations with specific resources, like games. This allows the creation of URL formats that include a slug like \"rpg-minecraft-heros\" for a game's url, and allows a frontend to pull the associate game id through this endpoint, to then use to retrieve the game.",
"tags": [
"Slugs"
],
"parameters": [
{
"name": "slugName",
"in": "path",
"description": "A valid slug name.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns a slug object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"gameId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/tags": {
"get": {
"operationId": "getTags",
"summary": "Get tags",
"description": "Returns an array of tags. These are currently used by games but may be used elsewhere in the future.",
"tags": [
"Tags"
],
"responses": {
"200": {
"description": "Returns an array of tags.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
},
{
"type": "object",
"properties": {
"gamesCount": {
"type": "number"
}
}
}
]
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "createTag",
"summary": "Create tag",
"description": "Create a new tag. Tags currently can be assigned to games by games, but may be assignable to other things in the future as well.",
"tags": [
"Tags"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the tag"
}
},
"required": [
"name"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created a new tag. Returns a tag object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"name": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/transactions": {
"get": {
"operationId": "getTransactions",
"summary": "Get transactions",
"description": "Returns an array of chronologically ordered transaction objects for the authenticated user.",
"tags": [
"Transactions"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an array of transaction object.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"function": {
"type": "string",
"description": "This field has not had a description added."
},
"args": {
"type": "object",
"description": "This field has not had a description added."
},
"value": {
"type": "string",
"description": "This field has not had a description added."
},
"hash": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "createTransaction",
"summary": "Create transaction",
"description": "Create a new transaction on behalf of the user. HYTOPIAs central relayer takes care of covering gas costs. If you exclude the `func` argument, a standard transfer will be assumed and attempted based on the `value` provided.",
"tags": [
"Transactions"
],
"parameters": [
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"chainName": {
"type": "string",
"description": "The blockchain to submit the transaction to.",
"enum": [
"HYTOPIA",
"HYTOPIATESTNET"
]
},
"target": {
"type": "string",
"description": "The contract or wallet address target."
},
"func": {
"type": "string",
"description": "The function selector for the transaction, including argument ABI. Such as `transfer(address, uint256)`."
},
"args": {
"type": "string",
"description": "A JSON array of arguments matching the provided functin selectors ABI."
},
"value": {
"type": "string",
"description": "The amount of token to sent to the target, denoted in WEI."
}
},
"required": [
"chainName",
"target"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created and confirmed a new transaction. Returns a transaction object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"userId": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"function": {
"type": "string",
"description": "This field has not had a description added."
},
"args": {
"type": "object",
"description": "This field has not had a description added."
},
"value": {
"type": "string",
"description": "This field has not had a description added."
},
"hash": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/users": {
"get": {
"operationId": "getUsers",
"summary": "Get users",
"description": "Returns an array of users matching the provided query parameter filters, or a count of total users if no query parameters provided.",
"tags": [
"Users"
],
"parameters": [
{
"name": "username",
"in": "query",
"description": "A user username.",
"example": "arkdev",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Returns an array of public user objects.",
"content": {
"application/json": {
"schema": {
"anyOf": [
{
"type": "array",
"items": {
"type": "object"
}
},
{
"type": "number"
}
]
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "createUser",
"summary": "Create user",
"description": "Create a new user. User greedily has their SCA wallet computed prior to deployment using create2 calculation. This is assigned to the `address` property of the returned user object.",
"tags": [
"Users"
],
"parameters": [
{
"name": "recaptchaToken",
"in": "query",
"description": "A Recaptcha2 token generated client-side by completion of a user-facing recaptcha2 request.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "referrerId",
"in": "query",
"description": "A user id representing the referrer.",
"example": "8beffbb6-1f37-40c8-9656-b0c1097bbf7c",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "credentialsExpireAt",
"in": "query",
"description": "An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.",
"example": 1677197460,
"required": false,
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "The users username, used to authenticate the user and represent them in-game. Usernames are unique. There cannot be 2 users with the same username."
},
"password": {
"type": "string",
"description": "The password to authenticate the user.",
"format": "password",
"example": "aReallyStrongPassword123"
},
"email": {
"type": "string",
"description": "An email address assigned to the user account. Used to send them account recovery details, opted-into promotions, and more.",
"example": "myemail@gmail.com"
}
},
"required": [
"username",
"password"
]
}
}
}
},
"responses": {
"200": {
"description": "Successfully created a new user. Returns a user object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"referrerId": {
"type": "string",
"description": "This field has not had a description added."
},
"username": {
"type": "string",
"description": "This field has not had a description added."
},
"email": {
"type": "string",
"description": "This field has not had a description added."
},
"accessToken": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"recoveryQuestions": {
"type": "object",
"description": "This field has not had a description added."
},
"emailVerificationCode": {
"type": "string",
"description": "This field has not had a description added."
},
"emailVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isCurator": {
"type": "boolean",
"description": "This field has not had a description added."
},
"credentialsExpireAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/users/{userId}": {
"patch": {
"operationId": "updateUser",
"summary": "Update user",
"description": "Update various fields specific to a user.",
"tags": [
"Users"
],
"parameters": [
{
"name": "userId",
"in": "path",
"description": "The user id of the authenticating user.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-Authorization",
"in": "header",
"description": "The `accessToken` of the authenticating user.",
"example": "user_at_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"currentPassword": {
"type": "string",
"description": "The user's current password. Must be provided if setting `newPassword`.",
"format": "password"
},
"newPassword": {
"type": "string",
"description": "A new password. The playetr's old password will no longer be valid. The user's existing access token and authority key will also be invalid. The response will include the new access token and authority key.",
"format": "password"
},
"email": {
"type": "string",
"description": "A valid, unique email address that is not currently assigned to another account."
},
"recoveryQuestions": {
"type": "array",
"description": "An array of any arbitrary questions to display to the user when going through account recovery.",
"items": {
"type": "string"
}
},
"recoveryAnswers": {
"type": "array",
"description": "An array of the correct answers for their recovery questions.",
"items": {
"type": "string"
}
},
"resetAccessToken": {
"type": "boolean",
"description": "Revokes the user's current access token and returns a new one if true."
},
"resetBackupCode": {
"type": "boolean",
"description": "Invalidates the user's backup code and generates a new one if true. `currentPassword` must also be provided."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Returns the updated user object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"referrerId": {
"type": "string",
"description": "This field has not had a description added."
},
"username": {
"type": "string",
"description": "This field has not had a description added."
},
"email": {
"type": "string",
"description": "This field has not had a description added."
},
"accessToken": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"recoveryQuestions": {
"type": "object",
"description": "This field has not had a description added."
},
"emailVerificationCode": {
"type": "string",
"description": "This field has not had a description added."
},
"emailVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isCurator": {
"type": "boolean",
"description": "This field has not had a description added."
},
"credentialsExpireAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/v1/users/auth": {
"get": {
"operationId": "authUser",
"summary": "Authenticate user",
"description": "Returns an existing user object containing access token, authority key, and other details when provided a correct username and password login using Basic Auth.",
"tags": [
"Users"
],
"parameters": [
{
"name": "credentialsExpireAt",
"in": "query",
"description": "An optional unix timestamp in seconds specifying when the returned `accessToken` should expire. If this value is provided, all prior `accessToken` will be invalidated and a new `accessToken` will be issued in the response. If no value is provided, the returned `accessToken` will not expire unless it is invalidated.",
"example": 1677197460,
"required": false,
"schema": {
"type": "number"
}
},
{
"name": "resetCredentials",
"in": "query",
"description": "Set this query parameter to `true` to reset accessToken and authorityKey.",
"example": "true",
"required": false,
"schema": {
"type": "string"
}
}
],
"security": [
{
"basicAuth": []
}
],
"responses": {
"200": {
"description": "Successfully authorized the user and returns a user object.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This field has not had a description added."
},
"referrerId": {
"type": "string",
"description": "This field has not had a description added."
},
"username": {
"type": "string",
"description": "This field has not had a description added."
},
"email": {
"type": "string",
"description": "This field has not had a description added."
},
"accessToken": {
"type": "string",
"description": "This field has not had a description added."
},
"address": {
"type": "string",
"description": "This field has not had a description added."
},
"recoveryQuestions": {
"type": "object",
"description": "This field has not had a description added."
},
"emailVerificationCode": {
"type": "string",
"description": "This field has not had a description added."
},
"emailVerified": {
"type": "boolean",
"description": "This field has not had a description added."
},
"isCurator": {
"type": "boolean",
"description": "This field has not had a description added."
},
"credentialsExpireAt": {
"type": "string",
"description": "This field has not had a description added."
},
"updatedAt": {
"type": "string",
"description": "This field has not had a description added."
},
"createdAt": {
"type": "string",
"description": "This field has not had a description added."
}
}
}
}
}
},
"400": {
"description": "An API level error occurred. This is often due to problematic data being provided by you.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"401": {
"description": "An authorization error occured. This is often due to incorrect tokens or keys being provided, or accessing a resource that the provided tokens or keys do not have access to.",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
}
}
@jahvi I was able to get your code sample working with full types using the following stack:
- Node.js 18.18.2
- NPM 9.8.1
- TypeScript 5.2.2
I'm guessing the issue is with your module
/moduleResolution
settings in your tsconfig.json
. You'll want to make sure those are set to something that supports modern module resolution (NodeNext
/NodeNext
, ESNext
/Bundler
, etc.)1. We'll make sure that these TypeScript requirements are documented so users don't get tricked by this!
See below for a screen recording that shows my solution:
Code.mp4
Hope this helps! Let us know if you have any questions.
Footnotes
-
This cheat sheet has been very helpful for us in understanding all of this if it's not already on your radar. ↩