ChatRPG
ChatRPG · GPT-Aktionen
Game Progress Firebase Functions API
This API interfaces with Firebase Functions to get and update user game progress.
GET /getUserProgressRetrieves the game progress for a specific user.POST /updateUserProgressUpdates the game progress for a specific user.POST /addUserAdds a new user to the database.
Ursprüngliches API-Schema
{
"openapi": "3.1.0",
"info": {
"title": "Game Progress Firebase Functions API",
"description": "This API interfaces with Firebase Functions to get and update user game progress.",
"version": "1.0.0"
},
"servers": [
{
"url": "https://us-central1-gpt-rpg-bot.cloudfunctions.net",
"description": "Firebase Functions server"
}
],
"components": {
"schemas": {
"UserProgress": {
"type": "object",
"properties": {
"class": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"lastLocation": {
"type": "string"
},
"fightsWon": {
"type": "integer"
},
"questsCompleted": {
"type": "integer"
},
"gold": {
"type": "integer"
}
}
}
}
},
"paths": {
"/getUserProgress": {
"get": {
"operationId": "getUserProgress",
"summary": "Retrieves the game progress for a specific user.",
"parameters": [
{
"in": "query",
"name": "username",
"required": true,
"schema": {
"type": "string"
},
"example": "adventurer"
},
{
"in": "query",
"name": "pin",
"required": true,
"schema": {
"type": "integer"
},
"example": 1234
}
],
"responses": {
"200": {
"description": "Successfully retrieved user progress",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"progress": {
"$ref": "#/components/schemas/UserProgress"
}
}
}
}
}
},
"400": {
"description": "Missing username or PIN"
},
"401": {
"description": "Incorrect username or PIN"
},
"404": {
"description": "User not found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/updateUserProgress": {
"post": {
"operationId": "updateUserProgress",
"summary": "Updates the game progress for a specific user.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "adventurer"
},
"pin": {
"type": "integer",
"example": 1234
},
"newProgress": {
"$ref": "#/components/schemas/UserProgress"
}
}
}
}
}
},
"responses": {
"200": {
"description": "User progress updated successfully"
},
"400": {
"description": "Missing username, PIN, or new progress data"
},
"401": {
"description": "Incorrect username or PIN"
},
"404": {
"description": "User not found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/addUser": {
"post": {
"operationId": "addUser",
"summary": "Adds a new user to the database.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "adventurer"
},
"pin": {
"type": "integer",
"example": 1234
},
"newProgress": {
"$ref": "#/components/schemas/UserProgress"
}
}
}
}
}
},
"responses": {
"200": {
"description": "User added successfully"
},
"400": {
"description": "Missing username, PIN, or new progress data"
},
"409": {
"description": "Username already exists"
},
"500": {
"description": "Internal Server Error"
}
}
}
}
}
}