@zyphr-dev/node-sdk 0.1.51 → 0.1.52

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.cjs CHANGED
@@ -909,6 +909,14 @@ __export(index_exports, {
909
909
  OAuthAuthorizationUrlResponseFromJSONTyped: () => OAuthAuthorizationUrlResponseFromJSONTyped,
910
910
  OAuthAuthorizationUrlResponseToJSON: () => OAuthAuthorizationUrlResponseToJSON,
911
911
  OAuthAuthorizationUrlResponseToJSONTyped: () => OAuthAuthorizationUrlResponseToJSONTyped,
912
+ OAuthAuthorizeResponseDataFromJSON: () => OAuthAuthorizeResponseDataFromJSON,
913
+ OAuthAuthorizeResponseDataFromJSONTyped: () => OAuthAuthorizeResponseDataFromJSONTyped,
914
+ OAuthAuthorizeResponseDataToJSON: () => OAuthAuthorizeResponseDataToJSON,
915
+ OAuthAuthorizeResponseDataToJSONTyped: () => OAuthAuthorizeResponseDataToJSONTyped,
916
+ OAuthAuthorizeResponseFromJSON: () => OAuthAuthorizeResponseFromJSON,
917
+ OAuthAuthorizeResponseFromJSONTyped: () => OAuthAuthorizeResponseFromJSONTyped,
918
+ OAuthAuthorizeResponseToJSON: () => OAuthAuthorizeResponseToJSON,
919
+ OAuthAuthorizeResponseToJSONTyped: () => OAuthAuthorizeResponseToJSONTyped,
912
920
  OAuthCallbackRequestFromJSON: () => OAuthCallbackRequestFromJSON,
913
921
  OAuthCallbackRequestFromJSONTyped: () => OAuthCallbackRequestFromJSONTyped,
914
922
  OAuthCallbackRequestToJSON: () => OAuthCallbackRequestToJSON,
@@ -941,6 +949,14 @@ __export(index_exports, {
941
949
  OAuthConnectionsResponseFromJSONTyped: () => OAuthConnectionsResponseFromJSONTyped,
942
950
  OAuthConnectionsResponseToJSON: () => OAuthConnectionsResponseToJSON,
943
951
  OAuthConnectionsResponseToJSONTyped: () => OAuthConnectionsResponseToJSONTyped,
952
+ OAuthLinkResponseDataFromJSON: () => OAuthLinkResponseDataFromJSON,
953
+ OAuthLinkResponseDataFromJSONTyped: () => OAuthLinkResponseDataFromJSONTyped,
954
+ OAuthLinkResponseDataToJSON: () => OAuthLinkResponseDataToJSON,
955
+ OAuthLinkResponseDataToJSONTyped: () => OAuthLinkResponseDataToJSONTyped,
956
+ OAuthLinkResponseFromJSON: () => OAuthLinkResponseFromJSON,
957
+ OAuthLinkResponseFromJSONTyped: () => OAuthLinkResponseFromJSONTyped,
958
+ OAuthLinkResponseToJSON: () => OAuthLinkResponseToJSON,
959
+ OAuthLinkResponseToJSONTyped: () => OAuthLinkResponseToJSONTyped,
944
960
  OAuthProviderFromJSON: () => OAuthProviderFromJSON,
945
961
  OAuthProviderFromJSONTyped: () => OAuthProviderFromJSONTyped,
946
962
  OAuthProviderInfoFromJSON: () => OAuthProviderInfoFromJSON,
@@ -2378,6 +2394,8 @@ __export(index_exports, {
2378
2394
  instanceOfMfaVerifyRequest: () => instanceOfMfaVerifyRequest,
2379
2395
  instanceOfOAuthAuthorizationUrlResponse: () => instanceOfOAuthAuthorizationUrlResponse,
2380
2396
  instanceOfOAuthAuthorizationUrlResponseData: () => instanceOfOAuthAuthorizationUrlResponseData,
2397
+ instanceOfOAuthAuthorizeResponse: () => instanceOfOAuthAuthorizeResponse,
2398
+ instanceOfOAuthAuthorizeResponseData: () => instanceOfOAuthAuthorizeResponseData,
2381
2399
  instanceOfOAuthCallbackRequest: () => instanceOfOAuthCallbackRequest,
2382
2400
  instanceOfOAuthCallbackResponse: () => instanceOfOAuthCallbackResponse,
2383
2401
  instanceOfOAuthCallbackResponseData: () => instanceOfOAuthCallbackResponseData,
@@ -2386,6 +2404,8 @@ __export(index_exports, {
2386
2404
  instanceOfOAuthConnectionInfoResponseData: () => instanceOfOAuthConnectionInfoResponseData,
2387
2405
  instanceOfOAuthConnectionsResponse: () => instanceOfOAuthConnectionsResponse,
2388
2406
  instanceOfOAuthConnectionsResponseData: () => instanceOfOAuthConnectionsResponseData,
2407
+ instanceOfOAuthLinkResponse: () => instanceOfOAuthLinkResponse,
2408
+ instanceOfOAuthLinkResponseData: () => instanceOfOAuthLinkResponseData,
2389
2409
  instanceOfOAuthProvider: () => instanceOfOAuthProvider,
2390
2410
  instanceOfOAuthProviderInfo: () => instanceOfOAuthProviderInfo,
2391
2411
  instanceOfOAuthProviderName: () => instanceOfOAuthProviderName,
@@ -10416,6 +10436,64 @@ function OAuthAuthorizationUrlResponseToJSONTyped(value, ignoreDiscriminator = f
10416
10436
  };
10417
10437
  }
10418
10438
 
10439
+ // src/src/models/OAuthAuthorizeResponseData.ts
10440
+ function instanceOfOAuthAuthorizeResponseData(value) {
10441
+ return true;
10442
+ }
10443
+ function OAuthAuthorizeResponseDataFromJSON(json) {
10444
+ return OAuthAuthorizeResponseDataFromJSONTyped(json, false);
10445
+ }
10446
+ function OAuthAuthorizeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10447
+ if (json == null) {
10448
+ return json;
10449
+ }
10450
+ return {
10451
+ "authorizationUrl": json["authorization_url"] == null ? void 0 : json["authorization_url"],
10452
+ "state": json["state"] == null ? void 0 : json["state"]
10453
+ };
10454
+ }
10455
+ function OAuthAuthorizeResponseDataToJSON(json) {
10456
+ return OAuthAuthorizeResponseDataToJSONTyped(json, false);
10457
+ }
10458
+ function OAuthAuthorizeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
10459
+ if (value == null) {
10460
+ return value;
10461
+ }
10462
+ return {
10463
+ "authorization_url": value["authorizationUrl"],
10464
+ "state": value["state"]
10465
+ };
10466
+ }
10467
+
10468
+ // src/src/models/OAuthAuthorizeResponse.ts
10469
+ function instanceOfOAuthAuthorizeResponse(value) {
10470
+ return true;
10471
+ }
10472
+ function OAuthAuthorizeResponseFromJSON(json) {
10473
+ return OAuthAuthorizeResponseFromJSONTyped(json, false);
10474
+ }
10475
+ function OAuthAuthorizeResponseFromJSONTyped(json, ignoreDiscriminator) {
10476
+ if (json == null) {
10477
+ return json;
10478
+ }
10479
+ return {
10480
+ "data": json["data"] == null ? void 0 : OAuthAuthorizeResponseDataFromJSON(json["data"]),
10481
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
10482
+ };
10483
+ }
10484
+ function OAuthAuthorizeResponseToJSON(json) {
10485
+ return OAuthAuthorizeResponseToJSONTyped(json, false);
10486
+ }
10487
+ function OAuthAuthorizeResponseToJSONTyped(value, ignoreDiscriminator = false) {
10488
+ if (value == null) {
10489
+ return value;
10490
+ }
10491
+ return {
10492
+ "data": OAuthAuthorizeResponseDataToJSON(value["data"]),
10493
+ "meta": RequestMetaToJSON(value["meta"])
10494
+ };
10495
+ }
10496
+
10419
10497
  // src/src/models/OAuthCallbackRequest.ts
10420
10498
  function instanceOfOAuthCallbackRequest(value) {
10421
10499
  if (!("code" in value) || value["code"] === void 0) return false;
@@ -10711,6 +10789,64 @@ function OAuthConnectionsResponseToJSONTyped(value, ignoreDiscriminator = false)
10711
10789
  };
10712
10790
  }
10713
10791
 
10792
+ // src/src/models/OAuthLinkResponseData.ts
10793
+ function instanceOfOAuthLinkResponseData(value) {
10794
+ return true;
10795
+ }
10796
+ function OAuthLinkResponseDataFromJSON(json) {
10797
+ return OAuthLinkResponseDataFromJSONTyped(json, false);
10798
+ }
10799
+ function OAuthLinkResponseDataFromJSONTyped(json, ignoreDiscriminator) {
10800
+ if (json == null) {
10801
+ return json;
10802
+ }
10803
+ return {
10804
+ "success": json["success"] == null ? void 0 : json["success"],
10805
+ "providerInfo": json["provider_info"] == null ? void 0 : OAuthProviderInfoFromJSON(json["provider_info"])
10806
+ };
10807
+ }
10808
+ function OAuthLinkResponseDataToJSON(json) {
10809
+ return OAuthLinkResponseDataToJSONTyped(json, false);
10810
+ }
10811
+ function OAuthLinkResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
10812
+ if (value == null) {
10813
+ return value;
10814
+ }
10815
+ return {
10816
+ "success": value["success"],
10817
+ "provider_info": OAuthProviderInfoToJSON(value["providerInfo"])
10818
+ };
10819
+ }
10820
+
10821
+ // src/src/models/OAuthLinkResponse.ts
10822
+ function instanceOfOAuthLinkResponse(value) {
10823
+ return true;
10824
+ }
10825
+ function OAuthLinkResponseFromJSON(json) {
10826
+ return OAuthLinkResponseFromJSONTyped(json, false);
10827
+ }
10828
+ function OAuthLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
10829
+ if (json == null) {
10830
+ return json;
10831
+ }
10832
+ return {
10833
+ "data": json["data"] == null ? void 0 : OAuthLinkResponseDataFromJSON(json["data"]),
10834
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
10835
+ };
10836
+ }
10837
+ function OAuthLinkResponseToJSON(json) {
10838
+ return OAuthLinkResponseToJSONTyped(json, false);
10839
+ }
10840
+ function OAuthLinkResponseToJSONTyped(value, ignoreDiscriminator = false) {
10841
+ if (value == null) {
10842
+ return value;
10843
+ }
10844
+ return {
10845
+ "data": OAuthLinkResponseDataToJSON(value["data"]),
10846
+ "meta": RequestMetaToJSON(value["meta"])
10847
+ };
10848
+ }
10849
+
10714
10850
  // src/src/models/OAuthProvider.ts
10715
10851
  function instanceOfOAuthProvider(value) {
10716
10852
  return true;
@@ -20763,6 +20899,53 @@ var AuthMagicLinksApi = class extends BaseAPI {
20763
20899
 
20764
20900
  // src/src/apis/AuthOAuthApi.ts
20765
20901
  var AuthOAuthApi = class extends BaseAPI {
20902
+ /**
20903
+ * Complete an authenticated account-linking flow started via the link authorize endpoint. Attaches the resolved provider identity to the current end user. Rejects if the provider identity is already linked to a different account, if the provider did not verify the email, or if the linking session does not belong to the authenticated user.
20904
+ * Complete linking an OAuth provider to the current account
20905
+ */
20906
+ async completeOAuthLinkRaw(requestParameters, initOverrides) {
20907
+ if (requestParameters["provider"] == null) {
20908
+ throw new RequiredError(
20909
+ "provider",
20910
+ 'Required parameter "provider" was null or undefined when calling completeOAuthLink().'
20911
+ );
20912
+ }
20913
+ if (requestParameters["oAuthCallbackRequest"] == null) {
20914
+ throw new RequiredError(
20915
+ "oAuthCallbackRequest",
20916
+ 'Required parameter "oAuthCallbackRequest" was null or undefined when calling completeOAuthLink().'
20917
+ );
20918
+ }
20919
+ const queryParameters = {};
20920
+ const headerParameters = {};
20921
+ headerParameters["Content-Type"] = "application/json";
20922
+ if (this.configuration && this.configuration.accessToken) {
20923
+ const token = this.configuration.accessToken;
20924
+ const tokenString = await token("EndUserToken", []);
20925
+ if (tokenString) {
20926
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
20927
+ }
20928
+ }
20929
+ if (this.configuration && this.configuration.apiKey) {
20930
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
20931
+ }
20932
+ const response = await this.request({
20933
+ path: `/auth/oauth/{provider}/link/callback`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
20934
+ method: "POST",
20935
+ headers: headerParameters,
20936
+ query: queryParameters,
20937
+ body: OAuthCallbackRequestToJSON(requestParameters["oAuthCallbackRequest"])
20938
+ }, initOverrides);
20939
+ return new JSONApiResponse(response, (jsonValue) => OAuthLinkResponseFromJSON(jsonValue));
20940
+ }
20941
+ /**
20942
+ * Complete an authenticated account-linking flow started via the link authorize endpoint. Attaches the resolved provider identity to the current end user. Rejects if the provider identity is already linked to a different account, if the provider did not verify the email, or if the linking session does not belong to the authenticated user.
20943
+ * Complete linking an OAuth provider to the current account
20944
+ */
20945
+ async completeOAuthLink(provider, oAuthCallbackRequest, initOverrides) {
20946
+ const response = await this.completeOAuthLinkRaw({ provider, oAuthCallbackRequest }, initOverrides);
20947
+ return await response.value();
20948
+ }
20766
20949
  /**
20767
20950
  * Disconnect an OAuth provider from the current user.
20768
20951
  * Disconnect OAuth provider
@@ -21065,6 +21248,54 @@ var AuthOAuthApi = class extends BaseAPI {
21065
21248
  const response = await this.refreshOAuthTokensRaw({ provider, refreshOAuthTokensRequest }, initOverrides);
21066
21249
  return await response.value();
21067
21250
  }
21251
+ /**
21252
+ * Begin an authenticated account-linking flow. Unlike the sign-in authorize endpoint, this binds the current end user into the OAuth state so the matching link callback attaches the returned provider identity to THIS account instead of finding-or-creating a user. Requires an end-user token.
21253
+ * Start linking an OAuth provider to the current account
21254
+ */
21255
+ async startOAuthLinkRaw(requestParameters, initOverrides) {
21256
+ if (requestParameters["provider"] == null) {
21257
+ throw new RequiredError(
21258
+ "provider",
21259
+ 'Required parameter "provider" was null or undefined when calling startOAuthLink().'
21260
+ );
21261
+ }
21262
+ if (requestParameters["redirectUri"] == null) {
21263
+ throw new RequiredError(
21264
+ "redirectUri",
21265
+ 'Required parameter "redirectUri" was null or undefined when calling startOAuthLink().'
21266
+ );
21267
+ }
21268
+ const queryParameters = {};
21269
+ if (requestParameters["redirectUri"] != null) {
21270
+ queryParameters["redirect_uri"] = requestParameters["redirectUri"];
21271
+ }
21272
+ const headerParameters = {};
21273
+ if (this.configuration && this.configuration.accessToken) {
21274
+ const token = this.configuration.accessToken;
21275
+ const tokenString = await token("EndUserToken", []);
21276
+ if (tokenString) {
21277
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
21278
+ }
21279
+ }
21280
+ if (this.configuration && this.configuration.apiKey) {
21281
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
21282
+ }
21283
+ const response = await this.request({
21284
+ path: `/auth/oauth/{provider}/link`.replace(`{${"provider"}}`, encodeURIComponent(String(requestParameters["provider"]))),
21285
+ method: "GET",
21286
+ headers: headerParameters,
21287
+ query: queryParameters
21288
+ }, initOverrides);
21289
+ return new JSONApiResponse(response, (jsonValue) => OAuthAuthorizeResponseFromJSON(jsonValue));
21290
+ }
21291
+ /**
21292
+ * Begin an authenticated account-linking flow. Unlike the sign-in authorize endpoint, this binds the current end user into the OAuth state so the matching link callback attaches the returned provider identity to THIS account instead of finding-or-creating a user. Requires an end-user token.
21293
+ * Start linking an OAuth provider to the current account
21294
+ */
21295
+ async startOAuthLink(provider, redirectUri, initOverrides) {
21296
+ const response = await this.startOAuthLinkRaw({ provider, redirectUri }, initOverrides);
21297
+ return await response.value();
21298
+ }
21068
21299
  };
21069
21300
 
21070
21301
  // src/src/apis/AuthOrganizationsApi.ts
@@ -30163,6 +30394,14 @@ var SDK_VERSION = "0.1.0";
30163
30394
  OAuthAuthorizationUrlResponseFromJSONTyped,
30164
30395
  OAuthAuthorizationUrlResponseToJSON,
30165
30396
  OAuthAuthorizationUrlResponseToJSONTyped,
30397
+ OAuthAuthorizeResponseDataFromJSON,
30398
+ OAuthAuthorizeResponseDataFromJSONTyped,
30399
+ OAuthAuthorizeResponseDataToJSON,
30400
+ OAuthAuthorizeResponseDataToJSONTyped,
30401
+ OAuthAuthorizeResponseFromJSON,
30402
+ OAuthAuthorizeResponseFromJSONTyped,
30403
+ OAuthAuthorizeResponseToJSON,
30404
+ OAuthAuthorizeResponseToJSONTyped,
30166
30405
  OAuthCallbackRequestFromJSON,
30167
30406
  OAuthCallbackRequestFromJSONTyped,
30168
30407
  OAuthCallbackRequestToJSON,
@@ -30195,6 +30434,14 @@ var SDK_VERSION = "0.1.0";
30195
30434
  OAuthConnectionsResponseFromJSONTyped,
30196
30435
  OAuthConnectionsResponseToJSON,
30197
30436
  OAuthConnectionsResponseToJSONTyped,
30437
+ OAuthLinkResponseDataFromJSON,
30438
+ OAuthLinkResponseDataFromJSONTyped,
30439
+ OAuthLinkResponseDataToJSON,
30440
+ OAuthLinkResponseDataToJSONTyped,
30441
+ OAuthLinkResponseFromJSON,
30442
+ OAuthLinkResponseFromJSONTyped,
30443
+ OAuthLinkResponseToJSON,
30444
+ OAuthLinkResponseToJSONTyped,
30198
30445
  OAuthProviderFromJSON,
30199
30446
  OAuthProviderFromJSONTyped,
30200
30447
  OAuthProviderInfoFromJSON,
@@ -31632,6 +31879,8 @@ var SDK_VERSION = "0.1.0";
31632
31879
  instanceOfMfaVerifyRequest,
31633
31880
  instanceOfOAuthAuthorizationUrlResponse,
31634
31881
  instanceOfOAuthAuthorizationUrlResponseData,
31882
+ instanceOfOAuthAuthorizeResponse,
31883
+ instanceOfOAuthAuthorizeResponseData,
31635
31884
  instanceOfOAuthCallbackRequest,
31636
31885
  instanceOfOAuthCallbackResponse,
31637
31886
  instanceOfOAuthCallbackResponseData,
@@ -31640,6 +31889,8 @@ var SDK_VERSION = "0.1.0";
31640
31889
  instanceOfOAuthConnectionInfoResponseData,
31641
31890
  instanceOfOAuthConnectionsResponse,
31642
31891
  instanceOfOAuthConnectionsResponseData,
31892
+ instanceOfOAuthLinkResponse,
31893
+ instanceOfOAuthLinkResponseData,
31643
31894
  instanceOfOAuthProvider,
31644
31895
  instanceOfOAuthProviderInfo,
31645
31896
  instanceOfOAuthProviderName,