@sylphx/sdk 0.32.18 → 0.32.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/money.d.ts CHANGED
@@ -956,6 +956,11 @@ export interface GetStoreConnectionRequest {
956
956
  /** The name of the store connection to get. */
957
957
  name: string;
958
958
  }
959
+ /** The request of GetStoreConsumptionRequest. */
960
+ export interface GetStoreConsumptionRequestRequest {
961
+ /** The name of the store consumption request to get. */
962
+ name: string;
963
+ }
959
964
  /** The request of GetStorePurchase. */
960
965
  export interface GetStorePurchaseRequest {
961
966
  /** The name of the store purchase to get. */
@@ -1396,6 +1401,24 @@ export interface ListStoreConnectionsResponse {
1396
1401
  /** The token of the next page; empty on the last page. */
1397
1402
  nextPageToken?: string;
1398
1403
  }
1404
+ /** The request of ListStoreConsumptionRequests. */
1405
+ export interface ListStoreConsumptionRequestsRequest {
1406
+ /** The parent to list in. */
1407
+ parent: string;
1408
+ /** At most this many; default 50, clamped to 1000. */
1409
+ pageSize?: number;
1410
+ /** `next_page_token` of the previous page. */
1411
+ pageToken?: string;
1412
+ /** AIP-160 filter over `store`, `transaction_id`, `store_purchase`, `status`. */
1413
+ filter?: string;
1414
+ }
1415
+ /** The response of ListStoreConsumptionRequests. */
1416
+ export interface ListStoreConsumptionRequestsResponse {
1417
+ /** The page. */
1418
+ storeConsumptionRequests?: StoreConsumptionRequest[];
1419
+ /** The token of the next page; empty on the last page. */
1420
+ nextPageToken?: string;
1421
+ }
1399
1422
  /** The request of ListStorePurchases. */
1400
1423
  export interface ListStorePurchasesRequest {
1401
1424
  /** The parent to list in. */
@@ -1797,6 +1820,50 @@ export interface ReleaseUsageReservationRequest {
1797
1820
  /** The reservation to release. */
1798
1821
  name: string;
1799
1822
  }
1823
+ /** The request of ReportStorePurchaseUsage. */
1824
+ export interface ReportStorePurchaseUsageRequest {
1825
+ /** The store purchase to report usage for. */
1826
+ name: string;
1827
+ /**
1828
+ * Optional consumption request resource name when targeting a specific
1829
+ * captured `CONSUMPTION_REQUEST`.
1830
+ */
1831
+ consumptionRequest?: string;
1832
+ /**
1833
+ * Apple `deliveryStatus`: `DELIVERED`, `UNDELIVERED_QUALITY_ISSUE`,
1834
+ * `UNDELIVERED_WRONG_ITEM`, `UNDELIVERED_SERVER_OUTAGE`, or
1835
+ * `UNDELIVERED_OTHER`.
1836
+ */
1837
+ deliveryStatus: string;
1838
+ /**
1839
+ * Apple `sampleContentProvided`: whether a free sample or trial was offered.
1840
+ * Explicit presence is required so an omitted value is never defaulted.
1841
+ */
1842
+ sampleContentProvided: boolean;
1843
+ /**
1844
+ * Apple `consumptionPercentage` in milliunits (0..=100000, where 25000 is
1845
+ * 25%). Required for non-subscription purchases (0 when undelivered) and
1846
+ * omitted for auto-renewable subscriptions.
1847
+ */
1848
+ consumptionPercentage?: number;
1849
+ /**
1850
+ * Optional Apple `refundPreference`: `DECLINE`, `GRANT_FULL`, or
1851
+ * `GRANT_PRORATED`.
1852
+ */
1853
+ refundPreference?: string;
1854
+ /**
1855
+ * Non-empty attestation confirming the caller holds exclusive reporting
1856
+ * custody for this purchase (never a consent override).
1857
+ */
1858
+ custodyAttestation: string;
1859
+ }
1860
+ /** The response of ReportStorePurchaseUsage. */
1861
+ export interface ReportStorePurchaseUsageResponse {
1862
+ /** The updated store consumption request record. */
1863
+ storeConsumptionRequest?: StoreConsumptionRequest;
1864
+ /** The store purchase that was answered. */
1865
+ storePurchase?: StorePurchase;
1866
+ }
1800
1867
  /** Resolves held evidence without altering its original receipt. */
1801
1868
  export interface ResolveBankReceiptRequest {
1802
1869
  /** Receipt name. */
@@ -2203,6 +2270,60 @@ export interface StoreConnectionStatus {
2203
2270
  /** The service account's email, read from the stored key (Play only). */
2204
2271
  readonly serviceAccountEmail?: string;
2205
2272
  }
2273
+ /**
2274
+ * A Store Consumption Request is an Apple App Store Server Notifications V2
2275
+ * `CONSUMPTION_REQUEST` observed by Money, with its 12-hour deadline and
2276
+ * immutable dispatch status. Money never invents usage or consent facts and
2277
+ * sends nothing to Apple without a verified buyer consent grant.
2278
+ */
2279
+ export interface StoreConsumptionRequest {
2280
+ /** `orgs/{org}/projects/{project}/envs/{env}/store_consumption_requests/{store_consumption_request}`. */
2281
+ name?: string;
2282
+ /** `scr_<cell><ulid>`; never reused. */
2283
+ readonly uid?: string;
2284
+ /** Resource metadata. */
2285
+ meta?: common.ResourceMeta;
2286
+ /** Store name (`app_store`). */
2287
+ readonly store?: string;
2288
+ /** App Store bundle identifier. */
2289
+ readonly bundleId?: string;
2290
+ /** `production` or `sandbox`. */
2291
+ readonly environment?: string;
2292
+ /** App Store transaction identifier. */
2293
+ readonly transactionId?: string;
2294
+ /** App Store original transaction identifier. */
2295
+ readonly originalTransactionId?: string;
2296
+ /** Store notification UUID that opened this request. */
2297
+ readonly notificationId?: string;
2298
+ /** Apple's `consumptionRequestReason`, when present. */
2299
+ readonly consumptionRequestReason?: string;
2300
+ /** Linked StorePurchase resource name, when verified in Money. */
2301
+ readonly storePurchase?: string;
2302
+ /** Linked buyer subject, when known. */
2303
+ readonly subject?: Subject;
2304
+ /**
2305
+ * Current state: `pending`, `consent_missing`, `consent_withdrawn`,
2306
+ * `in_flight`, `sent`, `failed_retryable`, `failed_terminal`, or
2307
+ * `expired`.
2308
+ */
2309
+ readonly status?: string;
2310
+ /** When Money observed the notification. */
2311
+ readonly observedTime?: string;
2312
+ /** 12-hour Apple response deadline. */
2313
+ readonly deadlineTime?: string;
2314
+ /** Number of outbound Apple Send Consumption attempts started. */
2315
+ readonly attemptCount?: number;
2316
+ /** Timestamp of the last outbound Apple Send Consumption attempt. */
2317
+ readonly lastAttemptTime?: string;
2318
+ /** Timestamp when Apple accepted the consumption report (HTTP 202). */
2319
+ readonly sentTime?: string;
2320
+ /** HTTP status code returned by Apple's consumption endpoint (202 when sent). */
2321
+ readonly appleHttpStatus?: number;
2322
+ /** Last fail-closed refusal reason, when blocked before calling Apple. */
2323
+ readonly lastRefusalReason?: string;
2324
+ /** Consent ledger event id evaluated for the dispatch, when present. */
2325
+ readonly consentId?: string;
2326
+ }
2206
2327
  /**
2207
2328
  * A Store Purchase is one store transaction Money verified with the store and
2208
2329
  * bound to one subject. Re-verifying it returns the same record and grant.
@@ -2836,6 +2957,8 @@ export declare class MoneyApi {
2836
2957
  readonly storeConnections: StoreConnectionsCollection;
2837
2958
  /** The `store_purchases` collection. */
2838
2959
  readonly storePurchases: StorePurchasesCollection;
2960
+ /** The `store_consumption_requests` collection. */
2961
+ readonly storeConsumptionRequests: StoreConsumptionRequestsCollection;
2839
2962
  /** The `customer_subscriptions` collection. */
2840
2963
  readonly customerSubscriptions: CustomerSubscriptionsCollection;
2841
2964
  /** The `entitlement_grants` collection. */
@@ -3196,6 +3319,41 @@ export declare class StorePurchasesCollection {
3196
3319
  list(request: ListStorePurchasesRequest): Promise<ListStorePurchasesResponse>;
3197
3320
  /** Every item of every page of `list`. */
3198
3321
  listAll(request: ListStorePurchasesRequest): AsyncGenerator<StorePurchase>;
3322
+ /**
3323
+ * Reports verified delivery and usage facts for an App Store purchase in
3324
+ * answer to an observed `CONSUMPTION_REQUEST`. Strictly fails closed (0
3325
+ * outbound Apple calls) unless Money's append-only buyer-authenticated
3326
+ * consent ledger holds an unwithdrawn `granted` decision for this purchase
3327
+ * or app.
3328
+ *
3329
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/store_purchases/*}:reportUsage` · permission `billing:write` · effect `write`
3330
+ *
3331
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
3332
+ */
3333
+ reportUsage(request: ReportStorePurchaseUsageRequest): Promise<ReportStorePurchaseUsageResponse>;
3334
+ }
3335
+ /** `store_consumption_requests` of Sylphx Money: Resource type `money.sylphx.com/StoreConsumptionRequest`. */
3336
+ export declare class StoreConsumptionRequestsCollection {
3337
+ private readonly client;
3338
+ constructor(client: runtime.Client);
3339
+ /**
3340
+ * Gets a captured store consumption request.
3341
+ *
3342
+ * `GET /v1/{name=orgs/*\/projects/*\/envs/*\/store_consumption_requests/*}` · permission `billing:read` · effect `read`
3343
+ *
3344
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
3345
+ */
3346
+ get(request: GetStoreConsumptionRequestRequest): Promise<StoreConsumptionRequest>;
3347
+ /**
3348
+ * Lists captured store consumption requests, newest first.
3349
+ *
3350
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/store_consumption_requests` · permission `billing:read` · effect `read`
3351
+ *
3352
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
3353
+ */
3354
+ list(request: ListStoreConsumptionRequestsRequest): Promise<ListStoreConsumptionRequestsResponse>;
3355
+ /** Every item of every page of `list`. */
3356
+ listAll(request: ListStoreConsumptionRequestsRequest): AsyncGenerator<StoreConsumptionRequest>;
3199
3357
  }
3200
3358
  /** `customer_subscriptions` of Sylphx Money: Resource type `money.sylphx.com/CustomerSubscription`. */
3201
3359
  export declare class CustomerSubscriptionsCollection {
package/dist/money.js CHANGED
@@ -268,6 +268,7 @@ runtime.registerSchemas({
268
268
  ['currencyCode', 'currency_code'],
269
269
  ],
270
270
  'sylphx.money.v1.GetStoreConnectionRequest': [],
271
+ 'sylphx.money.v1.GetStoreConsumptionRequestRequest': [],
271
272
  'sylphx.money.v1.GetStorePurchaseRequest': [],
272
273
  'sylphx.money.v1.GetTestClockRequest': [],
273
274
  'sylphx.money.v1.GetUsageInvoiceRequest': [],
@@ -416,6 +417,14 @@ runtime.registerSchemas({
416
417
  ['storeConnections', 'store_connections', 'sylphx.money.v1.StoreConnection'],
417
418
  ['nextPageToken', 'next_page_token'],
418
419
  ],
420
+ 'sylphx.money.v1.ListStoreConsumptionRequestsRequest': [
421
+ ['pageSize', 'page_size'],
422
+ ['pageToken', 'page_token'],
423
+ ],
424
+ 'sylphx.money.v1.ListStoreConsumptionRequestsResponse': [
425
+ ['storeConsumptionRequests', 'store_consumption_requests', 'sylphx.money.v1.StoreConsumptionRequest'],
426
+ ['nextPageToken', 'next_page_token'],
427
+ ],
419
428
  'sylphx.money.v1.ListStorePurchasesRequest': [
420
429
  ['pageSize', 'page_size'],
421
430
  ['pageToken', 'page_token'],
@@ -546,6 +555,18 @@ runtime.registerSchemas({
546
555
  ],
547
556
  'sylphx.money.v1.ReleaseUsageInvoiceCollectionRequest': [],
548
557
  'sylphx.money.v1.ReleaseUsageReservationRequest': [],
558
+ 'sylphx.money.v1.ReportStorePurchaseUsageRequest': [
559
+ ['consumptionRequest', 'consumption_request'],
560
+ ['deliveryStatus', 'delivery_status'],
561
+ ['sampleContentProvided', 'sample_content_provided'],
562
+ ['consumptionPercentage', 'consumption_percentage'],
563
+ ['refundPreference', 'refund_preference'],
564
+ ['custodyAttestation', 'custody_attestation'],
565
+ ],
566
+ 'sylphx.money.v1.ReportStorePurchaseUsageResponse': [
567
+ ['storeConsumptionRequest', 'store_consumption_request', 'sylphx.money.v1.StoreConsumptionRequest'],
568
+ ['storePurchase', 'store_purchase', 'sylphx.money.v1.StorePurchase'],
569
+ ],
549
570
  'sylphx.money.v1.ResolveBankReceiptRequest': [],
550
571
  'sylphx.money.v1.ResumeCustomerSubscriptionRequest': [],
551
572
  'sylphx.money.v1.RetireLicenceKeyRequest': [],
@@ -647,6 +668,24 @@ runtime.registerSchemas({
647
668
  ['notificationUrl', 'notification_url'],
648
669
  ['serviceAccountEmail', 'service_account_email'],
649
670
  ],
671
+ 'sylphx.money.v1.StoreConsumptionRequest': [
672
+ ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
673
+ ['bundleId', 'bundle_id'],
674
+ ['transactionId', 'transaction_id'],
675
+ ['originalTransactionId', 'original_transaction_id'],
676
+ ['notificationId', 'notification_id'],
677
+ ['consumptionRequestReason', 'consumption_request_reason'],
678
+ ['storePurchase', 'store_purchase'],
679
+ ['subject', 'subject', 'sylphx.money.v1.Subject'],
680
+ ['observedTime', 'observed_time'],
681
+ ['deadlineTime', 'deadline_time'],
682
+ ['attemptCount', 'attempt_count'],
683
+ ['lastAttemptTime', 'last_attempt_time'],
684
+ ['sentTime', 'sent_time'],
685
+ ['appleHttpStatus', 'apple_http_status'],
686
+ ['lastRefusalReason', 'last_refusal_reason'],
687
+ ['consentId', 'consent_id'],
688
+ ],
650
689
  'sylphx.money.v1.StorePurchase': [
651
690
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
652
691
  ['subject', 'subject', 'sylphx.money.v1.Subject'],
@@ -856,6 +895,8 @@ export class MoneyApi {
856
895
  storeConnections;
857
896
  /** The `store_purchases` collection. */
858
897
  storePurchases;
898
+ /** The `store_consumption_requests` collection. */
899
+ storeConsumptionRequests;
859
900
  /** The `customer_subscriptions` collection. */
860
901
  customerSubscriptions;
861
902
  /** The `entitlement_grants` collection. */
@@ -905,6 +946,7 @@ export class MoneyApi {
905
946
  this.checkoutPolicies = new CheckoutPoliciesCollection(client);
906
947
  this.storeConnections = new StoreConnectionsCollection(client);
907
948
  this.storePurchases = new StorePurchasesCollection(client);
949
+ this.storeConsumptionRequests = new StoreConsumptionRequestsCollection(client);
908
950
  this.customerSubscriptions = new CustomerSubscriptionsCollection(client);
909
951
  this.entitlementGrants = new EntitlementGrantsCollection(client);
910
952
  this.testClocks = new TestClocksCollection(client);
@@ -1575,6 +1617,76 @@ export class StorePurchasesCollection {
1575
1617
  next = { ...request, pageToken: page.nextPageToken };
1576
1618
  }
1577
1619
  }
1620
+ /**
1621
+ * Reports verified delivery and usage facts for an App Store purchase in
1622
+ * answer to an observed `CONSUMPTION_REQUEST`. Strictly fails closed (0
1623
+ * outbound Apple calls) unless Money's append-only buyer-authenticated
1624
+ * consent ledger holds an unwithdrawn `granted` decision for this purchase
1625
+ * or app.
1626
+ *
1627
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/store_purchases/*}:reportUsage` · permission `billing:write` · effect `write`
1628
+ *
1629
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
1630
+ */
1631
+ async reportUsage(request) {
1632
+ return this.client.call({
1633
+ method: 'POST',
1634
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/store_purchases/*', 'name')}:reportUsage`,
1635
+ body: runtime.omit(request, ['name']),
1636
+ bodyType: 'sylphx.money.v1.ReportStorePurchaseUsageRequest',
1637
+ responseType: 'sylphx.money.v1.ReportStorePurchaseUsageResponse',
1638
+ mutation: true,
1639
+ });
1640
+ }
1641
+ }
1642
+ /** `store_consumption_requests` of Sylphx Money: Resource type `money.sylphx.com/StoreConsumptionRequest`. */
1643
+ export class StoreConsumptionRequestsCollection {
1644
+ client;
1645
+ constructor(client) {
1646
+ this.client = client;
1647
+ }
1648
+ /**
1649
+ * Gets a captured store consumption request.
1650
+ *
1651
+ * `GET /v1/{name=orgs/*\/projects/*\/envs/*\/store_consumption_requests/*}` · permission `billing:read` · effect `read`
1652
+ *
1653
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
1654
+ */
1655
+ async get(request) {
1656
+ return this.client.call({
1657
+ method: 'GET',
1658
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/store_consumption_requests/*', 'name')}`,
1659
+ responseType: 'sylphx.money.v1.StoreConsumptionRequest',
1660
+ mutation: false,
1661
+ });
1662
+ }
1663
+ /**
1664
+ * Lists captured store consumption requests, newest first.
1665
+ *
1666
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/store_consumption_requests` · permission `billing:read` · effect `read`
1667
+ *
1668
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
1669
+ */
1670
+ async list(request) {
1671
+ return this.client.call({
1672
+ method: 'GET',
1673
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*', 'parent')}/store_consumption_requests`,
1674
+ query: { page_size: request.pageSize, page_token: request.pageToken, filter: request.filter },
1675
+ responseType: 'sylphx.money.v1.ListStoreConsumptionRequestsResponse',
1676
+ mutation: false,
1677
+ });
1678
+ }
1679
+ /** Every item of every page of `list`. */
1680
+ async *listAll(request) {
1681
+ let next = request;
1682
+ for (;;) {
1683
+ const page = await this.list(next);
1684
+ yield* page.storeConsumptionRequests ?? [];
1685
+ if (page.nextPageToken === undefined || page.nextPageToken === '')
1686
+ return;
1687
+ next = { ...request, pageToken: page.nextPageToken };
1688
+ }
1689
+ }
1578
1690
  }
1579
1691
  /** `customer_subscriptions` of Sylphx Money: Resource type `money.sylphx.com/CustomerSubscription`. */
1580
1692
  export class CustomerSubscriptionsCollection {