@ophelio/sdk 0.5.1 → 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 +27 -24
- package/dist/index.cjs +146 -41
- package/dist/index.d.cts +235 -30
- package/dist/index.d.mts +235 -30
- package/dist/index.mjs +146 -41
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -292,13 +292,25 @@ var BillingOptionSalesChannelsResource = class extends APIResource {
|
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/resources/billing-options.ts
|
|
294
294
|
var BillingOptionsResource = class extends APIResource {
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Every billing option in the project, across all plans — plans multiplied
|
|
297
|
+
* by their options, so this is the largest of the configuration lists.
|
|
298
|
+
* Ordered by plan, then display name. Use `collect` or `paginate` to walk it,
|
|
299
|
+
* or read `total_size` off the first page for a count without loading rows.
|
|
300
|
+
*/
|
|
301
|
+
async list(params, options) {
|
|
302
|
+
const response = await this.transport.request({
|
|
297
303
|
method: "GET",
|
|
298
304
|
path: "/api/v1/billing-options",
|
|
305
|
+
query: pageQuery(params),
|
|
299
306
|
retryable: true,
|
|
300
307
|
options
|
|
301
|
-
})
|
|
308
|
+
});
|
|
309
|
+
return {
|
|
310
|
+
items: response.billing_options,
|
|
311
|
+
next_page_token: response.next_page_token,
|
|
312
|
+
total_size: response.total_size
|
|
313
|
+
};
|
|
302
314
|
}
|
|
303
315
|
get(id, options) {
|
|
304
316
|
return this.transport.request({
|
|
@@ -325,13 +337,24 @@ var BillingOptionsResource = class extends APIResource {
|
|
|
325
337
|
options
|
|
326
338
|
});
|
|
327
339
|
}
|
|
328
|
-
|
|
329
|
-
|
|
340
|
+
/**
|
|
341
|
+
* The sales channels a billing option is restricted to, in the order they
|
|
342
|
+
* were linked. No links at all means the billing option is available
|
|
343
|
+
* everywhere.
|
|
344
|
+
*/
|
|
345
|
+
async listSalesChannels(id, params, options) {
|
|
346
|
+
const response = await this.transport.request({
|
|
330
347
|
method: "GET",
|
|
331
348
|
path: `/api/v1/billing-options/${encodeURIComponent(id)}/sales-channels`,
|
|
349
|
+
query: pageQuery(params),
|
|
332
350
|
retryable: true,
|
|
333
351
|
options
|
|
334
|
-
})
|
|
352
|
+
});
|
|
353
|
+
return {
|
|
354
|
+
items: response.sales_channels,
|
|
355
|
+
next_page_token: response.next_page_token,
|
|
356
|
+
total_size: response.total_size
|
|
357
|
+
};
|
|
335
358
|
}
|
|
336
359
|
createSalesChannelLink(id, params, options) {
|
|
337
360
|
return this.transport.request({
|
|
@@ -591,13 +614,19 @@ var EntitlementsResource = class extends APIResource {
|
|
|
591
614
|
options: requestOptions
|
|
592
615
|
})).usage;
|
|
593
616
|
}
|
|
594
|
-
async list(options) {
|
|
595
|
-
|
|
617
|
+
async list(params, options) {
|
|
618
|
+
const response = await this.transport.request({
|
|
596
619
|
method: "GET",
|
|
597
620
|
path: "/api/v1/entitlements",
|
|
621
|
+
query: pageQuery(params),
|
|
598
622
|
retryable: true,
|
|
599
623
|
options
|
|
600
|
-
})
|
|
624
|
+
});
|
|
625
|
+
return {
|
|
626
|
+
items: response.entitlements,
|
|
627
|
+
next_page_token: response.next_page_token,
|
|
628
|
+
total_size: response.total_size
|
|
629
|
+
};
|
|
601
630
|
}
|
|
602
631
|
get(id, options) {
|
|
603
632
|
return this.transport.request({
|
|
@@ -637,13 +666,19 @@ var EntitlementsResource = class extends APIResource {
|
|
|
637
666
|
//#endregion
|
|
638
667
|
//#region src/resources/member-roles.ts
|
|
639
668
|
var MemberRolesResource = class extends APIResource {
|
|
640
|
-
async list(options) {
|
|
641
|
-
|
|
669
|
+
async list(params, options) {
|
|
670
|
+
const response = await this.transport.request({
|
|
642
671
|
method: "GET",
|
|
643
672
|
path: "/api/v1/member-roles",
|
|
673
|
+
query: pageQuery(params),
|
|
644
674
|
retryable: true,
|
|
645
675
|
options
|
|
646
|
-
})
|
|
676
|
+
});
|
|
677
|
+
return {
|
|
678
|
+
items: response.member_roles,
|
|
679
|
+
next_page_token: response.next_page_token,
|
|
680
|
+
total_size: response.total_size
|
|
681
|
+
};
|
|
647
682
|
}
|
|
648
683
|
get(id, options) {
|
|
649
684
|
return this.transport.request({
|
|
@@ -737,18 +772,29 @@ var MembersResource = class extends APIResource {
|
|
|
737
772
|
* Each entitlement carries `valid_on` and `valid_at` when something
|
|
738
773
|
* restricts it by date or by target; both list only what it matched, never
|
|
739
774
|
* what it failed.
|
|
775
|
+
*
|
|
776
|
+
* `page_size` / `page_token` window the already-filtered result, so they
|
|
777
|
+
* compose with `type` and `targets` rather than replacing them. A page token
|
|
778
|
+
* is bound to the filters it was issued under: change `type` or `targets`
|
|
779
|
+
* and the token is refused rather than returning misaligned rows.
|
|
740
780
|
*/
|
|
741
781
|
async listEntitlements(id, params = {}, options) {
|
|
742
|
-
|
|
782
|
+
const response = await this.transport.request({
|
|
743
783
|
method: "GET",
|
|
744
784
|
path: `/api/v1/members/${encodeURIComponent(id)}/entitlements`,
|
|
745
785
|
query: {
|
|
786
|
+
...pageQuery(params),
|
|
746
787
|
type: params.type,
|
|
747
788
|
targets: params.targets
|
|
748
789
|
},
|
|
749
790
|
retryable: true,
|
|
750
791
|
options
|
|
751
|
-
})
|
|
792
|
+
});
|
|
793
|
+
return {
|
|
794
|
+
items: response.entitlements,
|
|
795
|
+
next_page_token: response.next_page_token,
|
|
796
|
+
total_size: response.total_size
|
|
797
|
+
};
|
|
752
798
|
}
|
|
753
799
|
/**
|
|
754
800
|
* Updates a member's details. Accepts `name`, `date_of_birth` and `role`
|
|
@@ -901,13 +947,24 @@ var MembershipsResource = class extends APIResource {
|
|
|
901
947
|
options: requestOptions
|
|
902
948
|
});
|
|
903
949
|
}
|
|
904
|
-
|
|
905
|
-
|
|
950
|
+
/**
|
|
951
|
+
* The cardholders on a membership, primary first, then in the order they
|
|
952
|
+
* were added. Bounded by the plan's `max_party_size`, so the default page
|
|
953
|
+
* size covers a membership in one request.
|
|
954
|
+
*/
|
|
955
|
+
async listMembers(id, params, options) {
|
|
956
|
+
const response = await this.transport.request({
|
|
906
957
|
method: "GET",
|
|
907
958
|
path: `/api/v1/memberships/${encodeURIComponent(id)}/members`,
|
|
959
|
+
query: pageQuery(params),
|
|
908
960
|
retryable: true,
|
|
909
961
|
options
|
|
910
|
-
})
|
|
962
|
+
});
|
|
963
|
+
return {
|
|
964
|
+
items: response.members,
|
|
965
|
+
next_page_token: response.next_page_token,
|
|
966
|
+
total_size: response.total_size
|
|
967
|
+
};
|
|
911
968
|
}
|
|
912
969
|
/**
|
|
913
970
|
* Add a member to an existing membership, up to the plan's max party size.
|
|
@@ -1124,13 +1181,19 @@ var PlanPricingGroupMappingsResource = class extends APIResource {
|
|
|
1124
1181
|
//#endregion
|
|
1125
1182
|
//#region src/resources/plans.ts
|
|
1126
1183
|
var PlansResource = class extends APIResource {
|
|
1127
|
-
async list(options) {
|
|
1128
|
-
|
|
1184
|
+
async list(params, options) {
|
|
1185
|
+
const response = await this.transport.request({
|
|
1129
1186
|
method: "GET",
|
|
1130
1187
|
path: "/api/v1/plans",
|
|
1188
|
+
query: pageQuery(params),
|
|
1131
1189
|
retryable: true,
|
|
1132
1190
|
options
|
|
1133
|
-
})
|
|
1191
|
+
});
|
|
1192
|
+
return {
|
|
1193
|
+
items: response.plans,
|
|
1194
|
+
next_page_token: response.next_page_token,
|
|
1195
|
+
total_size: response.total_size
|
|
1196
|
+
};
|
|
1134
1197
|
}
|
|
1135
1198
|
get(id, options) {
|
|
1136
1199
|
return this.transport.request({
|
|
@@ -1140,21 +1203,33 @@ var PlansResource = class extends APIResource {
|
|
|
1140
1203
|
options
|
|
1141
1204
|
});
|
|
1142
1205
|
}
|
|
1143
|
-
async listBillingOptions(id, options) {
|
|
1144
|
-
|
|
1206
|
+
async listBillingOptions(id, params, options) {
|
|
1207
|
+
const response = await this.transport.request({
|
|
1145
1208
|
method: "GET",
|
|
1146
1209
|
path: `/api/v1/plans/${encodeURIComponent(id)}/billing-options`,
|
|
1210
|
+
query: pageQuery(params),
|
|
1147
1211
|
retryable: true,
|
|
1148
1212
|
options
|
|
1149
|
-
})
|
|
1213
|
+
});
|
|
1214
|
+
return {
|
|
1215
|
+
items: response.billing_options,
|
|
1216
|
+
next_page_token: response.next_page_token,
|
|
1217
|
+
total_size: response.total_size
|
|
1218
|
+
};
|
|
1150
1219
|
}
|
|
1151
|
-
async listEntitlements(id, options) {
|
|
1152
|
-
|
|
1220
|
+
async listEntitlements(id, params, options) {
|
|
1221
|
+
const response = await this.transport.request({
|
|
1153
1222
|
method: "GET",
|
|
1154
1223
|
path: `/api/v1/plans/${encodeURIComponent(id)}/entitlements`,
|
|
1224
|
+
query: pageQuery(params),
|
|
1155
1225
|
retryable: true,
|
|
1156
1226
|
options
|
|
1157
|
-
})
|
|
1227
|
+
});
|
|
1228
|
+
return {
|
|
1229
|
+
items: response.entitlements,
|
|
1230
|
+
next_page_token: response.next_page_token,
|
|
1231
|
+
total_size: response.total_size
|
|
1232
|
+
};
|
|
1158
1233
|
}
|
|
1159
1234
|
create(params, options) {
|
|
1160
1235
|
return this.transport.request({
|
|
@@ -1191,13 +1266,19 @@ var PlansResource = class extends APIResource {
|
|
|
1191
1266
|
options
|
|
1192
1267
|
});
|
|
1193
1268
|
}
|
|
1194
|
-
async listPlanLinks(id, options) {
|
|
1195
|
-
|
|
1269
|
+
async listPlanLinks(id, params, options) {
|
|
1270
|
+
const response = await this.transport.request({
|
|
1196
1271
|
method: "GET",
|
|
1197
1272
|
path: `/api/v1/plans/${encodeURIComponent(id)}/plan-links`,
|
|
1273
|
+
query: pageQuery(params),
|
|
1198
1274
|
retryable: true,
|
|
1199
1275
|
options
|
|
1200
|
-
})
|
|
1276
|
+
});
|
|
1277
|
+
return {
|
|
1278
|
+
items: response.plan_links,
|
|
1279
|
+
next_page_token: response.next_page_token,
|
|
1280
|
+
total_size: response.total_size
|
|
1281
|
+
};
|
|
1201
1282
|
}
|
|
1202
1283
|
createPlanLink(id, params, options) {
|
|
1203
1284
|
return this.transport.request({
|
|
@@ -1217,13 +1298,19 @@ var PlansResource = class extends APIResource {
|
|
|
1217
1298
|
options
|
|
1218
1299
|
});
|
|
1219
1300
|
}
|
|
1220
|
-
async listPricingGroupMappings(id, options) {
|
|
1221
|
-
|
|
1301
|
+
async listPricingGroupMappings(id, params, options) {
|
|
1302
|
+
const response = await this.transport.request({
|
|
1222
1303
|
method: "GET",
|
|
1223
1304
|
path: `/api/v1/plans/${encodeURIComponent(id)}/pricing-group-mappings`,
|
|
1305
|
+
query: pageQuery(params),
|
|
1224
1306
|
retryable: true,
|
|
1225
1307
|
options
|
|
1226
|
-
})
|
|
1308
|
+
});
|
|
1309
|
+
return {
|
|
1310
|
+
items: response.pricing_group_mappings,
|
|
1311
|
+
next_page_token: response.next_page_token,
|
|
1312
|
+
total_size: response.total_size
|
|
1313
|
+
};
|
|
1227
1314
|
}
|
|
1228
1315
|
createPricingGroupMapping(id, params, options) {
|
|
1229
1316
|
return this.transport.request({
|
|
@@ -1238,13 +1325,19 @@ var PlansResource = class extends APIResource {
|
|
|
1238
1325
|
//#endregion
|
|
1239
1326
|
//#region src/resources/pricing-groups.ts
|
|
1240
1327
|
var PricingGroupsResource = class extends APIResource {
|
|
1241
|
-
async list(options) {
|
|
1242
|
-
|
|
1328
|
+
async list(params, options) {
|
|
1329
|
+
const response = await this.transport.request({
|
|
1243
1330
|
method: "GET",
|
|
1244
1331
|
path: "/api/v1/pricing-groups",
|
|
1332
|
+
query: pageQuery(params),
|
|
1245
1333
|
retryable: true,
|
|
1246
1334
|
options
|
|
1247
|
-
})
|
|
1335
|
+
});
|
|
1336
|
+
return {
|
|
1337
|
+
items: response.pricing_groups,
|
|
1338
|
+
next_page_token: response.next_page_token,
|
|
1339
|
+
total_size: response.total_size
|
|
1340
|
+
};
|
|
1248
1341
|
}
|
|
1249
1342
|
get(id, options) {
|
|
1250
1343
|
return this.transport.request({
|
|
@@ -1284,13 +1377,19 @@ var PricingGroupsResource = class extends APIResource {
|
|
|
1284
1377
|
//#endregion
|
|
1285
1378
|
//#region src/resources/sales-channels.ts
|
|
1286
1379
|
var SalesChannelsResource = class extends APIResource {
|
|
1287
|
-
async list(options) {
|
|
1288
|
-
|
|
1380
|
+
async list(params, options) {
|
|
1381
|
+
const response = await this.transport.request({
|
|
1289
1382
|
method: "GET",
|
|
1290
1383
|
path: "/api/v1/sales-channels",
|
|
1384
|
+
query: pageQuery(params),
|
|
1291
1385
|
retryable: true,
|
|
1292
1386
|
options
|
|
1293
|
-
})
|
|
1387
|
+
});
|
|
1388
|
+
return {
|
|
1389
|
+
items: response.sales_channels,
|
|
1390
|
+
next_page_token: response.next_page_token,
|
|
1391
|
+
total_size: response.total_size
|
|
1392
|
+
};
|
|
1294
1393
|
}
|
|
1295
1394
|
get(id, options) {
|
|
1296
1395
|
return this.transport.request({
|
|
@@ -1409,13 +1508,19 @@ var TargetCodesResource = class extends APIResource {
|
|
|
1409
1508
|
//#endregion
|
|
1410
1509
|
//#region src/resources/webhook-subscriptions.ts
|
|
1411
1510
|
var WebhookSubscriptionsResource = class extends APIResource {
|
|
1412
|
-
async list(options) {
|
|
1413
|
-
|
|
1511
|
+
async list(params, options) {
|
|
1512
|
+
const response = await this.transport.request({
|
|
1414
1513
|
method: "GET",
|
|
1415
1514
|
path: "/api/v1/webhook-subscriptions",
|
|
1515
|
+
query: pageQuery(params),
|
|
1416
1516
|
retryable: true,
|
|
1417
1517
|
options
|
|
1418
|
-
})
|
|
1518
|
+
});
|
|
1519
|
+
return {
|
|
1520
|
+
items: response.webhook_subscriptions,
|
|
1521
|
+
next_page_token: response.next_page_token,
|
|
1522
|
+
total_size: response.total_size
|
|
1523
|
+
};
|
|
1419
1524
|
}
|
|
1420
1525
|
get(id, options) {
|
|
1421
1526
|
return this.transport.request({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ophelio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Official JavaScript / TypeScript SDK for the Ophel.io membership & entitlement API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ophel.io",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"publint": "^0.3.21",
|
|
48
48
|
"tsdown": "^0.22.0",
|
|
49
49
|
"typescript": "^6.0.3",
|
|
50
|
-
"vitest": "^
|
|
50
|
+
"vitest": "^5.0.0"
|
|
51
51
|
}
|
|
52
52
|
}
|