@flashbacktech/tsclient 0.4.53 → 0.4.55

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/dist/index.cjs CHANGED
@@ -251,6 +251,26 @@ var OrganizationClient = class {
251
251
  const res = await this.http.put(`/organization/${orgId}`, { body });
252
252
  return unwrapData(res);
253
253
  }
254
+ /**
255
+ * Fetch the org's default-notification-channel config: the per-event
256
+ * subscriptions, the notify channels available to route to, and whether the
257
+ * caller's org is the platform-admin org (which unlocks the cross-org
258
+ * `engine_failure` / `infra_outage` event types).
259
+ */
260
+ async getNotifySubscriptions() {
261
+ const res = await this.http.get(
262
+ "/organization/notify-subscriptions"
263
+ );
264
+ return unwrapData(res);
265
+ }
266
+ /**
267
+ * Replace the org's notify subscriptions (replace-set). Each edge is
268
+ * validated server-side: the credential must be a notify channel in the org,
269
+ * and admin-only event types require a platform-admin caller.
270
+ */
271
+ setNotifySubscriptions(body) {
272
+ return this.http.put("/organization/notify-subscriptions", { body });
273
+ }
254
274
  async listUsers() {
255
275
  const res = await this.http.get("/organization/users");
256
276
  return res.data ?? [];
@@ -1195,6 +1215,129 @@ var BudgetsClient = class {
1195
1215
  }
1196
1216
  };
1197
1217
 
