@zenglobal/api-client 5.0.15 → 5.0.16

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.
@@ -8364,6 +8364,174 @@ export type VoucherTypeResponse = {
8364
8364
  version: string;
8365
8365
  };
8366
8366
  };
8367
+ /**
8368
+ * A webhook destination: one HTTPS endpoint, the events it receives, and how
8369
+ * deliveries to it are authenticated and retried.
8370
+ *
8371
+ * Every property here is returned on read. `active`, `has_credentials`,
8372
+ * `created_at` and `updated_at` are read-only — see
8373
+ * `WebhookDestinationInput` for what you can send.
8374
+ */
8375
+ export type WebhookDestination = {
8376
+ /**
8377
+ * Unique key within your company. 3-64 lowercase letters, digits or underscores. Cannot be changed after creation. `zen_` and `pc_` are reserved prefixes, and the exact name `validate` is reserved.
8378
+ */
8379
+ name: string;
8380
+ /**
8381
+ * Human-readable description
8382
+ */
8383
+ label: string;
8384
+ /**
8385
+ * Destination URL. Must be https://.
8386
+ */
8387
+ url: string;
8388
+ /**
8389
+ * An ADDITIONAL credential your endpoint requires, on top of the signature every delivery already carries. `none` is a complete choice, not an absent one: the HMAC signature authenticates the request by itself.
8390
+ */
8391
+ auth_scheme: 'none' | 'body_key' | 'bearer' | 'custom_header';
8392
+ /**
8393
+ * Scheme-specific settings: `header_name` for custom_header. Null for none, body_key and bearer, which take no additional keys. Never contains a secret.
8394
+ */
8395
+ auth_config?: {
8396
+ [key: string]: unknown;
8397
+ } | null;
8398
+ /**
8399
+ * The events this destination receives. Always non-empty.
8400
+ */
8401
+ event_types: Array<WebhookEventType>;
8402
+ /**
8403
+ * Site codes events are delivered for. Null means every site in your company; a list is an allowlist. Only permitted when EVERY subscribed event type carries a site dimension: item.soh, item.price, offer.redeem, transaction.complete. This is delivery efficiency, not an entitlement — a partner credential already reaches every site in the company.
8404
+ */
8405
+ site_filter?: Array<number> | null;
8406
+ /**
8407
+ * Whether deliveries must arrive in order. Ordered delivery means a failing event blocks those behind it, so enable it only if your endpoint genuinely requires sequence.
8408
+ */
8409
+ ordered: boolean;
8410
+ /**
8411
+ * Retry settings. Null uses the platform default.
8412
+ */
8413
+ retry_policy?: {
8414
+ [key: string]: unknown;
8415
+ } | null;
8416
+ /**
8417
+ * Optional response-body check that decides whether a 2xx really succeeded
8418
+ */
8419
+ response_check?: {
8420
+ [key: string]: unknown;
8421
+ } | null;
8422
+ /**
8423
+ * Whether a 4xx response from your endpoint counts as a permanent failure or a retryable one
8424
+ */
8425
+ treat_4xx_as: 'failed' | 'retry';
8426
+ /**
8427
+ * Read-only. Whether this destination is live. Creating sets it true and deleting sets it false; it cannot be driven from a request body.
8428
+ */
8429
+ active: boolean;
8430
+ /**
8431
+ * Read-only. Whether an authentication secret is stored. The secret itself is never returned by any operation.
8432
+ */
8433
+ has_credentials: boolean;
8434
+ /**
8435
+ * Read-only.
8436
+ */
8437
+ created_at: string;
8438
+ /**
8439
+ * Read-only.
8440
+ */
8441
+ updated_at: string;
8442
+ };
8443
+ export type WebhookDestinationHealthResponse = {
8444
+ /**
8445
+ * False when the delivery engine could not be reached. The destination itself is unaffected.
8446
+ */
8447
+ engine_available: boolean;
8448
+ /**
8449
+ * Recent delivery health, or null when the engine is unavailable
8450
+ */
8451
+ health?: {
8452
+ [key: string]: unknown;
8453
+ } | null;
8454
+ };
8455
+ /**
8456
+ * The writable fields.
8457
+ *
8458
+ * `name` is required on create and cannot be changed afterwards. On update,
8459
+ * every field is optional and an omitted one keeps its stored value — with two
8460
+ * exceptions where an explicit `null` is meaningful and distinct from omission:
8461
+ * sending `site_filter: null` clears an allowlist, and `retry_policy: null`
8462
+ * returns the destination to the platform default.
8463
+ *
8464
+ * `active` is NOT writable and is ignored if sent: create always activates the
8465
+ * destination, an update always preserves whatever is stored, and only DELETE
8466
+ * retires one. A body-driven `active: false` would otherwise retire a
8467
+ * destination through `write:webhooks` alone, which is the job of DELETE and is
8468
+ * gated behind `delete:webhooks`.
8469
+ *
8470
+ * `chain_code` is likewise ignored rather than rejected — the company always
8471
+ * comes from your credential — so a client may safely send back a destination
8472
+ * it previously read.
8473
+ */
8474
+ export type WebhookDestinationInput = {
8475
+ /**
8476
+ * Required on create, and must match the path on update. 3-64 lowercase letters, digits or underscores.
8477
+ */
8478
+ name?: string;
8479
+ label?: string;
8480
+ url?: string;
8481
+ auth_scheme?: 'none' | 'body_key' | 'bearer' | 'custom_header';
8482
+ /**
8483
+ * Scheme-specific settings. `custom_header` requires `header_name`. Changing `auth_scheme` without supplying a new `auth_config` drops the old scheme's config rather than carrying it across.
8484
+ */
8485
+ auth_config?: {
8486
+ [key: string]: unknown;
8487
+ } | null;
8488
+ /**
8489
+ * The shared secret deliveries are signed with. Write-only, never returned. Omit it or send a blank string on update to keep the stored one.
8490
+ */
8491
+ auth_secret?: string;
8492
+ event_types?: Array<WebhookEventType>;
8493
+ site_filter?: Array<number> | null;
8494
+ ordered?: boolean;
8495
+ retry_policy?: {
8496
+ [key: string]: unknown;
8497
+ } | null;
8498
+ response_check?: {
8499
+ [key: string]: unknown;
8500
+ } | null;
8501
+ treat_4xx_as?: 'failed' | 'retry';
8502
+ };
8503
+ export type WebhookDestinationListResponse = {
8504
+ destinations: Array<WebhookDestination>;
8505
+ };
8506
+ /**
8507
+ * The error body every failure on these operations returns.
8508
+ *
8509
+ * NOTE: these operations use conventional HTTP status codes and this body
8510
+ * shape. They do NOT use the `{result, errormessage}` envelope the rest of the
8511
+ * Zen v1 API returns, frequently over HTTP 200. Error handling written against
8512
+ * other Zen endpoints will misread these responses as successes with a missing
8513
+ * `result` field.
8514
+ */
8515
+ export type WebhookErrorBody = {
8516
+ /**
8517
+ * Human-readable summary. For a validation or conflict failure this is the first violation's message.
8518
+ */
8519
+ error: string;
8520
+ /**
8521
+ * Field-level failures, where the failure can be attributed to a field. Empty for 403 scope refusals on a path other than `event_types`, and for 404.
8522
+ */
8523
+ violations: Array<WebhookViolation>;
8524
+ };
8525
+ /**
8526
+ * The events a webhook destination can subscribe to.
8527
+ *
8528
+ * These are LEAVES: one subscribable key per event shape, `resource.action`.
8529
+ * The list is enumerate-only — `offer` is NOT shorthand for the four `offer.*`
8530
+ * leaves and is rejected. A destination subscribed to a resource-level
8531
+ * shorthand would silently start receiving a new event type the day one is
8532
+ * added, which is exactly what this granularity prevents.
8533
+ */
8534
+ export type WebhookEventType = 'loyalty.card' | 'loyalty.points' | 'customer.upsert' | 'offer.create' | 'offer.update' | 'offer.redeem' | 'offer.delete' | 'item.soh' | 'item.price' | 'transaction.complete';
8367
8535
  /**
8368
8536
  * Outbound Webhook Models
8369
8537
  *
@@ -8400,6 +8568,18 @@ export type WebhookPayload = {
8400
8568
  */
