@ophelio/sdk 0.5.0 → 0.6.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/README.md +59 -40
- package/dist/index.cjs +166 -42
- package/dist/index.d.cts +252 -30
- package/dist/index.d.mts +252 -30
- package/dist/index.mjs +166 -42
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,9 +30,11 @@ if (result.admitted) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Offline gate cache
|
|
33
|
-
const { members, generated_at } = await ophelio.members.sync(
|
|
33
|
+
const { members, generated_at } = await ophelio.members.sync({
|
|
34
|
+
targets: ['venue_a'], // roster for this gate; optional
|
|
35
|
+
})
|
|
34
36
|
// later, incremental:
|
|
35
|
-
await ophelio.members.sync({ since: generated_at })
|
|
37
|
+
await ophelio.members.sync({ since: generated_at, targets: ['venue_a'] })
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
## Authentication
|
|
@@ -149,35 +151,38 @@ To page manually — for example to show `total_size` or build numbered pages
|
|
|
149
151
|
`page_size` defaults to 50 and is capped at 250. Because pagination is
|
|
150
152
|
offset-based, a row can be seen twice or skipped across a page boundary if the
|
|
151
153
|
collection is written to while you iterate. Paginated methods are marked
|
|
152
|
-
`(params?)` in the table below; every other list
|
|
153
|
-
|
|
154
|
-
`
|
|
154
|
+
`(params?)` in the table below; every other list returns a plain array.
|
|
155
|
+
|
|
156
|
+
On `members.listEntitlements` the page parameters compose with `type` and
|
|
157
|
+
`targets` rather than replacing them: the page is a window onto the
|
|
158
|
+
already-filtered result, and a page token is bound to the filters it was
|
|
159
|
+
issued under.
|
|
155
160
|
|
|
156
161
|
## API surface
|
|
157
162
|
|
|
158
163
|
Everything reachable with an API key is covered:
|
|
159
164
|
|
|
160
|
-
| Namespace | Methods
|
|
161
|
-
| ------------------------------- |
|
|
162
|
-
| `admit` | `check({ card, targets? })`
|
|
163
|
-
| `members` | `sync({ since? })`, `get(id)`, `listEntitlements(id, { type?, targets? })`, `update(id, ...)`, `remove(id)`, `setPrimary(id)`, `reissueCard(id, { note? })`
|
|
164
|
-
| `memberships` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `cancel(id, ...)`, `uncancel(id)`, `renew(id, ...)`, `upgrade(id, ...)`, `downgrade(id, ...)`, `listMembers(id)`, `addMember(id, ...)`, `listScheduledChanges(id, params?)`, `cancelScheduledChange(id, changeId)`, `listTransactions(id, params?)`, `listTermTransactions(id, termId, params?)`, `createTransaction(id, ...)` |
|
|
165
|
-
| `customers` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listMemberships(id, params?)` — `list`/`get` accept `view: 'full'` to include `membership_summary`
|
|
166
|
-
| `entitlements` | `redeem(...)`, `recordUsage(...)`, `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`
|
|
167
|
-
| `plans` | `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listBillingOptions(id)`, `createBillingOption(id, ...)`, `listEntitlements(id)`, `createEntitlement(id, ...)`, `listPlanLinks(id)`, `createPlanLink(id, ...)`, `listPricingGroupMappings(id)`, `createPricingGroupMapping(id, ...)`
|
|
168
|
-
| `billingOptions` | `list()`, `get(id)`, `update(id, ...)`, `delete(id)`, `listSalesChannels(id)`, `createSalesChannelLink(id, ...)`
|
|
169
|
-
| `memberRoles` | `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`
|
|
170
|
-
| `pricingGroups` | `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`
|
|
171
|
-
| `salesChannels` | `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`
|
|
172
|
-
| `targetCodes` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)` — `list`/`get` accept `view: 'full'` to include `plan_entitlement_count`; `update` takes `display_name` / `description` only, as `code` is immutable
|
|
173
|
-
| `calendars` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listRules(id, params?)`, `createRule(id, ...)` — `list`/`get` accept `view: 'full'` to include `plan_entitlement_count`
|
|
174
|
-
| `calendarRules` | `get(id)`, `update(id, ...)`, `delete(id)`
|
|
175
|
-
| `planEntitlements` | `get(id)`, `update(id, ...)`, `delete(id)`, `listAvailabilities(id, params?)`, `createAvailability(id, ...)`
|
|
176
|
-
| `planEntitlementAvailabilities` | `get(id)`, `update(id, ...)`, `delete(id)`
|
|
177
|
-
| `planLinks` | `delete(id)`
|
|
178
|
-
| `planPricingGroupMappings` | `delete(id)`
|
|
179
|
-
| `billingOptionSalesChannels` | `delete(id)`
|
|
180
|
-
| `webhookSubscriptions` | `list()`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listDeliveries(id, params?)`
|
|
165
|
+
| Namespace | Methods |
|
|
166
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
167
|
+
| `admit` | `check({ card, targets? })` |
|
|
168
|
+
| `members` | `sync({ since?, targets? })`, `get(id)`, `listEntitlements(id, { page_size?, page_token?, type?, targets? })`, `update(id, ...)`, `remove(id)`, `setPrimary(id)`, `reissueCard(id, { note? })` |
|
|
169
|
+
| `memberships` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `cancel(id, ...)`, `uncancel(id)`, `renew(id, ...)`, `upgrade(id, ...)`, `downgrade(id, ...)`, `listMembers(id, params?)`, `addMember(id, ...)`, `listScheduledChanges(id, params?)`, `cancelScheduledChange(id, changeId)`, `listTransactions(id, params?)`, `listTermTransactions(id, termId, params?)`, `createTransaction(id, ...)` |
|
|
170
|
+
| `customers` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listMemberships(id, params?)` — `list`/`get` accept `view: 'full'` to include `membership_summary` |
|
|
171
|
+
| `entitlements` | `redeem(...)`, `recordUsage(...)`, `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)` |
|
|
172
|
+
| `plans` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listBillingOptions(id, params?)`, `createBillingOption(id, ...)`, `listEntitlements(id, params?)`, `createEntitlement(id, ...)`, `listPlanLinks(id, params?)`, `createPlanLink(id, ...)`, `listPricingGroupMappings(id, params?)`, `createPricingGroupMapping(id, ...)` |
|
|
173
|
+
| `billingOptions` | `list(params?)`, `get(id)`, `update(id, ...)`, `delete(id)`, `listSalesChannels(id, params?)`, `createSalesChannelLink(id, ...)` |
|
|
174
|
+
| `memberRoles` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)` |
|
|
175
|
+
| `pricingGroups` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)` |
|
|
176
|
+
| `salesChannels` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)` |
|
|
177
|
+
| `targetCodes` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)` — `list`/`get` accept `view: 'full'` to include `plan_entitlement_count`; `update` takes `display_name` / `description` only, as `code` is immutable |
|
|
178
|
+
| `calendars` | `list(params?)`, `get(id, params?)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listRules(id, params?)`, `createRule(id, ...)` — `list`/`get` accept `view: 'full'` to include `plan_entitlement_count` |
|
|
179
|
+
| `calendarRules` | `get(id)`, `update(id, ...)`, `delete(id)` |
|
|
180
|
+
| `planEntitlements` | `get(id)`, `update(id, ...)`, `delete(id)`, `listAvailabilities(id, params?)`, `createAvailability(id, ...)` |
|
|
181
|
+
| `planEntitlementAvailabilities` | `get(id)`, `update(id, ...)`, `delete(id)` |
|
|
182
|
+
| `planLinks` | `delete(id)` |
|
|
183
|
+
| `planPricingGroupMappings` | `delete(id)` |
|
|
184
|
+
| `billingOptionSalesChannels` | `delete(id)` |
|
|
185
|
+
| `webhookSubscriptions` | `list(params?)`, `get(id)`, `create(...)`, `update(id, ...)`, `delete(id)`, `listDeliveries(id, params?)` |
|
|
181
186
|
|
|
182
187
|
Every method accepts a trailing `options` argument: `{ signal?, headers? }`
|
|
183
188
|
(plus `idempotencyKey?` on the idempotency-keyed mutations: `memberships.create`
|
|
@@ -338,10 +343,11 @@ rejected, not registered for you.
|
|
|
338
343
|
### Target context
|
|
339
344
|
|
|
340
345
|
A read can say where it is being made, and the entitlements it gets back are
|
|
341
|
-
checked against the availability rows for that place. `admit.check
|
|
342
|
-
`members.listEntitlements` take `targets` — a set of
|
|
343
|
-
sent comma-separated on the wire — and
|
|
344
|
-
singular `target`, because one usage event
|
|
346
|
+
checked against the availability rows for that place. `admit.check`,
|
|
347
|
+
`members.listEntitlements` and `members.sync` take `targets` — a set of
|
|
348
|
+
registered target codes, sent comma-separated on the wire — and
|
|
349
|
+
`entitlements.recordUsage` takes a singular `target`, because one usage event
|
|
350
|
+
happens at one place.
|
|
345
351
|
|
|
346
352
|
```ts
|
|
347
353
|
const result = await ophelio.admit.check({
|
|
@@ -357,8 +363,9 @@ for (const entitlement of result.entitlements) {
|
|
|
357
363
|
}
|
|
358
364
|
```
|
|
359
365
|
|
|
360
|
-
**Three cases, answered differently
|
|
361
|
-
|
|
366
|
+
**Three cases, answered differently on `admit.check` and
|
|
367
|
+
`members.listEntitlements`.** Omitting `targets` says nothing about where the
|
|
368
|
+
request is: every target restriction is then treated as met, and
|
|
362
369
|
`target_context_applied` comes back `false`. Passing `[]` says the caller names
|
|
363
370
|
no targets, so only benefits valid everywhere come back. Passing codes means a
|
|
364
371
|
benefit has to name one of them. Dates are checked in all three cases.
|
|
@@ -369,9 +376,20 @@ rather than dropped, so a typo cannot pass for a benefit that does not apply.
|
|
|
369
376
|
|
|
370
377
|
**The parameter does a different job on each endpoint.** At the gate it is part
|
|
371
378
|
of the admission decision; on `members.listEntitlements` it filters the list you
|
|
372
|
-
get back. `members.sync`
|
|
373
|
-
are a snapshot taken at the moment of the sync,
|
|
374
|
-
|
|
379
|
+
get back. On `members.sync` it is the scope of what one gate stores for later:
|
|
380
|
+
each member's entitlements are a snapshot taken at the moment of the sync, read
|
|
381
|
+
back during an outage without being checked again, so the targets you sync with
|
|
382
|
+
settle what that gate can grant while it is offline. The gate applies no rules
|
|
383
|
+
of its own.
|
|
384
|
+
|
|
385
|
+
**`members.sync` differs from the other two in two ways, both deliberate.** An
|
|
386
|
+
empty `targets` is refused with a 400 there. It is not read as naming no
|
|
387
|
+
targets, so it never returns only the benefits valid everywhere. And the
|
|
388
|
+
per-project setting below does not apply to it — a sync that omits `targets`
|
|
389
|
+
is always answered and returns the whole roster. The roster is the copy a gate
|
|
390
|
+
falls back on when it cannot reach us, so a quietly shortened or unfetchable
|
|
391
|
+
one would go unnoticed until the outage it exists for. Neither is an oversight
|
|
392
|
+
to be tidied up into consistency.
|
|
375
393
|
|
|
376
394
|
`valid_on` and `valid_at` list only what an entitlement **matched**. `valid_on`
|
|
377
395
|
is omitted when no date restricts it, and `valid_at` when no place does. What
|
|
@@ -380,10 +398,11 @@ benefit is valid, never which restrictions the member missed. Read the two
|
|
|
380
398
|
lists separately — because an entitlement applies if any one row matches, a
|
|
381
399
|
date in `valid_on` and a place in `valid_at` need not come from the same row.
|
|
382
400
|
|
|
383
|
-
A project can require
|
|
384
|
-
their own `targets`, an operator turns the
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
401
|
+
A project can require `admit.check` and `members.listEntitlements` to say where
|
|
402
|
+
they are. Once all of its gates send their own `targets`, an operator turns the
|
|
403
|
+
setting on, and from then on one of those reads that omits `targets` altogether
|
|
404
|
+
is refused with a 400. `members.sync` is exempt, as above. Passing `[]` is not
|
|
405
|
+
the same as omitting it: that read has said where it is and named no targets,
|
|
406
|
+
so it is still answered, exactly as the three cases above describe. It is a
|
|
388
407
|
per-project setting rather than anything the client sends, so start sending
|
|
389
408
|
`targets` before expecting it to be required.
|
package/dist/index.cjs
CHANGED
|
@@ -293,13 +293,25 @@ var BillingOptionSalesChannelsResource = class extends APIResource {
|
|
|
293
293
|
//#endregion
|
|
294
294
|
//#region src/resources/billing-options.ts
|
|
295
295
|
var BillingOptionsResource = class extends APIResource {
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Every billing option in the project, across all plans — plans multiplied
|
|
298
|
+
* by their options, so this is the largest of the configuration lists.
|
|
299
|
+
* Ordered by plan, then display name. Use `collect` or `paginate` to walk it,
|
|
300
|
+
* or read `total_size` off the first page for a count without loading rows.
|
|
301
|
+
*/
|
|
302
|
+
async list(params, options) {
|
|
303
|
+
const response = await this.transport.request({
|
|
298
304
|
method: "GET",
|
|
299
305
|
path: "/api/v1/billing-options",
|
|
306
|
+
query: pageQuery(params),
|
|
300
307
|
retryable: true,
|
|
301
308
|
options
|
|
302
|
-
})
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
items: response.billing_options,
|
|
312
|
+
next_page_token: response.next_page_token,
|
|
313
|
+
total_size: response.total_size
|
|
314
|
+
};
|
|
303
315
|
}
|
|
304
316
|
get(id, options) {
|
|
305
317
|
return this.transport.request({
|
|
@@ -326,13 +338,24 @@ var BillingOptionsResource = class extends APIResource {
|
|
|
326
338
|
options
|
|
327
339
|
});
|
|
328
340
|
}
|
|
329
|
-
|
|
330
|
-
|
|
341
|
+
/**
|
|
342
|
+
* The sales channels a billing option is restricted to, in the order they
|
|
343
|
+
* were linked. No links at all means the billing option is available
|
|
344
|
+
* everywhere.
|
|
345
|
+
*/
|
|
346
|
+
async listSalesChannels(id, params, options) {
|
|
347
|
+
const response = await this.transport.request({
|
|
331
348
|
method: "GET",
|
|
332
349
|
path: `/api/v1/billing-options/${encodeURIComponent(id)}/sales-channels`,
|
|
350
|
+
query: pageQuery(params),
|
|
333
351
|
retryable: true,
|
|
334
352
|
options
|
|
335
|
-
})
|
|
353
|
+
});
|
|
354
|
+
return {
|
|
355
|
+
items: response.sales_channels,
|
|
356
|
+
next_page_token: response.next_page_token,
|
|
357
|
+
total_size: response.total_size
|
|
358
|
+
};
|
|
336
359
|
}
|
|
337
360
|
createSalesChannelLink(id, params, options) {
|
|
338
361
|
return this.transport.request({
|
|
@@ -592,13 +615,19 @@ var EntitlementsResource = class extends APIResource {
|
|
|
592
615
|
options: requestOptions
|
|
593
616
|
})).usage;
|
|
594
617
|
}
|
|
595
|
-
async list(options) {
|
|
596
|
-
|
|
618
|
+
async list(params, options) {
|
|
619
|
+
const response = await this.transport.request({
|
|
597
620
|
method: "GET",
|
|
598
621
|
path: "/api/v1/entitlements",
|
|
622
|
+
query: pageQuery(params),
|
|
599
623
|
retryable: true,
|
|
600
624
|
options
|
|
601
|
-
})
|
|
625
|
+
});
|
|
626
|
+
return {
|
|
627
|
+
items: response.entitlements,
|
|
628
|
+
next_page_token: response.next_page_token,
|
|
629
|
+
total_size: response.total_size
|
|
630
|
+
};
|
|
602
631
|
}
|
|
603
632
|
get(id, options) {
|
|
604
633
|
return this.transport.request({
|
|
@@ -638,13 +667,19 @@ var EntitlementsResource = class extends APIResource {
|
|
|
638
667
|
//#endregion
|
|
639
668
|
//#region src/resources/member-roles.ts
|
|
640
669
|
var MemberRolesResource = class extends APIResource {
|
|
641
|
-
async list(options) {
|
|
642
|
-
|
|
670
|
+
async list(params, options) {
|
|
671
|
+
const response = await this.transport.request({
|
|
643
672
|
method: "GET",
|
|
644
673
|
path: "/api/v1/member-roles",
|
|
674
|
+
query: pageQuery(params),
|
|
645
675
|
retryable: true,
|
|
646
676
|
options
|
|
647
|
-
})
|
|
677
|
+
});
|
|
678
|
+
return {
|
|
679
|
+
items: response.member_roles,
|
|
680
|
+
next_page_token: response.next_page_token,
|
|
681
|
+
total_size: response.total_size
|
|
682
|
+
};
|
|
648
683
|
}
|
|
649
684
|
get(id, options) {
|
|
650
685
|
return this.transport.request({
|
|
@@ -687,12 +722,31 @@ var MembersResource = class extends APIResource {
|
|
|
687
722
|
/**
|
|
688
723
|
* Active-member list for offline gate caching. Pass the previous
|
|
689
724
|
* response's `generated_at` as `since` to fetch incrementally.
|
|
725
|
+
*
|
|
726
|
+
* `targets` names the venue, zone, shop or gate this roster is for, and
|
|
727
|
+
* settles what the gate can grant while it is offline: each member's
|
|
728
|
+
* entitlements are stored as they stand at the moment of the sync and are
|
|
729
|
+
* read back during an outage without being checked again. Omit it for the
|
|
730
|
+
* whole roster. Codes are matched exactly, so send them back verbatim from
|
|
731
|
+
* `targetCodes.list()` — an unregistered one is refused with a 400.
|
|
732
|
+
*
|
|
733
|
+
* Two things work differently here than on `admit.check` and
|
|
734
|
+
* `members.listEntitlements`, both on purpose. An empty `targets` is
|
|
735
|
+
* refused with a 400. It is not read as naming no targets, so it never
|
|
736
|
+
* returns only the benefits valid everywhere. And a project that requires
|
|
737
|
+
* every read to say where it is still answers a sync that omits `targets`.
|
|
738
|
+
* The roster is what a gate falls back on when it cannot reach us, so a
|
|
739
|
+
* quietly shortened or unfetchable copy would only show up during the
|
|
740
|
+
* outage it was kept for.
|
|
690
741
|
*/
|
|
691
742
|
sync(params = {}, options) {
|
|
692
743
|
return this.transport.request({
|
|
693
744
|
method: "GET",
|
|
694
745
|
path: "/api/v1/members/sync",
|
|
695
|
-
query: {
|
|
746
|
+
query: {
|
|
747
|
+
since: params.since,
|
|
748
|
+
targets: params.targets
|
|
749
|
+
},
|
|
696
750
|
retryable: true,
|
|
697
751
|
options
|
|
698
752
|
});
|
|
@@ -719,18 +773,29 @@ var MembersResource = class extends APIResource {
|
|
|
719
773
|
* Each entitlement carries `valid_on` and `valid_at` when something
|
|
720
774
|
* restricts it by date or by target; both list only what it matched, never
|
|
721
775
|
* what it failed.
|
|
776
|
+
*
|
|
777
|
+
* `page_size` / `page_token` window the already-filtered result, so they
|
|
778
|
+
* compose with `type` and `targets` rather than replacing them. A page token
|
|
779
|
+
* is bound to the filters it was issued under: change `type` or `targets`
|
|
780
|
+
* and the token is refused rather than returning misaligned rows.
|
|
722
781
|
*/
|
|
723
782
|
async listEntitlements(id, params = {}, options) {
|
|
724
|
-
|
|
783
|
+
const response = await this.transport.request({
|
|
725
784
|
method: "GET",
|
|
726
785
|
path: `/api/v1/members/${encodeURIComponent(id)}/entitlements`,
|
|
727
786
|
query: {
|
|
787
|
+
...pageQuery(params),
|
|
728
788
|
type: params.type,
|
|
729
789
|
targets: params.targets
|
|
730
790
|
},
|
|
731
791
|
retryable: true,
|
|
732
792
|
options
|
|
733
|
-
})
|
|
793
|
+
});
|
|
794
|
+
return {
|
|
795
|
+
items: response.entitlements,
|
|
796
|
+
next_page_token: response.next_page_token,
|
|
797
|
+
total_size: response.total_size
|
|
798
|
+
};
|
|
734
799
|
}
|
|
735
800
|
/**
|
|
736
801
|
* Updates a member's details. Accepts `name`, `date_of_birth` and `role`
|
|
@@ -883,13 +948,24 @@ var MembershipsResource = class extends APIResource {
|
|
|
883
948
|
options: requestOptions
|
|
884
949
|
});
|
|
885
950
|
}
|
|
886
|
-
|
|
887
|
-
|
|
951
|
+
/**
|
|
952
|
+
* The cardholders on a membership, primary first, then in the order they
|
|
953
|
+
* were added. Bounded by the plan's `max_party_size`, so the default page
|
|
954
|
+
* size covers a membership in one request.
|
|
955
|
+
*/
|
|
956
|
+
async listMembers(id, params, options) {
|
|
957
|
+
const response = await this.transport.request({
|
|
888
958
|
method: "GET",
|
|
889
959
|
path: `/api/v1/memberships/${encodeURIComponent(id)}/members`,
|
|
960
|
+
query: pageQuery(params),
|
|
890
961
|
retryable: true,
|
|
891
962
|
options
|
|
892
|
-
})
|
|
963
|
+
});
|
|
964
|
+
return {
|
|
965
|
+
items: response.members,
|
|
966
|
+
next_page_token: response.next_page_token,
|
|
967
|
+
total_size: response.total_size
|
|
968
|
+
};
|
|
893
969
|
}
|
|
894
970
|
/**
|
|
895
971
|
* Add a member to an existing membership, up to the plan's max party size.
|
|
@@ -1106,13 +1182,19 @@ var PlanPricingGroupMappingsResource = class extends APIResource {
|
|
|
1106
1182
|
//#endregion
|
|
1107
1183
|
//#region src/resources/plans.ts
|
|
1108
1184
|
var PlansResource = class extends APIResource {
|
|
1109
|
-
async list(options) {
|
|
1110
|
-
|
|
1185
|
+
async list(params, options) {
|
|
1186
|
+
const response = await this.transport.request({
|
|
1111
1187
|
method: "GET",
|
|
1112
1188
|
path: "/api/v1/plans",
|
|
1189
|
+
query: pageQuery(params),
|
|
1113
1190
|
retryable: true,
|
|
1114
1191
|
options
|
|
1115
|
-
})
|
|
1192
|
+
});
|
|
1193
|
+
return {
|
|
1194
|
+
items: response.plans,
|
|
1195
|
+
next_page_token: response.next_page_token,
|
|
1196
|
+
total_size: response.total_size
|
|
1197
|
+
};
|
|
1116
1198
|
}
|
|
1117
1199
|
get(id, options) {
|
|
1118
1200
|
return this.transport.request({
|
|
@@ -1122,21 +1204,33 @@ var PlansResource = class extends APIResource {
|
|
|
1122
1204
|
options
|
|
1123
1205
|
});
|
|
1124
1206
|
}
|
|
1125
|
-
async listBillingOptions(id, options) {
|
|
1126
|
-
|
|
1207
|
+
async listBillingOptions(id, params, options) {
|
|
1208
|
+
const response = await this.transport.request({
|
|
1127
1209
|
method: "GET",
|
|
1128
1210
|
path: `/api/v1/plans/${encodeURIComponent(id)}/billing-options`,
|
|
1211
|
+
query: pageQuery(params),
|
|
1129
1212
|
retryable: true,
|
|
1130
1213
|
options
|
|
1131
|
-
})
|
|
1214
|
+
});
|
|
1215
|
+
return {
|
|
1216
|
+
items: response.billing_options,
|
|
1217
|
+
next_page_token: response.next_page_token,
|
|
1218
|
+
total_size: response.total_size
|
|
1219
|
+
};
|
|
1132
1220
|
}
|
|
1133
|
-
async listEntitlements(id, options) {
|
|
1134
|
-
|
|
1221
|
+
async listEntitlements(id, params, options) {
|
|
1222
|
+
const response = await this.transport.request({
|
|
1135
1223
|
method: "GET",
|
|
1136
1224
|
path: `/api/v1/plans/${encodeURIComponent(id)}/entitlements`,
|
|
1225
|
+
query: pageQuery(params),
|
|
1137
1226
|
retryable: true,
|
|
1138
1227
|
options
|
|
1139
|
-
})
|
|
1228
|
+
});
|
|
1229
|
+
return {
|
|
1230
|
+
items: response.entitlements,
|
|
1231
|
+
next_page_token: response.next_page_token,
|
|
1232
|
+
total_size: response.total_size
|
|
1233
|
+
};
|
|
1140
1234
|
}
|
|
1141
1235
|
create(params, options) {
|
|
1142
1236
|
return this.transport.request({
|
|
@@ -1173,13 +1267,19 @@ var PlansResource = class extends APIResource {
|
|
|
1173
1267
|
options
|
|
1174
1268
|
});
|
|
1175
1269
|
}
|
|
1176
|
-
async listPlanLinks(id, options) {
|
|
1177
|
-
|
|
1270
|
+
async listPlanLinks(id, params, options) {
|
|
1271
|
+
const response = await this.transport.request({
|
|
1178
1272
|
method: "GET",
|
|
1179
1273
|
path: `/api/v1/plans/${encodeURIComponent(id)}/plan-links`,
|
|
1274
|
+
query: pageQuery(params),
|
|
1180
1275
|
retryable: true,
|
|
1181
1276
|
options
|
|
1182
|
-
})
|
|
1277
|
+
});
|
|
1278
|
+
return {
|
|
1279
|
+
items: response.plan_links,
|
|
1280
|
+
next_page_token: response.next_page_token,
|
|
1281
|
+
total_size: response.total_size
|
|
1282
|
+
};
|
|
1183
1283
|
}
|
|
1184
1284
|
createPlanLink(id, params, options) {
|
|
1185
1285
|
return this.transport.request({
|
|
@@ -1199,13 +1299,19 @@ var PlansResource = class extends APIResource {
|
|
|
1199
1299
|
options
|
|
1200
1300
|
});
|
|
1201
1301
|
}
|
|
1202
|
-
async listPricingGroupMappings(id, options) {
|
|
1203
|
-
|
|
1302
|
+
async listPricingGroupMappings(id, params, options) {
|
|
1303
|
+
const response = await this.transport.request({
|
|
1204
1304
|
method: "GET",
|
|
1205
1305
|
path: `/api/v1/plans/${encodeURIComponent(id)}/pricing-group-mappings`,
|
|
1306
|
+
query: pageQuery(params),
|
|
1206
1307
|
retryable: true,
|
|
1207
1308
|
options
|
|
1208
|
-
})
|
|
1309
|
+
});
|
|
1310
|
+
return {
|
|
1311
|
+
items: response.pricing_group_mappings,
|
|
1312
|
+
next_page_token: response.next_page_token,
|
|
1313
|
+
total_size: response.total_size
|
|
1314
|
+
};
|
|
1209
1315
|
}
|
|
1210
1316
|
createPricingGroupMapping(id, params, options) {
|
|
1211
1317
|
return this.transport.request({
|
|
@@ -1220,13 +1326,19 @@ var PlansResource = class extends APIResource {
|
|
|
1220
1326
|
//#endregion
|
|
1221
1327
|
//#region src/resources/pricing-groups.ts
|
|
1222
1328
|
var PricingGroupsResource = class extends APIResource {
|
|
1223
|
-
async list(options) {
|
|
1224
|
-
|
|
1329
|
+
async list(params, options) {
|
|
1330
|
+
const response = await this.transport.request({
|
|
1225
1331
|
method: "GET",
|
|
1226
1332
|
path: "/api/v1/pricing-groups",
|
|
1333
|
+
query: pageQuery(params),
|
|
1227
1334
|
retryable: true,
|
|
1228
1335
|
options
|
|
1229
|
-
})
|
|
1336
|
+
});
|
|
1337
|
+
return {
|
|
1338
|
+
items: response.pricing_groups,
|
|
1339
|
+
next_page_token: response.next_page_token,
|
|
1340
|
+
total_size: response.total_size
|
|
1341
|
+
};
|
|
1230
1342
|
}
|
|
1231
1343
|
get(id, options) {
|
|
1232
1344
|
return this.transport.request({
|
|
@@ -1266,13 +1378,19 @@ var PricingGroupsResource = class extends APIResource {
|
|
|
1266
1378
|
//#endregion
|
|
1267
1379
|
//#region src/resources/sales-channels.ts
|
|
1268
1380
|
var SalesChannelsResource = class extends APIResource {
|
|
1269
|
-
async list(options) {
|
|
1270
|
-
|
|
1381
|
+
async list(params, options) {
|
|
1382
|
+
const response = await this.transport.request({
|
|
1271
1383
|
method: "GET",
|
|
1272
1384
|
path: "/api/v1/sales-channels",
|
|
1385
|
+
query: pageQuery(params),
|
|
1273
1386
|
retryable: true,
|
|
1274
1387
|
options
|
|
1275
|
-
})
|
|
1388
|
+
});
|
|
1389
|
+
return {
|
|
1390
|
+
items: response.sales_channels,
|
|
1391
|
+
next_page_token: response.next_page_token,
|
|
1392
|
+
total_size: response.total_size
|
|
1393
|
+
};
|
|
1276
1394
|
}
|
|
1277
1395
|
get(id, options) {
|
|
1278
1396
|
return this.transport.request({
|
|
@@ -1391,13 +1509,19 @@ var TargetCodesResource = class extends APIResource {
|
|
|
1391
1509
|
//#endregion
|
|
1392
1510
|
//#region src/resources/webhook-subscriptions.ts
|
|
1393
1511
|
var WebhookSubscriptionsResource = class extends APIResource {
|
|
1394
|
-
async list(options) {
|
|
1395
|
-
|
|
1512
|
+
async list(params, options) {
|
|
1513
|
+
const response = await this.transport.request({
|
|
1396
1514
|
method: "GET",
|
|
1397
1515
|
path: "/api/v1/webhook-subscriptions",
|
|
1516
|
+
query: pageQuery(params),
|
|
1398
1517
|
retryable: true,
|
|
1399
1518
|
options
|
|
1400
|
-
})
|
|
1519
|
+
});
|
|
1520
|
+
return {
|
|
1521
|
+
items: response.webhook_subscriptions,
|
|
1522
|
+
next_page_token: response.next_page_token,
|
|
1523
|
+
total_size: response.total_size
|
|
1524
|
+
};
|
|
1401
1525
|
}
|
|
1402
1526
|
get(id, options) {
|
|
1403
1527
|
return this.transport.request({
|