1218
+ // src/modules/referrals/ReferralsClient.ts
1219
+ var ReferralsClient = class {
1220
+ constructor(http) {
1221
+ this.http = http;
1222
+ }
1223
+ /** Mint a new referral code for the caller's org. */
1224
+ async mintCode(body = {}) {
1225
+ const res = await this.http.post("/referrals/codes", { body });
1226
+ return unwrapData(res);
1227
+ }
1228
+ /** List the caller org's codes with per-code redeemed/qualified counts. */
1229
+ async listCodes() {
1230
+ const res = await this.http.get("/referrals/codes");
1231
+ return res.data ?? [];
1232
+ }
1233
+ /** Activate or deactivate one of the caller org's codes. */
1234
+ async setCodeActive(codeId, isActive) {
1235
+ const res = await this.http.patch(
1236
+ `/referrals/codes/${codeId}`,
1237
+ { body: { isActive } }
1238
+ );
1239
+ return unwrapData(res);
1240
+ }
1241
+ /** Caller org's referral summary as referrer (redemptions, qualified, credits earned). */
1242
+ async stats() {
1243
+ const res = await this.http.get("/referrals/stats");
1244
+ return unwrapData(res);
1245
+ }
1246
+ /**
1247
+ * Redeem a referral code for the caller's org. Fails (4xx with an
1248
+ * `error_code`) when a guard rejects it: `code_inactive`, `self_referral`,
1249
+ * `already_redeemed`, `already_associated`, or `has_purchases`.
1250
+ */
1251
+ async redeem(body) {
1252
+ const res = await this.http.post(
1253
+ "/referrals/redeem",
1254
+ { body }
1255
+ );
1256
+ return unwrapData(res);
1257
+ }
1258
+ };
1259
+
1260
+ // src/modules/reseller/ResellerClient.ts
1261
+ var ResellerClient = class {
1262
+ constructor(http) {
1263
+ this.http = http;
1264
+ }
1265
+ // --- Reseller self-service (org.isReseller) ---
1266
+ /** Orgs associated to the caller reseller, with gross + commission rollups. */
1267
+ async listAssociatedOrgs() {
1268
+ const res = await this.http.get("/reseller/associated-orgs");
1269
+ return res.data ?? [];
1270
+ }
1271
+ /** The caller reseller's commission ledger. */
1272
+ async listCommissions() {
1273
+ const res = await this.http.get("/reseller/commissions");
1274
+ return res.data ?? [];
1275
+ }
1276
+ /** The caller reseller's payout history. */
1277
+ async listPayouts() {
1278
+ const res = await this.http.get("/reseller/payouts");
1279
+ return res.data ?? [];
1280
+ }
1281
+ // --- Platform-admin only ---
1282
+ /** List all reseller orgs with aggregate performance. */
1283
+ async listResellers() {
1284
+ const res = await this.http.get("/admin/resellers");
1285
+ return res.data ?? [];
1286
+ }
1287
+ /** Designate an org as a reseller (optionally with a per-reseller bps override). */
1288
+ async setReseller(orgId, body = {}) {
1289
+ const res = await this.http.post(
1290
+ `/admin/orgs/${orgId}/reseller`,
1291
+ { body }
1292
+ );
1293
+ return unwrapData(res);
1294
+ }
1295
+ /** Revoke an org's reseller status. */
1296
+ async revokeReseller(orgId) {
1297
+ const res = await this.http.delete(`/admin/orgs/${orgId}/reseller`);
1298
+ return unwrapData(res);
1299
+ }
1300
+ /** End an org's reseller association (stamps resellerDetachedAt). */
1301
+ async detachAssociation(orgId) {
1302
+ const res = await this.http.post(
1303
+ `/admin/orgs/${orgId}/detach-reseller`,
1304
+ { body: {} }
1305
+ );
1306
+ return unwrapData(res);
1307
+ }
1308
+ /** The billing-program-config journal, newest first. */
1309
+ async getProgramConfig() {
1310
+ const res = await this.http.get(
1311
+ "/admin/billing-program-config"
1312
+ );
1313
+ return res.data ?? [];
1314
+ }
1315
+ /** Append a new program-config period (closes the prior open row). */
1316
+ async appendProgramConfig(body) {
1317
+ const res = await this.http.post(
1318
+ "/admin/billing-program-config",
1319
+ { body }
1320
+ );
1321
+ return unwrapData(res);
1322
+ }
1323
+ /** Draft payouts from accrued commissions in the given period. */
1324
+ async generatePayouts(body) {
1325
+ const res = await this.http.post(
1326
+ "/admin/reseller-payouts/generate",
1327
+ { body }
1328
+ );
1329
+ return res.data ?? [];
1330
+ }
1331
+ /** Approve or mark-paid a payout (and optionally record an external ref). */
1332
+ async updatePayout(payoutId, body) {
1333
+ const res = await this.http.patch(
1334
+ `/admin/reseller-payouts/${payoutId}`,
1335
+ { body }
1336
+ );
1337
+ return unwrapData(res);
1338
+ }
1339
+ };
1340
+
1198
1341
  // src/client.ts
1199
1342
  var AgentEngineFacade = class {
1200
1343
  constructor(templates, scheduledTasks) {
@@ -1228,6 +1371,8 @@ var CloudAgentClient = class {
1228
1371
  this.billing = new BillingFacade(new SubscriptionsClient(this.http), new CreditsClient(this.http));
1229
1372
  this.usage = new UsageClient(this.http);
1230
1373
  this.budgets = new BudgetsClient(this.http);
1374
+ this.referrals = new ReferralsClient(this.http);
1375
+ this.reseller = new ResellerClient(this.http);
1231
1376
  }
1232
1377
  };
1233
1378
 
@@ -2078,6 +2223,8 @@ exports.NotImplementedError = NotImplementedError;
2078
2223
  exports.OrgRoles = OrgRoles;
2079
2224
  exports.PROVIDER_CATALOG = PROVIDER_CATALOG;
2080
2225
  exports.ProviderType = ProviderType;
2226
+ exports.ReferralsClient = ReferralsClient;
2227
+ exports.ResellerClient = ResellerClient;
2081
2228
  exports.ResourcesClient = ResourcesClient;
2082
2229
  exports.computeDisplayHint = computeDisplayHint;
2083
2230
  exports.getProvider = getProvider;