@mitumba/sdk 5.2.0 → 5.3.0

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/index.mjs CHANGED
@@ -677,6 +677,9 @@ var AuthModule = class {
677
677
  };
678
678
 
679
679
  // src/modules/oauth.ts
680
+ function isConsentRequired(result) {
681
+ return result.consent_required === true;
682
+ }
680
683
  var OAuthModule = class {
681
684
  constructor(client) {
682
685
  this.client = client;
@@ -788,6 +791,46 @@ var OAuthModule = class {
788
791
  async userinfo(options) {
789
792
  return this.client.get("/auth/oauth/userinfo", void 0, options);
790
793
  }
794
+ /**
795
+ * Record the current user's consent to a client's scopes.
796
+ *
797
+ * The accounts consent screen calls this (after the user approves) before retrying
798
+ * {@link OAuthModule.authorize}, which then finds covering consent and mints a code. Requires an
799
+ * authenticated session. Re-granting with a wider scope set supersedes the prior consent.
800
+ *
801
+ * @param input - The client and the space-delimited scopes being granted
802
+ * @param options - Optional per-request options
803
+ * @returns `{ ok: true }` on success
804
+ * @throws {APIError} On `400 invalid_client` / `invalid_scope`, or `401` without a session
805
+ */
806
+ async grantConsent(input, options) {
807
+ return this.client.post("/auth/oauth/consent", input, options);
808
+ }
809
+ /**
810
+ * Withdraw the current user's consent for a client (account-console self-service).
811
+ *
812
+ * @param clientId - The client to revoke consent for
813
+ * @param options - Optional per-request options
814
+ * @returns `{ ok: true, revoked }` — `revoked` is false when there was nothing live to revoke
815
+ * @throws {APIError} On `401` without a session
816
+ */
817
+ async revokeConsent(clientId, options) {
818
+ return this.client.delete(
819
+ `/auth/oauth/consent/${encodeURIComponent(clientId)}`,
820
+ void 0,
821
+ options
822
+ );
823
+ }
824
+ /**
825
+ * List the current user's live consents, for a "connected apps" account-management view.
826
+ *
827
+ * @param options - Optional per-request options
828
+ * @returns The live consents (client id + name, granted scopes, grant time)
829
+ * @throws {APIError} On `401` without a session
830
+ */
831
+ async listConsents(options) {
832
+ return this.client.get("/auth/oauth/consents", void 0, options);
833
+ }
791
834
  };
792
835
 
793
836
  // src/modules/listings.ts
@@ -2668,6 +2711,6 @@ var MitumbaClient = class {
2668
2711
  }
2669
2712
  };
2670
2713
 
2671
- export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, IDBTokenStore, LISTING_STATUSES, ListingsModule, MailerModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
2714
+ export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, IDBTokenStore, LISTING_STATUSES, ListingsModule, MailerModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
2672
2715
  //# sourceMappingURL=index.mjs.map
2673
2716
  //# sourceMappingURL=index.mjs.map