@insurup/sdk 0.1.15 → 0.1.17

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
@@ -60,7 +60,7 @@ module.exports = __toCommonJS(index_exports);
60
60
  // package.json
61
61
  var package_default = {
62
62
  name: "@insurup/sdk",
63
- version: "0.1.15",
63
+ version: "0.1.17",
64
64
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
65
65
  keywords: [
66
66
  "insurup",
@@ -1703,11 +1703,8 @@ var customers = {
1703
1703
  render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1704
1704
  },
1705
1705
  revoke: {
1706
- definition: "customers/{CustomerId}/consents/revoke",
1707
- render: (customerId) => "customers/{CustomerId}/consents/revoke".replace(
1708
- "{CustomerId}",
1709
- encodeURIComponent(customerId)
1710
- )
1706
+ definition: "customers/{CustomerId}/consents/{ConsentType}",
1707
+ render: (customerId, consentType) => "customers/{CustomerId}/consents/{ConsentType}".replace("{CustomerId}", encodeURIComponent(customerId)).replace("{ConsentType}", encodeURIComponent(consentType))
1711
1708
  },
1712
1709
  getAll: {
1713
1710
  definition: "customers/{CustomerId}/consents",
@@ -2966,6 +2963,16 @@ var InsurUpAgentUserClient = class {
2966
2963
  // src/clients/customer.ts
2967
2964
  var import_contracts3 = require("@insurup/contracts");
2968
2965
  var import_contracts4 = require("@insurup/contracts");
2966
+ function customerTypeDiscriminator(type) {
2967
+ switch (type) {
2968
+ case import_contracts3.CustomerType.Individual:
2969
+ return "individual";
2970
+ case import_contracts3.CustomerType.Company:
2971
+ return "company";
2972
+ case import_contracts3.CustomerType.Foreign:
2973
+ return "foreign";
2974
+ }
2975
+ }
2969
2976
  var InsurUpCustomerClient = class {
2970
2977
  constructor(http, graphql) {
2971
2978
  this.http = http;
@@ -2976,21 +2983,9 @@ var InsurUpCustomerClient = class {
2976
2983
  */
2977
2984
  async createCustomer(request, options) {
2978
2985
  const { type, ...rest } = request;
2979
- let $type;
2980
- switch (type) {
2981
- case import_contracts3.CustomerType.Individual:
2982
- $type = "individual";
2983
- break;
2984
- case import_contracts3.CustomerType.Company:
2985
- $type = "company";
2986
- break;
2987
- case import_contracts3.CustomerType.Foreign:
2988
- $type = "foreign";
2989
- break;
2990
- }
2991
2986
  return this.http.post(
2992
2987
  endpoints.customers.createCustomer,
2993
- { $type, ...rest },
2988
+ { $type: customerTypeDiscriminator(type), ...rest },
2994
2989
  options
2995
2990
  );
2996
2991
  }
@@ -3013,9 +3008,10 @@ var InsurUpCustomerClient = class {
3013
3008
  * Updates existing customer profile information.
3014
3009
  */
3015
3010
  async updateCustomer(request, options) {
3011
+ const { type, ...rest } = request;
3016
3012
  return this.http.putNoContent(
3017
3013
  endpoints.customers.updateCustomer.render(request.id),
3018
- request,
3014
+ { $type: customerTypeDiscriminator(type), ...rest },
3019
3015
  options
3020
3016
  );
3021
3017
  }
@@ -3280,7 +3276,7 @@ var InsurUpCustomerClient = class {
3280
3276
  async giveCustomerConsent(customerId, request, options) {
3281
3277
  return this.http.postNoContent(
3282
3278
  endpoints.customers.consents.give.render(customerId),
3283
- request,
3279
+ { ...request, customerId },
3284
3280
  options
3285
3281
  );
3286
3282
  }
@@ -3290,13 +3286,12 @@ var InsurUpCustomerClient = class {
3290
3286
  * Müşteri veri hakları uyarınca önceden verilmiş bir müşteri iznini geri çeker.
3291
3287
  *
3292
3288
  * @param customerId Unique identifier of the customer / Müşterinin benzersiz tanımlayıcısı
3293
- * @param request Consent revocation request / İzin geri çekme talebi
3289
+ * @param consentType Type of consent to revoke / Geri çekilecek izin türü
3294
3290
  * @returns Operation result / İşlem sonucu
3295
3291
  */
3296
- async revokeCustomerConsent(customerId, request, options) {
3297
- return this.http.postNoContent(
3298
- endpoints.customers.consents.revoke.render(customerId),
3299
- request,
3292
+ async revokeCustomerConsent(customerId, consentType, options) {
3293
+ return this.http.deleteNoContent(
3294
+ endpoints.customers.consents.revoke.render(customerId, consentType),
3300
3295
  options
3301
3296
  );
3302
3297
  }