quests: reportProgress on QuestsService + regenerated DTOs
CI / check (push) Successful in 56s

This commit is contained in:
edmand46
2026-08-13 12:10:07 +03:00
parent fd364fd156
commit 25f66be16a
3 changed files with 22 additions and 1 deletions
+7 -1
View File
@@ -7,7 +7,7 @@ import type { GetInventoryResponse } from './inventory.js';
import type { GetRankingResponse, SubmitScoreRequest } from './leaderboards.js'; import type { GetRankingResponse, SubmitScoreRequest } from './leaderboards.js';
import type { PlayerProfile } from './player.js'; import type { PlayerProfile } from './player.js';
import type { GetProjectStorageResponse, UpdateProjectStorageRequest } from './project-storage.js'; import type { GetProjectStorageResponse, UpdateProjectStorageRequest } from './project-storage.js';
import type { ClaimQuestRequest, ClaimQuestResponse, ListQuestsRequest, ListQuestsResponse } from './quests.js'; import type { ClaimQuestRequest, ClaimQuestResponse, ListQuestsRequest, ListQuestsResponse, ReportQuestProgressRequest, ReportQuestProgressResponse } from './quests.js';
import type { ListRemoteConfigsResponse, RemoteConfig } from './remote-config.js'; import type { ListRemoteConfigsResponse, RemoteConfig } from './remote-config.js';
import type { GetScenarioRunRequest, GetScenarioRunResponse, HandleScenarioCallbackRequest, HandleScenarioCallbackResponse, TriggerScenarioRequest, TriggerScenarioResponse, UpdateScenarioCounterRequest, UpdateScenarioCounterResponse } from './scenarios.js'; import type { GetScenarioRunRequest, GetScenarioRunResponse, HandleScenarioCallbackRequest, HandleScenarioCallbackResponse, TriggerScenarioRequest, TriggerScenarioResponse, UpdateScenarioCounterRequest, UpdateScenarioCounterResponse } from './scenarios.js';
import type { GetStorageResponse, UpdateStorageRequest } from './storage.js'; import type { GetStorageResponse, UpdateStorageRequest } from './storage.js';
@@ -201,6 +201,12 @@ export const api = {
): Promise<RefreshAccessTokenResponse> => ): Promise<RefreshAccessTokenResponse> =>
t.request<RefreshAccessTokenResponse>('POST', '/sdk/v1/authorization/refresh', body), t.request<RefreshAccessTokenResponse>('POST', '/sdk/v1/authorization/refresh', body),
reportQuestProgress: (
t: Transport,
body: ReportQuestProgressRequest,
): Promise<ReportQuestProgressResponse> =>
t.request<ReportQuestProgressResponse>('POST', '/sdk/v1/quests/progress', body),
submitScore: ( submitScore: (
t: Transport, t: Transport,
path: { slug: string }, path: { slug: string },
+9
View File
@@ -40,3 +40,12 @@ export interface QuestReward {
"itemId"?: string; "itemId"?: string;
} }
export interface ReportQuestProgressRequest {
"amount"?: number;
"metric"?: string;
}
export interface ReportQuestProgressResponse {
"completedQuestIds"?: string[];
}
+6
View File
@@ -23,4 +23,10 @@ export class QuestsService {
claim(questId: string): Promise<ClaimQuestResponse> { claim(questId: string): Promise<ClaimQuestResponse> {
return api.claimQuest(this.ctx, { questId }); return api.claimQuest(this.ctx, { questId });
} }
/** Reports metric progress; returns ids of quests completed by this report. */
async reportProgress(metric: string, amount: number): Promise<string[]> {
const response = await api.reportQuestProgress(this.ctx, { metric, amount });
return response.completedQuestIds ?? [];
}
} }