Games API
The Games API enables you to manage your game catalog, submit games for review, publish updates, and track version history. Build and distribute games across multiple platforms with comprehensive metadata and media management.
Authentication
All endpoints require authentication using either:
- API Key: Include
x-api-keyheader - Cognito JWT: Include
Authorization: Bearer <token>header - Developer Auth: Special authentication for developer operations
The getGameCategories endpoint is public and doesn't require authentication.
Base URL
https://api.getjar.com/games
Core Concepts
Games
A Game represents a playable application in the GetJar platform. Each game has:
- Unique identifier (
documentId) - Developer ownership
- Platform support (Web, Windows, Mac, Linux, iOS, Android)
- Rich metadata (title, description, categories)
- Media assets (cover, icon, screenshots)
- Version history
- Review status
Game Versions
Versions track updates and improvements to your game:
- Incremental version numbers
- Version strings (e.g., "1.2.0")
- Release notes
- Independent review process
- Historical tracking
Review Status Flow
draft → pending_review → approved → published
↓
rejected
Status Types
| Status | Description |
|---|---|
| draft | Game is being created, not yet submitted |
| pending_review | Submitted for review, awaiting approval |
| approved | Approved by review team |
| rejected | Rejected during review |
| published | Live and available to players |
Create Game
Create a new game with metadata. Automatically creates an associated app and submits for review.
Endpoint
POST /games
Request Body
{
title: string; // Required: Game title
description: string; // Required: Game description
platforms: string[]; // Required: Supported platforms
categories: string[]; // Required: Category IDs
gameFileId?: string; // Web game file ID
coverImageId?: string; // Cover image ID
iconImageId?: string; // Square icon ID
screenshotIds?: string[]; // Screenshot image IDs
}
Response
{
id: number;
documentId: string;
title: string;
description: string;
appId: string;
developerId: string;
selfStatus: string; // 'pending_review'
hasActiveReview: boolean; // true
platforms: string[];
categories: object[];
createdAt: string;
}
Example
import { GamesApi } from "@getjar-iap/sdk";
const gamesApi = new GamesApi(configuration);
const game = await gamesApi.createGame({
body: {
title: "Awesome Puzzle Game",
description:
"A challenging puzzle game with unique mechanics and beautiful graphics",
platforms: ["WEB", "WINDOWS"],
categories: ["cat_puzzle", "cat_casual"],
gameFileId: "file_123",
coverImageId: "img_456",
iconImageId: "img_789",
screenshotIds: ["img_101", "img_102", "img_103"],
},
});
console.log("Game ID:", game.data.documentId);
console.log("Status:", game.data.selfStatus);
console.log("App ID:", game.data.appId);
Platforms
| Platform | Description |
|---|---|
| WEB | Browser-based web game |
| WINDOWS | Windows desktop |
| MAC | macOS desktop |
| LINUX | Linux desktop |
| IOS | iPhone/iPad |
| ANDROID | Android devices |
Response Codes
| Code | Description |
|---|---|
| 201 | Game created successfully |
| 400 | Invalid game data |
| 401 | Unauthorized |
Get Game by ID
Retrieve detailed information about a specific game including screenshots, cover, icon, and current version.
Endpoint
GET /games/:gameId
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| gameId | string | Yes | The unique game identifier (documentId) |
Response
{
id: number;
documentId: string;
title: string;
description: string;
appId: string;
developerId: string;
selfStatus: string;
hasActiveReview: boolean;
platforms: string[];
categories: Array<{
id: number;
name: string;
slug: string;
}>;
cover: {
id: number;
url: string;
width: number;
height: number;
};
squareIcon: object;
screenshots: object[];
currentVersion: {
documentId: string;
versionNumber: number;
versionString: string;
releaseNotes: string;
};
createdAt: string;
updatedAt: string;
publishedAt: string;
}
Example
const game = await gamesApi.getGameById({
gameId: "game_abc123",
});
console.log("📱 Game Details:");
console.log("Title:", game.data.title);
console.log("Status:", game.data.selfStatus);
console.log("Platforms:", game.data.platforms.join(", "));
console.log("Current Version:", game.data.currentVersion?.versionString);
console.log("Categories:", game.data.categories.map((c) => c.name).join(", "));
console.log("Has Cover:", !!game.data.cover);
console.log("Screenshots:", game.data.screenshots?.length || 0);
Response Codes
| Code | Description |
|---|---|
| 200 | Game retrieved |
| 401 | Unauthorized |
| 403 | Access denied to this game |
| 404 | Game does not exist |
Update Game
Update game metadata such as title, description, platforms, or categories.
Endpoint
PUT /games/:gameId
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| gameId | string | Yes | The unique game identifier (documentId) |
Request Body
{
title?: string; // Updated game title
description?: string; // Updated description
platforms?: string[]; // Updated platforms
categories?: string[]; // Updated category IDs
coverImageId?: string; // New cover image ID
iconImageId?: string; // New icon image ID
screenshotIds?: string[]; // Updated screenshot IDs
}
Example
const updated = await gamesApi.updateGame({
gameId: "game_abc123",
body: {
title: "Awesome Puzzle Game - Remastered",
description: "An even more challenging puzzle game with 50+ new levels!",
platforms: ["WEB", "WINDOWS", "MAC"],
screenshotIds: ["img_201", "img_202", "img_203", "img_204"],
},
});
console.log("Updated:", updated.data.title);
console.log("Platforms:", updated.data.platforms);
Response Codes
| Code | Description |
|---|---|
| 200 | Game updated successfully |
| 400 | Invalid update data |
| 401 | Unauthorized |
| 403 | Access denied to this game |
| 404 | Game does not exist |
Delete Game
Permanently delete a game and all its versions. This action cannot be undone.
Endpoint
DELETE /games/:gameId
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| gameId | string | Yes | The unique game identifier (documentId) |
Response
{
success: boolean;
message: string;
}
Example
await gamesApi.deleteGame({
gameId: "game_abc123",
});
console.log("Game deleted successfully");
Response Codes
| Code | Description |
|---|---|
| 200 | Game deleted successfully |
| 401 | Unauthorized |
| 403 | Access denied to this game |
| 404 | Game does not exist |
Get Developer Games
Retrieve a paginated list of all games created by the authenticated developer with filters and sorting.
Endpoint
GET /games
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| selfStatus | string | No | Filter by status |
| page | number | No | Page number (default: 1) |
| pageSize | number | No | Items per page (default: 25) |
| sort | string | No | Sort order (default: 'createdAt:desc') |
Response
{
data: Array<{
id: number;
documentId: string;
title: string;
description: string;
appId: string;
selfStatus: string;
platforms: string[];
categories: object[];
cover: object;
squareIcon: object;
screenshots: object[];
hasActiveReview: boolean;
createdAt: string;
}>;
meta: {
pagination: {
page: number;
pageSize: number;
pageCount: number;
total: number;
}
}
}
Example
// Get all games
const games = await gamesApi.getDeveloperGames({
page: 1,
pageSize: 25,
sort: "createdAt:desc",
});
console.log("Total games:", games.data.meta.pagination.total);
console.log("\n📱 Your Games:");
games.data.data.forEach((game, index) => {
console.log(`${index + 1}. ${game.title}`);
console.log(` Status: ${game.selfStatus}`);
console.log(` Platforms: ${game.platforms.join(", ")}`);
console.log(` Created: ${new Date(game.createdAt).toLocaleDateString()}`);
});
// Get only published games
const published = await gamesApi.getDeveloperGames({
selfStatus: "published",
page: 1,
pageSize: 50,
});
console.log("\n✓ Published games:", published.data.data.length);
// Get games pending review
const pending = await gamesApi.getDeveloperGames({
selfStatus: "pending_review",
page: 1,
pageSize: 50,
});
console.log("⏳ Pending review:", pending.data.data.length);
Sort Options
| Sort String | Description |
|---|---|
| createdAt:desc | Newest first (default) |
| createdAt:asc | Oldest first |
| updatedAt:desc | Recently updated first |
| title:asc | Alphabetical A-Z |
| title:desc | Alphabetical Z-A |
Response Codes
| Code | Description |
|---|---|
| 200 | Games retrieved |
| 401 | Unauthorized |
Create Game Version
Submit a new version of an existing game for review. Automatically increments version number.
Endpoint
POST /games/:gameId/versions
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| gameId | string | Yes | The unique game identifier (documentId) |
Request Body
{
versionString: string; // Required: Version string (e.g., '1.2.0')
releaseNotes: string; // Required: What changed in this version
gameFileId?: string; // New game file ID
coverImageId?: string; // Updated cover image ID
iconImageId?: string; // Updated icon image ID
screenshotIds?: string[]; // Updated screenshot IDs
}
Response
{
id: number;
documentId: string;
versionNumber: number;
versionString: string;
releaseNotes: string;
selfStatus: string; // 'pending_review'
submittedAt: string;
createdAt: string;
}
Example
const newVersion = await gamesApi.createGameVersion({
gameId: "game_abc123",
body: {
versionString: "1.2.0",
releaseNotes: `
New Features:
- Added 20 new levels
- Multiplayer mode
- New power-ups
Bug Fixes:
- Fixed collision detection
- Improved performance
- UI improvements
`,
gameFileId: "file_v1_2_0",
},
});
console.log("✓ Version created:", newVersion.data.versionString);
console.log("Version number:", newVersion.data.versionNumber);
console.log("Status:", newVersion.data.selfStatus);
Response Codes
| Code | Description |
|---|---|
| 201 | Version created successfully |
| 400 | Invalid version data |
| 401 | Unauthorized |
| 403 | Access denied to this game |
| 404 | Game does not exist |
Get Game Versions
Retrieve a paginated list of all versions for a specific game, sorted by version number.
Endpoint
GET /games/:gameId/versions
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| gameId | string | Yes | The unique game identifier (documentId) |
| page | number | No | Page number (default: 1) |
| pageSize | number | No | Items per page (default: 25) |
| sort | string | No | Sort order (default: 'versionNumber:desc') |
Response
{
data: Array<{
id: number;
documentId: string;
versionNumber: number;
versionString: string;
releaseNotes: string;
selfStatus: string;
submittedAt: string;
approvedAt: string | null;
publishedAt: string | null;
rejectedAt: string | null;
rejectionReason: string | null;
createdAt: string;
}>;
meta: {
pagination: {
page: number;
pageSize: number;
pageCount: number;
total: number;
}
}
}
Example
const versions = await gamesApi.getGameVersions({
gameId: "game_abc123",
page: 1,
pageSize: 50,
sort: "versionNumber:desc",
});
console.log("📋 Version History:");
console.log("Total versions:", versions.data.meta.pagination.total);
versions.data.data.forEach((version) => {
console.log(`\nv${version.versionString} (Version ${version.versionNumber})`);
console.log(`Status: ${version.selfStatus}`);
console.log(
`Submitted: ${new Date(version.submittedAt).toLocaleDateString()}`
);
if (version.publishedAt) {
console.log(
`Published: ${new Date(version.publishedAt).toLocaleDateString()}`
);
}
if (version.rejectionReason) {
console.log(`Rejection: ${version.rejectionReason}`);
}
console.log(`Notes: ${version.releaseNotes.substring(0, 100)}...`);
});
Response Codes
| Code | Description |
|---|---|
| 200 | Versions retrieved |
| 401 | Unauthorized |
| 403 | Access denied to this game |
| 404 | Game does not exist |
Get Game Categories
Retrieve a list of all available game categories for classification. This endpoint is public.
Endpoint
GET /games/categories/list
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | No | Page number (default: 1) |
| pageSize | number | No | Items per page (default: 100) |
Response
{
data: Array<{
id: number;
documentId: string;
name: string;
slug: string;
categoryType: string;
description: string;
icon: string | null;
createdAt: string;
}>;
meta: {
pagination: {
page: number;
pageSize: number;
total: number;
}
}
}
Example
const categories = await gamesApi.getGameCategories({
page: 1,
pageSize: 100,
});
console.log("📁 Available Categories:");
categories.data.data.forEach((category) => {
console.log(`${category.name} (${category.slug})`);
console.log(` ID: ${category.documentId}`);
console.log(` Description: ${category.description}`);
});
// Common categories
const categoryMap = categories.data.data.reduce((map, cat) => {
map[cat.slug] = cat.documentId;
return map;
}, {} as Record<string, string>);
console.log("\nCategory IDs:");
console.log("Puzzle:", categoryMap.puzzle);
console.log("Action:", categoryMap.action);
console.log("Adventure:", categoryMap.adventure);
Common Categories
- Action - Fast-paced action games
- Adventure - Story-driven adventure games
- Puzzle - Brain-teasing puzzle games
- Strategy - Strategic thinking games
- RPG - Role-playing games
- Simulation - Simulation games
- Sports - Sports games
- Racing - Racing games
- Casual - Easy-to-play casual games
- Arcade - Classic arcade-style games
Response Codes
| Code | Description |
|---|---|
| 200 | Categories retrieved |
Complete Example
Here's a complete workflow for creating and managing a game:
import { Configuration, GamesApi } from "@getjar-iap/sdk";
const configuration = new Configuration({
basePath: "https://api.getjar.com",
apiKey: "your-api-key",
});
const gamesApi = new GamesApi(configuration);
async function completeGameWorkflow() {
console.log("🎮 Complete Game Workflow\n");
// 1. Get available categories
const categories = await gamesApi.getGameCategories({
page: 1,
pageSize: 100,
});
console.log("✓ Available categories:", categories.data.data.length);
// Find category IDs we need
const puzzleCategory = categories.data.data.find((c) => c.slug === "puzzle");
const casualCategory = categories.data.data.find((c) => c.slug === "casual");
// 2. Create the game
const game = await gamesApi.createGame({
body: {
title: "Space Puzzle Adventure",
description:
"A challenging space-themed puzzle game with stunning visuals and engaging gameplay",
platforms: ["WEB", "WINDOWS", "MAC"],
categories: [puzzleCategory.documentId, casualCategory.documentId],
gameFileId: "file_main_game_v1",
coverImageId: "img_cover_1920x1080",
iconImageId: "img_icon_512x512",
screenshotIds: [
"img_screenshot_1",
"img_screenshot_2",
"img_screenshot_3",
"img_screenshot_4",
],
},
});
console.log("\n✓ Game created");
console.log("Game ID:", game.data.documentId);
console.log("App ID:", game.data.appId);
console.log("Status:", game.data.selfStatus);
const gameId = game.data.documentId;
// 3. Get game details
const gameDetails = await gamesApi.getGameById({ gameId });
console.log("\n📱 Game Details:");
console.log("Title:", gameDetails.data.title);
console.log("Platforms:", gameDetails.data.platforms.join(", "));
console.log(
"Categories:",
gameDetails.data.categories.map((c) => c.name).join(", ")
);
console.log("Under Review:", gameDetails.data.hasActiveReview);
// 4. Wait for approval (in real scenario)
console.log("\n⏳ Waiting for review approval...");
// 5. After approval, create version 1.1.0
console.log("\n📦 Creating version 1.1.0...");
const version1_1 = await gamesApi.createGameVersion({
gameId,
body: {
versionString: "1.1.0",
releaseNotes: `
New Features:
- Added 15 new challenging levels
- Introduced daily challenges
- New power-up system
- Achievement integration
Improvements:
- Enhanced graphics and animations
- Improved level loading times
- Better touch controls
- UI/UX improvements
Bug Fixes:
- Fixed collision detection issues
- Resolved audio sync problems
- Fixed save game bugs
`,
gameFileId: "file_main_game_v1_1",
},
});
console.log("✓ Version 1.1.0 submitted");
console.log("Version number:", version1_1.data.versionNumber);
// 6. Create version 1.2.0
console.log("\n📦 Creating version 1.2.0...");
const version1_2 = await gamesApi.createGameVersion({
gameId,
body: {
versionString: "1.2.0",
releaseNotes: "Critical bug fixes and performance optimizations",
gameFileId: "file_main_game_v1_2",
},
});
console.log("✓ Version 1.2.0 submitted");
// 7. Get complete version history
const versionHistory = await gamesApi.getGameVersions({
gameId,
page: 1,
pageSize: 50,
sort: "versionNumber:desc",
});
console.log("\n📋 Version History:");
console.log("Total versions:", versionHistory.data.meta.pagination.total);
versionHistory.data.data.forEach((version) => {
console.log(`\nv${version.versionString} (${version.versionNumber})`);
console.log(` Status: ${version.selfStatus}`);
console.log(
` Submitted: ${new Date(version.submittedAt).toLocaleDateString()}`
);
if (version.publishedAt) {
console.log(
` Published: ${new Date(version.publishedAt).toLocaleDateString()}`
);
}
});
// 8. Get all developer games
const allGames = await gamesApi.getDeveloperGames({
page: 1,
pageSize: 50,
});
console.log("\n📊 Developer Statistics:");
console.log("Total games:", allGames.data.meta.pagination.total);
// Count by status
const statusCounts = allGames.data.data.reduce((acc, game) => {
acc[game.selfStatus] = (acc[game.selfStatus] || 0) + 1;
return acc;
}, {} as Record<string, number>);
console.log("\nGames by Status:");
Object.entries(statusCounts).forEach(([status, count]) => {
console.log(` ${status}: ${count}`);
});
return { game, versions: versionHistory };
}
// Run the workflow
completeGameWorkflow()
.then(() => console.log("\n✅ Workflow complete!"))
.catch((error) => console.error("❌ Error:", error));
Game Publishing Workflow
Complete workflow from creation to publishing:
async function publishingWorkflow() {
// Step 1: Create game (automatically submits for review)
const game = await gamesApi.createGame({
body: {
title: "My Awesome Game",
description: "An amazing game experience",
platforms: ["WEB", "WINDOWS"],
categories: ["cat_action", "cat_adventure"],
gameFileId: "file_v1_0",
coverImageId: "img_cover",
iconImageId: "img_icon",
screenshotIds: ["img_ss1", "img_ss2", "img_ss3"],
},
});
console.log("Status:", game.data.selfStatus); // 'pending_review'
// Step 2: Review process (handled by GetJar team)
// Status changes: pending_review → approved → published
// OR: pending_review → rejected
// Step 3: After approval, publish updates
const update = await gamesApi.createGameVersion({
gameId: game.data.documentId,
body: {
versionString: "1.1.0",
releaseNotes: "New features and improvements",
gameFileId: "file_v1_1",
},
});
console.log("Update submitted for review");
// Step 4: Monitor status
const current = await gamesApi.getGameById({
gameId: game.data.documentId,
});
console.log("Current status:", current.data.selfStatus);
console.log("Current version:", current.data.currentVersion?.versionString);
}
Game Dashboard
Build a comprehensive game management dashboard:
async function gameDashboard() {
const games = await gamesApi.getDeveloperGames({
page: 1,
pageSize: 100,
});
const stats = {
total: games.data.meta.pagination.total,
byStatus: {} as Record<string, number>,
byPlatform: {} as Record<string, number>,
recent: [] as any[],
};
// Analyze games
games.data.data.forEach((game) => {
// Count by status
stats.byStatus[game.selfStatus] =
(stats.byStatus[game.selfStatus] || 0) + 1;
// Count by platform
game.platforms?.forEach((platform) => {
stats.byPlatform[platform] = (stats.byPlatform[platform] || 0) + 1;
});
});
// Get recent games
stats.recent = games.data.data
.sort(
(a, b) =>
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)
.slice(0, 5);
console.log("📊 Game Dashboard\n");
console.log("Total Games:", stats.total);
console.log("\n📈 By Status:");
Object.entries(stats.byStatus).forEach(([status, count]) => {
console.log(` ${status}: ${count}`);
});
console.log("\n💻 By Platform:");
Object.entries(stats.byPlatform).forEach(([platform, count]) => {
console.log(` ${platform}: ${count} games`);
});
console.log("\n🕐 Recent Games:");
stats.recent.forEach((game, index) => {
console.log(` ${index + 1}. ${game.title} (${game.selfStatus})`);
console.log(
` Created: ${new Date(game.createdAt).toLocaleDateString()}`
);
});
return stats;
}
Best Practices
Game Submission
-
Complete Metadata: Provide all required information before submission
await createGame({
body: {
title: "Clear, descriptive title",
description: "Detailed description with key features",
platforms: ["WEB", "WINDOWS", "MAC"],
categories: ["cat_puzzle", "cat_casual"],
// Include all media
gameFileId: "file_123",
coverImageId: "img_456",
iconImageId: "img_789",
screenshotIds: ["img_1", "img_2", "img_3", "img_4"],
},
}); -
Quality Screenshots: Include 4-8 high-quality screenshots
- Show actual gameplay
- Highlight key features
- Use diverse scenes
- High resolution (1920x1080 recommended)
-
Clear Release Notes: Write detailed version notes
releaseNotes: `
New Features:
- Feature 1: Description
- Feature 2: Description
Improvements:
- Improvement 1
- Improvement 2
Bug Fixes:
- Fixed issue X
- Resolved problem Y
`;
Version Management
-
Semantic Versioning: Use proper version strings
MAJOR.MINOR.PATCH
1.0.0 - Initial release
1.1.0 - New features
1.1.1 - Bug fixes
2.0.0 - Breaking changes -
Incremental Updates: Submit versions regularly
// Good: Regular small updates
v1.0.0 - Initial release
v1.1.0 - New levels
v1.2.0 - Multiplayer
v1.2.1 - Bug fixes
// Avoid: Infrequent massive updates
v1.0.0 - Initial release
v2.0.0 - Everything new (months later) -
Test Before Submission: Always test thoroughly
// Test checklist:
// ✓ Game loads correctly
// ✓ All features work
// ✓ No critical bugs
// ✓ Performance is good
// ✓ Works on all target platforms
Platform Support
-
Start Small: Begin with fewer platforms
// Initial release
platforms: ["WEB"];
// Later versions
platforms: ["WEB", "WINDOWS", "MAC"]; -
Platform-Specific Testing: Test each platform separately
// Test on actual devices/OS when possible
// Verify controls work correctly
// Check performance on target hardware -
Cross-Platform Saves: Implement if supporting multiple platforms
// Use UserApps API to sync progress across platforms
await userAppsApi.updateAppProgress({
userId,
appId,
updateAppProgressRequest: {
level: 10,
experience: 5000,
// Syncs across all platforms
},
});
Media Assets
-
Optimize Images: Keep file sizes reasonable
- Cover: 1920x1080, under 500KB
- Icon: 512x512, under 100KB
- Screenshots: 1920x1080, under 300KB each
-
Consistent Branding: Use consistent visual style
- Same color scheme
- Matching art style
- Professional quality
-
Update Media: Keep screenshots current
// Update screenshots when game changes significantly
await updateGame({
gameId,
body: {
screenshotIds: ["new_img_1", "new_img_2", "new_img_3", "new_img_4"],
},
});
Common Patterns
Multi-Platform Game
async function createMultiPlatformGame() {
const game = await gamesApi.createGame({
body: {
title: "Universal Game",
description: "Plays everywhere!",
platforms: ["WEB", "WINDOWS", "MAC", "LINUX", "IOS", "ANDROID"],
categories: ["cat_casual"],
gameFileId: "file_universal",
coverImageId: "img_cover",
iconImageId: "img_icon",
screenshotIds: [
"img_web_gameplay",
"img_desktop_gameplay",
"img_mobile_gameplay",
"img_features",
],
},
});
console.log("✓ Multi-platform game created");
console.log("Platforms:", game.data.platforms.join(", "));
}
Game Update Cadence
async function regularUpdates(gameId: string) {
// Monthly update schedule
const updates = [
{
version: "1.1.0",
notes: "Month 1: New levels and features",
file: "file_v1_1",
},
{
version: "1.2.0",
notes: "Month 2: Community requested features",
file: "file_v1_2",
},
{
version: "1.3.0",
notes: "Month 3: Performance improvements",
file: "file_v1_3",
},
];
for (const update of updates) {
await gamesApi.createGameVersion({
gameId,
body: {
versionString: update.version,
releaseNotes: update.notes,
gameFileId: update.file,
},
});
console.log(`✓ Version ${update.version} submitted`);
// Wait for approval before next update
// In real scenario, this would be event-driven
}
}
Game Portfolio Management
async function managePortfolio() {
// Get all games grouped by status
const allGames = await gamesApi.getDeveloperGames({
page: 1,
pageSize: 100,
});
const portfolio = {
published: [] as any[],
inReview: [] as any[],
draft: [] as any[],
rejected: [] as any[],
};
allGames.data.data.forEach((game) => {
if (game.selfStatus === "published") {
portfolio.published.push(game);
} else if (
game.selfStatus === "pending_review" ||
game.selfStatus === "approved"
) {
portfolio.inReview.push(game);
} else if (game.selfStatus === "draft") {
portfolio.draft.push(game);
} else if (game.selfStatus === "rejected") {
portfolio.rejected.push(game);
}
});
console.log("📊 Game Portfolio:");
console.log("Published:", portfolio.published.length);
console.log("In Review:", portfolio.inReview.length);
console.log("Draft:", portfolio.draft.length);
console.log("Rejected:", portfolio.rejected.length);
return portfolio;
}
Error Handling
async function safeGameOperation() {
try {
const game = await gamesApi.createGame({
body: {
title: "My Game",
description: "A great game",
platforms: ["WEB"],
categories: ["cat_puzzle"],
},
});
return {
success: true,
data: game.data,
};
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 400:
console.error("Invalid game data:", error.response.data.message);
// Check required fields
break;
case 401:
console.error("Authentication required");
// Refresh token or re-authenticate
break;
case 403:
console.error("Access denied to this resource");
// Check permissions
break;
case 404:
console.error("Game not found");
// Game may have been deleted
break;
default:
console.error("Unexpected error:", error.response.status);
}
} else {
console.error("Network error:", error.message);
}
return {
success: false,
error: error.message,
};
}
}
Support
For additional help or questions:
- Documentation: https://docs.getjar.com
- API Reference: https://sdk.getjar.com/api/docs
- Support: support@getjar.com