비트맵 ESD 애플리케이션은 웹과 API를 연동하여 입점된 게임의 정보를 가져옵니다. 해당 기능의 API 구조는 다음과 같습니다.
interface stringLocalized {
en: string;
ko: string;
}
/**
* Bitmap 스토어에 노출되는 게임의 세부 내용
* @param gameId 게임의 고유 ID
* @param uid 게임 게시자의 UID
* @param gameTitle 게임 제목
* @param gameLatestRevision 게임의 최신 버전
* @param gamePlatformWindows Windows 지원 여부
* @param gamePlatformMac macOS 지원 여부
* @param gamePlatformMobile 모바일 지원 여부
* @param gameEngine 게임 엔진
* @param gameGenre 게임의 장르
* @param gameDeveloper 게임 개발사 이름
* @param gamePublisher 게임 배급사 이름
* @param isEarlyAccess 얼리 액세스 여부
* @param isReleased 출시 여부. true일 때 앱에서 게임을 다운로드할 수 있음
* @param gameReleasedDate 게임 출시일
* @param gameReleasedDate ISO 8601 형식의 게임 출시일 문자열
* @param gameWebsite 게임의 공식 웹사이트
* @param gameVideoURL 게임 트레일러의 YouTube 영상 ID
* @param gameDownloadMacURL macOS 게임 아카이브 링크
* @param gameDownloadWinURL Windows 게임 아카이브 링크
* @param gameImageURL 게임 미리보기 이미지 URL
* @param gameHeadline 게임 한 줄 소개
* @param gameDescription 게임 살세 설명 (마크다운)
*/
interface Game {
gameId: number;
isApproved: boolean;
uid: string;
gameTitle: string;
gameLatestRevision: number;
gamePlatformWindows: number;
gamePlatformMac: number;
gamePlatformMobile: number;
gameEngine: string;
gameGenre: stringLocalized;
gameDeveloper: string;
gamePublisher: string;
isEarlyAccess: number;
isReleased: number;
gameReleasedDate: string;
gameWebsite: string;
gameVideoURL: string;
gameDownloadMacURL: string | null;
gameDownloadWinURL: string | null;
gameImageURL: string[];
gameBinaryName: string;
gameHeadline: stringLocalized;
gameDescription: stringLocalized;
}
interface GameListInternal extends Pick<
Game,
| "gameId"
| "gameTitle"
| "gameImageURL"
| "gameDeveloper"
| "gamePublisher"
| "gameGenre"
| "gameReleasedDate"
| "isApproved"
| "isEarlyAccess"
> {}
gameImageURL 배열은 다음과 같은 규칙을 가집니다. 일부 뷰어에서 배열의 인덱스가 해당 조건을 만족하지 않으면 0번째 인덱스의 사진을 falloff로 표시할 수 있습니다.
gameImageURL[0]: 게임의 포스터 (1:1.414 비율 권장)gameImageURL[1]: 게임의 리스트 이미지 (16:9 비율)gameImageURL[2]: 게임의 아이콘 (1:1 정방형)gameImageURL[3] ~ : 게임의 미리보기 이미지 (16:9 비율)/games/list GETinterface GameListInternal 오브젝트를 배열로 반환합니다.page 쿼리를 통해 8개씩 페이지네이션된 오브젝트 배열을 반환합니다./games/pick/:id GETgameId가 일치하는 게임 정보에 대해 interface Game 오브젝트를 반환합니다./games/caidx/:gameId GETgameId가 일치하는 게임의 게임 버전 식별자를 다운로드합니다. Bitmap ID의 JWT 토큰이 필요하며, platform 쿼리 및 version 쿼리를 요구합니다.platform: 게임 플랫폼 (windows|macos)version: 게임 버전 (임의 버전 및 latest)/games/caidx/:gameId/list GETgameId가 일치하는 게임의 모든 게임 버전 식별자 파일 이름을 조회합니다. Bitmap ID의 JWT 토큰이 필요합니다./games/submit POSTAuthorization: Bearer {JWT}
TypeScript를 사용한 예시는 다음과 같습니다.
import axios from "axios";
import type { Game } from "./types";
async function submitGame(gameInfo: Game, token: string): Promise<boolean> {
try {
// API 호출
const response = await axios.post(
getApiLinkByPurpose("games/submit"),
gameInfo,
{
timeout: 30000, // 30초 타임아웃
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`
},
}
);
console.log("Submit succeed:", response.data);
// 성공 알림
return true;
} catch (error) {
console.error("대기 중인 게임 데이터를 가져오는 중 오류 발생:", error);
return false;
}
}
/games/edit POSTAuthorization: Bearer {JWT}
TypeScript를 사용한 예시는 다음과 같습니다.
import axios from "axios";
import type { Game } from "./types";
async function editGame(gameInfo: Game, token: string): Promise<boolean> {
try {
// API 호출
const response = await axios.post(
getApiLinkByPurpose("games/edit"),
gameInfo,
{
timeout: 30000, // 30초 타임아웃
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`
},
}
);
console.log("Submit succeed:", response.data);
// 성공 알림
return true;
} catch (error) {
console.error("대기 중인 게임 데이터를 가져오는 중 오류 발생:", error);
return false;
}
}