Merge api-coverage: storebound api, every App Store Connect and Play endpoint
# Conflicts: # .cursor/rules/storebound.mdc # .github/copilot-instructions.md # AGENTS.md # CHANGELOG.md # GEMINI.md # README.md # cli/index.ts # cli/serve.ts # tools/gen-adapters.ts
This commit is contained in:
commit
8988a2144f
30 changed files with 281170 additions and 12 deletions
174
cli/api.ts
Normal file
174
cli/api.ts
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
// storebound api: every App Store Connect and Google Play Developer API operation, from the pinned specs.
|
||||
//
|
||||
// storebound api list [--store apple|play] [--search text] [--json]
|
||||
// storebound api coverage [--store apple|play] [--json]
|
||||
// storebound api apple|play <operationId | METHOD path> [--param k=v ...] [--body file.json] [--upload file]
|
||||
// [--out file] [--all-pages] [--json] [--dry] [--yes]
|
||||
// storebound api get apple|play <operationId> ... GET only (what the MCP tool api_get runs)
|
||||
//
|
||||
// GETs run right away. Writes print the exact request and are only sent with --yes in an interactive terminal;
|
||||
// owner-only operations (submit, release, delete, cancel, prices, testers, review replies, experiments: cli/api/gate.ts)
|
||||
// also need the operation id typed at the prompt. Under MCP or the desktop app no write is ever sent.
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import type { Args } from './lib/args';
|
||||
import { allOps, authFor, type BuiltRequest, buildRequest, resolveOp, send, sendAll } from './api/client';
|
||||
import { decide, gateOf, ownerReason, resourceOf, type GateKind, type Store } from './api/gate';
|
||||
import { APPLE_SPEC } from './api/apple.gen';
|
||||
import { PLAY_APIS } from './api/play.gen';
|
||||
import { WRAPPED } from './api/wrapped.gen';
|
||||
import type { ParamValue } from './api/types';
|
||||
|
||||
const STORES: Store[] = ['apple', 'play'];
|
||||
|
||||
export const USAGE = `usage:
|
||||
storebound api list [--store apple|play] [--search text] [--json]
|
||||
storebound api coverage [--store apple|play] [--json]
|
||||
storebound api apple|play <operationId | METHOD path> [--param k=v ...] [--body file.json] [--upload file]
|
||||
[--out file] [--all-pages] [--json] [--dry] [--yes]
|
||||
storebound api get apple|play <operationId> [--param k=v ...] [--all-pages] [--json] (GET only)
|
||||
|
||||
GETs run right away. Writes print the exact request and are sent only with --yes in a terminal; owner-only
|
||||
operations (submit, release, delete, cancel, prices, testers, review replies, experiments) also ask you to type the
|
||||
operation id. Full table: docs/api-coverage.md`;
|
||||
|
||||
export interface Row { store: Store; id: string; method: string; path: string; gate: GateKind; wrapped: string }
|
||||
|
||||
export function rows(store?: Store): Row[] {
|
||||
return (store ? [store] : STORES).flatMap(s => allOps(s).map(o => ({
|
||||
store: s, id: o.id, method: o.method, path: o.path, gate: gateOf(s, o.id, o.method), wrapped: WRAPPED[s][o.id] ?? '',
|
||||
})));
|
||||
}
|
||||
|
||||
export function search(list: Row[], text: string): Row[] {
|
||||
const words = text.toLowerCase().split(/\s+/).filter(Boolean);
|
||||
return list.filter(r => words.every(w => `${r.id} ${r.method} ${r.path}`.toLowerCase().includes(w)));
|
||||
}
|
||||
|
||||
export interface Coverage {
|
||||
apis: { api: string; title: string; operations: number; get: number; write: number; owner: number; wrapped: number }[];
|
||||
resources: { store: Store; resource: string; operations: number; wrapped: number }[];
|
||||
}
|
||||
|
||||
export function coverage(store?: Store): Coverage {
|
||||
const list = rows(store);
|
||||
const groups: [string, string, Row[]][] = [];
|
||||
if (!store || store === 'apple') groups.push(['appstoreconnect', `${APPLE_SPEC.title} ${APPLE_SPEC.version}`, list.filter(r => r.store === 'apple')]);
|
||||
if (!store || store === 'play') for (const [name, a] of Object.entries(PLAY_APIS)) groups.push([name, `${a.title} (${a.revision})`, list.filter(r => r.store === 'play' && r.id.startsWith(name + '.'))]);
|
||||
const res = new Map<string, { store: Store; resource: string; operations: number; wrapped: number }>();
|
||||
for (const r of list) {
|
||||
const k = `${r.store} ${resourceOf(r)}`;
|
||||
const cur = res.get(k) ?? { store: r.store, resource: resourceOf(r), operations: 0, wrapped: 0 };
|
||||
cur.operations++;
|
||||
if (r.wrapped) cur.wrapped++;
|
||||
res.set(k, cur);
|
||||
}
|
||||
return {
|
||||
apis: groups.map(([api, title, rs]) => ({ api, title, operations: rs.length, get: rs.filter(r => r.method === 'GET').length,
|
||||
write: rs.filter(r => r.gate === 'write').length, owner: rs.filter(r => r.gate === 'owner').length, wrapped: rs.filter(r => r.wrapped).length })),
|
||||
resources: [...res.values()],
|
||||
};
|
||||
}
|
||||
|
||||
/** --param k=v (repeatable; a repeated name becomes a list). */
|
||||
export function parseParams(values: string[]): Record<string, ParamValue> {
|
||||
const out: Record<string, ParamValue> = {};
|
||||
for (const kv of values) {
|
||||
const eq = kv.indexOf('=');
|
||||
if (eq <= 0) throw new Error(`--param ${kv}: expected name=value`);
|
||||
const k = kv.slice(0, eq), v = kv.slice(eq + 1);
|
||||
const cur = out[k];
|
||||
out[k] = cur === undefined ? v : [...(Array.isArray(cur) ? cur : [String(cur)]), v];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const UPLOAD_TYPES: Record<string, string> = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', apk: 'application/vnd.android.package-archive' };
|
||||
|
||||
/** The exact request as text, the credential replaced by a placeholder. */
|
||||
export function describeRequest(req: BuiltRequest): string {
|
||||
const lines = [`${req.method} ${req.url}`, `Authorization: Bearer <${req.op.store === 'apple' ? 'App Store Connect API key JWT' : 'Google service account token'}, not shown>`];
|
||||
if (req.contentType) lines.push(`Content-Type: ${req.contentType}`);
|
||||
if (typeof req.body === 'string') lines.push('', JSON.stringify(JSON.parse(req.body), null, 2));
|
||||
else if (req.body) lines.push('', `<${req.body.length} bytes of file data>`);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
async function readLine(): Promise<string> {
|
||||
for await (const line of console) return line.trim();
|
||||
return '';
|
||||
}
|
||||
|
||||
export async function run(args: Args): Promise<void> {
|
||||
const [sub, ...rest] = args._;
|
||||
const json = args.has('json');
|
||||
const store = args.get('store') as Store | undefined;
|
||||
if (store && !STORES.includes(store)) throw new Error('--store: apple or play');
|
||||
if (!sub || args.has('help')) { console.log(USAGE); return; }
|
||||
|
||||
if (sub === 'list') {
|
||||
const list = args.get('search') ? search(rows(store), args.get('search')!) : rows(store);
|
||||
if (json) { console.log(JSON.stringify(list)); return; }
|
||||
for (const r of list) console.log(`${r.store.padEnd(5)} ${r.method.padEnd(6)} ${r.id.padEnd(60)} ${r.path}${r.gate === 'owner' ? ' [owner only]' : ''}${r.wrapped ? ` (wrapped: ${r.wrapped})` : ''}`);
|
||||
console.error(`${list.length} operation(s)`);
|
||||
return;
|
||||
}
|
||||
if (sub === 'coverage') {
|
||||
const c = coverage(store);
|
||||
if (json) { console.log(JSON.stringify(c)); return; }
|
||||
for (const a of c.apis) console.log(`${a.title}: ${a.operations} operations (${a.get} GET, ${a.write} write, ${a.owner} owner only), ${a.wrapped} wrapped by storebound commands`);
|
||||
console.log(`\n${'resource'.padEnd(62)} ops wrapped`);
|
||||
for (const r of c.resources) console.log(`${(r.store + ' ' + r.resource).padEnd(62)} ${String(r.operations).padStart(3)} ${String(r.wrapped).padStart(7)}`);
|
||||
const total = c.apis.reduce((n, a) => n + a.operations, 0);
|
||||
console.log(`\n${total} operations, every one callable with storebound api; full table: docs/api-coverage.md`);
|
||||
return;
|
||||
}
|
||||
|
||||
const getOnly = sub === 'get';
|
||||
const st = (getOnly ? rest.shift() : sub) as Store;
|
||||
if (!STORES.includes(st)) { console.error(USAGE); throw new Error(`unknown api subcommand: ${sub}`); }
|
||||
const [ref, maybePath] = rest;
|
||||
if (!ref) throw new Error(`storebound api ${getOnly ? 'get ' : ''}${st} <operationId | METHOD path>`);
|
||||
const { op, params: fromPath } = resolveOp(st, ref, maybePath);
|
||||
const params = { ...fromPath, ...parseParams(args.many('param')) };
|
||||
const body = args.get('body') ? JSON.parse(readFileSync(resolve(args.get('body')!), 'utf8')) as unknown : undefined;
|
||||
const uploadFile = args.get('upload');
|
||||
const upload = uploadFile ? { bytes: new Uint8Array(readFileSync(resolve(uploadFile))), contentType: UPLOAD_TYPES[uploadFile.split('.').pop()!.toLowerCase()] ?? 'application/octet-stream' } : undefined;
|
||||
const out = args.get('out');
|
||||
const req = buildRequest(op, params, body, { upload, download: !!out && op.flags.includes('d') });
|
||||
|
||||
const kind = gateOf(st, op.id, op.method);
|
||||
const decision = decide({
|
||||
kind, method: op.method, dry: args.has('dry'), yes: args.has('yes'), getOnly,
|
||||
tty: !!process.stdin.isTTY && !!process.stdout.isTTY,
|
||||
agent: process.env.STOREBOUND_SERVE === '1' || process.env.STOREBOUND_MCP === '1',
|
||||
});
|
||||
if (decision.action === 'refuse') throw new Error(`${op.id}: ${decision.why}`);
|
||||
if (decision.action === 'dry') {
|
||||
if (json) console.log(JSON.stringify({ dryRun: true, operation: op.id, gate: kind, why: decision.why, request: { method: req.method, url: req.url, body: typeof req.body === 'string' ? JSON.parse(req.body) : req.body ? `<${req.body.length} bytes>` : undefined } }));
|
||||
else console.log(`dry run (${decision.why}): nothing sent\n${kind === 'owner' ? `owner only: this ${ownerReason(st, op.id, op.method)}; sending also asks you to type the operation id\n` : ''}\n${describeRequest(req)}`);
|
||||
return;
|
||||
}
|
||||
if (decision.action === 'confirm') {
|
||||
console.log(describeRequest(req));
|
||||
process.stdout.write(`\nThis ${ownerReason(st, op.id, op.method)}. Type the operation id (${op.id}) to send it: `);
|
||||
if ((await readLine()) !== op.id) { console.log('not sent'); process.exitCode = 1; return; }
|
||||
}
|
||||
|
||||
const root = process.env.STOREBOUND_PROJECT || process.cwd();
|
||||
const auth = await authFor(st, root);
|
||||
const onRetry = (m: string) => console.error(`api: ${m}`);
|
||||
const all = args.has('all-pages');
|
||||
if (all && op.method !== 'GET' && !(op.store === 'play' && /[pt]/.test(op.flags))) throw new Error(`${op.id}: --all-pages is for paged reads`);
|
||||
const r = all ? await sendAll(req, auth, { onRetry, onPage: n => { if (!json) console.error(`api: page ${n}`); } }) : { ...(await send(req, auth, { onRetry })), pages: 1 };
|
||||
if (!json) console.error(`${req.method} ${req.url.replace(/\?.*$/, '')} -> ${r.status}${r.pages > 1 ? ` · ${r.pages} pages` : ''}${r.rateLimit ? ` · rate limit ${r.rateLimit}` : ''}`);
|
||||
if (r.bytes) {
|
||||
if (!out) throw new Error(`${op.id}: binary response (${r.bytes.length} bytes): pass --out <file>`);
|
||||
writeFileSync(resolve(out), r.bytes);
|
||||
console.log(json ? JSON.stringify({ status: r.status, out, bytes: r.bytes.length }) : `wrote ${out} (${r.bytes.length} bytes)`);
|
||||
return;
|
||||
}
|
||||
if (out) { writeFileSync(resolve(out), JSON.stringify(r.json, null, 2) + '\n'); if (!json) console.log(`wrote ${out}`); return; }
|
||||
console.log(json ? JSON.stringify(r.json) : JSON.stringify(r.json, null, 2));
|
||||
}
|
||||
|
||||
1311
cli/api/apple.gen.ts
Normal file
1311
cli/api/apple.gen.ts
Normal file
File diff suppressed because it is too large
Load diff
341
cli/api/client.ts
Normal file
341
cli/api/client.ts
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
// Generic client for every App Store Connect and Google Play operation: the generated rows (apple.gen.ts, play.gen.ts)
|
||||
// plus a few helpers instead of a function per endpoint. Request building is pure (tests cover URLs and parameters);
|
||||
// sending retries 429 / 5xx with backoff (Retry-After honoured) and follows pages.
|
||||
// Auth: the App Store Connect team key JWT from cli/apple/asc.ts, the Play service account token from
|
||||
// cli/lib/google-auth.ts (one scope per Google API). Credentials only come from env or .storebound/.
|
||||
import { APPLE_OPS, APPLE_SPEC } from './apple.gen';
|
||||
import { PLAY_APIS, PLAY_OPS } from './play.gen';
|
||||
import type { AppleBody, AppleOp, AppleParams, AppleResponse, ParamValue, PlayBody, PlayOp, PlayParams, PlayResponse } from './types';
|
||||
import type { Store } from './gate';
|
||||
import { errorBody } from '../lib/http';
|
||||
|
||||
export interface QueryParam { name: string; required: boolean; repeated: boolean }
|
||||
|
||||
export interface Op {
|
||||
store: Store;
|
||||
id: string;
|
||||
method: string;
|
||||
/** Path template: Apple "/v1/apps/{id}", Google "androidpublisher/v3/applications/{packageName}/edits" */
|
||||
path: string;
|
||||
query: QueryParam[];
|
||||
/** Apple: resource type ("type", "type[]", "json", ""). Google: request schema name ("" for none). */
|
||||
request: string;
|
||||
/** Apple: "many:type" | "one:type" | "json" | "raw:<media type>" | "none". Google: response schema name. */
|
||||
response: string;
|
||||
/** Google: m media upload, d media download, p pageToken paging, t token paging. Apple: "". */
|
||||
flags: string;
|
||||
/** Google API name (androidpublisher, playdeveloperreporting); "" for Apple. */
|
||||
api: string;
|
||||
/** Google: the shape of each {+param}, e.g. name -> "apps/* /crashRateMetricSet" (no space; * is one segment). */
|
||||
shapes: Record<string, string>;
|
||||
}
|
||||
|
||||
/** Query parameters every Google API accepts on top of a method's own. */
|
||||
export const GOOGLE_GLOBAL = ['fields', 'prettyPrint', 'quotaUser'];
|
||||
|
||||
const parseQuery = (s: string): QueryParam[] => (s ? s.split(' ') : []).map(t => ({ name: t.replace(/[!*]/g, ''), required: t.includes('!'), repeated: t.includes('*') }));
|
||||
|
||||
const cache: Partial<Record<Store, Op[]>> = {};
|
||||
export function allOps(store: Store): Op[] {
|
||||
if (cache[store]) return cache[store]!;
|
||||
const rows = store === 'apple' ? APPLE_OPS as Record<string, readonly string[]> : PLAY_OPS as Record<string, readonly string[]>;
|
||||
return (cache[store] = Object.entries(rows).map(([id, r]) => ({
|
||||
store, id, method: r[0]!, path: r[1]!, query: parseQuery(r[2]!), request: r[3]!, response: r[4]!, flags: r[5] ?? '',
|
||||
api: store === 'play' ? id.split('.')[0]! : '',
|
||||
shapes: Object.fromEntries((r[6] ?? '').split(' ').filter(Boolean).map(s => [s.slice(0, s.indexOf('=')), s.slice(s.indexOf('=') + 1)])),
|
||||
})));
|
||||
}
|
||||
|
||||
export function getOp(store: Store, id: string): Op | undefined {
|
||||
const ops = allOps(store);
|
||||
return ops.find(o => o.id === id) ?? (store === 'play' ? ops.find(o => o.id.slice(o.api.length + 1) === id) : undefined);
|
||||
}
|
||||
|
||||
const esc = (s: string) => s.replace(/[.*+?^$()|[\]\\]/g, '\\$&');
|
||||
/** "apps/* /crashRateMetricSet" (no space) -> a regex source; * is one path segment. */
|
||||
const shapeSource = (shape: string) => shape.split('*').map(esc).join('[^/]+');
|
||||
|
||||
/** Path template -> RegExp with one group per path parameter ({+param}s narrowed by their shape). */
|
||||
function templateRe(op: Op): { re: RegExp; names: string[]; fixed: number } {
|
||||
const names: string[] = [];
|
||||
const body = op.path.replace(/^\//, '').split(/(\{\+?[^}]+\})/).map(part => {
|
||||
const m = /^\{(\+?)([^}]+)\}$/.exec(part);
|
||||
if (!m) return esc(part);
|
||||
names.push(m[2]!);
|
||||
if (!m[1]) return '([^/:]+)';
|
||||
const shape = op.shapes[m[2]!];
|
||||
return shape ? `(${shapeSource(shape)})` : '(.+)';
|
||||
}).join('');
|
||||
return { re: new RegExp('^' + body + '$'), names, fixed: op.path.split('{')[0]!.length };
|
||||
}
|
||||
|
||||
/**
|
||||
* An operation from what the user typed: an operation id (Google ids also without the API prefix), or "METHOD path"
|
||||
* with a concrete path (and query string), whose values become parameters.
|
||||
*/
|
||||
export function resolveOp(store: Store, ref: string, path?: string): { op: Op; params: Record<string, string> } {
|
||||
if (path === undefined) {
|
||||
const op = getOp(store, ref);
|
||||
if (!op) throw new Error(`${store}: no operation "${ref}" (storebound api list --store ${store} --search <text>)`);
|
||||
return { op, params: {} };
|
||||
}
|
||||
const method = ref.toUpperCase();
|
||||
if (!/^(GET|POST|PUT|PATCH|DELETE)$/.test(method)) throw new Error(`"${ref}": expected an operation id or METHOD path`);
|
||||
let p = path.replace(/^https:\/\/[^/]+/, '');
|
||||
if (store === 'play') p = p.replace(/^\/?upload\//, '/');
|
||||
const [rawPath, qs = ''] = p.split('?', 2) as [string, string?];
|
||||
const clean = decodeURI(rawPath).replace(/^\//, '');
|
||||
const hits = allOps(store).filter(o => o.method === method).map(o => ({ o, t: templateRe(o) }))
|
||||
.map(x => ({ ...x, m: x.t.re.exec(clean) })).filter(x => x.m).sort((a, b) => b.t.fixed - a.t.fixed);
|
||||
const best = hits[0];
|
||||
if (!best) throw new Error(`${store}: no ${method} operation matches ${rawPath}`);
|
||||
const params: Record<string, string> = {};
|
||||
best.t.names.forEach((n, i) => { params[n] = best.m![i + 1]!; });
|
||||
for (const [k, v] of new URLSearchParams(qs)) params[k] = v;
|
||||
return { op: best.o, params };
|
||||
}
|
||||
|
||||
export interface BuiltRequest {
|
||||
op: Op;
|
||||
method: string;
|
||||
url: string;
|
||||
/** JSON text or file bytes */
|
||||
body?: string | Uint8Array;
|
||||
contentType?: string;
|
||||
/** Apple vendor media types (perfPowerMetrics: application/vnd.apple.xcode-metrics+json, reports: application/a-gzip) */
|
||||
accept?: string;
|
||||
}
|
||||
|
||||
const encSeg = (v: string) => encodeURIComponent(v);
|
||||
// Apple writes brackets and commas plainly in its docs and links (filter[app]=1,2); keep them readable
|
||||
const encName = (k: string) => encodeURIComponent(k).replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
||||
const encVal = (v: string) => encodeURIComponent(v).replace(/%2C/gi, ',');
|
||||
const str = (v: string | number | boolean) => String(v);
|
||||
|
||||
/** Builds the URL and body of one call. Throws on a missing path / required parameter or an unknown parameter. Pure. */
|
||||
export function buildRequest(op: Op, params: Record<string, ParamValue | undefined>, body?: unknown, o: { upload?: { bytes: Uint8Array; contentType: string }; download?: boolean } = {}): BuiltRequest {
|
||||
const left = new Map(Object.entries(params).filter(([, v]) => v !== undefined) as [string, ParamValue][]);
|
||||
const path = op.path.replace(/\{(\+?)([^}]+)\}/g, (_, plus: string, name: string) => {
|
||||
const v = left.get(name);
|
||||
if (v === undefined || v === '') throw new Error(`${op.id}: path parameter "${name}" is required`);
|
||||
left.delete(name);
|
||||
const s = Array.isArray(v) ? v.join(',') : str(v as string);
|
||||
const shape = op.shapes[name];
|
||||
if (shape && !new RegExp(`^${shapeSource(shape)}$`).test(s)) throw new Error(`${op.id}: "${name}" must look like ${shape} (* is one segment), got "${s}"`);
|
||||
return plus ? s.split('/').map(encSeg).join('/') : encSeg(s);
|
||||
});
|
||||
const known = new Map(op.query.map(q => [q.name, q] as const));
|
||||
for (const q of op.query) if (q.required && !left.has(q.name)) throw new Error(`${op.id}: query parameter "${q.name}" is required`);
|
||||
const parts: string[] = [];
|
||||
for (const [k, v] of left) {
|
||||
const q = known.get(k);
|
||||
if (!q && !(op.store === 'play' && GOOGLE_GLOBAL.includes(k))) {
|
||||
const names = op.query.map(x => x.name);
|
||||
throw new Error(`${op.id}: unknown parameter "${k}"${names.length ? ` (takes: ${names.slice(0, 30).join(', ')}${names.length > 30 ? ', …' : ''})` : ' (takes no query parameters)'}`);
|
||||
}
|
||||
const values = Array.isArray(v) ? v.map(str) : [str(v as string)];
|
||||
if (q?.repeated) for (const x of values) parts.push(`${encName(k)}=${encVal(x)}`);
|
||||
else parts.push(`${encName(k)}=${encVal(values.join(','))}`);
|
||||
}
|
||||
let base: string;
|
||||
if (op.store === 'apple') base = APPLE_SPEC.base + path;
|
||||
else {
|
||||
const api = PLAY_APIS[op.api as keyof typeof PLAY_APIS];
|
||||
if (!api) throw new Error(`${op.id}: unknown Google API ${op.api}`);
|
||||
const upload = !!o.upload && op.flags.includes('m');
|
||||
if (o.upload && !upload) throw new Error(`${op.id}: takes no file upload`);
|
||||
base = api.root + (upload ? 'upload/' : '') + path;
|
||||
if (upload) parts.unshift('uploadType=media');
|
||||
if (o.download) {
|
||||
if (!op.flags.includes('d')) throw new Error(`${op.id}: has no media download`);
|
||||
parts.push('alt=media');
|
||||
}
|
||||
}
|
||||
const req: BuiltRequest = { op, method: op.method, url: base + (parts.length ? '?' + parts.join('&') : '') };
|
||||
if (op.response.startsWith('raw:')) req.accept = op.response.slice(4);
|
||||
if (o.upload) { req.body = o.upload.bytes; req.contentType = o.upload.contentType; }
|
||||
else if (body !== undefined) {
|
||||
if (op.method === 'GET' || op.method === 'DELETE' && op.store === 'play') throw new Error(`${op.id}: ${op.method} takes no body`);
|
||||
req.body = JSON.stringify(body);
|
||||
req.contentType = 'application/json';
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------- sending
|
||||
|
||||
/** Authorization header value for a request ("Bearer ..."). */
|
||||
export type Auth = (req: BuiltRequest) => Promise<string> | string;
|
||||
|
||||
export interface SendOptions {
|
||||
fetch?: (url: string, init: RequestInit) => Promise<Response>;
|
||||
sleep?: (ms: number) => Promise<unknown>;
|
||||
/** attempts for 429 / 5xx / network errors (default 5) */
|
||||
attempts?: number;
|
||||
/** each retry is logged here (stderr in the CLI) */
|
||||
onRetry?: (msg: string) => void;
|
||||
}
|
||||
|
||||
export interface ApiResult {
|
||||
status: number;
|
||||
/** parsed JSON, or null for an empty body */
|
||||
json?: unknown;
|
||||
/** non-JSON body (gzip reports, media downloads) */
|
||||
bytes?: Uint8Array;
|
||||
/** Apple's X-Rate-Limit header ("user-hour-lim:3600;user-hour-rem:3412;") */
|
||||
rateLimit?: string;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
constructor(readonly status: number, message: string) { super(message); }
|
||||
}
|
||||
|
||||
/** Wait before retry `attempt` (1-based): Retry-After when the server sent one (max 60 s), else 1, 2, 4, 8 ... s (max 30 s). */
|
||||
export function backoffMs(attempt: number, retryAfter?: string | null): number {
|
||||
const s = retryAfter ? Number(retryAfter) : NaN;
|
||||
if (Number.isFinite(s) && s >= 0) return Math.min(s, 60) * 1000;
|
||||
return Math.min(1000 * 2 ** (attempt - 1), 30_000);
|
||||
}
|
||||
|
||||
const short = (url: string) => url.replace(/^https:\/\/[^/]+/, '').replace(/\?.*$/, '');
|
||||
|
||||
export async function send(req: BuiltRequest, auth: Auth, o: SendOptions = {}): Promise<ApiResult> {
|
||||
const doFetch = o.fetch ?? ((u: string, i: RequestInit) => fetch(u, i));
|
||||
const sleep = o.sleep ?? ((ms: number) => Bun.sleep(ms));
|
||||
const attempts = o.attempts ?? 5;
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
const headers: Record<string, string> = { Authorization: await auth(req) };
|
||||
if (req.contentType) headers['Content-Type'] = req.contentType;
|
||||
if (req.accept) headers.Accept = req.accept;
|
||||
let r: Response;
|
||||
try {
|
||||
r = await doFetch(req.url, { method: req.method, headers, body: req.body as BodyInit | undefined });
|
||||
} catch (e) {
|
||||
if (attempt >= attempts) throw e;
|
||||
o.onRetry?.(`${req.method} ${short(req.url)}: ${(e as Error).message}, retry ${attempt}/${attempts - 1}`);
|
||||
await sleep(backoffMs(attempt));
|
||||
continue;
|
||||
}
|
||||
if ((r.status === 429 || r.status >= 500) && attempt < attempts) {
|
||||
const wait = backoffMs(attempt, r.headers.get('retry-after'));
|
||||
await r.body?.cancel();
|
||||
o.onRetry?.(`${req.method} ${short(req.url)} -> ${r.status}, retry ${attempt}/${attempts - 1} in ${Math.round(wait / 1000)} s`);
|
||||
await sleep(wait);
|
||||
continue;
|
||||
}
|
||||
const rateLimit = r.headers.get('x-rate-limit') ?? undefined;
|
||||
const type = r.headers.get('content-type') ?? '';
|
||||
if (!r.ok) throw new ApiError(r.status, `${req.method} ${short(req.url)} -> ${r.status} ${errorBody(await r.text())}`);
|
||||
if (/json/.test(type) || (!type && r.status !== 204)) {
|
||||
const t = await r.text();
|
||||
return { status: r.status, json: t ? JSON.parse(t) : null, rateLimit };
|
||||
}
|
||||
if (r.status === 204) return { status: 204, json: null, rateLimit };
|
||||
return { status: r.status, bytes: new Uint8Array(await r.arrayBuffer()), rateLimit };
|
||||
}
|
||||
}
|
||||
|
||||
/** Merges two pages: arrays are concatenated (Apple's included de-duplicated), the page tokens dropped. Pure. */
|
||||
export function mergePages(a: Record<string, unknown>, b: Record<string, unknown>): Record<string, unknown> {
|
||||
const out: Record<string, unknown> = { ...a };
|
||||
for (const [k, v] of Object.entries(b)) {
|
||||
const cur = out[k];
|
||||
if (Array.isArray(cur) && Array.isArray(v)) {
|
||||
if (k === 'included') {
|
||||
const seen = new Set(cur.map(x => `${(x as { type?: string }).type}/${(x as { id?: string }).id}`));
|
||||
out[k] = [...cur, ...v.filter(x => !seen.has(`${(x as { type?: string }).type}/${(x as { id?: string }).id}`))];
|
||||
} else out[k] = [...cur, ...v];
|
||||
} else if (cur === undefined) out[k] = v;
|
||||
}
|
||||
delete out.nextPageToken;
|
||||
if (out.tokenPagination) delete out.tokenPagination;
|
||||
if (out.links && typeof out.links === 'object') out.links = { ...(out.links as Record<string, unknown>), next: undefined };
|
||||
return out;
|
||||
}
|
||||
|
||||
/** The next page of a result, or null. Apple: links.next (same host only, the token never leaves it); Google: the page token. */
|
||||
export function nextRequest(req: BuiltRequest, json: unknown): BuiltRequest | null {
|
||||
const j = (json ?? {}) as { links?: { next?: string }; nextPageToken?: string; tokenPagination?: { nextPageToken?: string } };
|
||||
if (req.op.store === 'apple') {
|
||||
const next = j.links?.next;
|
||||
if (!next) return null;
|
||||
if (!next.startsWith(APPLE_SPEC.base + '/')) throw new Error(`refusing to follow a next link to another host: ${next.slice(0, 80)}`);
|
||||
return { ...req, url: next };
|
||||
}
|
||||
const [name, token] = req.op.flags.includes('p') ? ['pageToken', j.nextPageToken] : req.op.flags.includes('t') ? ['token', j.tokenPagination?.nextPageToken] : ['', undefined];
|
||||
if (!token) return null;
|
||||
const u = new URL(req.url);
|
||||
u.searchParams.set(name, token);
|
||||
return { ...req, url: u.toString() };
|
||||
}
|
||||
|
||||
/** Every page of a GET (or a paged query), merged. `maxPages` guards against a server that never stops. */
|
||||
export async function sendAll(req: BuiltRequest, auth: Auth, o: SendOptions & { maxPages?: number; onPage?: (n: number) => void } = {}): Promise<ApiResult & { pages: number }> {
|
||||
let first = await send(req, auth, o);
|
||||
let pages = 1;
|
||||
let cur: BuiltRequest | null = req;
|
||||
let last = first.json;
|
||||
while ((cur = nextRequest(cur, last))) {
|
||||
if (pages >= (o.maxPages ?? 1000)) throw new Error(`more than ${o.maxPages ?? 1000} pages: stopped`);
|
||||
const r = await send(cur, auth, o);
|
||||
pages++;
|
||||
o.onPage?.(pages);
|
||||
last = r.json;
|
||||
first = { ...first, json: mergePages(first.json as Record<string, unknown>, r.json as Record<string, unknown>), rateLimit: r.rateLimit ?? first.rateLimit };
|
||||
}
|
||||
return { ...first, pages };
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------- typed facades
|
||||
|
||||
/** Typed App Store Connect client: `api.call('apps_getCollection', { 'filter[bundleId]': 'com.example.app' })`. */
|
||||
export function appleApi(auth: Auth, o: SendOptions = {}) {
|
||||
const build = <O extends AppleOp>(op: O, params: AppleParams<O>, body?: AppleBody<O>) =>
|
||||
buildRequest(getOp('apple', op)!, params as Record<string, ParamValue>, body);
|
||||
const out = (r: ApiResult) => (r.bytes ?? r.json ?? null);
|
||||
return {
|
||||
build,
|
||||
async call<O extends AppleOp>(op: O, params: AppleParams<O>, body?: AppleBody<O>): Promise<AppleResponse<O>> {
|
||||
return out(await send(build(op, params, body), auth, o)) as AppleResponse<O>;
|
||||
},
|
||||
async all<O extends AppleOp>(op: O, params: AppleParams<O>): Promise<AppleResponse<O>> {
|
||||
return out(await sendAll(build(op, params), auth, o)) as AppleResponse<O>;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** Typed Google Play client: `api.call('androidpublisher.edits.tracks.list', { packageName, editId })`. */
|
||||
export function playApi(auth: Auth, o: SendOptions = {}) {
|
||||
const build = <O extends PlayOp>(op: O, params: PlayParams<O>, body?: PlayBody<O>) =>
|
||||
body instanceof Uint8Array
|
||||
? buildRequest(getOp('play', op)!, params as Record<string, ParamValue>, undefined, { upload: { bytes: body, contentType: 'application/octet-stream' } })
|
||||
: buildRequest(getOp('play', op)!, params as Record<string, ParamValue>, body);
|
||||
const out = (r: ApiResult) => (r.bytes ?? r.json ?? {});
|
||||
return {
|
||||
build,
|
||||
async call<O extends PlayOp>(op: O, params: PlayParams<O>, body?: PlayBody<O>): Promise<PlayResponse<O>> {
|
||||
return out(await send(build(op, params, body), auth, o)) as PlayResponse<O>;
|
||||
},
|
||||
async all<O extends PlayOp>(op: O, params: PlayParams<O>): Promise<PlayResponse<O>> {
|
||||
return out(await sendAll(build(op, params), auth, o)) as PlayResponse<O>;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** Auth from the project's credentials (env or .storebound/): Apple team key JWT, or a Play token for the op's API scope. */
|
||||
export async function authFor(store: Store, root: string): Promise<Auth> {
|
||||
if (store === 'apple') {
|
||||
const { ascJwt } = await import('../apple/asc');
|
||||
const { jwt } = ascJwt(root);
|
||||
return () => 'Bearer ' + jwt();
|
||||
}
|
||||
const { playServiceAccount } = await import('../lib/credentials');
|
||||
const { tokenSource } = await import('../lib/google-auth');
|
||||
const sa = playServiceAccount(root);
|
||||
const sources = new Map<string, () => Promise<string>>();
|
||||
return async req => {
|
||||
const scope = PLAY_APIS[req.op.api as keyof typeof PLAY_APIS].scope;
|
||||
if (!sources.has(scope)) sources.set(scope, tokenSource(sa, scope));
|
||||
return 'Bearer ' + (await sources.get(scope)!());
|
||||
};
|
||||
}
|
||||
99
cli/api/gate.ts
Normal file
99
cli/api/gate.ts
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
// Write gating for `storebound api`: which operations read, which write, and which only the owner may run.
|
||||
//
|
||||
// read GET (and a few POSTs that only compute or query, listed below): runs right away.
|
||||
// write any other POST / PATCH / PUT / DELETE: prints the exact request; sent only with --yes in an interactive
|
||||
// terminal, never under MCP (`storebound mcp`) or the desktop app (`storebound serve`).
|
||||
// owner writes that submit, release, delete, cancel, change prices, invite or remove testers, send review replies,
|
||||
// start or stop experiments, refund or rotate keys (AGENTS.md rule 1): a write that also needs the operation id
|
||||
// typed at the prompt. Never reachable through MCP or serve.
|
||||
// Pure; tests/api.test.ts covers every rule.
|
||||
|
||||
export type Store = 'apple' | 'play';
|
||||
export type GateKind = 'read' | 'write' | 'owner';
|
||||
|
||||
/** POSTs that change nothing (vitals queries, price conversion, batch reads). */
|
||||
export const READ_POSTS: RegExp[] = [
|
||||
/^playdeveloperreporting\..*\.query$/,
|
||||
/^androidpublisher\.monetization\.convertRegionPrices$/,
|
||||
/^androidpublisher\.monetization\..*\.batchGet$/,
|
||||
];
|
||||
|
||||
/** [pattern over "METHOD operationId", why]: the curated owner-only list. */
|
||||
export const OWNER_ONLY: Record<Store, [RegExp, string][]> = {
|
||||
apple: [
|
||||
[/^DELETE /, 'deletes'],
|
||||
[/^(POST|PATCH) \w*Submissions?(V\d)?_(create|update)Instance$/, 'submits for review (or cancels a submission)'],
|
||||
[/^POST (?!appStoreVersionPhasedReleases)\w*(Releases|ReleaseRequests)_createInstance$/, 'releases'],
|
||||
[/^PATCH appStoreVersionPhasedReleases_updateInstance$/, 'pauses, resumes or completes a phased release'],
|
||||
[/^PATCH appStoreVersionExperiments(V2)?_updateInstance$/, 'starts or stops a product page test'],
|
||||
[/^POST (appPriceSchedules|inAppPurchasePriceSchedules|subscriptionPrices)_createInstance$/, 'changes prices'],
|
||||
[/^POST customerReviewResponses_createInstance$/, 'sends a public review reply'],
|
||||
[/^POST (betaTesterInvitations|betaTesters|userInvitations)_createInstance$/, 'invites testers or users'],
|
||||
[/^POST (betaGroups_betaTesters|betaTesters_betaGroups|betaTesters_builds|builds_individualTesters)_createToManyRelationship$/, 'adds testers'],
|
||||
[/^(POST|PATCH) users_(updateInstance|visibleApps_\w+)$/, 'changes a team member\'s access'],
|
||||
],
|
||||
play: [
|
||||
[/^DELETE /, 'deletes'],
|
||||
[/^POST \S+\.(batchDelete|deleteall)$/, 'deletes'],
|
||||
[/^POST androidpublisher\.edits\.commit$/, 'publishes the edit (releases, listing and graphics go live)'],
|
||||
[/^POST \S+\.(cancel|refund|refundexternaltransaction|reviewrefund|revoke)$/, 'cancels, refunds or revokes'],
|
||||
[/^POST androidpublisher\.apprecovery\.deploy$/, 'deploys an app recovery action'],
|
||||
[/^POST \S+\.(activate|deactivate|archive|batchUpdateStates)$/, 'makes products or offers live (or takes them down)'],
|
||||
[/^POST androidpublisher\.appstoreappsreview\.updateappstorehostedapppublishstatus$/, 'changes a publish status'],
|
||||
[/^POST \S+\.(migratePrices|batchMigratePrices)$/, 'changes prices for existing subscribers'],
|
||||
[/^POST androidpublisher\.reviews\.reply$/, 'sends a public review reply'],
|
||||
[/^(PUT|PATCH) androidpublisher\.edits\.testers\.(update|patch)$/, 'changes the testers of a track'],
|
||||
[/^(POST|PATCH) androidpublisher\.(users|grants)\.(create|patch)$/, 'invites users or changes their permissions'],
|
||||
[/^POST androidpublisher\.appsigning\.(enrollApp|rotateAppSigningKey)$/, 'changes app signing (irreversible)'],
|
||||
],
|
||||
};
|
||||
|
||||
/** Why an operation is owner-only, or null. */
|
||||
export function ownerReason(store: Store, id: string, method: string): string | null {
|
||||
const key = `${method.toUpperCase()} ${id}`;
|
||||
return OWNER_ONLY[store].find(([re]) => re.test(key))?.[1] ?? null;
|
||||
}
|
||||
|
||||
/** Resource of an operation, for counts: Apple's first path segment (/v1/<apps>/...), Google's id without the method. */
|
||||
export const resourceOf = (r: { store: Store; id: string; path: string }): string =>
|
||||
r.store === 'apple' ? r.path.split('/')[2]! : r.id.split('.').slice(0, -1).join('.');
|
||||
|
||||
export function gateOf(store: Store, id: string, method: string): GateKind {
|
||||
const m = method.toUpperCase();
|
||||
if (m === 'GET') return 'read';
|
||||
if (store === 'play' && m === 'POST' && READ_POSTS.some(re => re.test(id))) return 'read';
|
||||
return ownerReason(store, id, m) ? 'owner' : 'write';
|
||||
}
|
||||
|
||||
export interface GateInput {
|
||||
kind: GateKind;
|
||||
method: string;
|
||||
/** --dry */
|
||||
dry: boolean;
|
||||
/** --yes */
|
||||
yes: boolean;
|
||||
/** stdin and stdout are a terminal */
|
||||
tty: boolean;
|
||||
/** under `storebound mcp` or `storebound serve` (STOREBOUND_MCP / STOREBOUND_SERVE) */
|
||||
agent: boolean;
|
||||
/** `storebound api get` (the MCP api_get tool): plain GETs only */
|
||||
getOnly: boolean;
|
||||
}
|
||||
|
||||
export type Decision =
|
||||
| { action: 'send' }
|
||||
| { action: 'confirm'; typed: true }
|
||||
| { action: 'dry'; why: string }
|
||||
| { action: 'refuse'; why: string };
|
||||
|
||||
/** What to do with one call. Pure. */
|
||||
export function decide(g: GateInput): Decision {
|
||||
if (g.getOnly && g.method.toUpperCase() !== 'GET') return { action: 'refuse', why: 'api get runs GET operations only' };
|
||||
if (g.kind === 'read') return g.dry ? { action: 'dry', why: '--dry' } : { action: 'send' };
|
||||
if (g.agent) return { action: 'refuse', why: g.kind === 'owner'
|
||||
? 'owner-only operation: never through MCP or the desktop app; the owner runs it in a terminal'
|
||||
: 'writes through `storebound api` are not available to MCP or the desktop app; run it in a terminal' };
|
||||
if (g.dry || !g.yes) return { action: 'dry', why: g.dry ? '--dry' : 'writes are dry by default: add --yes (in a terminal) to send' };
|
||||
if (!g.tty) return { action: 'dry', why: 'not an interactive terminal: writes through `storebound api` are only sent from one' };
|
||||
return g.kind === 'owner' ? { action: 'confirm', typed: true } : { action: 'send' };
|
||||
}
|
||||
181
cli/api/play.gen.ts
Normal file
181
cli/api/play.gen.ts
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
// GENERATED by tools/gen-api.ts from specs/androidpublisher_v3.discovery.json (Google Play Android Developer API v3, revision 20261008, https://www.googleapis.com/discovery/v1/apis/androidpublisher/v3/rest, downloaded 2026-10-11) and specs/playdeveloperreporting_v1beta1.discovery.json (Google Play Developer Reporting API v1beta1, revision 20261008, https://playdeveloperreporting.googleapis.com/$discovery/rest?version=v1beta1, downloaded 2026-10-11). Do not edit: run `bun tools/gen-api.ts` (CI checks it is fresh).
|
||||
// One row per method: [HTTP method, path ({p} one segment, {+p} may hold slashes), query parameters ("name", "name!"
|
||||
// required, "name*" repeated), request schema, response schema, flags (m media upload, d media download, p pageToken
|
||||
// paging, t token paging)]. The API is the first part of the id.
|
||||
export const PLAY_APIS = {
|
||||
androidpublisher: { title: 'Google Play Android Developer API v3', version: 'v3', revision: '20261008', root: 'https://androidpublisher.googleapis.com/', scope: 'https://www.googleapis.com/auth/androidpublisher', sha256: '668757f25cbe47e97f782758e818f1e18bf7da4e2049180ef0e49b3d0e465efc' },
|
||||
playdeveloperreporting: { title: 'Google Play Developer Reporting API v1beta1', version: 'v1beta1', revision: '20261008', root: 'https://playdeveloperreporting.googleapis.com/', scope: 'https://www.googleapis.com/auth/playdeveloperreporting', sha256: '277afdf1c026c13d91d0b3d6d5fd10a46ecaa9b21bbc2f085c104193e254a448' },
|
||||
} as const;
|
||||
|
||||
export const PLAY_OPS = {
|
||||
'androidpublisher.applications.dataSafety': ['POST', 'androidpublisher/v3/applications/{packageName}/dataSafety', '', 'SafetyLabelsUpdateRequest', 'SafetyLabelsUpdateResponse', '', ''],
|
||||
'androidpublisher.applications.deviceTierConfigs.create': ['POST', 'androidpublisher/v3/applications/{packageName}/deviceTierConfigs', 'allowUnknownDevices', 'DeviceTierConfig', 'DeviceTierConfig', '', ''],
|
||||
'androidpublisher.applications.deviceTierConfigs.get': ['GET', 'androidpublisher/v3/applications/{packageName}/deviceTierConfigs/{deviceTierConfigId}', '', '', 'DeviceTierConfig', '', ''],
|
||||
'androidpublisher.applications.deviceTierConfigs.list': ['GET', 'androidpublisher/v3/applications/{packageName}/deviceTierConfigs', 'pageSize pageToken', '', 'ListDeviceTierConfigsResponse', 'p', ''],
|
||||
'androidpublisher.applications.tracks.releases.list': ['GET', 'androidpublisher/v3/{+parent}/releases', '', '', 'ListReleaseSummariesResponse', '', 'parent=applications/*/tracks/*'],
|
||||
'androidpublisher.apprecovery.addTargeting': ['POST', 'androidpublisher/v3/applications/{packageName}/appRecoveries/{appRecoveryId}:addTargeting', '', 'AddTargetingRequest', 'AddTargetingResponse', '', ''],
|
||||
'androidpublisher.apprecovery.cancel': ['POST', 'androidpublisher/v3/applications/{packageName}/appRecoveries/{appRecoveryId}:cancel', '', 'CancelAppRecoveryRequest', 'CancelAppRecoveryResponse', '', ''],
|
||||
'androidpublisher.apprecovery.create': ['POST', 'androidpublisher/v3/applications/{packageName}/appRecoveries', '', 'CreateDraftAppRecoveryRequest', 'AppRecoveryAction', '', ''],
|
||||
'androidpublisher.apprecovery.deploy': ['POST', 'androidpublisher/v3/applications/{packageName}/appRecoveries/{appRecoveryId}:deploy', '', 'DeployAppRecoveryRequest', 'DeployAppRecoveryResponse', '', ''],
|
||||
'androidpublisher.apprecovery.list': ['GET', 'androidpublisher/v3/applications/{packageName}/appRecoveries', 'versionCode', '', 'ListAppRecoveriesResponse', '', ''],
|
||||
'androidpublisher.appsigning.enrollApp': ['POST', 'androidpublisher/v3/applications/{name}/appSigning:enrollApp', '', 'EnrollAppRequest', 'EnrollAppResponse', '', ''],
|
||||
'androidpublisher.appsigning.rotateAppSigningKey': ['POST', 'androidpublisher/v3/applications/{name}/appSigning:rotateAppSigningKey', '', 'RotateAppSigningKeyRequest', 'RotateAppSigningKeyResponse', '', ''],
|
||||
'androidpublisher.appstoreappsreview.createappstorehostedapp': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps:create', '', 'CreateAppStoreHostedAppRequest', 'CreateAppStoreHostedAppResponse', '', ''],
|
||||
'androidpublisher.appstoreappsreview.updateappstorehostedapp': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps:update', '', 'UpdateAppStoreHostedAppRequest', 'UpdateAppStoreHostedAppResponse', '', ''],
|
||||
'androidpublisher.appstoreappsreview.updateappstorehostedapppublishstatus': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps/{packageName}:updateAppStoreHostedAppPublishStatus', '', 'UpdateAppStoreHostedAppPublishStatusRequest', 'UpdateAppStoreHostedAppPublishStatusResponse', '', ''],
|
||||
'androidpublisher.appstoreappsreview.uploadapk': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps/{packageName}/apks:upload', '', 'UploadApkRequest', 'UploadApkResponse', 'm', ''],
|
||||
'androidpublisher.appstoreappsreview.uploadappstoreapppolicydeclarationfile': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps/{packageName}/policyDeclarationFiles:upload', '', 'UploadAppStoreAppPolicyDeclarationFileRequest', 'UploadAppStoreAppPolicyDeclarationFileResponse', 'm', ''],
|
||||
'androidpublisher.appstoreappsreview.uploadimage': ['POST', 'androidpublisher/v3/appstore/{appStorePackageName}/apps/{packageName}/images:upload', '', 'UploadImageRequest', 'UploadImageResponse', 'm', ''],
|
||||
'androidpublisher.appstorecatalog.recentappviews.get': ['GET', 'androidpublisher/v3/appstorecatalog/{appStorePackageName}/recentAppViews/{playAppPackageName}', '', '', 'RecentAppView', '', ''],
|
||||
'androidpublisher.appstorecatalog.recentupdateevents.list': ['GET', 'androidpublisher/v3/appstorecatalog/{appStorePackageName}/recentUpdateEvents', 'endTime pageSize pageToken startTime', '', 'ListRecentUpdateEventsResponse', 'p', ''],
|
||||
'androidpublisher.edits.apks.addexternallyhosted': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/externallyHosted', '', 'ApksAddExternallyHostedRequest', 'ApksAddExternallyHostedResponse', '', ''],
|
||||
'androidpublisher.edits.apks.list': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks', '', '', 'ApksListResponse', '', ''],
|
||||
'androidpublisher.edits.apks.upload': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks', '', '', 'Apk', 'm', ''],
|
||||
'androidpublisher.edits.bundles.list': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/bundles', '', '', 'BundlesListResponse', '', ''],
|
||||
'androidpublisher.edits.bundles.upload': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/bundles', 'ackBundleInstallationWarning deviceTierConfigId', '', 'Bundle', 'm', ''],
|
||||
'androidpublisher.edits.commit': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}:commit', 'changesInReviewBehavior changesNotSentForReview', '', 'AppEdit', '', ''],
|
||||
'androidpublisher.edits.countryavailability.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/countryAvailability/{track}', '', '', 'TrackCountryAvailability', '', ''],
|
||||
'androidpublisher.edits.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/edits/{editId}', '', '', '', '', ''],
|
||||
'androidpublisher.edits.deobfuscationfiles.upload': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/deobfuscationFiles/{deobfuscationFileType}', '', '', 'DeobfuscationFilesUploadResponse', 'm', ''],
|
||||
'androidpublisher.edits.details.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/details', '', '', 'AppDetails', '', ''],
|
||||
'androidpublisher.edits.details.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/details', '', 'AppDetails', 'AppDetails', '', ''],
|
||||
'androidpublisher.edits.details.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/details', '', 'AppDetails', 'AppDetails', '', ''],
|
||||
'androidpublisher.edits.expansionfiles.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/expansionFiles/{expansionFileType}', '', '', 'ExpansionFile', '', ''],
|
||||
'androidpublisher.edits.expansionfiles.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/expansionFiles/{expansionFileType}', '', 'ExpansionFile', 'ExpansionFile', '', ''],
|
||||
'androidpublisher.edits.expansionfiles.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/expansionFiles/{expansionFileType}', '', 'ExpansionFile', 'ExpansionFile', '', ''],
|
||||
'androidpublisher.edits.expansionfiles.upload': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/apks/{apkVersionCode}/expansionFiles/{expansionFileType}', '', '', 'ExpansionFilesUploadResponse', 'm', ''],
|
||||
'androidpublisher.edits.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}', '', '', 'AppEdit', '', ''],
|
||||
'androidpublisher.edits.images.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}/{imageId}', '', '', '', '', ''],
|
||||
'androidpublisher.edits.images.deleteall': ['DELETE', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}', '', '', 'ImagesDeleteAllResponse', '', ''],
|
||||
'androidpublisher.edits.images.list': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}', '', '', 'ImagesListResponse', '', ''],
|
||||
'androidpublisher.edits.images.upload': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}', 'aiGeneratedState', '', 'ImagesUploadResponse', 'm', ''],
|
||||
'androidpublisher.edits.insert': ['POST', 'androidpublisher/v3/applications/{packageName}/edits', '', 'AppEdit', 'AppEdit', '', ''],
|
||||
'androidpublisher.edits.listings.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}', '', '', '', '', ''],
|
||||
'androidpublisher.edits.listings.deleteall': ['DELETE', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings', '', '', '', '', ''],
|
||||
'androidpublisher.edits.listings.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}', '', '', 'Listing', '', ''],
|
||||
'androidpublisher.edits.listings.list': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings', '', '', 'ListingsListResponse', '', ''],
|
||||
'androidpublisher.edits.listings.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}', '', 'Listing', 'Listing', '', ''],
|
||||
'androidpublisher.edits.listings.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/listings/{language}', '', 'Listing', 'Listing', '', ''],
|
||||
'androidpublisher.edits.testers.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/testers/{track}', '', '', 'Testers', '', ''],
|
||||
'androidpublisher.edits.testers.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/testers/{track}', '', 'Testers', 'Testers', '', ''],
|
||||
'androidpublisher.edits.testers.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/testers/{track}', '', 'Testers', 'Testers', '', ''],
|
||||
'androidpublisher.edits.tracks.create': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks', '', 'TrackConfig', 'Track', '', ''],
|
||||
'androidpublisher.edits.tracks.get': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks/{track}', '', '', 'Track', '', ''],
|
||||
'androidpublisher.edits.tracks.list': ['GET', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks', '', '', 'TracksListResponse', '', ''],
|
||||
'androidpublisher.edits.tracks.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks/{track}', '', 'Track', 'Track', '', ''],
|
||||
'androidpublisher.edits.tracks.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/edits/{editId}/tracks/{track}', '', 'Track', 'Track', '', ''],
|
||||
'androidpublisher.edits.validate': ['POST', 'androidpublisher/v3/applications/{packageName}/edits/{editId}:validate', '', '', 'AppEdit', '', ''],
|
||||
'androidpublisher.externaltransactions.createexternaltransaction': ['POST', 'androidpublisher/v3/{+parent}/externalTransactions', 'externalTransactionId', 'ExternalTransaction', 'ExternalTransaction', '', 'parent=applications/*'],
|
||||
'androidpublisher.externaltransactions.getexternaltransaction': ['GET', 'androidpublisher/v3/{+name}', '', '', 'ExternalTransaction', '', 'name=applications/*/externalTransactions/*'],
|
||||
'androidpublisher.externaltransactions.refundexternaltransaction': ['POST', 'androidpublisher/v3/{+name}:refund', '', 'RefundExternalTransactionRequest', 'ExternalTransaction', '', 'name=applications/*/externalTransactions/*'],
|
||||
'androidpublisher.generatedapks.download': ['GET', 'androidpublisher/v3/applications/{packageName}/generatedApks/{versionCode}/downloads/{downloadId}:download', '', '', '', 'd', ''],
|
||||
'androidpublisher.generatedapks.list': ['GET', 'androidpublisher/v3/applications/{packageName}/generatedApks/{versionCode}', '', '', 'GeneratedApksListResponse', '', ''],
|
||||
'androidpublisher.grants.create': ['POST', 'androidpublisher/v3/{+parent}/grants', '', 'Grant', 'Grant', '', 'parent=developers/*/users/*'],
|
||||
'androidpublisher.grants.delete': ['DELETE', 'androidpublisher/v3/{+name}', '', '', '', '', 'name=developers/*/users/*/grants/*'],
|
||||
'androidpublisher.grants.patch': ['PATCH', 'androidpublisher/v3/{+name}', 'updateMask', 'Grant', 'Grant', '', 'name=developers/*/users/*/grants/*'],
|
||||
'androidpublisher.inappproducts.batchDelete': ['POST', 'androidpublisher/v3/applications/{packageName}/inappproducts:batchDelete', '', 'InappproductsBatchDeleteRequest', '', '', ''],
|
||||
'androidpublisher.inappproducts.batchGet': ['GET', 'androidpublisher/v3/applications/{packageName}/inappproducts:batchGet', 'sku*', '', 'InappproductsBatchGetResponse', '', ''],
|
||||
'androidpublisher.inappproducts.batchUpdate': ['POST', 'androidpublisher/v3/applications/{packageName}/inappproducts:batchUpdate', '', 'InappproductsBatchUpdateRequest', 'InappproductsBatchUpdateResponse', '', ''],
|
||||
'androidpublisher.inappproducts.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/inappproducts/{sku}', 'latencyTolerance', '', '', '', ''],
|
||||
'androidpublisher.inappproducts.get': ['GET', 'androidpublisher/v3/applications/{packageName}/inappproducts/{sku}', '', '', 'InAppProduct', '', ''],
|
||||
'androidpublisher.inappproducts.insert': ['POST', 'androidpublisher/v3/applications/{packageName}/inappproducts', 'autoConvertMissingPrices', 'InAppProduct', 'InAppProduct', '', ''],
|
||||
'androidpublisher.inappproducts.list': ['GET', 'androidpublisher/v3/applications/{packageName}/inappproducts', 'maxResults startIndex token', '', 'InappproductsListResponse', 't', ''],
|
||||
'androidpublisher.inappproducts.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/inappproducts/{sku}', 'autoConvertMissingPrices latencyTolerance', 'InAppProduct', 'InAppProduct', '', ''],
|
||||
'androidpublisher.inappproducts.update': ['PUT', 'androidpublisher/v3/applications/{packageName}/inappproducts/{sku}', 'allowMissing autoConvertMissingPrices latencyTolerance', 'InAppProduct', 'InAppProduct', '', ''],
|
||||
'androidpublisher.internalappsharingartifacts.uploadapk': ['POST', 'androidpublisher/v3/applications/internalappsharing/{packageName}/artifacts/apk', '', '', 'InternalAppSharingArtifact', 'm', ''],
|
||||
'androidpublisher.internalappsharingartifacts.uploadbundle': ['POST', 'androidpublisher/v3/applications/internalappsharing/{packageName}/artifacts/bundle', '', '', 'InternalAppSharingArtifact', 'm', ''],
|
||||
'androidpublisher.monetization.convertRegionPrices': ['POST', 'androidpublisher/v3/applications/{packageName}/pricing:convertRegionPrices', '', 'ConvertRegionPricesRequest', 'ConvertRegionPricesResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.batchDelete': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts:batchDelete', '', 'BatchDeleteOneTimeProductsRequest', '', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.batchGet': ['GET', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts:batchGet', 'productIds*', '', 'BatchGetOneTimeProductsResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.batchUpdate': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts:batchUpdate', '', 'BatchUpdateOneTimeProductsRequest', 'BatchUpdateOneTimeProductsResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}', 'latencyTolerance', '', '', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.get': ['GET', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}', '', '', 'OneTimeProduct', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.list': ['GET', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts', 'pageSize pageToken', '', 'ListOneTimeProductsResponse', 'p', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/onetimeproducts/{productId}', 'allowMissing latencyTolerance regionsVersion.version updateMask', 'OneTimeProduct', 'OneTimeProduct', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.batchDelete': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions:batchDelete', '', 'BatchDeletePurchaseOptionsRequest', '', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.batchUpdateStates': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions:batchUpdateStates', '', 'BatchUpdatePurchaseOptionStatesRequest', 'BatchUpdatePurchaseOptionStatesResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.activate': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers/{offerId}:activate', '', 'ActivateOneTimeProductOfferRequest', 'OneTimeProductOffer', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.batchDelete': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers:batchDelete', '', 'BatchDeleteOneTimeProductOffersRequest', '', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.batchGet': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers:batchGet', '', 'BatchGetOneTimeProductOffersRequest', 'BatchGetOneTimeProductOffersResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.batchUpdate': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers:batchUpdate', '', 'BatchUpdateOneTimeProductOffersRequest', 'BatchUpdateOneTimeProductOffersResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.batchUpdateStates': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers:batchUpdateStates', '', 'BatchUpdateOneTimeProductOfferStatesRequest', 'BatchUpdateOneTimeProductOfferStatesResponse', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.cancel': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers/{offerId}:cancel', '', 'CancelOneTimeProductOfferRequest', 'OneTimeProductOffer', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.deactivate': ['POST', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers/{offerId}:deactivate', '', 'DeactivateOneTimeProductOfferRequest', 'OneTimeProductOffer', '', ''],
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.offers.list': ['GET', 'androidpublisher/v3/applications/{packageName}/oneTimeProducts/{productId}/purchaseOptions/{purchaseOptionId}/offers', 'pageSize pageToken', '', 'ListOneTimeProductOffersResponse', 'p', ''],
|
||||
'androidpublisher.monetization.subscriptions.archive': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}:archive', '', 'ArchiveSubscriptionRequest', 'Subscription', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.activate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}:activate', '', 'ActivateBasePlanRequest', 'Subscription', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.batchMigratePrices': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans:batchMigratePrices', '', 'BatchMigrateBasePlanPricesRequest', 'BatchMigrateBasePlanPricesResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.batchUpdateStates': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans:batchUpdateStates', '', 'BatchUpdateBasePlanStatesRequest', 'BatchUpdateBasePlanStatesResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.deactivate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}:deactivate', '', 'DeactivateBasePlanRequest', 'Subscription', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}', '', '', '', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.migratePrices': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}:migratePrices', '', 'MigrateBasePlanPricesRequest', 'MigrateBasePlanPricesResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.activate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers/{offerId}:activate', '', 'ActivateSubscriptionOfferRequest', 'SubscriptionOffer', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.batchGet': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers:batchGet', '', 'BatchGetSubscriptionOffersRequest', 'BatchGetSubscriptionOffersResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.batchUpdate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers:batchUpdate', '', 'BatchUpdateSubscriptionOffersRequest', 'BatchUpdateSubscriptionOffersResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.batchUpdateStates': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers:batchUpdateStates', '', 'BatchUpdateSubscriptionOfferStatesRequest', 'BatchUpdateSubscriptionOfferStatesResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.create': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers', 'offerId regionsVersion.version', 'SubscriptionOffer', 'SubscriptionOffer', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.deactivate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers/{offerId}:deactivate', '', 'DeactivateSubscriptionOfferRequest', 'SubscriptionOffer', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers/{offerId}', '', '', '', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.get': ['GET', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers/{offerId}', '', '', 'SubscriptionOffer', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.list': ['GET', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers', 'pageSize pageToken', '', 'ListSubscriptionOffersResponse', 'p', ''],
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}/basePlans/{basePlanId}/offers/{offerId}', 'allowMissing latencyTolerance regionsVersion.version updateMask', 'SubscriptionOffer', 'SubscriptionOffer', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.batchGet': ['GET', 'androidpublisher/v3/applications/{packageName}/subscriptions:batchGet', 'productIds*', '', 'BatchGetSubscriptionsResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.batchUpdate': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions:batchUpdate', '', 'BatchUpdateSubscriptionsRequest', 'BatchUpdateSubscriptionsResponse', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.create': ['POST', 'androidpublisher/v3/applications/{packageName}/subscriptions', 'productId regionsVersion.version', 'Subscription', 'Subscription', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.delete': ['DELETE', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}', '', '', '', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.get': ['GET', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}', '', '', 'Subscription', '', ''],
|
||||
'androidpublisher.monetization.subscriptions.list': ['GET', 'androidpublisher/v3/applications/{packageName}/subscriptions', 'pageSize pageToken showArchived', '', 'ListSubscriptionsResponse', 'p', ''],
|
||||
'androidpublisher.monetization.subscriptions.patch': ['PATCH', 'androidpublisher/v3/applications/{packageName}/subscriptions/{productId}', 'allowMissing latencyTolerance regionsVersion.version updateMask', 'Subscription', 'Subscription', '', ''],
|
||||
'androidpublisher.orders.batchget': ['GET', 'androidpublisher/v3/applications/{packageName}/orders:batchGet', 'orderIds*', '', 'BatchGetOrdersResponse', '', ''],
|
||||
'androidpublisher.orders.get': ['GET', 'androidpublisher/v3/applications/{packageName}/orders/{orderId}', '', '', 'Order', '', ''],
|
||||
'androidpublisher.orders.refund': ['POST', 'androidpublisher/v3/applications/{packageName}/orders/{orderId}:refund', 'revoke', '', '', '', ''],
|
||||
'androidpublisher.orders.reviewrefund': ['POST', 'androidpublisher/v3/applications/{packageName}/orders/{orderId}:reviewrefund', '', 'OrdersReviewRefundRequest', '', '', ''],
|
||||
'androidpublisher.purchases.products.acknowledge': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:acknowledge', '', 'ProductPurchasesAcknowledgeRequest', '', '', ''],
|
||||
'androidpublisher.purchases.products.consume': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:consume', '', '', '', '', ''],
|
||||
'androidpublisher.purchases.products.get': ['GET', 'androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}', '', '', 'ProductPurchase', '', ''],
|
||||
'androidpublisher.purchases.productsv2.getproductpurchasev2': ['GET', 'androidpublisher/v3/applications/{packageName}/purchases/productsv2/tokens/{token}', '', '', 'ProductPurchaseV2', '', ''],
|
||||
'androidpublisher.purchases.subscriptions.acknowledge': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:acknowledge', '', 'SubscriptionPurchasesAcknowledgeRequest', '', '', ''],
|
||||
'androidpublisher.purchases.subscriptions.cancel': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:cancel', '', '', '', '', ''],
|
||||
'androidpublisher.purchases.subscriptions.defer': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:defer', '', 'SubscriptionPurchasesDeferRequest', 'SubscriptionPurchasesDeferResponse', '', ''],
|
||||
'androidpublisher.purchases.subscriptionsv2.cancel': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:cancel', '', 'CancelSubscriptionPurchaseRequest', 'CancelSubscriptionPurchaseResponse', '', ''],
|
||||
'androidpublisher.purchases.subscriptionsv2.defer': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:defer', '', 'DeferSubscriptionPurchaseRequest', 'DeferSubscriptionPurchaseResponse', '', ''],
|
||||
'androidpublisher.purchases.subscriptionsv2.get': ['GET', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}', '', '', 'SubscriptionPurchaseV2', '', ''],
|
||||
'androidpublisher.purchases.subscriptionsv2.revoke': ['POST', 'androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}:revoke', '', 'RevokeSubscriptionPurchaseRequest', 'RevokeSubscriptionPurchaseResponse', '', ''],
|
||||
'androidpublisher.purchases.voidedpurchases.list': ['GET', 'androidpublisher/v3/applications/{packageName}/purchases/voidedpurchases', 'endTime includeQuantityBasedPartialRefund maxResults startIndex startTime token type', '', 'VoidedPurchasesListResponse', 't', ''],
|
||||
'androidpublisher.reviews.get': ['GET', 'androidpublisher/v3/applications/{packageName}/reviews/{reviewId}', 'translationLanguage', '', 'Review', '', ''],
|
||||
'androidpublisher.reviews.list': ['GET', 'androidpublisher/v3/applications/{packageName}/reviews', 'maxResults startIndex token translationLanguage', '', 'ReviewsListResponse', 't', ''],
|
||||
'androidpublisher.reviews.reply': ['POST', 'androidpublisher/v3/applications/{packageName}/reviews/{reviewId}:reply', '', 'ReviewsReplyRequest', 'ReviewsReplyResponse', '', ''],
|
||||
'androidpublisher.systemapks.variants.create': ['POST', 'androidpublisher/v3/applications/{packageName}/systemApks/{versionCode}/variants', '', 'Variant', 'Variant', '', ''],
|
||||
'androidpublisher.systemapks.variants.download': ['GET', 'androidpublisher/v3/applications/{packageName}/systemApks/{versionCode}/variants/{variantId}:download', '', '', '', 'd', ''],
|
||||
'androidpublisher.systemapks.variants.get': ['GET', 'androidpublisher/v3/applications/{packageName}/systemApks/{versionCode}/variants/{variantId}', '', '', 'Variant', '', ''],
|
||||
'androidpublisher.systemapks.variants.list': ['GET', 'androidpublisher/v3/applications/{packageName}/systemApks/{versionCode}/variants', '', '', 'SystemApksListResponse', '', ''],
|
||||
'androidpublisher.users.create': ['POST', 'androidpublisher/v3/{+parent}/users', '', 'User', 'User', '', 'parent=developers/*'],
|
||||
'androidpublisher.users.delete': ['DELETE', 'androidpublisher/v3/{+name}', '', '', '', '', 'name=developers/*/users/*'],
|
||||
'androidpublisher.users.list': ['GET', 'androidpublisher/v3/{+parent}/users', 'pageSize pageToken', '', 'ListUsersResponse', 'p', 'parent=developers/*'],
|
||||
'androidpublisher.users.patch': ['PATCH', 'androidpublisher/v3/{+name}', 'updateMask', 'User', 'User', '', 'name=developers/*/users/*'],
|
||||
'playdeveloperreporting.anomalies.list': ['GET', 'v1beta1/{+parent}/anomalies', 'filter pageSize pageToken', '', 'GooglePlayDeveloperReportingV1beta1ListAnomaliesResponse', 'p', 'parent=apps/*'],
|
||||
'playdeveloperreporting.apps.fetchReleaseFilterOptions': ['GET', 'v1beta1/{+name}:fetchReleaseFilterOptions', '', '', 'GooglePlayDeveloperReportingV1beta1ReleaseFilterOptions', '', 'name=apps/*'],
|
||||
'playdeveloperreporting.apps.search': ['GET', 'v1beta1/apps:search', 'pageSize pageToken', '', 'GooglePlayDeveloperReportingV1beta1SearchAccessibleAppsResponse', 'p', ''],
|
||||
'playdeveloperreporting.vitals.anonrssandswapmemoryusage.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1AnonRssAndSwapMemoryUsageMetricSet', '', 'name=apps/*/anonRssAndSwapMemoryUsageMetricSet'],
|
||||
'playdeveloperreporting.vitals.anonrssandswapmemoryusage.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryAnonRssAndSwapMemoryUsageMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryAnonRssAndSwapMemoryUsageMetricSetResponse', '', 'name=apps/*/anonRssAndSwapMemoryUsageMetricSet'],
|
||||
'playdeveloperreporting.vitals.anrrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1AnrRateMetricSet', '', 'name=apps/*/anrRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.anrrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryAnrRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryAnrRateMetricSetResponse', '', 'name=apps/*/anrRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.bitmapmemoryusage.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1BitmapMemoryUsageMetricSet', '', 'name=apps/*/bitmapMemoryUsageMetricSet'],
|
||||
'playdeveloperreporting.vitals.bitmapmemoryusage.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryBitmapMemoryUsageMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryBitmapMemoryUsageMetricSetResponse', '', 'name=apps/*/bitmapMemoryUsageMetricSet'],
|
||||
'playdeveloperreporting.vitals.crashrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1CrashRateMetricSet', '', 'name=apps/*/crashRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.crashrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryCrashRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryCrashRateMetricSetResponse', '', 'name=apps/*/crashRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.errors.counts.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1ErrorCountMetricSet', '', 'name=apps/*/errorCountMetricSet'],
|
||||
'playdeveloperreporting.vitals.errors.counts.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryErrorCountMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryErrorCountMetricSetResponse', '', 'name=apps/*/errorCountMetricSet'],
|
||||
'playdeveloperreporting.vitals.errors.issues.search': ['GET', 'v1beta1/{+parent}/errorIssues:search', 'filter interval.endTime.day interval.endTime.hours interval.endTime.minutes interval.endTime.month interval.endTime.nanos interval.endTime.seconds interval.endTime.timeZone.id interval.endTime.timeZone.version interval.endTime.utcOffset interval.endTime.year interval.startTime.day interval.startTime.hours interval.startTime.minutes interval.startTime.month interval.startTime.nanos interval.startTime.seconds interval.startTime.timeZone.id interval.startTime.timeZone.version interval.startTime.utcOffset interval.startTime.year orderBy pageSize pageToken sampleErrorReportLimit', '', 'GooglePlayDeveloperReportingV1beta1SearchErrorIssuesResponse', 'p', 'parent=apps/*'],
|
||||
'playdeveloperreporting.vitals.errors.reports.search': ['GET', 'v1beta1/{+parent}/errorReports:search', 'filter interval.endTime.day interval.endTime.hours interval.endTime.minutes interval.endTime.month interval.endTime.nanos interval.endTime.seconds interval.endTime.timeZone.id interval.endTime.timeZone.version interval.endTime.utcOffset interval.endTime.year interval.startTime.day interval.startTime.hours interval.startTime.minutes interval.startTime.month interval.startTime.nanos interval.startTime.seconds interval.startTime.timeZone.id interval.startTime.timeZone.version interval.startTime.utcOffset interval.startTime.year pageSize pageToken', '', 'GooglePlayDeveloperReportingV1beta1SearchErrorReportsResponse', 'p', 'parent=apps/*'],
|
||||
'playdeveloperreporting.vitals.excessivewakeuprate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1ExcessiveWakeupRateMetricSet', '', 'name=apps/*/excessiveWakeupRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.excessivewakeuprate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryExcessiveWakeupRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryExcessiveWakeupRateMetricSetResponse', '', 'name=apps/*/excessiveWakeupRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.lmkrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1LmkRateMetricSet', '', 'name=apps/*/lmkRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.lmkrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryLmkRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryLmkRateMetricSetResponse', '', 'name=apps/*/lmkRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.slowrenderingrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1SlowRenderingRateMetricSet', '', 'name=apps/*/slowRenderingRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.slowrenderingrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QuerySlowRenderingRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QuerySlowRenderingRateMetricSetResponse', '', 'name=apps/*/slowRenderingRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.slowstartrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1SlowStartRateMetricSet', '', 'name=apps/*/slowStartRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.slowstartrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QuerySlowStartRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QuerySlowStartRateMetricSetResponse', '', 'name=apps/*/slowStartRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.stuckbackgroundwakelockrate.get': ['GET', 'v1beta1/{+name}', '', '', 'GooglePlayDeveloperReportingV1beta1StuckBackgroundWakelockRateMetricSet', '', 'name=apps/*/stuckBackgroundWakelockRateMetricSet'],
|
||||
'playdeveloperreporting.vitals.stuckbackgroundwakelockrate.query': ['POST', 'v1beta1/{+name}:query', '', 'GooglePlayDeveloperReportingV1beta1QueryStuckBackgroundWakelockRateMetricSetRequest', 'GooglePlayDeveloperReportingV1beta1QueryStuckBackgroundWakelockRateMetricSetResponse', '', 'name=apps/*/stuckBackgroundWakelockRateMetricSet'],
|
||||
} as const;
|
||||
68
cli/api/types.ts
Normal file
68
cli/api/types.ts
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
// Types of every App Store Connect / Google Play operation, derived from the generated rows (apple.gen.ts, play.gen.ts)
|
||||
// instead of one generated interface per endpoint: path parameters from the path template, query parameters from the
|
||||
// row's parameter list ("!" required), request and response shapes from the row's body / response columns.
|
||||
import type { APPLE_OPS } from './apple.gen';
|
||||
import type { PLAY_OPS } from './play.gen';
|
||||
|
||||
export type AppleOp = keyof typeof APPLE_OPS;
|
||||
export type PlayOp = keyof typeof PLAY_OPS;
|
||||
|
||||
/** A parameter value: arrays are comma-joined (Apple) or repeated (Google, "name*" parameters). */
|
||||
export type ParamValue = string | number | boolean | readonly (string | number)[];
|
||||
|
||||
/** "a b c" -> "a" | "b" | "c" (tail-recursive, so rows with 70+ parameters stay under the depth limit). */
|
||||
export type Split<S extends string, Acc = never> = S extends `${infer H} ${infer T}` ? Split<T, Acc | H> : S extends '' ? Acc : Acc | S;
|
||||
/** "/v1/apps/{id}/builds" -> "id"; "{+name}" -> "name". */
|
||||
export type PathParams<P extends string, Acc = never> = P extends `${string}{${infer N}}${infer R}` ? PathParams<R, Acc | (N extends `+${infer M}` ? M : N)> : Acc;
|
||||
type Required<T> = T extends `${infer N}!${string}` ? N : never;
|
||||
type Optional<T> = T extends `${string}!${string}` ? never : T extends `${infer N}*` ? N : T;
|
||||
|
||||
/** Parameters of one row: path parameters and required query parameters must be given, the rest may. */
|
||||
export type RowParams<R extends readonly string[]> =
|
||||
{ [K in PathParams<R[1]> | Required<Split<R[2]>>]: ParamValue } & { [K in Optional<Split<R[2]>>]?: ParamValue };
|
||||
|
||||
export type AppleParams<O extends AppleOp> = RowParams<(typeof APPLE_OPS)[O]>;
|
||||
export type PlayParams<O extends PlayOp> = RowParams<(typeof PLAY_OPS)[O]> & { fields?: string; prettyPrint?: boolean; quotaUser?: string };
|
||||
|
||||
// ---------------------------------------------------------------- JSON:API (App Store Connect), loosely typed
|
||||
|
||||
export interface Resource<T extends string = string> {
|
||||
type: T;
|
||||
id: string;
|
||||
attributes?: Record<string, unknown>;
|
||||
relationships?: Record<string, { data?: Linkage | Linkage[] | null; links?: Record<string, string>; meta?: Record<string, unknown> }>;
|
||||
links?: Record<string, string>;
|
||||
}
|
||||
export interface Linkage { type: string; id: string }
|
||||
export interface Document<D> {
|
||||
data: D;
|
||||
included?: Resource[];
|
||||
links?: { self?: string; next?: string; first?: string; related?: string };
|
||||
meta?: { paging?: { total?: number; limit?: number; nextCursor?: string } } & Record<string, unknown>;
|
||||
}
|
||||
|
||||
type AppleRow<O extends AppleOp> = (typeof APPLE_OPS)[O];
|
||||
|
||||
/** Response of an Apple operation: a JSON:API document of the row's resource type, raw bytes, or nothing. */
|
||||
export type AppleResponse<O extends AppleOp> =
|
||||
AppleRow<O>[4] extends `many:${infer T}` ? Document<Resource<T>[]>
|
||||
: AppleRow<O>[4] extends `one:${infer T}` ? Document<Resource<T>>
|
||||
: AppleRow<O>[4] extends `raw:${string}json` ? Record<string, unknown>
|
||||
: AppleRow<O>[4] extends `raw:${string}` ? Uint8Array
|
||||
: AppleRow<O>[4] extends 'none' ? null
|
||||
: Record<string, unknown>;
|
||||
|
||||
/** Request body of an Apple operation (undefined when it takes none). */
|
||||
export type AppleBody<O extends AppleOp> =
|
||||
AppleRow<O>[3] extends '' ? undefined
|
||||
: AppleRow<O>[3] extends 'json' ? Record<string, unknown>
|
||||
: AppleRow<O>[3] extends `${infer T}[]` ? { data: { type: T; id: string }[] }
|
||||
: { data: { type: AppleRow<O>[3]; id?: string; attributes?: Record<string, unknown>; relationships?: Record<string, unknown> } };
|
||||
|
||||
type PlayRow<O extends PlayOp> = (typeof PLAY_OPS)[O];
|
||||
|
||||
/** Google responses are plain JSON objects (schema name in the row); media downloads are bytes. */
|
||||
export type PlayResponse<O extends PlayOp> = PlayRow<O>[5] extends `${string}d${string}` ? Record<string, unknown> | Uint8Array : Record<string, unknown>;
|
||||
/** Request body: the JSON object of the row's schema, file bytes for a media upload, else nothing. */
|
||||
export type PlayBody<O extends PlayOp> =
|
||||
PlayRow<O>[3] extends '' ? (PlayRow<O>[5] extends `${string}m${string}` ? Uint8Array : undefined) : Record<string, unknown>;
|
||||
171
cli/api/wrapped.gen.ts
Normal file
171
cli/api/wrapped.gen.ts
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
// GENERATED by tools/gen-api.ts from a scan of the API calls in cli/ (outside cli/api). Do not edit: run `bun tools/gen-api.ts` (CI checks it is fresh).
|
||||
// Operation id -> the source modules (cli/<module>.ts) of storebound commands that already call it.
|
||||
export const WRAPPED: { apple: Record<string, string>; play: Record<string, string> } = {
|
||||
apple: {
|
||||
'ageRatingDeclarations_updateInstance': 'apple/appinfo',
|
||||
'analyticsReportInstances_segments_getToManyRelated': 'analytics',
|
||||
'analyticsReportRequests_createInstance': 'analytics',
|
||||
'analyticsReportRequests_reports_getToManyRelated': 'analytics',
|
||||
'analyticsReports_instances_getToManyRelated': 'analytics',
|
||||
'appAvailabilitiesV2_createInstance': 'apple/appinfo',
|
||||
'appEncryptionDeclarations_getCollection': 'apple/encryption',
|
||||
'appInfos_ageRatingDeclaration_getToOneRelated': 'validate',
|
||||
'appInfos_appInfoLocalizations_getToManyRelated': 'apple/listing validate',
|
||||
'appInfos_updateInstance': 'apple/appinfo',
|
||||
'appPreviewSets_appPreviews_getToManyRelated': 'apple/previews',
|
||||
'appPreviewSets_createInstance': 'apple/previews',
|
||||
'appPreviews_createInstance': 'apple/previews',
|
||||
'appPreviews_deleteInstance': 'apple/previews',
|
||||
'appPreviews_updateInstance': 'apple/previews',
|
||||
'appPriceSchedules_createInstance': 'apple/appinfo',
|
||||
'appScreenshotSets_appScreenshots_getToManyRelated': 'apple/ppo apple/screenshots validate',
|
||||
'appScreenshotSets_createInstance': 'apple/screenshots',
|
||||
'appScreenshots_createInstance': 'apple/screenshots',
|
||||
'appScreenshots_deleteInstance': 'apple/screenshots',
|
||||
'appScreenshots_updateInstance': 'apple/screenshots',
|
||||
'appStoreReviewDetails_createInstance': 'apple/review-details',
|
||||
'appStoreReviewDetails_updateInstance': 'apple/review-details',
|
||||
'appStoreVersionExperimentTreatmentLocalizations_appScreenshotSets_getToManyRelated': 'apple/ppo',
|
||||
'appStoreVersionExperimentTreatmentLocalizations_createInstance': 'lib/ppo',
|
||||
'appStoreVersionExperimentTreatments_appStoreVersionExperimentTreatmentLocalizations_getToManyRelated': 'apple/ppo',
|
||||
'appStoreVersionExperimentTreatments_createInstance': 'lib/ppo',
|
||||
'appStoreVersionExperimentsV2_appStoreVersionExperimentTreatments_getToManyRelated': 'apple/ppo',
|
||||
'appStoreVersionExperimentsV2_createInstance': 'lib/ppo',
|
||||
'appStoreVersionExperimentsV2_updateInstance': 'lib/ppo',
|
||||
'appStoreVersionLocalizations_appPreviewSets_getToManyRelated': 'apple/previews',
|
||||
'appStoreVersionLocalizations_appScreenshotSets_getToManyRelated': 'apple/screenshots validate',
|
||||
'appStoreVersionPhasedReleases_createInstance': 'apple/release',
|
||||
'appStoreVersionPhasedReleases_updateInstance': 'apple/release',
|
||||
'appStoreVersionReleaseRequests_createInstance': 'apple/release',
|
||||
'appStoreVersions_appStoreReviewDetail_getToOneRelated': 'apple/review-details validate',
|
||||
'appStoreVersions_appStoreVersionLocalizations_getToManyRelated': 'apple/listing apple/previews apple/screenshots validate',
|
||||
'appStoreVersions_appStoreVersionPhasedRelease_getToOneRelated': 'apple/release apple/status',
|
||||
'appStoreVersions_build_getToOneRelated': 'validate',
|
||||
'appStoreVersions_build_updateToOneRelationship': 'apple/listing',
|
||||
'appStoreVersions_createInstance': 'apple/listing',
|
||||
'appStoreVersions_updateInstance': 'apple/listing',
|
||||
'apps_analyticsReportRequests_getToManyRelated': 'analytics',
|
||||
'apps_appAvailabilityV2_getToOneRelated': 'apple/appinfo validate',
|
||||
'apps_appInfos_getToManyRelated': 'apple/asc',
|
||||
'apps_appPricePoints_getToManyRelated': 'apple/appinfo',
|
||||
'apps_appPriceSchedule_getToOneRelated': 'apple/appinfo validate',
|
||||
'apps_appStoreVersionExperimentsV2_getToManyRelated': 'apple/ppo',
|
||||
'apps_appStoreVersions_getToManyRelated': 'apple/asc apple/release apple/review-details apple/status lib/store-apps validate',
|
||||
'apps_betaAppLocalizations_getToManyRelated': 'apple/testflight',
|
||||
'apps_betaAppReviewDetail_getToOneRelated': 'apple/testflight',
|
||||
'apps_betaFeedbackCrashSubmissions_getToManyRelated': 'health',
|
||||
'apps_betaGroups_getToManyRelated': 'apple/testflight',
|
||||
'apps_customerReviews_getToManyRelated': 'reviews',
|
||||
'apps_getCollection': 'apple/asc apple/bundle apps lib/store-apps',
|
||||
'apps_getInstance': 'apple/status',
|
||||
'apps_inAppPurchasesV2_getToManyRelated': 'apple/iap apple/iap-review apple/status catalog prices validate',
|
||||
'apps_perfPowerMetrics_getToManyRelated': 'health',
|
||||
'apps_subscriptionGroups_getToManyRelated': 'apple/subscriptions catalog validate',
|
||||
'apps_updateInstance': 'apple/appinfo',
|
||||
'betaAppLocalizations_createInstance': 'lib/testflight',
|
||||
'betaAppLocalizations_updateInstance': 'lib/testflight',
|
||||
'betaAppReviewDetails_updateInstance': 'lib/testflight',
|
||||
'betaAppReviewSubmissions_createInstance': 'lib/testflight',
|
||||
'betaBuildLocalizations_createInstance': 'lib/testflight',
|
||||
'betaBuildLocalizations_updateInstance': 'lib/testflight',
|
||||
'betaGroups_betaTesters_createToManyRelationship': 'lib/testflight',
|
||||
'betaGroups_betaTesters_deleteToManyRelationship': 'lib/testflight',
|
||||
'betaGroups_betaTesters_getToManyRelated': 'apple/testflight',
|
||||
'betaGroups_builds_createToManyRelationship': 'lib/testflight',
|
||||
'betaGroups_builds_getToManyRelated': 'apple/testflight',
|
||||
'betaGroups_createInstance': 'lib/testflight',
|
||||
'betaGroups_getCollection': 'apple/testflight',
|
||||
'betaTesterInvitations_createInstance': 'lib/testflight',
|
||||
'betaTesters_createInstance': 'lib/testflight',
|
||||
'betaTesters_getCollection': 'apple/testflight',
|
||||
'builds_appEncryptionDeclaration_getToOneRelated': 'validate',
|
||||
'builds_betaAppReviewSubmission_getToOneRelated': 'apple/testflight',
|
||||
'builds_betaBuildLocalizations_getToManyRelated': 'apple/testflight',
|
||||
'builds_diagnosticSignatures_getToManyRelated': 'health',
|
||||
'builds_getCollection': 'apple/encryption apple/listing apple/next-build apple/status apple/testflight health lib/store-apps',
|
||||
'builds_updateInstance': 'apple/encryption',
|
||||
'bundleIds_createInstance': 'apple/bundle',
|
||||
'bundleIds_getCollection': 'apple/bundle',
|
||||
'customerReviewResponses_createInstance': 'lib/reviews',
|
||||
'inAppPurchaseAppStoreReviewScreenshots_createInstance': 'apple/iap-review',
|
||||
'inAppPurchaseAppStoreReviewScreenshots_deleteInstance': 'apple/iap-review',
|
||||
'inAppPurchaseAppStoreReviewScreenshots_updateInstance': 'apple/iap-review',
|
||||
'inAppPurchaseAvailabilities_createInstance': 'apple/iap',
|
||||
'inAppPurchaseLocalizations_createInstance': 'apple/iap',
|
||||
'inAppPurchasePriceSchedules_automaticPrices_getToManyRelated': 'prices',
|
||||
'inAppPurchasePriceSchedules_baseTerritory_getToOneRelated': 'prices',
|
||||
'inAppPurchasePriceSchedules_createInstance': 'apple/iap prices',
|
||||
'inAppPurchasePriceSchedules_manualPrices_getToManyRelated': 'prices',
|
||||
'inAppPurchasesV2_appStoreReviewScreenshot_getToOneRelated': 'apple/iap-review validate',
|
||||
'inAppPurchasesV2_createInstance': 'apple/iap',
|
||||
'inAppPurchasesV2_iapPriceSchedule_getToOneRelated': 'apple/iap catalog',
|
||||
'inAppPurchasesV2_inAppPurchaseAvailability_getToOneRelated': 'apple/iap',
|
||||
'inAppPurchasesV2_inAppPurchaseLocalizations_getToManyRelated': 'apple/iap catalog',
|
||||
'inAppPurchasesV2_pricePoints_getToManyRelated': 'apple/iap prices',
|
||||
'reviewSubmissions_getCollection': 'apple/status',
|
||||
'reviewSubmissions_updateInstance': 'apple/status',
|
||||
'subscriptionAppStoreReviewScreenshots_createInstance': 'apple/subscriptions',
|
||||
'subscriptionAppStoreReviewScreenshots_updateInstance': 'apple/subscriptions',
|
||||
'subscriptionAvailabilities_createInstance': 'apple/subscriptions',
|
||||
'subscriptionGroupLocalizations_createInstance': 'apple/subscriptions',
|
||||
'subscriptionGroups_createInstance': 'apple/subscriptions',
|
||||
'subscriptionGroups_subscriptionGroupLocalizations_getToManyRelated': 'apple/subscriptions validate',
|
||||
'subscriptionGroups_subscriptions_getToManyRelated': 'apple/subscriptions catalog validate',
|
||||
'subscriptionLocalizations_createInstance': 'apple/subscriptions',
|
||||
'subscriptionOfferCodeCustomCodes_createInstance': 'apple/subscriptions',
|
||||
'subscriptionOfferCodes_createInstance': 'apple/subscriptions',
|
||||
'subscriptionOfferCodes_customCodes_getToManyRelated': 'apple/subscriptions',
|
||||
'subscriptionPricePoints_equalizations_getToManyRelated': 'apple/subscriptions',
|
||||
'subscriptionPromotionalOffers_createInstance': 'apple/subscriptions',
|
||||
'subscriptions_appStoreReviewScreenshot_getToOneRelated': 'apple/subscriptions validate',
|
||||
'subscriptions_createInstance': 'apple/subscriptions',
|
||||
'subscriptions_introductoryOffers_getToManyRelated': 'apple/subscriptions catalog',
|
||||
'subscriptions_offerCodes_getToManyRelated': 'apple/subscriptions catalog',
|
||||
'subscriptions_pricePoints_getToManyRelated': 'apple/subscriptions',
|
||||
'subscriptions_prices_getToManyRelated': 'apple/subscriptions catalog',
|
||||
'subscriptions_promotionalOffers_getToManyRelated': 'apple/subscriptions catalog',
|
||||
'subscriptions_subscriptionAvailability_getToOneRelated': 'apple/subscriptions',
|
||||
'subscriptions_subscriptionLocalizations_getToManyRelated': 'apple/subscriptions catalog validate',
|
||||
'subscriptions_updateInstance': 'apple/subscriptions',
|
||||
'territories_getCollection': 'apple/appinfo apple/iap apple/subscriptions',
|
||||
},
|
||||
play: {
|
||||
'androidpublisher.applications.dataSafety': 'play/data-safety',
|
||||
'androidpublisher.edits.apks.list': 'play/next-version-code',
|
||||
'androidpublisher.edits.bundles.list': 'play/next-version-code',
|
||||
'androidpublisher.edits.bundles.upload': 'play/release',
|
||||
'androidpublisher.edits.commit': 'play/client',
|
||||
'androidpublisher.edits.delete': 'apps play/client validate',
|
||||
'androidpublisher.edits.details.get': 'apps play/listing play/status validate',
|
||||
'androidpublisher.edits.details.update': 'play/listing',
|
||||
'androidpublisher.edits.images.deleteall': 'play/images',
|
||||
'androidpublisher.edits.images.list': 'apps play/images validate',
|
||||
'androidpublisher.edits.images.upload': 'play/images',
|
||||
'androidpublisher.edits.insert': 'apps play/client validate',
|
||||
'androidpublisher.edits.listings.list': 'play/listing play/status validate',
|
||||
'androidpublisher.edits.listings.update': 'play/listing',
|
||||
'androidpublisher.edits.tracks.get': 'play/rollout',
|
||||
'androidpublisher.edits.tracks.list': 'play/next-version-code play/status validate',
|
||||
'androidpublisher.edits.tracks.update': 'play/release play/rollout',
|
||||
'androidpublisher.edits.validate': 'play/client',
|
||||
'androidpublisher.monetization.convertRegionPrices': 'play/products play/subscriptions prices',
|
||||
'androidpublisher.monetization.onetimeproducts.get': 'prices',
|
||||
'androidpublisher.monetization.onetimeproducts.list': 'play/products',
|
||||
'androidpublisher.monetization.onetimeproducts.patch': 'play/products prices',
|
||||
'androidpublisher.monetization.onetimeproducts.purchaseOptions.batchUpdateStates': 'play/products',
|
||||
'androidpublisher.monetization.subscriptions.basePlans.activate': 'play/subscriptions',
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.activate': 'play/subscriptions',
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.create': 'play/subscriptions',
|
||||
'androidpublisher.monetization.subscriptions.basePlans.offers.list': 'catalog play/subscriptions',
|
||||
'androidpublisher.monetization.subscriptions.create': 'play/subscriptions',
|
||||
'androidpublisher.monetization.subscriptions.list': 'catalog play/subscriptions validate',
|
||||
'androidpublisher.monetization.subscriptions.patch': 'play/subscriptions',
|
||||
'androidpublisher.reviews.list': 'reviews',
|
||||
'androidpublisher.reviews.reply': 'lib/reviews',
|
||||
'playdeveloperreporting.apps.search': 'apps lib/store-apps',
|
||||
'playdeveloperreporting.vitals.anrrate.query': 'health',
|
||||
'playdeveloperreporting.vitals.crashrate.get': 'health',
|
||||
'playdeveloperreporting.vitals.crashrate.query': 'health',
|
||||
'playdeveloperreporting.vitals.errors.issues.search': 'health',
|
||||
},
|
||||
};
|
||||
|
|
@ -24,7 +24,9 @@ export function setUpToDate(existing: { checksum?: string | null; state?: string
|
|||
return existing.length === want.length && existing.every((e, i) => e.checksum === want[i] && DELIVERED.includes(e.state ?? ''));
|
||||
}
|
||||
|
||||
export async function ascClient(root: string, bundleId: string, appIdHint?: string) {
|
||||
/** Cached ES256 token getter for the team API key (env or .storebound/): valid 18 minutes, renewed after 15. Shared by
|
||||
* ascClient and the generic `storebound api apple` client (cli/api/client.ts). */
|
||||
export function ascJwt(root: string): { jwt: () => string; keyId: string } {
|
||||
const k = ascKey(root);
|
||||
const key = createPrivateKey(k.pem);
|
||||
let cached = { jwt: '', until: 0 };
|
||||
|
|
@ -36,6 +38,12 @@ export async function ascClient(root: string, bundleId: string, appIdHint?: stri
|
|||
cached = { jwt: `${h}.${p}.${b64(sign('sha256', Buffer.from(h + '.' + p), { key, dsaEncoding: 'ieee-p1363' }))}`, until: now + 900 };
|
||||
return cached.jwt;
|
||||
}
|
||||
return { jwt, keyId: k.keyId };
|
||||
}
|
||||
|
||||
export async function ascClient(root: string, bundleId: string, appIdHint?: string) {
|
||||
const k = ascJwt(root);
|
||||
const jwt = k.jwt;
|
||||
|
||||
async function asc(method: string, path: string, body?: unknown, attempt = 1): Promise<J> {
|
||||
const r = await fetch(path.startsWith('http') ? path : 'https://api.appstoreconnect.apple.com' + path, {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const PLAIN: Record<string, [() => Promise<Plain>, string]> = {
|
|||
'desktop': [() => import('./desktop'), 'open the storebound desktop app (in an app folder: add or select it there); not installed: the download for this system, --download saves it to ~/Downloads after checking its signature (never installs)'],
|
||||
'doctor': [() => import('./doctor'), 'local tools for screenshots, previews, icons and captures (ffmpeg, Chrome, playwright, Xcode, adb, git) and how to install what is missing; --json'],
|
||||
'scan': [() => import('./scan'), 'offline, read-only rejection-risk scan of the project itself (stack, SDKs, Info.plist, manifest, listings) with guideline, evidence file:line, fix and skill, plus the Data safety / App Privacy / ATT / privacy manifest proposal; --write puts the detected answers into the config; --json; exit 1 on blockers'],
|
||||
'api': [() => import('./api'), 'every App Store Connect / Google Play API operation: list | coverage | apple|play <operationId|METHOD path> [--param k=v] [--body f.json] [--all-pages] (GET runs; writes dry unless --yes in a terminal; owner-only ones need the id typed)'],
|
||||
'privacy-manifest': [() => import('./privacy-manifest'), 'iOS PrivacyInfo.xcprivacy + required-reason API + SDK manifest scan (--ios <path>)'],
|
||||
'ws': [() => import('./workspace'), 'many apps and studios (storebound.workspace.json): init | list | status (apps x stores, parallel) | check | validate | run <command> --apps a,b|--all (writes dry unless --apply) | apps import --account <profile> | desktop export|import'],
|
||||
'release': [() => import('./release'), 'status [--app a,b] [--versions]: both stores on one train per version (build > testing > review > live > rollout %) | plan <version>: what is left on each store, in fix order; read-only, --json'],
|
||||
|
|
|
|||
|
|
@ -6,21 +6,25 @@ export interface Args {
|
|||
str(name: string, d: string): string;
|
||||
num(name: string, d: number): number;
|
||||
list(name: string): string[];
|
||||
/** Every value of a flag given more than once (--param a=1 --param b=2), in order. */
|
||||
many(name: string): string[];
|
||||
}
|
||||
|
||||
export function parseArgs(argv: string[], booleans: string[] = []): Args {
|
||||
const flags = new Map<string, string>();
|
||||
const repeated = new Map<string, string[]>();
|
||||
const set = (k: string, v: string) => { flags.set(k, v); repeated.set(k, [...(repeated.get(k) ?? []), v]); };
|
||||
const _: string[] = [];
|
||||
const bool = new Set(['dry', 'yes', 'help', 'json', 'verbose', ...booleans]);
|
||||
const bool = new Set(['dry', 'yes', 'help', 'json', 'verbose', 'all-pages', ...booleans]);
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i]!;
|
||||
if (!a.startsWith('--')) { _.push(a); continue; }
|
||||
const eq = a.indexOf('=');
|
||||
if (eq > 0) { flags.set(a.slice(2, eq), a.slice(eq + 1)); continue; }
|
||||
if (eq > 0) { set(a.slice(2, eq), a.slice(eq + 1)); continue; }
|
||||
const name = a.slice(2);
|
||||
const next = argv[i + 1];
|
||||
if (bool.has(name) || name.startsWith('no-') || next === undefined || next.startsWith('--')) flags.set(name, 'true');
|
||||
else { flags.set(name, next); i++; }
|
||||
if (bool.has(name) || name.startsWith('no-') || next === undefined || next.startsWith('--')) set(name, 'true');
|
||||
else { set(name, next); i++; }
|
||||
}
|
||||
const get = (n: string) => flags.get(n);
|
||||
return {
|
||||
|
|
@ -30,5 +34,6 @@ export function parseArgs(argv: string[], booleans: string[] = []): Args {
|
|||
str: (n, d) => get(n) ?? d,
|
||||
num: (n, d) => { const v = get(n); const x = v === undefined ? d : Number(v); if (Number.isNaN(x)) throw new Error(`--${n}: not a number`); return x; },
|
||||
list: n => (get(n) ?? '').split(',').map(s => s.trim()).filter(Boolean),
|
||||
many: n => repeated.get(n) ?? [],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// submits for review, releases to the public, resumes / completes a rollout, cancels a submission or deletes is
|
||||
// exposed. Those stay terminal commands the owner runs (they also ask for confirmation there).
|
||||
|
||||
export interface JsonSchema { type: string; description?: string; enum?: (string | number)[]; default?: unknown; items?: JsonSchema; minimum?: number; maximum?: number; pattern?: string }
|
||||
export interface JsonSchema { type: string; description?: string; enum?: (string | number)[]; default?: unknown; items?: JsonSchema; minimum?: number; maximum?: number; pattern?: string; additionalProperties?: JsonSchema | boolean }
|
||||
|
||||
export interface ToolDef {
|
||||
name: string;
|
||||
|
|
@ -209,6 +209,14 @@ export const TOOLS: ToolDef[] = [
|
|||
description: 'Sync the screenshots of one shots variant (renders/<variant>/<lang>/...) into the matching treatment of the editable Product Page Optimization test, per locale (MD5-idempotent; changed sets are replaced). Nothing is shown to players until the owner starts the test.',
|
||||
props: { variant, experiment: { type: 'string', description: 'Test name (default: the one editable test)' }, only },
|
||||
required: ['variant'], args: i => [...opt('variant', i.variant), ...opt('experiment', i.experiment), ...opt('only', i.only)] },
|
||||
{ name: 'api_get', title: 'Any store API read', command: ['api', 'get'], write: false, network: true,
|
||||
description: 'Read-only call of any App Store Connect API or Google Play Developer API GET operation by its operation id (every one is listed by `storebound api list` and in docs/api-coverage.md), e.g. store apple, operation apps_getCollection, params {"filter[bundleId]": "com.example.app"}. GET only: writes, and anything that submits, releases, deletes or cancels, are never available here.',
|
||||
props: { store: { type: 'string', enum: ['apple', 'play'] },
|
||||
operation: { type: 'string', pattern: '^[A-Za-z][A-Za-z0-9_.]{0,200}$', description: 'Operation id: Apple e.g. apps_getCollection, Google e.g. androidpublisher.reviews.list (the API prefix may be left out)' },
|
||||
params: { type: 'object', additionalProperties: { type: 'string' }, description: 'Path and query parameters by name (string, number or boolean values; lists comma-separated)' },
|
||||
all_pages: { type: 'boolean', description: 'Follow every page and merge them' } },
|
||||
required: ['store', 'operation'],
|
||||
args: i => [String(i.store), String(i.operation), ...Object.entries((i.params ?? {}) as Record<string, unknown>).map(([k, v]) => `--param=${k}=${String(v)}`), ...flag('all-pages', i.all_pages), '--json'] },
|
||||
{ name: 'icons', title: 'Generate icons', command: ['icons'], write: true, network: false, idempotent: true,
|
||||
description: 'Write every store / launcher / web icon from the artwork in the config (local files, needs ffmpeg).' },
|
||||
{ name: 'import_fastlane', title: 'Import a fastlane setup', command: ['import', 'fastlane'], write: true, network: false, idempotent: true,
|
||||
|
|
@ -272,8 +280,10 @@ export function validateInput(t: ToolDef, input: unknown): string[] {
|
|||
for (const [k, v] of Object.entries(i)) {
|
||||
const p = s.properties[k];
|
||||
if (!p) { e.push(`${k}: unknown argument`); continue; }
|
||||
const ok = p.type === 'integer' ? Number.isInteger(v) : p.type === 'boolean' ? typeof v === 'boolean' : p.type === 'string' ? typeof v === 'string' : true;
|
||||
if (!ok) { e.push(`${k}: must be ${p.type}`); continue; }
|
||||
const ok = p.type === 'integer' ? Number.isInteger(v) : p.type === 'boolean' ? typeof v === 'boolean' : p.type === 'string' ? typeof v === 'string'
|
||||
: p.type === 'object' ? typeof v === 'object' && v !== null && !Array.isArray(v) && Object.entries(v).every(([pk, pv]) => /^[A-Za-z][A-Za-z0-9_.[\]+-]{0,100}$/.test(pk) && ['string', 'number', 'boolean'].includes(typeof pv) && !/[\n\r]/.test(String(pv)))
|
||||
: true;
|
||||
if (!ok) { e.push(`${k}: must be ${p.type === 'object' ? 'an object of name -> string / number / boolean' : p.type}`); continue; }
|
||||
if (p.enum && !p.enum.includes(v as string)) e.push(`${k}: one of ${p.enum.join(', ')}`);
|
||||
if (p.pattern && typeof v === 'string' && !new RegExp(p.pattern).test(v)) e.push(`${k}: does not match ${p.pattern}`);
|
||||
if (p.minimum !== undefined && typeof v === 'number' && v < p.minimum) e.push(`${k}: >= ${p.minimum}`);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ const running = new Map<Id, Running>();
|
|||
function cancel(id: Id | undefined): void { if (id !== undefined) running.get(id)?.cancel(); }
|
||||
|
||||
async function runCli(argv: string[], id: Id): Promise<{ code: number; out: string }> {
|
||||
const r = runCommand(argv, { cwd: process.env.STOREBOUND_PROJECT || process.cwd() });
|
||||
// STOREBOUND_MCP: `storebound api` never sends a write from an MCP call, whatever the arguments
|
||||
const r = runCommand(argv, { cwd: process.env.STOREBOUND_PROJECT || process.cwd(), env: { STOREBOUND_MCP: '1' } });
|
||||
running.set(id, r);
|
||||
try { const { code, out } = await r.result; return { code, out }; } finally { running.delete(id); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ const lang = { type: 'string', pattern: '^[A-Za-z0-9_-]{1,20}(,[A-Za-z0-9_-]{1,2
|
|||
export const PRICE_SHEET_RE = /^(?!-)[^\x00-\x1f]{1,1000}\.[cC][sS][vV]$/;
|
||||
|
||||
/** MCP tools the desktop profile leaves out (sending builds to testers on Play, release state changes: the window has
|
||||
* the owner actions for those; workspace and release-train reads: the window has portfolio.status for those). */
|
||||
export const DESKTOP_EXCLUDED = new Set(['play_release_testing', 'apple_phased_release', 'workspace_list', 'workspace_status', 'release_status', 'release_plan']);
|
||||
* the owner actions for those; workspace and release-train reads: the window has portfolio.status for those; the raw API reader api_get). */
|
||||
export const DESKTOP_EXCLUDED = new Set(['play_release_testing', 'apple_phased_release', 'workspace_list', 'workspace_status', 'release_status', 'release_plan', 'api_get']);
|
||||
/** Words no desktop method name may contain. */
|
||||
export const FORBIDDEN_METHOD_WORDS = /submit|release|publish|rollout|resume|complete|send|start|stop|cancel|delete|remove|invite/i;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue