UNPKG

@capgo/cli

Version:
51 lines (50 loc) 2.22 kB
/** * A Play Store app record as returned by `apps:search`. Used by the Android * app-verification step to check whether an app exists whose `packageName` * matches the project's Gradle `applicationId`. */ export interface PlayApp { packageName: string; displayName: string; } /** * Parse an `apps:search` response into {@link PlayApp} records. Tolerant of a * missing `apps` array and of individual apps missing `displayName` — Google * omits fields rather than nulling them, and a malformed page must never throw * into the wizard (the whole feature degrades gracefully). * * Entries missing `packageName` are DROPPED: the package is the join key for * reconciliation, and letting an empty one through could spuriously * "exact-match" a project whose Gradle parse found no applicationId. The API * documents `packageName` as always present, so this only guards malformed * pages. */ export declare function parseAppsSearchResponse(json: any): PlayApp[]; /** * Carries the HTTP status alongside the message so callers can distinguish a * 403 (scope not granted / Reporting API disabled → graceful degrade to the * plain Gradle picker) from other failures. */ export declare class ReportingApiHttpError extends Error { readonly status: number; constructor(status: number, message: string); } /** Injectable fetch — defaults to the global `fetch`, overridable in tests. */ export type FetchImpl = typeof fetch; export interface ListPlayAppsOptions { /** * Override the global `fetch`. Tests inject a stub returning a Response-like * object; production omits this and uses `globalThis.fetch`. */ fetchImpl?: FetchImpl; } /** * List every Play Store app accessible to the signed-in user, following * pagination. Authenticates with the supplied user OAuth access token (must * carry the `playdeveloperreporting` scope). * * `GET …/v1beta1/apps:search?pageSize=1000`, following `nextPageToken` up to * {@link MAX_LIST_PAGES}. Throws {@link ReportingApiHttpError} on a non-OK * response so callers can branch on `.status` (e.g. 403 → degrade). */ export declare function listPlayApps(accessToken: string, opts?: ListPlayAppsOptions): Promise<PlayApp[]>;