@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.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@insurup/sdk",
10
- version: "0.1.15",
10
+ version: "0.1.17",
11
11
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
12
12
  keywords: [
13
13
  "insurup",
@@ -1655,11 +1655,8 @@ var customers = {
1655
1655
  render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1656
1656
  },
1657
1657
  revoke: {
1658
- definition: "customers/{CustomerId}/consents/revoke",
1659
- render: (customerId) => "customers/{CustomerId}/consents/revoke".replace(
1660
- "{CustomerId}",
1661
- encodeURIComponent(customerId)
1662
- )
1658
+ definition: "customers/{CustomerId}/consents/{ConsentType}",
1659
+ render: (customerId, consentType) => "customers/{CustomerId}/consents/{ConsentType}".replace("{CustomerId}", encodeURIComponent(customerId)).replace("{ConsentType}", encodeURIComponent(consentType))
1663
1660
  },
1664
1661
  getAll: {
1665
1662
  definition: "customers/{CustomerId}/consents",
@@ -2923,6 +2920,16 @@ import {
2923
2920
  CustomerType
2924
2921
  } from "@insurup/contracts";
2925
2922
  import { buildFieldSelection as buildFieldSelection2 } from "@insurup/contracts";
2923
+ function customerTypeDiscriminator(type) {
2924
+ switch (type) {
2925
+ case CustomerType.Individual:
2926
+ return "individual";
2927
+ case CustomerType.Company:
2928
+ return "company";
2929
+ case CustomerType.Foreign:
2930
+ return "foreign";
2931
+ }
2932
+ }
2926
2933
  var InsurUpCustomerClient = class {
2927
2934
  constructor(http, graphql) {
2928
2935
  this.http = http;
@@ -2933,21 +2940,9 @@ var InsurUpCustomerClient = class {
2933
2940
  */
2934
2941
  async createCustomer(request, options) {
2935
2942
  const { type, ...rest } = request;
2936
- let $type;
2937
- switch (type) {
2938
- case CustomerType.Individual:
2939
- $type = "individual";
2940
- break;
2941
- case CustomerType.Company:
2942
- $type = "company";
2943
- break;
2944
- case CustomerType.Foreign:
2945
- $type = "foreign";
2946
- break;
2947
- }
2948
2943
  return this.http.post(
2949
2944
  endpoints.customers.createCustomer,
2950
- { $type, ...rest },
2945
+ { $type: customerTypeDiscriminator(type), ...rest },
2951
2946
  options
2952
2947
  );
2953
2948
  }
@@ -2970,9 +2965,10 @@ var InsurUpCustomerClient = class {
2970
2965
  * Updates existing customer profile information.
2971
2966
  */
2972
2967
  async updateCustomer(request, options) {
2968
+ const { type, ...rest } = request;
2973
2969
  return this.http.putNoContent(
2974
2970
  endpoints.customers.updateCustomer.render(request.id),
2975
- request,
2971
+ { $type: customerTypeDiscriminator(type), ...rest },
2976
2972
  options
2977
2973
  );
2978
2974
  }
@@ -3237,7 +3233,7 @@ var InsurUpCustomerClient = class {
3237
3233
  async giveCustomerConsent(customerId, request, options) {
3238
3234
  return this.http.postNoContent(
3239
3235
  endpoints.customers.consents.give.render(customerId),
3240
- request,
3236
+ { ...request, customerId },
3241
3237
  options
3242
3238
  );
3243
3239
  }
@@ -3247,13 +3243,12 @@ var InsurUpCustomerClient = class {
3247
3243
  * Müşteri veri hakları uyarınca önceden verilmiş bir müşteri iznini geri çeker.
3248
3244
  *
3249
3245
  * @param customerId Unique identifier of the customer / Müşterinin benzersiz tanımlayıcısı
3250
- * @param request Consent revocation request / İzin geri çekme talebi
3246
+ * @param consentType Type of consent to revoke / Geri çekilecek izin türü
3251
3247
  * @returns Operation result / İşlem sonucu
3252
3248
  */
3253
- async revokeCustomerConsent(customerId, request, options) {
3254
- return this.http.postNoContent(
3255
- endpoints.customers.consents.revoke.render(customerId),
3256
- request,
3249
+ async revokeCustomerConsent(customerId, consentType, options) {
3250
+ return this.http.deleteNoContent(
3251
+ endpoints.customers.consents.revoke.render(customerId, consentType),
3257
3252
  options
3258
3253
  );
3259
3254
  }