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