8401
8569
  viaBody: boolean;
8402
8570
  };
8571
+ /**
8572
+ * 200 — a newly generated signing key.
8573
+ *
8574
+ * This is the ONLY response in the API that contains a signing key. Store it
8575
+ * when you receive it: there is no operation that reads it back.
8576
+ */
8577
+ export type WebhookSigningKeyResponse = {
8578
+ /**
8579
+ * The new signing key. Shown once, here, and never again.
8580
+ */
8581
+ signing_key: string;
8582
+ };
8403
8583
  /**
8404
8584
  * Transaction loyalty information
8405
8585
  */
@@ -8433,6 +8613,19 @@ export type WebhookTransactionLoyalty = {
8433
8613
  */
8434
8614
  CardType: string;
8435
8615
  };
8616
+ /**
8617
+ * A field-level validation failure.
8618
+ */
8619
+ export type WebhookViolation = {
8620
+ /**
8621
+ * The request field this failure belongs to, or an empty string when the failure cannot be attributed to one field
8622
+ */
8623
+ propertyPath: string;
8624
+ /**
8625
+ * Human-readable explanation
8626
+ */
8627
+ title: string;
8628
+ };
8436
8629
  /**
8437
8630
  * Not found error (404)
8438
8631
  */
@@ -11761,6 +11954,237 @@ export type VoucherSearchVouchersFlatResponses = {
11761
11954
  200: VoucherFlatSearchResponse;
11762
11955
  };
