2026-08-12 14:02:25 +03:00
|
|
|
// Code generated by apigen. DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
import type { LoginViaDeviceRequest, LoginViaDeviceResponse, RefreshAccessTokenRequest, RefreshAccessTokenResponse } from './auth.js';
|
|
|
|
|
import type { AddBattlePassXpRequest, AddBattlePassXpResponse, ClaimBattlePassRewardRequest, ClaimBattlePassRewardResponse, GetBattlePassProgressRequest, GetBattlePassProgressResponse, PurchaseBattlePassPremiumRequest, PurchaseBattlePassPremiumResponse } from './battlepass.js';
|
|
|
|
|
import type { ListCatalogItemsResponse } from './catalog.js';
|
|
|
|
|
import type { GetInventoryResponse } from './inventory.js';
|
|
|
|
|
import type { GetRankingResponse, SubmitScoreRequest } from './leaderboards.js';
|
|
|
|
|
import type { PlayerProfile } from './player.js';
|
2026-08-12 23:58:30 +03:00
|
|
|
import type { GetProjectStorageResponse, UpdateProjectStorageRequest } from './project-storage.js';
|
2026-08-12 14:02:25 +03:00
|
|
|
import type { ClaimQuestRequest, ClaimQuestResponse, ListQuestsRequest, ListQuestsResponse } from './quests.js';
|
|
|
|
|
import type { ListRemoteConfigsResponse, RemoteConfig } from './remote-config.js';
|
|
|
|
|
import type { GetScenarioRunRequest, GetScenarioRunResponse, HandleScenarioCallbackRequest, HandleScenarioCallbackResponse, TriggerScenarioRequest, TriggerScenarioResponse, UpdateScenarioCounterRequest, UpdateScenarioCounterResponse } from './scenarios.js';
|
|
|
|
|
import type { GetStorageResponse, UpdateStorageRequest } from './storage.js';
|
|
|
|
|
import type { ListStoresResponse, PurchaseOfferRequest, PurchaseOfferResponse, Store } from './stores.js';
|
|
|
|
|
import type { DeleteUgcResponse, GetDownloadUrlResponse, GetUploadUrlResponse, ListUgcResponse, SubmitUgcRequest, UgcSubmission } from './ugc.js';
|
|
|
|
|
|
|
|
|
|
/** The minimal transport contract the generated API functions call through. */
|
|
|
|
|
export interface Transport {
|
|
|
|
|
request<TResponse>(method: string, path: string, body?: unknown): Promise<TResponse>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function enc(value: string | number): string {
|
|
|
|
|
return encodeURIComponent(String(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function qs(
|
|
|
|
|
params: Array<[string, string | number | boolean | null | undefined]>,
|
|
|
|
|
): string {
|
|
|
|
|
const parts: string[] = [];
|
|
|
|
|
for (const [key, value] of params) {
|
|
|
|
|
if (value !== null && value !== undefined && value !== '') {
|
|
|
|
|
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return parts.length === 0 ? '' : `?${parts.join('&')}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Typed request functions, one per SDK operation. */
|
|
|
|
|
export const api = {
|
|
|
|
|
addBattlePassXp: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: AddBattlePassXpRequest,
|
|
|
|
|
): Promise<AddBattlePassXpResponse> =>
|
|
|
|
|
t.request<AddBattlePassXpResponse>('POST', '/sdk/v1/battlepass/xp', body),
|
|
|
|
|
|
|
|
|
|
claimBattlePassReward: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: ClaimBattlePassRewardRequest,
|
|
|
|
|
): Promise<ClaimBattlePassRewardResponse> =>
|
|
|
|
|
t.request<ClaimBattlePassRewardResponse>('POST', '/sdk/v1/battlepass/claim', body),
|
|
|
|
|
|
|
|
|
|
claimQuest: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: ClaimQuestRequest,
|
|
|
|
|
): Promise<ClaimQuestResponse> =>
|
|
|
|
|
t.request<ClaimQuestResponse>('POST', '/sdk/v1/quests/claim', body),
|
|
|
|
|
|
|
|
|
|
deleteStorage: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
query?: { type?: string },
|
|
|
|
|
): Promise<void> =>
|
|
|
|
|
t.request<void>('DELETE', `/sdk/v1/storage${qs([['type', query?.type]])}`),
|
|
|
|
|
|
|
|
|
|
deleteUgc: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { id: string },
|
|
|
|
|
): Promise<DeleteUgcResponse> =>
|
|
|
|
|
t.request<DeleteUgcResponse>('DELETE', `/sdk/v1/ugc/${enc(path.id)}`),
|
|
|
|
|
|
|
|
|
|
getBattlePassProgress: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: GetBattlePassProgressRequest,
|
|
|
|
|
): Promise<GetBattlePassProgressResponse> =>
|
|
|
|
|
t.request<GetBattlePassProgressResponse>('POST', '/sdk/v1/battlepass/progress', body),
|
|
|
|
|
|
|
|
|
|
getDownloadUrl: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { id: string },
|
|
|
|
|
): Promise<GetDownloadUrlResponse> =>
|
|
|
|
|
t.request<GetDownloadUrlResponse>('GET', `/sdk/v1/ugc/${enc(path.id)}/download`),
|
|
|
|
|
|
|
|
|
|
getInventory: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<GetInventoryResponse> =>
|
|
|
|
|
t.request<GetInventoryResponse>('GET', '/sdk/v1/inventory'),
|
|
|
|
|
|
|
|
|
|
getPlayerInformation: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<PlayerProfile> =>
|
|
|
|
|
t.request<PlayerProfile>('GET', '/sdk/v1/player/information'),
|
|
|
|
|
|
2026-08-12 23:58:30 +03:00
|
|
|
getProjectStorage: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
query?: { types?: string; limit?: number; cursor?: string },
|
|
|
|
|
): Promise<GetProjectStorageResponse> =>
|
|
|
|
|
t.request<GetProjectStorageResponse>('GET', `/sdk/v1/project-storage${qs([['types', query?.types], ['limit', query?.limit], ['cursor', query?.cursor]])}`),
|
|
|
|
|
|
2026-08-12 14:02:25 +03:00
|
|
|
getRanking: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { slug: string },
|
|
|
|
|
query?: { limit?: number },
|
|
|
|
|
): Promise<GetRankingResponse> =>
|
|
|
|
|
t.request<GetRankingResponse>('GET', `/sdk/v1/leaderboards/${enc(path.slug)}/ranking${qs([['limit', query?.limit]])}`),
|
|
|
|
|
|
|
|
|
|
getRemoteConfig: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { key: string },
|
|
|
|
|
): Promise<RemoteConfig> =>
|
|
|
|
|
t.request<RemoteConfig>('GET', `/sdk/v1/remote-configs/${enc(path.key)}`),
|
|
|
|
|
|
|
|
|
|
getRevisions: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<{ [key: string]: number }> =>
|
|
|
|
|
t.request<{ [key: string]: number }>('GET', '/sdk/v1/sync'),
|
|
|
|
|
|
|
|
|
|
getScenarioRun: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: GetScenarioRunRequest,
|
|
|
|
|
): Promise<GetScenarioRunResponse> =>
|
|
|
|
|
t.request<GetScenarioRunResponse>('POST', '/sdk/v1/scenarios/run', body),
|
|
|
|
|
|
|
|
|
|
getStorage: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
query?: { types?: string; limit?: number; cursor?: string },
|
|
|
|
|
): Promise<GetStorageResponse> =>
|
|
|
|
|
t.request<GetStorageResponse>('GET', `/sdk/v1/storage${qs([['types', query?.types], ['limit', query?.limit], ['cursor', query?.cursor]])}`),
|
|
|
|
|
|
|
|
|
|
getStore: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { slug: string },
|
|
|
|
|
): Promise<Store> =>
|
|
|
|
|
t.request<Store>('GET', `/sdk/v1/stores/${enc(path.slug)}`),
|
|
|
|
|
|
|
|
|
|
getUgc: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { id: string },
|
|
|
|
|
): Promise<UgcSubmission> =>
|
|
|
|
|
t.request<UgcSubmission>('GET', `/sdk/v1/ugc/${enc(path.id)}`),
|
|
|
|
|
|
|
|
|
|
getUploadUrl: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
query?: { filename?: string },
|
|
|
|
|
): Promise<GetUploadUrlResponse> =>
|
|
|
|
|
t.request<GetUploadUrlResponse>('GET', `/sdk/v1/ugc/upload-url${qs([['filename', query?.filename]])}`),
|
|
|
|
|
|
|
|
|
|
handleScenarioCallback: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: HandleScenarioCallbackRequest,
|
|
|
|
|
): Promise<HandleScenarioCallbackResponse> =>
|
|
|
|
|
t.request<HandleScenarioCallbackResponse>('POST', '/sdk/v1/scenarios/callback', body),
|
|
|
|
|
|
|
|
|
|
listCatalogItems: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<ListCatalogItemsResponse> =>
|
|
|
|
|
t.request<ListCatalogItemsResponse>('GET', '/sdk/v1/catalog'),
|
|
|
|
|
|
|
|
|
|
listQuests: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: ListQuestsRequest,
|
|
|
|
|
): Promise<ListQuestsResponse> =>
|
|
|
|
|
t.request<ListQuestsResponse>('POST', '/sdk/v1/quests/list', body),
|
|
|
|
|
|
|
|
|
|
listSdkRemoteConfigs: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<ListRemoteConfigsResponse> =>
|
|
|
|
|
t.request<ListRemoteConfigsResponse>('GET', '/sdk/v1/remote-configs'),
|
|
|
|
|
|
|
|
|
|
listSdkStores: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
): Promise<ListStoresResponse> =>
|
|
|
|
|
t.request<ListStoresResponse>('GET', '/sdk/v1/stores'),
|
|
|
|
|
|
|
|
|
|
listUgc: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
query?: { status?: string; limit?: number; cursor?: string },
|
|
|
|
|
): Promise<ListUgcResponse> =>
|
|
|
|
|
t.request<ListUgcResponse>('GET', `/sdk/v1/ugc${qs([['status', query?.status], ['limit', query?.limit], ['cursor', query?.cursor]])}`),
|
|
|
|
|
|
|
|
|
|
loginViaDevice: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: LoginViaDeviceRequest,
|
|
|
|
|
): Promise<LoginViaDeviceResponse> =>
|
|
|
|
|
t.request<LoginViaDeviceResponse>('POST', '/sdk/v1/authorization/device', body),
|
|
|
|
|
|
|
|
|
|
purchaseBattlePassPremium: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: PurchaseBattlePassPremiumRequest,
|
|
|
|
|
): Promise<PurchaseBattlePassPremiumResponse> =>
|
|
|
|
|
t.request<PurchaseBattlePassPremiumResponse>('POST', '/sdk/v1/battlepass/premium', body),
|
|
|
|
|
|
|
|
|
|
purchaseOffer: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { storeSlug: string; offerId: string },
|
|
|
|
|
body: PurchaseOfferRequest,
|
|
|
|
|
): Promise<PurchaseOfferResponse> =>
|
|
|
|
|
t.request<PurchaseOfferResponse>('POST', `/sdk/v1/stores/${enc(path.storeSlug)}/offers/${enc(path.offerId)}/purchase`, body),
|
|
|
|
|
|
|
|
|
|
refreshAccessToken: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: RefreshAccessTokenRequest,
|
|
|
|
|
): Promise<RefreshAccessTokenResponse> =>
|
|
|
|
|
t.request<RefreshAccessTokenResponse>('POST', '/sdk/v1/authorization/refresh', body),
|
|
|
|
|
|
|
|
|
|
submitScore: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
path: { slug: string },
|
|
|
|
|
body: SubmitScoreRequest,
|
|
|
|
|
): Promise<void> =>
|
|
|
|
|
t.request<void>('POST', `/sdk/v1/leaderboards/${enc(path.slug)}/submit-score`, body),
|
|
|
|
|
|
|
|
|
|
submitUgc: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: SubmitUgcRequest,
|
|
|
|
|
): Promise<UgcSubmission> =>
|
|
|
|
|
t.request<UgcSubmission>('POST', '/sdk/v1/ugc', body),
|
|
|
|
|
|
|
|
|
|
triggerScenario: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: TriggerScenarioRequest,
|
|
|
|
|
): Promise<TriggerScenarioResponse> =>
|
|
|
|
|
t.request<TriggerScenarioResponse>('POST', '/sdk/v1/scenarios/trigger', body),
|
|
|
|
|
|
2026-08-12 23:58:30 +03:00
|
|
|
updateProjectStorage: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: UpdateProjectStorageRequest,
|
|
|
|
|
): Promise<void> =>
|
|
|
|
|
t.request<void>('PUT', '/sdk/v1/project-storage', body),
|
|
|
|
|
|
2026-08-12 14:02:25 +03:00
|
|
|
updateScenarioCounter: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: UpdateScenarioCounterRequest,
|
|
|
|
|
): Promise<UpdateScenarioCounterResponse> =>
|
|
|
|
|
t.request<UpdateScenarioCounterResponse>('POST', '/sdk/v1/scenarios/counter', body),
|
|
|
|
|
|
|
|
|
|
updateStorage: (
|
|
|
|
|
t: Transport,
|
|
|
|
|
body: UpdateStorageRequest,
|
|
|
|
|
): Promise<void> =>
|
|
|
|
|
t.request<void>('PUT', '/sdk/v1/storage', body),
|
|
|
|
|
|
|
|
|
|
};
|