@acosmi/sdk-ts 1.6.0 → 2.0.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/CHANGELOG.md +178 -0
- package/README.md +1 -1
- package/dist/browser/index.mjs +394 -1
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs +394 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +397 -0
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +726 -1
- package/dist/node/index.d.ts +726 -1
- package/dist/node/index.mjs +394 -1
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -6128,8 +6128,403 @@ 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
|
+
Client.prototype.getMyLawyerCredentialStatus = async function(signal) {
|
|
6347
|
+
const resp = await this.doJSON(
|
|
6348
|
+
"GET",
|
|
6349
|
+
`/api/casehall/lawyer-credentials/my`,
|
|
6350
|
+
null,
|
|
6351
|
+
signal
|
|
6352
|
+
);
|
|
6353
|
+
return resp.data ?? [];
|
|
6354
|
+
};
|
|
6355
|
+
|
|
6356
|
+
// src/enterprise/client.ts
|
|
6357
|
+
Client.prototype.listMyEnterprises = async function(signal) {
|
|
6358
|
+
const resp = await this.doJSON(
|
|
6359
|
+
"GET",
|
|
6360
|
+
`/me/enterprises`,
|
|
6361
|
+
null,
|
|
6362
|
+
signal
|
|
6363
|
+
);
|
|
6364
|
+
return resp.data ?? [];
|
|
6365
|
+
};
|
|
6366
|
+
Client.prototype.getEnterprise = async function(id, signal) {
|
|
6367
|
+
const resp = await this.doJSON(
|
|
6368
|
+
"GET",
|
|
6369
|
+
`/api/admin/enterprises/${id}`,
|
|
6370
|
+
null,
|
|
6371
|
+
signal
|
|
6372
|
+
);
|
|
6373
|
+
if (!resp.data) throw new Error(`enterprise ${id} not found`);
|
|
6374
|
+
return resp.data;
|
|
6375
|
+
};
|
|
6376
|
+
Client.prototype.inviteMember = async function(req, signal) {
|
|
6377
|
+
const resp = await this.doJSON(
|
|
6378
|
+
"POST",
|
|
6379
|
+
`/api/admin/enterprise-members`,
|
|
6380
|
+
req,
|
|
6381
|
+
signal
|
|
6382
|
+
);
|
|
6383
|
+
if (!resp.data) throw new Error("invite member failed");
|
|
6384
|
+
return resp.data;
|
|
6385
|
+
};
|
|
6386
|
+
Client.prototype.listEnterpriseMembers = async function(enterpriseId, signal) {
|
|
6387
|
+
const resp = await this.doJSON(
|
|
6388
|
+
"GET",
|
|
6389
|
+
`/api/admin/enterprise-members/by-enterprise/${enterpriseId}`,
|
|
6390
|
+
null,
|
|
6391
|
+
signal
|
|
6392
|
+
);
|
|
6393
|
+
return resp.data ?? [];
|
|
6394
|
+
};
|
|
6395
|
+
Client.prototype.listOrgSubscriptions = async function(enterpriseId, signal) {
|
|
6396
|
+
const resp = await this.doJSON(
|
|
6397
|
+
"GET",
|
|
6398
|
+
`/api/admin/org-subscriptions/by-enterprise/${enterpriseId}`,
|
|
6399
|
+
null,
|
|
6400
|
+
signal
|
|
6401
|
+
);
|
|
6402
|
+
return resp.data ?? [];
|
|
6403
|
+
};
|
|
6404
|
+
Client.prototype.listSeats = async function(orgSubscriptionId, signal) {
|
|
6405
|
+
const resp = await this.doJSON(
|
|
6406
|
+
"GET",
|
|
6407
|
+
`/api/admin/org-seats/by-subscription/${orgSubscriptionId}`,
|
|
6408
|
+
null,
|
|
6409
|
+
signal
|
|
6410
|
+
);
|
|
6411
|
+
return resp.data ?? [];
|
|
6412
|
+
};
|
|
6413
|
+
Client.prototype.assignSeat = async function(req, signal) {
|
|
6414
|
+
const resp = await this.doJSON(
|
|
6415
|
+
"POST",
|
|
6416
|
+
`/api/admin/org-seats/assign`,
|
|
6417
|
+
req,
|
|
6418
|
+
signal
|
|
6419
|
+
);
|
|
6420
|
+
if (!resp.data) throw new Error("assign seat failed");
|
|
6421
|
+
return resp.data;
|
|
6422
|
+
};
|
|
6423
|
+
Client.prototype.revokeSeat = async function(seatId, note, signal) {
|
|
6424
|
+
const qs = note ? `?note=${encodeURIComponent(note)}` : "";
|
|
6425
|
+
await this.doJSON(
|
|
6426
|
+
"POST",
|
|
6427
|
+
`/api/admin/org-seats/${seatId}/revoke${qs}`,
|
|
6428
|
+
null,
|
|
6429
|
+
signal
|
|
6430
|
+
);
|
|
6431
|
+
};
|
|
6432
|
+
Client.prototype.getOrgConsumeReport = async function(enterpriseId, signal) {
|
|
6433
|
+
const resp = await this.doJSON(
|
|
6434
|
+
"GET",
|
|
6435
|
+
`/api/admin/enterprise-settlements/overview/${enterpriseId}`,
|
|
6436
|
+
null,
|
|
6437
|
+
signal
|
|
6438
|
+
);
|
|
6439
|
+
if (!resp.data) {
|
|
6440
|
+
return {
|
|
6441
|
+
enterpriseId,
|
|
6442
|
+
subscriptionCount: 0,
|
|
6443
|
+
totalPoolTk: 0,
|
|
6444
|
+
totalUsedTk: 0,
|
|
6445
|
+
totalPriceFen: 0
|
|
6446
|
+
};
|
|
6447
|
+
}
|
|
6448
|
+
return resp.data;
|
|
6449
|
+
};
|
|
6450
|
+
Client.prototype.getMyEnterpriseKycStatus = async function(signal) {
|
|
6451
|
+
const resp = await this.doJSON(
|
|
6452
|
+
"GET",
|
|
6453
|
+
`/api/distribution/enterprise/kyc/my`,
|
|
6454
|
+
null,
|
|
6455
|
+
signal
|
|
6456
|
+
);
|
|
6457
|
+
return resp.data ?? {};
|
|
6458
|
+
};
|
|
6459
|
+
|
|
6460
|
+
// src/finance/client.ts
|
|
6461
|
+
Client.prototype.requestRefund = async function(req, signal) {
|
|
6462
|
+
const resp = await this.doJSON(
|
|
6463
|
+
"POST",
|
|
6464
|
+
`/api/distribution/finance/refund/request`,
|
|
6465
|
+
req,
|
|
6466
|
+
signal
|
|
6467
|
+
);
|
|
6468
|
+
if (!resp.data) throw new Error("refund/request: empty response");
|
|
6469
|
+
return resp.data;
|
|
6470
|
+
};
|
|
6471
|
+
Client.prototype.listMyRefunds = async function(signal) {
|
|
6472
|
+
const resp = await this.doJSON(
|
|
6473
|
+
"GET",
|
|
6474
|
+
`/api/distribution/finance/refund/my`,
|
|
6475
|
+
null,
|
|
6476
|
+
signal
|
|
6477
|
+
);
|
|
6478
|
+
return resp.data ?? [];
|
|
6479
|
+
};
|
|
6480
|
+
Client.prototype.requestInvoice = async function(req, signal) {
|
|
6481
|
+
const resp = await this.doJSON(
|
|
6482
|
+
"POST",
|
|
6483
|
+
`/api/distribution/finance/invoice/request`,
|
|
6484
|
+
req,
|
|
6485
|
+
signal
|
|
6486
|
+
);
|
|
6487
|
+
if (!resp.data) throw new Error("invoice/request: empty response");
|
|
6488
|
+
return resp.data;
|
|
6489
|
+
};
|
|
6490
|
+
Client.prototype.listMyInvoices = async function(signal) {
|
|
6491
|
+
const resp = await this.doJSON(
|
|
6492
|
+
"GET",
|
|
6493
|
+
`/api/distribution/finance/invoice/my`,
|
|
6494
|
+
null,
|
|
6495
|
+
signal
|
|
6496
|
+
);
|
|
6497
|
+
return resp.data ?? [];
|
|
6498
|
+
};
|
|
6499
|
+
Client.prototype.initiateCorporateTransfer = async function(req, signal) {
|
|
6500
|
+
const resp = await this.doJSON(
|
|
6501
|
+
"POST",
|
|
6502
|
+
`/api/distribution/finance/corporate-transfer/initiate`,
|
|
6503
|
+
req,
|
|
6504
|
+
signal
|
|
6505
|
+
);
|
|
6506
|
+
if (!resp.data) throw new Error("corporate-transfer/initiate: empty response");
|
|
6507
|
+
return resp.data;
|
|
6508
|
+
};
|
|
6509
|
+
Client.prototype.uploadCorporateTransferProof = async function(id, proofUrl, signal) {
|
|
6510
|
+
const path = `/api/distribution/finance/corporate-transfer/${encodeURIComponent(String(id))}/upload-proof?proofUrl=${encodeURIComponent(proofUrl)}`;
|
|
6511
|
+
const resp = await this.doJSON("POST", path, null, signal);
|
|
6512
|
+
return resp.data ?? false;
|
|
6513
|
+
};
|
|
6514
|
+
Client.prototype.listMyCorporateTransfers = async function(signal) {
|
|
6515
|
+
const resp = await this.doJSON(
|
|
6516
|
+
"GET",
|
|
6517
|
+
`/api/distribution/finance/corporate-transfer/my`,
|
|
6518
|
+
null,
|
|
6519
|
+
signal
|
|
6520
|
+
);
|
|
6521
|
+
return resp.data ?? [];
|
|
6522
|
+
};
|
|
6523
|
+
|
|
6131
6524
|
exports.AgentRunStreamError = AgentRunStreamError;
|
|
6132
6525
|
exports.AgentRunsClient = AgentRunsClient;
|
|
6526
|
+
exports.AudienceEnum = AudienceEnum;
|
|
6527
|
+
exports.BillingModeEnum = BillingModeEnum;
|
|
6133
6528
|
exports.Client = Client;
|
|
6134
6529
|
exports.ComplianceClient = ComplianceClient;
|
|
6135
6530
|
exports.CompliancePollError = CompliancePollError;
|
|
@@ -6176,7 +6571,9 @@ exports.FilterStatusUnknown = FilterStatusUnknown;
|
|
|
6176
6571
|
exports.IdempotencyKeyHeader = IdempotencyKeyHeader;
|
|
6177
6572
|
exports.InMemoryTokenStore = InMemoryTokenStore;
|
|
6178
6573
|
exports.LocalStorageTokenStore = LocalStorageTokenStore;
|
|
6574
|
+
exports.ProductFamilyEnum = ProductFamilyEnum;
|
|
6179
6575
|
exports.RETRY_ADVICE_REASONS = RETRY_ADVICE_REASONS;
|
|
6576
|
+
exports.RegionScopeEnum = RegionScopeEnum;
|
|
6180
6577
|
exports.ScopeAI = ScopeAI;
|
|
6181
6578
|
exports.ScopeAccount = ScopeAccount;
|
|
6182
6579
|
exports.ScopeComplianceContractSigningRead = ScopeComplianceContractSigningRead;
|