@ophelio/sdk 0.5.1 → 0.6.1
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 +151 -42
- package/dist/index.d.cts +242 -32
- package/dist/index.d.mts +242 -32
- package/dist/index.mjs +151 -42
- 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.
|
|
@@ -963,13 +1020,17 @@ var MembershipsResource = class extends APIResource {
|
|
|
963
1020
|
options
|
|
964
1021
|
});
|
|
965
1022
|
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Lists scheduled changes. `status` accepts one status, several, or `all`;
|
|
1025
|
+
* omit it to return every status.
|
|
1026
|
+
*/
|
|
966
1027
|
async listScheduledChanges(id, params, options) {
|
|
967
1028
|
const response = await this.transport.request({
|
|
968
1029
|
method: "GET",
|
|
969
1030
|
path: `/api/v1/memberships/${encodeURIComponent(id)}/scheduled-changes`,
|
|
970
1031
|
query: {
|
|
971
1032
|
...pageQuery(params),
|
|
972
|
-
...params?.status ? { status: params.status } : {}
|
|
1033
|
+
...params?.status !== void 0 ? { status: params.status } : {}
|
|
973
1034
|
},
|
|
974
1035
|
retryable: true,
|
|
975
1036
|
options
|
|
@@ -1124,13 +1185,19 @@ var PlanPricingGroupMappingsResource = class extends APIResource {
|
|
|
1124
1185
|
//#endregion
|
|
1125
1186
|
//#region src/resources/plans.ts
|
|
1126
1187
|
var PlansResource = class extends APIResource {
|
|
1127
|
-
async list(options) {
|
|
1128
|
-
|
|
1188
|
+
async list(params, options) {
|
|
1189
|
+
const response = await this.transport.request({
|
|
1129
1190
|
method: "GET",
|
|
1130
1191
|
path: "/api/v1/plans",
|
|
1192
|
+
query: pageQuery(params),
|
|
1131
1193
|
retryable: true,
|
|
1132
1194
|
options
|
|
1133
|
-
})
|
|
1195
|
+
});
|
|
1196
|
+
return {
|
|
1197
|
+
items: response.plans,
|
|
1198
|
+
next_page_token: response.next_page_token,
|
|
1199
|
+
total_size: response.total_size
|
|
1200
|
+
};
|
|
1134
1201
|
}
|
|
1135
1202
|
get(id, options) {
|
|
1136
1203
|
return this.transport.request({
|
|
@@ -1140,21 +1207,33 @@ var PlansResource = class extends APIResource {
|
|
|
1140
1207
|
options
|
|
1141
1208
|
});
|
|
1142
1209
|
}
|
|
1143
|
-
async listBillingOptions(id, options) {
|
|
1144
|
-
|
|
1210
|
+
async listBillingOptions(id, params, options) {
|
|
1211
|
+
const response = await this.transport.request({
|
|
1145
1212
|
method: "GET",
|
|
1146
1213
|
path: `/api/v1/plans/${encodeURIComponent(id)}/billing-options`,
|
|
1214
|
+
query: pageQuery(params),
|
|
1147
1215
|
retryable: true,
|
|
1148
1216
|
options
|
|
1149
|
-
})
|
|
1217
|
+
});
|
|
1218
|
+
return {
|
|
1219
|
+
items: response.billing_options,
|
|
1220
|
+
next_page_token: response.next_page_token,
|
|
1221
|
+
total_size: response.total_size
|
|
1222
|
+
};
|
|
1150
1223
|
}
|
|
1151
|
-
async listEntitlements(id, options) {
|
|
1152
|
-
|
|
1224
|
+
async listEntitlements(id, params, options) {
|
|
1225
|
+
const response = await this.transport.request({
|
|
1153
1226
|
method: "GET",
|
|
1154
1227
|
path: `/api/v1/plans/${encodeURIComponent(id)}/entitlements`,
|
|
1228
|
+
query: pageQuery(params),
|
|
1155
1229
|
retryable: true,
|
|
1156
1230
|
options
|
|
1157
|
-
})
|
|
1231
|
+
});
|
|
1232
|
+
return {
|
|
1233
|
+
items: response.entitlements,
|
|
1234
|
+
next_page_token: response.next_page_token,
|
|
1235
|
+
total_size: response.total_size
|
|
1236
|
+
};
|
|
1158
1237
|
}
|
|
1159
1238
|
create(params, options) {
|
|
1160
1239
|
return this.transport.request({
|
|
@@ -1191,13 +1270,19 @@ var PlansResource = class extends APIResource {
|
|
|
1191
1270
|
options
|
|
1192
1271
|
});
|
|
1193
1272
|
}
|
|
1194
|
-
async listPlanLinks(id, options) {
|
|
1195
|
-
|
|
1273
|
+
async listPlanLinks(id, params, options) {
|
|
1274
|
+
const response = await this.transport.request({
|
|
1196
1275
|
method: "GET",
|
|
1197
1276
|
path: `/api/v1/plans/${encodeURIComponent(id)}/plan-links`,
|
|
1277
|
+
query: pageQuery(params),
|
|
1198
1278
|
retryable: true,
|
|
1199
1279
|
options
|
|
1200
|
-
})
|
|
1280
|
+
});
|
|
1281
|
+
return {
|
|
1282
|
+
items: response.plan_links,
|
|
1283
|
+
next_page_token: response.next_page_token,
|
|
1284
|
+
total_size: response.total_size
|
|
1285
|
+
};
|
|
1201
1286
|
}
|
|
1202
1287
|
createPlanLink(id, params, options) {
|
|
1203
1288
|
return this.transport.request({
|
|
@@ -1217,13 +1302,19 @@ var PlansResource = class extends APIResource {
|
|
|
1217
1302
|
options
|
|
1218
1303
|
});
|
|
1219
1304
|
}
|
|
1220
|
-
async listPricingGroupMappings(id, options) {
|
|
1221
|
-
|
|
1305
|
+
async listPricingGroupMappings(id, params, options) {
|
|
1306
|
+
const response = await this.transport.request({
|
|
1222
1307
|
method: "GET",
|
|
1223
1308
|
path: `/api/v1/plans/${encodeURIComponent(id)}/pricing-group-mappings`,
|
|
1309
|
+
query: pageQuery(params),
|
|
1224
1310
|
retryable: true,
|
|
1225
1311
|
options
|
|
1226
|
-
})
|
|
1312
|
+
});
|
|
1313
|
+
return {
|
|
1314
|
+
items: response.pricing_group_mappings,
|
|
1315
|
+
next_page_token: response.next_page_token,
|
|
1316
|
+
total_size: response.total_size
|
|
1317
|
+
};
|
|
1227
1318
|
}
|
|
1228
1319
|
createPricingGroupMapping(id, params, options) {
|
|
1229
1320
|
return this.transport.request({
|
|
@@ -1238,13 +1329,19 @@ var PlansResource = class extends APIResource {
|
|
|
1238
1329
|
//#endregion
|
|
1239
1330
|
//#region src/resources/pricing-groups.ts
|
|
1240
1331
|
var PricingGroupsResource = class extends APIResource {
|
|
1241
|
-
async list(options) {
|
|
1242
|
-
|
|
1332
|
+
async list(params, options) {
|
|
1333
|
+
const response = await this.transport.request({
|
|
1243
1334
|
method: "GET",
|
|
1244
1335
|
path: "/api/v1/pricing-groups",
|
|
1336
|
+
query: pageQuery(params),
|
|
1245
1337
|
retryable: true,
|
|
1246
1338
|
options
|
|
1247
|
-
})
|
|
1339
|
+
});
|
|
1340
|
+
return {
|
|
1341
|
+
items: response.pricing_groups,
|
|
1342
|
+
next_page_token: response.next_page_token,
|
|
1343
|
+
total_size: response.total_size
|
|
1344
|
+
};
|
|
1248
1345
|
}
|
|
1249
1346
|
get(id, options) {
|
|
1250
1347
|
return this.transport.request({
|
|
@@ -1284,13 +1381,19 @@ var PricingGroupsResource = class extends APIResource {
|
|
|
1284
1381
|
//#endregion
|
|
1285
1382
|
//#region src/resources/sales-channels.ts
|
|
1286
1383
|
var SalesChannelsResource = class extends APIResource {
|
|
1287
|
-
async list(options) {
|
|
1288
|
-
|
|
1384
|
+
async list(params, options) {
|
|
1385
|
+
const response = await this.transport.request({
|
|
1289
1386
|
method: "GET",
|
|
1290
1387
|
path: "/api/v1/sales-channels",
|
|
1388
|
+
query: pageQuery(params),
|
|
1291
1389
|
retryable: true,
|
|
1292
1390
|
options
|
|
1293
|
-
})
|
|
1391
|
+
});
|
|
1392
|
+
return {
|
|
1393
|
+
items: response.sales_channels,
|
|
1394
|
+
next_page_token: response.next_page_token,
|
|
1395
|
+
total_size: response.total_size
|
|
1396
|
+
};
|
|
1294
1397
|
}
|
|
1295
1398
|
get(id, options) {
|
|
1296
1399
|
return this.transport.request({
|
|
@@ -1409,13 +1512,19 @@ var TargetCodesResource = class extends APIResource {
|
|
|
1409
1512
|
//#endregion
|
|
1410
1513
|
//#region src/resources/webhook-subscriptions.ts
|
|
1411
1514
|
var WebhookSubscriptionsResource = class extends APIResource {
|
|
1412
|
-
async list(options) {
|
|
1413
|
-
|
|
1515
|
+
async list(params, options) {
|
|
1516
|
+
const response = await this.transport.request({
|
|
1414
1517
|
method: "GET",
|
|
1415
1518
|
path: "/api/v1/webhook-subscriptions",
|
|
1519
|
+
query: pageQuery(params),
|
|
1416
1520
|
retryable: true,
|
|
1417
1521
|
options
|
|
1418
|
-
})
|
|
1522
|
+
});
|
|
1523
|
+
return {
|
|
1524
|
+
items: response.webhook_subscriptions,
|
|
1525
|
+
next_page_token: response.next_page_token,
|
|
1526
|
+
total_size: response.total_size
|
|
1527
|
+
};
|
|
1419
1528
|
}
|
|
1420
1529
|
get(id, options) {
|
|
1421
1530
|
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.1",
|
|
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
|
}
|