11763
11956
  export type VoucherSearchVouchersFlatResponse = VoucherSearchVouchersFlatResponses[keyof VoucherSearchVouchersFlatResponses];
11957
+ export type WebhookDestinationsListDestinationsData = {
11958
+ body?: never;
11959
+ path?: never;
11960
+ query?: never;
11961
+ url: '/v1/webhooks/destinations';
11962
+ };
11963
+ export type WebhookDestinationsListDestinationsResponses = {
11964
+ /**
11965
+ * The request has succeeded.
11966
+ */
11967
+ 200: WebhookDestinationListResponse;
11968
+ };
11969
+ export type WebhookDestinationsListDestinationsResponse = WebhookDestinationsListDestinationsResponses[keyof WebhookDestinationsListDestinationsResponses];
11970
+ export type WebhookDestinationsCreateDestinationData = {
11971
+ body: WebhookDestinationInput;
11972
+ path?: never;
11973
+ query?: never;
11974
+ url: '/v1/webhooks/destinations';
11975
+ };
11976
+ export type WebhookDestinationsCreateDestinationErrors = {
11977
+ /**
11978
+ * 403 — your credential holds the endpoint scope but not the data scope one of
11979
+ * the subscribed event types requires. The message names both the event type
11980
+ * and the missing scope, and `propertyPath` is `eventTypes`. The subscription
11981
+ * is never silently trimmed to the permitted subset.
11982
+ */
11983
+ 403: WebhookErrorBody;
11984
+ /**
11985
+ * 409 — a destination with that name already exists in your company. Names
11986
+ * stay reserved after a destination is deleted, because its delivery history
11987
+ * is keyed on them.
11988
+ */
11989
+ 409: WebhookErrorBody;
11990
+ /**
11991
+ * 422 — the request body was rejected. `violations[].propertyPath` names the
11992
+ * offending field: one of `name`, `url`, `eventTypes`, `authScheme` or
11993
+ * `siteFilter`.
11994
+ */
11995
+ 422: WebhookErrorBody;
11996
+ };
11997
+ export type WebhookDestinationsCreateDestinationError = WebhookDestinationsCreateDestinationErrors[keyof WebhookDestinationsCreateDestinationErrors];
11998
+ export type WebhookDestinationsCreateDestinationResponses = {
11999
+ /**
12000
+ * The request has succeeded and a new resource has been created as a result.
12001
+ */
12002
+ 201: WebhookDestination;
12003
+ };
12004
+ export type WebhookDestinationsCreateDestinationResponse = WebhookDestinationsCreateDestinationResponses[keyof WebhookDestinationsCreateDestinationResponses];
12005
+ export type WebhookDestinationsDeleteDestinationData = {
12006
+ body?: never;
12007
+ path: {
12008
+ name: string;
12009
+ };
12010
+ query?: never;
12011
+ url: '/v1/webhooks/destinations/{name}';
12012
+ };
12013
+ export type WebhookDestinationsDeleteDestinationErrors = {
12014
+ /**
12015
+ * 404 — no such destination. A destination belonging to another company, and a
12016
+ * destination that has been deleted, are both reported as not found: a 403
12017
+ * would confirm that the name exists.
12018
+ */
12019
+ 404: WebhookErrorBody;
12020
+ };
12021
+ export type WebhookDestinationsDeleteDestinationError = WebhookDestinationsDeleteDestinationErrors[keyof WebhookDestinationsDeleteDestinationErrors];
12022
+ export type WebhookDestinationsDeleteDestinationResponses = {
12023
+ /**
12024
+ * There is no content to send for this request, but the headers may be useful.
12025
+ */
12026
+ 204: void;
12027
+ };
12028
+ export type WebhookDestinationsDeleteDestinationResponse = WebhookDestinationsDeleteDestinationResponses[keyof WebhookDestinationsDeleteDestinationResponses];
12029
+ export type WebhookDestinationsGetDestinationData = {
12030
+ body?: never;
12031
+ path: {
12032
+ name: string;
12033
+ };
12034
+ query?: never;
12035
+ url: '/v1/webhooks/destinations/{name}';
12036
+ };
12037
+ export type WebhookDestinationsGetDestinationErrors = {
12038
+ /**
12039
+ * 404 — no such destination. A destination belonging to another company, and a
12040
+ * destination that has been deleted, are both reported as not found: a 403
12041
+ * would confirm that the name exists.
12042
+ */
12043
+ 404: WebhookErrorBody;
12044
+ };
12045
+ export type WebhookDestinationsGetDestinationError = WebhookDestinationsGetDestinationErrors[keyof WebhookDestinationsGetDestinationErrors];
12046
+ export type WebhookDestinationsGetDestinationResponses = {
12047
+ /**
12048
+ * The request has succeeded.
12049
+ */
12050
+ 200: WebhookDestination;
12051
+ };
12052
+ export type WebhookDestinationsGetDestinationResponse = WebhookDestinationsGetDestinationResponses[keyof WebhookDestinationsGetDestinationResponses];
12053
+ export type WebhookDestinationsUpdateDestinationData = {
12054
+ body: WebhookDestinationInput;
12055
+ path: {
12056
+ name: string;
12057
+ };
12058
+ query?: never;
12059
+ url: '/v1/webhooks/destinations/{name}';
12060
+ };
12061
+ export type WebhookDestinationsUpdateDestinationErrors = {
12062
+ /**
12063
+ * 403 — your credential holds the endpoint scope but not the data scope one of
12064
+ * the subscribed event types requires. The message names both the event type
12065
+ * and the missing scope, and `propertyPath` is `eventTypes`. The subscription
12066
+ * is never silently trimmed to the permitted subset.
12067
+ */
12068
+ 403: WebhookErrorBody;
12069
+ /**
12070
+ * 404 — no such destination. A destination belonging to another company, and a
12071
+ * destination that has been deleted, are both reported as not found: a 403
12072
+ * would confirm that the name exists.
12073
+ */
12074
+ 404: WebhookErrorBody;
12075
+ /**
12076
+ * 409 — a destination with that name already exists in your company. Names
12077
+ * stay reserved after a destination is deleted, because its delivery history
12078
+ * is keyed on them.
12079
+ */
12080
+ 409: WebhookErrorBody;
12081
+ /**
12082
+ * 422 — the request body was rejected. `violations[].propertyPath` names the
12083
+ * offending field: one of `name`, `url`, `eventTypes`, `authScheme` or
12084
+ * `siteFilter`.
12085
+ */
12086
+ 422: WebhookErrorBody;
12087
+ };
12088
+ export type WebhookDestinationsUpdateDestinationError = WebhookDestinationsUpdateDestinationErrors[keyof WebhookDestinationsUpdateDestinationErrors];
12089
+ export type WebhookDestinationsUpdateDestinationResponses = {
12090
+ /**
12091
+ * The request has succeeded.
12092
+ */
12093
+ 200: WebhookDestination;
12094
+ };
12095
+ export type WebhookDestinationsUpdateDestinationResponse = WebhookDestinationsUpdateDestinationResponses[keyof WebhookDestinationsUpdateDestinationResponses];
12096
+ export type WebhookDestinationsGetDestinationHealthData = {
12097
+ body?: never;
12098
+ path: {
12099
+ name: string;
12100
+ };
12101
+ query?: never;
12102
+ url: '/v1/webhooks/destinations/{name}/health';
12103
+ };
12104
+ export type WebhookDestinationsGetDestinationHealthErrors = {
12105
+ /**
12106
+ * 404 — no such destination. A destination belonging to another company, and a
12107
+ * destination that has been deleted, are both reported as not found: a 403
12108
+ * would confirm that the name exists.
12109
+ */
12110
+ 404: WebhookErrorBody;
12111
+ };
12112
+ export type WebhookDestinationsGetDestinationHealthError = WebhookDestinationsGetDestinationHealthErrors[keyof WebhookDestinationsGetDestinationHealthErrors];
12113
+ export type WebhookDestinationsGetDestinationHealthResponses = {
12114
+ /**
12115
+ * The request has succeeded.
12116
+ */
12117
+ 200: WebhookDestinationHealthResponse;
12118
+ };
12119
+ export type WebhookDestinationsGetDestinationHealthResponse = WebhookDestinationsGetDestinationHealthResponses[keyof WebhookDestinationsGetDestinationHealthResponses];
12120
+ export type WebhookDestinationsRotateSigningKeyData = {
12121
+ body?: never;
12122
+ path: {
12123
+ name: string;
12124
+ };
12125
+ query?: never;
12126
+ url: '/v1/webhooks/destinations/{name}/signing-key';
12127
+ };
12128
+ export type WebhookDestinationsRotateSigningKeyErrors = {
12129
+ /**
12130
+ * 404 — no such destination. A destination belonging to another company, and a
12131
+ * destination that has been deleted, are both reported as not found: a 403
12132
+ * would confirm that the name exists.
12133
+ */
12134
+ 404: WebhookErrorBody;
12135
+ /**
12136
+ * 409 — a destination with that name already exists in your company. Names
12137
+ * stay reserved after a destination is deleted, because its delivery history
12138
+ * is keyed on them.
12139
+ */
12140
+ 409: WebhookErrorBody;
12141
+ };
12142
+ export type WebhookDestinationsRotateSigningKeyError = WebhookDestinationsRotateSigningKeyErrors[keyof WebhookDestinationsRotateSigningKeyErrors];
12143
+ export type WebhookDestinationsRotateSigningKeyResponses = {
12144
+ /**
12145
+ * The request has succeeded.
12146
+ */
12147
+ 200: WebhookSigningKeyResponse;
12148
+ };
12149
+ export type WebhookDestinationsRotateSigningKeyResponse = WebhookDestinationsRotateSigningKeyResponses[keyof WebhookDestinationsRotateSigningKeyResponses];
12150
+ export type WebhookDestinationsTestDestinationData = {
12151
+ body?: never;
12152
+ path: {
12153
+ name: string;
12154
+ };
12155
+ query?: never;
12156
+ url: '/v1/webhooks/destinations/{name}/test';
12157
+ };
12158
+ export type WebhookDestinationsTestDestinationErrors = {
12159
+ /**
12160
+ * 404 — no such destination. A destination belonging to another company, and a
12161
+ * destination that has been deleted, are both reported as not found: a 403
12162
+ * would confirm that the name exists.
12163
+ */
12164
+ 404: WebhookErrorBody;
12165
+ /**
12166
+ * 409 — a destination with that name already exists in your company. Names
12167
+ * stay reserved after a destination is deleted, because its delivery history
12168
+ * is keyed on them.
12169
+ */
12170
+ 409: WebhookErrorBody;
12171
+ /**
12172
+ * 429 — too many test dispatches for this destination. Retry after the number
12173
+ * of seconds given in the `Retry-After` response header.
12174
+ */
12175
+ 429: WebhookErrorBody;
12176
+ };
12177
+ export type WebhookDestinationsTestDestinationError = WebhookDestinationsTestDestinationErrors[keyof WebhookDestinationsTestDestinationErrors];
12178
+ export type WebhookDestinationsTestDestinationResponses = {
12179
+ /**
12180
+ * 202 — the test dispatch has been accepted for delivery. The body is the
12181
+ * delivery engine's acknowledgement.
12182
+ */
12183
+ 202: {
12184
+ [key: string]: unknown;
12185
+ };
12186
+ };
12187
+ export type WebhookDestinationsTestDestinationResponse = WebhookDestinationsTestDestinationResponses[keyof WebhookDestinationsTestDestinationResponses];
11764
12188
  export type CustomerDeleteData = {
11765
12189
  body?: never;
11766
12190
  path: {