@acosmi/sdk-ts 1.6.0 → 1.9.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.
@@ -6128,8 +6128,390 @@ Client.prototype.getBugReport = async function(bugID, signal) {
6128
6128
  return resp.data;
6129
6129
  };
6130
6130
 
6131
+ // src/subscription/client.ts
6132
+ Client.prototype.listPlans = async function(audience, signal) {
6133
+ const query = audience ? `?audience=${encodeURIComponent(audience)}` : "";
6134
+ const resp = await this.doJSON(
6135
+ "GET",
6136
+ `/distribution/public/pricing/plans${query}`,
6137
+ null,
6138
+ signal
6139
+ );
6140
+ return Array.isArray(resp.data) ? resp.data : [];
6141
+ };
6142
+ Client.prototype.listUserSubscriptions = async function(signal) {
6143
+ const resp = await this.doJSON(
6144
+ "GET",
6145
+ "/distribution/user/subscriptions",
6146
+ null,
6147
+ signal
6148
+ );
6149
+ return Array.isArray(resp.data) ? resp.data : [];
6150
+ };
6151
+
6152
+ // src/pricing/client.ts
6153
+ Client.prototype.getPricingConfig = async function(key, signal) {
6154
+ const query = key ? `?key=${encodeURIComponent(key)}` : "";
6155
+ const resp = await this.doJSON(
6156
+ "GET",
6157
+ `/distribution/public/pricing/config${query}`,
6158
+ null,
6159
+ signal
6160
+ );
6161
+ return resp.data ?? {};
6162
+ };
6163
+ Client.prototype.listPublicModels = async function(signal) {
6164
+ const resp = await this.doJSON(
6165
+ "GET",
6166
+ "/distribution/public/pricing/models",
6167
+ null,
6168
+ signal
6169
+ );
6170
+ return Array.isArray(resp.data) ? resp.data : [];
6171
+ };
6172
+ Client.prototype.listComplianceSkus = async function(region, signal) {
6173
+ const query = region ? `?region=${encodeURIComponent(region)}` : "";
6174
+ const resp = await this.doJSON(
6175
+ "GET",
6176
+ `/distribution/public/compliance/skus${query}`,
6177
+ null,
6178
+ signal
6179
+ );
6180
+ return Array.isArray(resp.data) ? resp.data : [];
6181
+ };
6182
+ Client.prototype.quoteCompliance = async function(skuCode, quantity, region, signal) {
6183
+ if (!skuCode) {
6184
+ throw new Error("quoteCompliance: skuCode is required");
6185
+ }
6186
+ const params = [`skuCode=${encodeURIComponent(skuCode)}`];
6187
+ if (quantity != null) params.push(`quantity=${quantity}`);
6188
+ if (region) params.push(`region=${encodeURIComponent(region)}`);
6189
+ const resp = await this.doJSON(
6190
+ "GET",
6191
+ `/distribution/public/compliance/quote?${params.join("&")}`,
6192
+ null,
6193
+ signal
6194
+ );
6195
+ return resp.data ?? { skuCode, available: false };
6196
+ };
6197
+
6198
+ // src/products/types.ts
6199
+ var ProductFamilyEnum = {
6200
+ MODEL_MEMBERSHIP: "MODEL_MEMBERSHIP",
6201
+ TOKEN_PACK: "TOKEN_PACK",
6202
+ COMPLIANCE: "COMPLIANCE",
6203
+ LEGAL: "LEGAL",
6204
+ DESIGN_AGENT: "DESIGN_AGENT",
6205
+ ENTERPRISE: "ENTERPRISE"
6206
+ };
6207
+ var AudienceEnum = {
6208
+ PERSONAL: "PERSONAL",
6209
+ ENTERPRISE: "ENTERPRISE",
6210
+ DEVELOPER: "DEVELOPER"
6211
+ };
6212
+ var BillingModeEnum = {
6213
+ ONE_TIME: "ONE_TIME",
6214
+ SUBSCRIPTION: "SUBSCRIPTION",
6215
+ METERED: "METERED",
6216
+ HYBRID: "HYBRID"
6217
+ };
6218
+ var RegionScopeEnum = {
6219
+ CN: "CN",
6220
+ OS: "OS",
6221
+ GLOBAL: "GLOBAL"
6222
+ };
6223
+
6224
+ // src/products/client.ts
6225
+ Client.prototype.listProductsByFamily = async function(family, audience, region, signal) {
6226
+ const params = [];
6227
+ if (family) params.push(`family=${encodeURIComponent(family)}`);
6228
+ if (audience) params.push(`audience=${encodeURIComponent(audience)}`);
6229
+ if (region) params.push(`region=${encodeURIComponent(region)}`);
6230
+ const query = params.length > 0 ? `?${params.join("&")}` : "";
6231
+ const resp = await this.doJSON(
6232
+ "GET",
6233
+ `/distribution/public/products/by-family${query}`,
6234
+ null,
6235
+ signal
6236
+ );
6237
+ return Array.isArray(resp.data) ? resp.data : [];
6238
+ };
6239
+ Client.prototype.getProductBySlug = async function(slug, region, signal) {
6240
+ if (!slug) {
6241
+ throw new Error("getProductBySlug: slug is required");
6242
+ }
6243
+ const query = region ? `?region=${encodeURIComponent(region)}` : "";
6244
+ const resp = await this.doJSON(
6245
+ "GET",
6246
+ `/distribution/public/products/by-slug/${encodeURIComponent(slug)}${query}`,
6247
+ null,
6248
+ signal
6249
+ );
6250
+ if (!resp.data) {
6251
+ throw new Error(`getProductBySlug: product not found (slug=${slug})`);
6252
+ }
6253
+ return resp.data;
6254
+ };
6255
+
6256
+ // src/casehall/client.ts
6257
+ Client.prototype.listLawyers = async function(params, signal) {
6258
+ const qs = new URLSearchParams();
6259
+ if (params?.practiceArea) qs.set("practiceArea", params.practiceArea);
6260
+ if (params?.location) qs.set("location", params.location);
6261
+ if (params?.pageNo != null) qs.set("pageNo", String(params.pageNo));
6262
+ if (params?.pageSize != null) qs.set("pageSize", String(params.pageSize));
6263
+ const q = qs.toString() ? `?${qs.toString()}` : "";
6264
+ const resp = await this.doJSON(
6265
+ "GET",
6266
+ `/casehall/app/lawyers${q}`,
6267
+ null,
6268
+ signal
6269
+ );
6270
+ return resp.data ?? [];
6271
+ };
6272
+ Client.prototype.getLawyer = async function(id, signal) {
6273
+ const resp = await this.doJSON(
6274
+ "GET",
6275
+ `/casehall/app/lawyers/${id}`,
6276
+ null,
6277
+ signal
6278
+ );
6279
+ if (!resp.data) throw new Error(`lawyer ${id} not found`);
6280
+ return resp.data;
6281
+ };
6282
+ Client.prototype.submitCaseLead = async function(req, signal) {
6283
+ const resp = await this.doJSON(
6284
+ "POST",
6285
+ `/casehall/me/case-leads`,
6286
+ req,
6287
+ signal
6288
+ );
6289
+ return resp.data ?? { id: 0 };
6290
+ };
6291
+ Client.prototype.listMyCaseLeads = async function(signal) {
6292
+ const resp = await this.doJSON(
6293
+ "GET",
6294
+ `/casehall/me/case-leads`,
6295
+ null,
6296
+ signal
6297
+ );
6298
+ return resp.data ?? [];
6299
+ };
6300
+ Client.prototype.getMyCases = async function(signal) {
6301
+ const resp = await this.doJSON(
6302
+ "GET",
6303
+ `/casehall/me/cases`,
6304
+ null,
6305
+ signal
6306
+ );
6307
+ return resp.data ?? [];
6308
+ };
6309
+ Client.prototype.bookConsultation = async function(req, signal) {
6310
+ const resp = await this.doJSON(
6311
+ "POST",
6312
+ `/casehall/me/consultations`,
6313
+ req,
6314
+ signal
6315
+ );
6316
+ return resp.data ?? { consultationId: 0 };
6317
+ };
6318
+ Client.prototype.listMyConsultations = async function(signal) {
6319
+ const resp = await this.doJSON(
6320
+ "GET",
6321
+ `/casehall/me/consultations`,
6322
+ null,
6323
+ signal
6324
+ );
6325
+ return resp.data ?? [];
6326
+ };
6327
+ Client.prototype.listMyLegalOrders = async function(signal) {
6328
+ const resp = await this.doJSON(
6329
+ "GET",
6330
+ `/casehall/me/orders`,
6331
+ null,
6332
+ signal
6333
+ );
6334
+ return resp.data ?? [];
6335
+ };
6336
+ Client.prototype.listLegalSKUs = async function(region, signal) {
6337
+ const q = region ? `?region=${encodeURIComponent(region)}&benefitType=LEGAL_SERVICE` : `?benefitType=LEGAL_SERVICE`;
6338
+ const resp = await this.doJSON(
6339
+ "GET",
6340
+ `/casehall/app/legal-skus${q}`,
6341
+ null,
6342
+ signal
6343
+ );
6344
+ return resp.data ?? [];
6345
+ };
6346
+
6347
+ // src/enterprise/client.ts
6348
+ Client.prototype.listMyEnterprises = async function(signal) {
6349
+ const resp = await this.doJSON(
6350
+ "GET",
6351
+ `/me/enterprises`,
6352
+ null,
6353
+ signal
6354
+ );
6355
+ return resp.data ?? [];
6356
+ };
6357
+ Client.prototype.getEnterprise = async function(id, signal) {
6358
+ const resp = await this.doJSON(
6359
+ "GET",
6360
+ `/api/admin/enterprises/${id}`,
6361
+ null,
6362
+ signal
6363
+ );
6364
+ if (!resp.data) throw new Error(`enterprise ${id} not found`);
6365
+ return resp.data;
6366
+ };
6367
+ Client.prototype.inviteMember = async function(req, signal) {
6368
+ const resp = await this.doJSON(
6369
+ "POST",
6370
+ `/api/admin/enterprise-members`,
6371
+ req,
6372
+ signal
6373
+ );
6374
+ if (!resp.data) throw new Error("invite member failed");
6375
+ return resp.data;
6376
+ };
6377
+ Client.prototype.listEnterpriseMembers = async function(enterpriseId, signal) {
6378
+ const resp = await this.doJSON(
6379
+ "GET",
6380
+ `/api/admin/enterprise-members/by-enterprise/${enterpriseId}`,
6381
+ null,
6382
+ signal
6383
+ );
6384
+ return resp.data ?? [];
6385
+ };
6386
+ Client.prototype.listOrgSubscriptions = async function(enterpriseId, signal) {
6387
+ const resp = await this.doJSON(
6388
+ "GET",
6389
+ `/api/admin/org-subscriptions/by-enterprise/${enterpriseId}`,
6390
+ null,
6391
+ signal
6392
+ );
6393
+ return resp.data ?? [];
6394
+ };
6395
+ Client.prototype.listSeats = async function(orgSubscriptionId, signal) {
6396
+ const resp = await this.doJSON(
6397
+ "GET",
6398
+ `/api/admin/org-seats/by-subscription/${orgSubscriptionId}`,
6399
+ null,
6400
+ signal
6401
+ );
6402
+ return resp.data ?? [];
6403
+ };
6404
+ Client.prototype.assignSeat = async function(req, signal) {
6405
+ const resp = await this.doJSON(
6406
+ "POST",
6407
+ `/api/admin/org-seats/assign`,
6408
+ req,
6409
+ signal
6410
+ );
6411
+ if (!resp.data) throw new Error("assign seat failed");
6412
+ return resp.data;
6413
+ };
6414
+ Client.prototype.revokeSeat = async function(seatId, note, signal) {
6415
+ const qs = note ? `?note=${encodeURIComponent(note)}` : "";
6416
+ await this.doJSON(
6417
+ "POST",
6418
+ `/api/admin/org-seats/${seatId}/revoke${qs}`,
6419
+ null,
6420
+ signal
6421
+ );
6422
+ };
6423
+ Client.prototype.getOrgConsumeReport = async function(enterpriseId, signal) {
6424
+ const resp = await this.doJSON(
6425
+ "GET",
6426
+ `/api/admin/enterprise-settlements/overview/${enterpriseId}`,
6427
+ null,
6428
+ signal
6429
+ );
6430
+ if (!resp.data) {
6431
+ return {
6432
+ enterpriseId,
6433
+ subscriptionCount: 0,
6434
+ totalPoolTk: 0,
6435
+ totalUsedTk: 0,
6436
+ totalPriceFen: 0
6437
+ };
6438
+ }
6439
+ return resp.data;
6440
+ };
6441
+
6442
+ // src/finance/client.ts
6443
+ Client.prototype.requestRefund = async function(req, signal) {
6444
+ const resp = await this.doJSON(
6445
+ "POST",
6446
+ `/api/distribution/finance/refund/request`,
6447
+ req,
6448
+ signal
6449
+ );
6450
+ if (!resp.data) throw new Error("refund/request: empty response");
6451
+ return resp.data;
6452
+ };
6453
+ Client.prototype.listMyRefunds = async function(signal) {
6454
+ const resp = await this.doJSON(
6455
+ "GET",
6456
+ `/api/distribution/finance/refund/my`,
6457
+ null,
6458
+ signal
6459
+ );
6460
+ return resp.data ?? [];
6461
+ };
6462
+ Client.prototype.requestInvoice = async function(req, signal) {
6463
+ const resp = await this.doJSON(
6464
+ "POST",
6465
+ `/api/distribution/finance/invoice/request`,
6466
+ req,
6467
+ signal
6468
+ );
6469
+ if (!resp.data) throw new Error("invoice/request: empty response");
6470
+ return resp.data;
6471
+ };
6472
+ Client.prototype.listMyInvoices = async function(signal) {
6473
+ const resp = await this.doJSON(
6474
+ "GET",
6475
+ `/api/distribution/finance/invoice/my`,
6476
+ null,
6477
+ signal
6478
+ );
6479
+ return resp.data ?? [];
6480
+ };
6481
+ Client.prototype.initiateCorporateTransfer = async function(req, signal) {
6482
+ const resp = await this.doJSON(
6483
+ "POST",
6484
+ `/api/distribution/finance/corporate-transfer/initiate`,
6485
+ req,
6486
+ signal
6487
+ );
6488
+ if (!resp.data) throw new Error("corporate-transfer/initiate: empty response");
6489
+ return resp.data;
6490
+ };
6491
+ Client.prototype.uploadCorporateTransferProof = async function(id, proofUrl, signal) {
6492
+ const qs = new URLSearchParams({ proofUrl });
6493
+ const resp = await this.doJSON(
6494
+ "POST",
6495
+ `/api/distribution/finance/corporate-transfer/${id}/upload-proof?${qs.toString()}`,
6496
+ null,
6497
+ signal
6498
+ );
6499
+ return resp.data ?? false;
6500
+ };
6501
+ Client.prototype.listMyCorporateTransfers = async function(signal) {
6502
+ const resp = await this.doJSON(
6503
+ "GET",
6504
+ `/api/distribution/finance/corporate-transfer/my`,
6505
+ null,
6506
+ signal
6507
+ );
6508
+ return resp.data ?? [];
6509
+ };
6510
+
6131
6511
  exports.AgentRunStreamError = AgentRunStreamError;
6132
6512
  exports.AgentRunsClient = AgentRunsClient;
6513
+ exports.AudienceEnum = AudienceEnum;
6514
+ exports.BillingModeEnum = BillingModeEnum;
6133
6515
  exports.Client = Client;
6134
6516
  exports.ComplianceClient = ComplianceClient;
6135
6517
  exports.CompliancePollError = CompliancePollError;
@@ -6176,7 +6558,9 @@ exports.FilterStatusUnknown = FilterStatusUnknown;
6176
6558
  exports.IdempotencyKeyHeader = IdempotencyKeyHeader;
6177
6559
  exports.InMemoryTokenStore = InMemoryTokenStore;
6178
6560
  exports.LocalStorageTokenStore = LocalStorageTokenStore;
6561
+ exports.ProductFamilyEnum = ProductFamilyEnum;
6179
6562
  exports.RETRY_ADVICE_REASONS = RETRY_ADVICE_REASONS;
6563
+ exports.RegionScopeEnum = RegionScopeEnum;
6180
6564
  exports.ScopeAI = ScopeAI;
6181
6565
  exports.ScopeAccount = ScopeAccount;
6182
6566
  exports.ScopeComplianceContractSigningRead = ScopeComplianceContractSigningRead;