import { apiRequest } from './http'; import type { ReleasedGame, ReleaseStore, ReleaseSummary } from './ReleaseStore'; export class HttpReleaseStore implements ReleaseStore { constructor(private readonly endpoint: string) {} of(projectId: string): Promise { return apiRequest(this.endpoint, 'GET', route(projectId)); } publish(projectId: string): Promise { return apiRequest(this.endpoint, 'POST', route(projectId)); } takeDown(projectId: string): Promise { return apiRequest(this.endpoint, 'DELETE', route(projectId)); } } /** The one call that needs no sign-in (#266). */ export function loadReleasedGame(endpoint: string, token: string): Promise { return apiRequest(endpoint, 'GET', `releases/${token}`); } function route(projectId: string): string { return `projects/${encodeURIComponent(projectId)}/release`; }