@ticketlayer/backstage 2.1.0 → 2.2.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/client.js CHANGED
@@ -447,6 +447,33 @@ class BackstageClient {
447
447
  }
448
448
  };
449
449
  this.events = Object.assign((eventId) => ({
450
+ offers: {
451
+ get: async (options) => {
452
+ const params = new URLSearchParams();
453
+ if (options?.occurrenceId !== undefined)
454
+ params.append('occurrenceId', String(options.occurrenceId));
455
+ if (options?.at !== undefined)
456
+ params.append('at', String(options.at));
457
+ if (options?.customerId !== undefined)
458
+ params.append('customerId', String(options.customerId));
459
+ if (options?.code !== undefined)
460
+ params.append('code', String(options.code));
461
+ if (options?.presaleCode !== undefined)
462
+ params.append('presaleCode', String(options.presaleCode));
463
+ if (options?.quantity !== undefined)
464
+ params.append('quantity', String(options.quantity));
465
+ if (options?.cartId !== undefined)
466
+ params.append('cartId', String(options.cartId));
467
+ if (options?.view !== undefined)
468
+ params.append('view', String(options.view));
469
+ const queryString = params.toString();
470
+ const requestPath = queryString ? `/events/${eventId}/offers?${queryString}` : `/events/${eventId}/offers`;
471
+ const response = await this.request(requestPath, {
472
+ method: 'GET'
473
+ });
474
+ return response;
475
+ }
476
+ },
450
477
  occurrences: {
451
478
  create: async (request) => {
452
479
  const response = await this.request(`/events/${eventId}/occurrences`, {
@@ -1226,6 +1253,30 @@ class BackstageClient {
1226
1253
  });
1227
1254
  return response.customer;
1228
1255
  },
1256
+ listTags: async (customerId, options) => {
1257
+ const params = new URLSearchParams();
1258
+ if (options?.includeRevoked !== undefined)
1259
+ params.append('includeRevoked', String(options.includeRevoked));
1260
+ const queryString = params.toString();
1261
+ const requestPath = queryString ? `/customers/${customerId}/tags?${queryString}` : `/customers/${customerId}/tags`;
1262
+ const response = await this.request(requestPath, {
1263
+ method: 'GET'
1264
+ });
1265
+ return response.customerTags;
1266
+ },
1267
+ grantTag: async (customerId, request) => {
1268
+ const response = await this.request(`/customers/${customerId}/tags`, {
1269
+ method: 'POST',
1270
+ body: JSON.stringify(request)
1271
+ });
1272
+ return response.customerTag;
1273
+ },
1274
+ revokeTag: async (customerId, customerTagId) => {
1275
+ const response = await this.request(`/customers/${customerId}/tags/${customerTagId}/revoke`, {
1276
+ method: 'POST'
1277
+ });
1278
+ return response.customerTag;
1279
+ },
1229
1280
  listBenefits: async (customerId, options) => {
1230
1281
  const params = new URLSearchParams();
1231
1282
  if (options?.includeRevoked !== undefined)
@@ -1898,6 +1949,49 @@ class BackstageClient {
1898
1949
  return response.brand;
1899
1950
  }
1900
1951
  };
1952
+ this.tags = {
1953
+ list: async (options) => {
1954
+ const params = new URLSearchParams();
1955
+ if (options?.kind !== undefined)
1956
+ params.append('kind', String(options.kind));
1957
+ if (options?.appliesTo !== undefined)
1958
+ params.append('appliesTo', String(options.appliesTo));
1959
+ if (options?.includeArchived !== undefined)
1960
+ params.append('includeArchived', String(options.includeArchived));
1961
+ const queryString = params.toString();
1962
+ const requestPath = queryString ? `/tag-definitions?${queryString}` : `/tag-definitions`;
1963
+ const response = await this.request(requestPath, {
1964
+ method: 'GET'
1965
+ });
1966
+ return response.tagDefinitions;
1967
+ },
1968
+ create: async (request) => {
1969
+ const response = await this.request(`/tag-definitions`, {
1970
+ method: 'POST',
1971
+ body: JSON.stringify(request)
1972
+ });
1973
+ return response.tagDefinition;
1974
+ },
1975
+ get: async (id) => {
1976
+ const response = await this.request(`/tag-definitions/${id}`, {
1977
+ method: 'GET'
1978
+ });
1979
+ return response.tagDefinition;
1980
+ },
1981
+ update: async (id, request) => {
1982
+ const response = await this.request(`/tag-definitions/${id}`, {
1983
+ method: 'PATCH',
1984
+ body: JSON.stringify(request)
1985
+ });
1986
+ return response.tagDefinition;
1987
+ },
1988
+ archive: async (id) => {
1989
+ const response = await this.request(`/tag-definitions/${id}`, {
1990
+ method: 'DELETE'
1991
+ });
1992
+ return response.tagDefinition;
1993
+ }
1994
+ };
1901
1995
  this.passes = Object.assign((passeId) => ({
1902
1996
  entitlements: {
1903
1997
  redeem: async (barcode, request) => {