@dakota-xyz/ts-sdk 1.0.16 → 1.1.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/dist/index.js CHANGED
@@ -666,6 +666,58 @@ var CustomersResource = class extends BaseResource {
666
666
  path: `/customers/${customerId}`
667
667
  });
668
668
  }
669
+ /**
670
+ * Update the sub-client association for a customer.
671
+ *
672
+ * Associates or disassociates a customer with a sub-client.
673
+ * Set `sub_client_id` to associate, or set it to `null` to disassociate.
674
+ *
675
+ * @param customerId - Customer ID (KSUID)
676
+ * @param data - Sub-client association data
677
+ * @param options - Request options (e.g., custom idempotency key)
678
+ * @returns Updated customer record
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * // Associate customer with a sub-client
683
+ * const customer = await client.customers.updateSubClient('cust_abc123', {
684
+ * sub_client_id: 'cust_sub456',
685
+ * });
686
+ *
687
+ * // Disassociate customer from sub-client
688
+ * const customer = await client.customers.updateSubClient('cust_abc123', {
689
+ * sub_client_id: null,
690
+ * });
691
+ * ```
692
+ */
693
+ async updateSubClient(customerId, data, options) {
694
+ return this.transport.request({
695
+ method: "PATCH",
696
+ path: `/customers/${customerId}/sub-client`,
697
+ body: data,
698
+ idempotencyKey: options?.idempotencyKey
699
+ });
700
+ }
701
+ /**
702
+ * Get a summary of all sub-clients and their associated customer counts.
703
+ *
704
+ * @returns Array of sub-client summaries
705
+ *
706
+ * @example
707
+ * ```typescript
708
+ * const summaries = await client.customers.getSubClientSummary();
709
+ * for (const summary of summaries) {
710
+ * console.log(`${summary.sub_client_name}: ${summary.customer_count} customers`);
711
+ * }
712
+ * ```
713
+ */
714
+ async getSubClientSummary() {
715
+ const response = await this.transport.request({
716
+ method: "GET",
717
+ path: "/customers/sub-client-summary"
718
+ });
719
+ return response.data;
720
+ }
669
721
  };
670
722
 
671
723
  // src/client/resources/recipients.ts
@@ -750,6 +802,22 @@ var RecipientsResource = class extends BaseResource {
750
802
  idempotencyKey: options?.idempotencyKey
751
803
  });
752
804
  }
805
+ /**
806
+ * Delete a recipient.
807
+ *
808
+ * @param recipientId - Recipient ID
809
+ *
810
+ * @example
811
+ * ```typescript
812
+ * await client.recipients.delete(recipientId);
813
+ * ```
814
+ */
815
+ async delete(recipientId) {
816
+ await this.transport.request({
817
+ method: "DELETE",
818
+ path: `/recipients/${recipientId}`
819
+ });
820
+ }
753
821
  };
754
822
 
755
823
  // src/client/resources/destinations.ts
@@ -812,6 +880,23 @@ var DestinationsResource = class extends BaseResource {
812
880
  (item) => item.destination_id
813
881
  );
814
882
  }
883
+ /**
884
+ * Delete a destination.
885
+ *
886
+ * @param recipientId - Recipient ID
887
+ * @param destinationId - Destination ID
888
+ *
889
+ * @example
890
+ * ```typescript
891
+ * await client.destinations.delete(recipientId, destinationId);
892
+ * ```
893
+ */
894
+ async delete(recipientId, destinationId) {
895
+ await this.transport.request({
896
+ method: "DELETE",
897
+ path: `/recipients/${recipientId}/destinations/${destinationId}`
898
+ });
899
+ }
815
900
  };
816
901
 
817
902
  // src/client/resources/accounts.ts
@@ -921,6 +1006,22 @@ var AccountsResource = class extends BaseResource {
921
1006
  idempotencyKey: options?.idempotencyKey
922
1007
  });
923
1008
  }
1009
+ /**
1010
+ * Delete an account.
1011
+ *
1012
+ * @param accountId - Account ID
1013
+ *
1014
+ * @example
1015
+ * ```typescript
1016
+ * await client.accounts.delete(accountId);
1017
+ * ```
1018
+ */
1019
+ async delete(accountId) {
1020
+ await this.transport.request({
1021
+ method: "DELETE",
1022
+ path: `/accounts/${accountId}`
1023
+ });
1024
+ }
924
1025
  };
925
1026
 
926
1027
  // src/client/resources/transactions.ts
@@ -1154,23 +1255,6 @@ var EventsResource = class extends BaseResource {
1154
1255
  list(params) {
1155
1256
  return this.paginate("/events", params);
1156
1257
  }
1157
- /**
1158
- * Get an event by ID.
1159
- *
1160
- * @param eventId - Event ID
1161
- * @returns Event record
1162
- *
1163
- * @example
1164
- * ```typescript
1165
- * const event = await client.events.get(eventId);
1166
- * ```
1167
- */
1168
- async get(eventId) {
1169
- return this.transport.request({
1170
- method: "GET",
1171
- path: `/events/${eventId}`
1172
- });
1173
- }
1174
1258
  };
1175
1259
 
1176
1260
  // src/client/resources/applications.ts
@@ -1211,58 +1295,78 @@ var ApplicationsResource = class extends BaseResource {
1211
1295
  idempotencyKey: options?.idempotencyKey
1212
1296
  });
1213
1297
  }
1298
+ // ==========================================================================
1299
+ // Business Details
1300
+ // ==========================================================================
1214
1301
  /**
1215
- * List associated individuals for an application.
1302
+ * Update business details for an application.
1303
+ *
1304
+ * Uses PUT (full replace) per the OpenAPI spec.
1216
1305
  *
1217
1306
  * @param applicationId - Application ID
1218
- * @param params - Pagination parameters
1219
- * @returns Async iterator of individuals
1307
+ * @param data - Business details (full BusinessApplicationCreateRequest)
1308
+ * @returns Updated business details with application context
1220
1309
  */
1221
- listIndividuals(applicationId, params) {
1222
- return this.paginate(
1223
- `/applications/${applicationId}/associated-individuals`,
1224
- params
1225
- );
1310
+ async updateBusinessDetails(applicationId, data, options) {
1311
+ return this.transport.request({
1312
+ method: "PUT",
1313
+ path: `/applications/${applicationId}/business-details`,
1314
+ body: data,
1315
+ idempotencyKey: options?.idempotencyKey
1316
+ });
1226
1317
  }
1318
+ // ==========================================================================
1319
+ // Individual Details (non-business applications)
1320
+ // ==========================================================================
1227
1321
  /**
1228
- * Add an associated individual to an application.
1322
+ * Update individual details for a non-business application.
1323
+ *
1324
+ * Uses PUT (full replace) per the OpenAPI spec. Only callable when the
1325
+ * application status is 'pending'.
1229
1326
  *
1230
1327
  * @param applicationId - Application ID
1231
- * @param data - Individual data
1232
- * @returns Created individual
1328
+ * @param data - Individual details (full IndividualRequest)
1329
+ * @returns Updated individual details with application context
1233
1330
  */
1234
- async addIndividual(applicationId, data, options) {
1331
+ async updateIndividualDetails(applicationId, data, options) {
1235
1332
  return this.transport.request({
1236
- method: "POST",
1237
- path: `/applications/${applicationId}/associated-individuals`,
1333
+ method: "PUT",
1334
+ path: `/applications/${applicationId}/individual-details`,
1238
1335
  body: data,
1239
1336
  idempotencyKey: options?.idempotencyKey
1240
1337
  });
1241
1338
  }
1339
+ // ==========================================================================
1340
+ // Associated Individuals
1341
+ // ==========================================================================
1242
1342
  /**
1243
- * Get an associated individual.
1343
+ * Add an associated individual to an application.
1244
1344
  *
1245
1345
  * @param applicationId - Application ID
1246
- * @param individualId - Individual ID
1247
- * @returns Individual record
1346
+ * @param data - Individual data
1347
+ * @returns Created individual
1248
1348
  */
1249
- async getIndividual(applicationId, individualId) {
1349
+ async addIndividual(applicationId, data, options) {
1250
1350
  return this.transport.request({
1251
- method: "GET",
1252
- path: `/applications/${applicationId}/associated-individuals/${individualId}`
1351
+ method: "POST",
1352
+ path: `/applications/${applicationId}/associated-individuals`,
1353
+ body: data,
1354
+ idempotencyKey: options?.idempotencyKey
1253
1355
  });
1254
1356
  }
1255
1357
  /**
1256
1358
  * Update an associated individual.
1257
1359
  *
1360
+ * Uses PUT (full replace) per the OpenAPI spec.
1361
+ *
1258
1362
  * @param applicationId - Application ID
1259
1363
  * @param individualId - Individual ID
1260
- * @param data - Update data
1364
+ * @param data - Full individual data (replaces existing)
1261
1365
  * @returns Updated individual
1262
1366
  */
1263
1367
  async updateIndividual(applicationId, individualId, data, options) {
1264
1368
  return this.transport.request({
1265
- method: "PATCH",
1369
+ method: "PUT",
1266
1370
  path: `/applications/${applicationId}/associated-individuals/${individualId}`,
1267
1371
  body: data,
1268
1372
  idempotencyKey: options?.idempotencyKey
@@ -1280,27 +1384,145 @@ var ApplicationsResource = class extends BaseResource {
1280
1384
  path: `/applications/${applicationId}/associated-individuals/${individualId}`
1281
1385
  });
1282
1386
  }
1387
+ // ==========================================================================
1388
+ // Attestations
1389
+ // ==========================================================================
1283
1390
  /**
1284
- * Update business details for an application.
1391
+ * Submit an attestation for an application.
1285
1392
  *
1286
1393
  * @param applicationId - Application ID
1287
- * @param data - Business details
1288
- * @returns Updated application
1394
+ * @param data - Attestation data (type, timestamp, applicant_id)
1289
1395
  */
1290
- async updateBusinessDetails(applicationId, data, options) {
1396
+ async submitAttestation(applicationId, data, options) {
1397
+ await this.transport.request({
1398
+ method: "POST",
1399
+ path: `/applications/${applicationId}/attestations`,
1400
+ body: data,
1401
+ idempotencyKey: options?.idempotencyKey
1402
+ });
1403
+ }
1404
+ // ==========================================================================
1405
+ // Enhanced Due Diligence (EDD)
1406
+ // ==========================================================================
1407
+ /**
1408
+ * Get the EDD record for an application.
1409
+ *
1410
+ * @param applicationId - Application ID
1411
+ * @returns EDD record with application context
1412
+ */
1413
+ async getEDD(applicationId) {
1291
1414
  return this.transport.request({
1292
- method: "PATCH",
1293
- path: `/applications/${applicationId}/business-details`,
1415
+ method: "GET",
1416
+ path: `/applications/${applicationId}/edd`
1417
+ });
1418
+ }
1419
+ /**
1420
+ * Create or update the EDD record for an application.
1421
+ *
1422
+ * This endpoint is idempotent (uses PUT).
1423
+ *
1424
+ * @param applicationId - Application ID
1425
+ * @param data - EDD data
1426
+ * @returns Updated EDD record with application context
1427
+ */
1428
+ async createOrUpdateEDD(applicationId, data, options) {
1429
+ return this.transport.request({
1430
+ method: "PUT",
1431
+ path: `/applications/${applicationId}/edd`,
1294
1432
  body: data,
1295
1433
  idempotencyKey: options?.idempotencyKey
1296
1434
  });
1297
1435
  }
1436
+ // ==========================================================================
1437
+ // Application Documents
1438
+ // ==========================================================================
1439
+ /**
1440
+ * Upload an application document using base64-encoded content.
1441
+ *
1442
+ * For files larger than 20MB, use {@link getDocumentUploadUrl} and upload
1443
+ * directly to cloud storage, then call {@link verifyDocument}.
1444
+ *
1445
+ * @param applicationId - Application ID
1446
+ * @param data - Document data including base64 content
1447
+ * @returns Document upload response with document_id
1448
+ */
1449
+ async createDocument(applicationId, data, options) {
1450
+ return this.transport.request({
1451
+ method: "POST",
1452
+ path: `/applications/${applicationId}/documents`,
1453
+ body: data,
1454
+ idempotencyKey: options?.idempotencyKey
1455
+ });
1456
+ }
1457
+ /**
1458
+ * List documents for an application.
1459
+ *
1460
+ * Supports filtering by category and document type.
1461
+ *
1462
+ * @param applicationId - Application ID
1463
+ * @param params - Pagination and filter parameters
1464
+ * @returns Paginated iterator of document metadata
1465
+ */
1466
+ listDocuments(applicationId, params) {
1467
+ return this.paginate(
1468
+ `/applications/${applicationId}/documents`,
1469
+ params
1470
+ );
1471
+ }
1472
+ /**
1473
+ * Download/get a document by ID.
1474
+ *
1475
+ * @param applicationId - Application ID
1476
+ * @param documentId - Document ID
1477
+ * @returns Document content (binary)
1478
+ */
1479
+ async getDocument(applicationId, documentId) {
1480
+ return this.transport.request({
1481
+ method: "GET",
1482
+ path: `/applications/${applicationId}/documents/${documentId}`
1483
+ });
1484
+ }
1485
+ /**
1486
+ * Delete a document from a pending application.
1487
+ *
1488
+ * Only documents from applications in 'pending' status can be deleted.
1489
+ *
1490
+ * @param applicationId - Application ID
1491
+ * @param documentId - Document ID
1492
+ */
1493
+ async deleteDocument(applicationId, documentId) {
1494
+ await this.transport.request({
1495
+ method: "DELETE",
1496
+ path: `/applications/${applicationId}/documents/${documentId}`
1497
+ });
1498
+ }
1499
+ /**
1500
+ * Verify a document uploaded via presigned URL.
1501
+ *
1502
+ * After uploading a file to the presigned URL from {@link getDocumentUploadUrl},
1503
+ * call this endpoint to register and verify the upload.
1504
+ *
1505
+ * @param applicationId - Application ID
1506
+ * @param documentId - The upload_id from the presigned URL response
1507
+ * @returns Document upload response with document_id
1508
+ */
1509
+ async verifyDocument(applicationId, documentId, _data, options) {
1510
+ return this.transport.request({
1511
+ method: "POST",
1512
+ path: `/applications/${applicationId}/documents/${documentId}/verifications`,
1513
+ body: _data ?? {},
1514
+ idempotencyKey: options?.idempotencyKey
1515
+ });
1516
+ }
1298
1517
  /**
1299
- * Get document upload URL for an application.
1518
+ * Get a presigned upload URL for an application document.
1519
+ *
1520
+ * Use this for files larger than 20MB. Upload the file directly to the
1521
+ * returned URL, then call {@link verifyDocument} to register it.
1300
1522
  *
1301
1523
  * @param applicationId - Application ID
1302
1524
  * @param data - Document metadata
1303
- * @returns Upload URL and document ID
1525
+ * @returns Upload URL and upload ID
1304
1526
  */
1305
1527
  async getDocumentUploadUrl(applicationId, data, options) {
1306
1528
  return this.transport.request({
@@ -1310,6 +1532,48 @@ var ApplicationsResource = class extends BaseResource {
1310
1532
  idempotencyKey: options?.idempotencyKey
1311
1533
  });
1312
1534
  }
1535
+ // ==========================================================================
1536
+ // Individual Documents
1537
+ // ==========================================================================
1538
+ /**
1539
+ * Upload a document for an associated individual using base64-encoded content.
1540
+ *
1541
+ * Supports identity documents (passport, driver's license, residence permit)
1542
+ * and EDD documents (bank statement, etc.). For files larger than 10MB, use
1543
+ * {@link getIndividualDocumentUploadUrl} instead.
1544
+ *
1545
+ * @param applicationId - Application ID
1546
+ * @param individualId - Individual ID
1547
+ * @param data - Document data including base64 content
1548
+ * @returns Document upload response with document_id
1549
+ */
1550
+ async uploadIndividualDocument(applicationId, individualId, data, options) {
1551
+ return this.transport.request({
1552
+ method: "POST",
1553
+ path: `/applications/${applicationId}/associated-individuals/${individualId}/documents`,
1554
+ body: data,
1555
+ idempotencyKey: options?.idempotencyKey
1556
+ });
1557
+ }
1558
+ /**
1559
+ * Get a presigned upload URL for an individual document.
1560
+ *
1561
+ * Use this for files larger than 10MB. Upload the file directly to the
1562
+ * returned URL.
1563
+ *
1564
+ * @param applicationId - Application ID
1565
+ * @param individualId - Individual ID
1566
+ * @param data - Document metadata
1567
+ * @returns Upload URL and upload ID
1568
+ */
1569
+ async getIndividualDocumentUploadUrl(applicationId, individualId, data, options) {
1570
+ return this.transport.request({
1571
+ method: "POST",
1572
+ path: `/applications/${applicationId}/associated-individuals/${individualId}/document-uploads`,
1573
+ body: data,
1574
+ idempotencyKey: options?.idempotencyKey
1575
+ });
1576
+ }
1313
1577
  };
1314
1578
 
1315
1579
  // src/client/resources/policies.ts
@@ -1519,27 +1783,31 @@ var SignerGroupsResource = class extends BaseResource {
1519
1783
  path: `/wallets/${walletId}/signer-groups/${signerGroupId}`
1520
1784
  });
1521
1785
  }
1522
- };
1523
- var SignersResource = class extends BaseResource {
1524
1786
  /**
1525
- * List all signers.
1787
+ * List signer groups attached to a wallet.
1526
1788
  *
1789
+ * @param walletId - Wallet ID
1527
1790
  * @param params - Pagination parameters
1528
- * @returns Async iterator of signers
1791
+ * @returns Async iterator of signer groups
1529
1792
  */
1530
- list(params) {
1531
- return this.paginate("/signers", params);
1793
+ listForWallet(walletId, params) {
1794
+ return this.paginate(`/wallets/${walletId}/signer-groups`, params);
1532
1795
  }
1796
+ };
1797
+ var SignersResource = class extends BaseResource {
1533
1798
  /**
1534
- * Get a signer by public key.
1799
+ * Create a new signer.
1535
1800
  *
1536
- * @param publicKey - Signer public key
1537
- * @returns Signer record
1801
+ * @param data - Signer creation data (name, public_key, key_type)
1802
+ * @param options - Request options
1803
+ * @returns Created signer
1538
1804
  */
1539
- async getByPublicKey(publicKey) {
1805
+ async create(data, options) {
1540
1806
  return this.transport.request({
1541
- method: "GET",
1542
- path: `/signers/${publicKey}`
1807
+ method: "POST",
1808
+ path: "/signers",
1809
+ body: data,
1810
+ idempotencyKey: options?.idempotencyKey
1543
1811
  });
1544
1812
  }
1545
1813
  /**
@@ -1593,6 +1861,34 @@ var ApiKeysResource = class extends BaseResource {
1593
1861
  path: `/api-keys/${apiKeyId}`
1594
1862
  });
1595
1863
  }
1864
+ /**
1865
+ * Delete all API keys.
1866
+ *
1867
+ * Intended for incident response only.
1868
+ */
1869
+ async deleteAll() {
1870
+ await this.transport.request({
1871
+ method: "DELETE",
1872
+ path: "/api-keys"
1873
+ });
1874
+ }
1875
+ /**
1876
+ * Create an API key for a specific client (admin only).
1877
+ *
1878
+ * Requires admin access token.
1879
+ *
1880
+ * @param data - Request data containing `client_id`
1881
+ * @param options - Request options
1882
+ * @returns Created API key response (includes key, only shown once)
1883
+ */
1884
+ async createForClient(data, options) {
1885
+ return this.transport.request({
1886
+ method: "POST",
1887
+ path: "/api-keys/admin",
1888
+ body: data,
1889
+ idempotencyKey: options?.idempotencyKey
1890
+ });
1891
+ }
1596
1892
  };
1597
1893
 
1598
1894
  // src/client/resources/users.ts
@@ -1620,27 +1916,14 @@ var UsersResource = class extends BaseResource {
1620
1916
  list(params) {
1621
1917
  return this.paginate("/users", params);
1622
1918
  }
1623
- /**
1624
- * Get a user by ID.
1625
- *
1626
- * @param userId - User ID
1627
- * @returns User record
1628
- */
1629
- async get(userId) {
1630
- return this.transport.request({
1631
- method: "GET",
1632
- path: `/users/${userId}`
1633
- });
1634
- }
1635
1919
  /**
1636
1920
  * Update a user.
1637
1921
  *
1638
1922
  * @param userId - User ID
1639
- * @param data - Update data
1640
- * @returns Updated user
1923
+ * @param data - Update data (first_name, last_name, role)
1641
1924
  */
1642
1925
  async update(userId, data, options) {
1643
- return this.transport.request({
1926
+ await this.transport.request({
1644
1927
  method: "PATCH",
1645
1928
  path: `/users/${userId}`,
1646
1929
  body: data,
@@ -1724,13 +2007,42 @@ var WebhooksResource = class extends BaseResource {
1724
2007
  });
1725
2008
  }
1726
2009
  /**
1727
- * List webhook events.
2010
+ * List webhook delivery history.
1728
2011
  *
1729
- * @param params - Pagination parameters
1730
- * @returns Async iterator of webhook events
2012
+ * Note: This endpoint uses cursor-based pagination (`cursor`/`has_more`) instead
2013
+ * of the standard `starting_after`/`has_more_after` format. Because of this,
2014
+ * it returns the raw response rather than a `PaginatedIterator`. Use the `cursor`
2015
+ * field from the response to fetch subsequent pages.
2016
+ *
2017
+ * @param params - Webhook history query parameters
2018
+ * @returns Webhook history response with `data`, `has_more`, and `cursor`
2019
+ *
2020
+ * @example
2021
+ * ```typescript
2022
+ * let cursor: string | undefined;
2023
+ * do {
2024
+ * const page = await client.webhooks.listEvents({ limit: 50, cursor });
2025
+ * for (const event of page.data) {
2026
+ * console.log(event);
2027
+ * }
2028
+ * cursor = page.cursor ?? undefined;
2029
+ * } while (page.has_more);
2030
+ * ```
1731
2031
  */
1732
- listEvents(params) {
1733
- return this.paginate("/webhooks", params);
2032
+ async listEvents(params) {
2033
+ const query = {};
2034
+ if (params) {
2035
+ for (const [key, value] of Object.entries(params)) {
2036
+ if (value !== void 0) {
2037
+ query[key] = value;
2038
+ }
2039
+ }
2040
+ }
2041
+ return this.transport.request({
2042
+ method: "GET",
2043
+ path: "/webhooks",
2044
+ query
2045
+ });
1734
2046
  }
1735
2047
  /**
1736
2048
  * Get a webhook event by ID.
@@ -1747,10 +2059,14 @@ var WebhooksResource = class extends BaseResource {
1747
2059
  /**
1748
2060
  * Replay a webhook event.
1749
2061
  *
2062
+ * Re-queues the webhook for delivery to all configured targets.
2063
+ *
1750
2064
  * @param eventId - Webhook event ID
2065
+ * @param options - Request options
2066
+ * @returns Replay response with `webhook_id`, `status`, and `replayed_to_count`
1751
2067
  */
1752
2068
  async replayEvent(eventId, options) {
1753
- await this.transport.request({
2069
+ return this.transport.request({
1754
2070
  method: "POST",
1755
2071
  path: `/webhooks/events/${eventId}/replay`,
1756
2072
  idempotencyKey: options?.idempotencyKey
@@ -1875,9 +2191,10 @@ var SandboxResource = class extends BaseResource {
1875
2191
  * Drives KYB, KYC, or applicant account status through a sandbox transition
1876
2192
  * without waiting for real compliance review.
1877
2193
  *
1878
- * **Important:** For full activation, you typically need TWO calls:
1879
- * 1. `kyb_approve` - Approves the KYB application
1880
- * 2. `applicant_activate` - Activates the applicant (triggers provisioning)
2194
+ * **Important:** Use `kyb_approve` to fully approve any customer type (individual or
2195
+ * business). This triggers the complete onboarding flow including endorsement and
2196
+ * recipient creation. The `kyc_*` types only update the individual applicant's KYC
2197
+ * application status without triggering the full onboarding flow.
1881
2198
  *
1882
2199
  * @param data - Simulation request data
1883
2200
  * @returns Simulation response with previous and new state
@@ -1987,6 +2304,108 @@ var SandboxResource = class extends BaseResource {
1987
2304
  }
1988
2305
  };
1989
2306
 
2307
+ // src/client/resources/self-serve.ts
2308
+ var SelfServeResource = class extends BaseResource {
2309
+ /**
2310
+ * Purchase self-serve credits.
2311
+ *
2312
+ * Creates a Stripe checkout session for purchasing credits at the specified tier.
2313
+ *
2314
+ * @param data - Purchase request with the tier price
2315
+ * @param options - Optional request options (e.g., idempotency key)
2316
+ * @returns Response containing the Stripe checkout URL
2317
+ *
2318
+ * @example
2319
+ * ```typescript
2320
+ * const { checkout_url } = await client.selfServe.purchaseCredits({
2321
+ * tier_price_cents: 10000,
2322
+ * });
2323
+ * // Redirect user to checkout_url
2324
+ * ```
2325
+ */
2326
+ async purchaseCredits(data, options) {
2327
+ return this.transport.request({
2328
+ method: "POST",
2329
+ path: "/self-serve/credits/purchase",
2330
+ body: data,
2331
+ idempotencyKey: options?.idempotencyKey
2332
+ });
2333
+ }
2334
+ /**
2335
+ * Get current credits balance.
2336
+ *
2337
+ * @returns The current balance and transfer capacity in cents
2338
+ *
2339
+ * @example
2340
+ * ```typescript
2341
+ * const balance = await client.selfServe.getBalance();
2342
+ * console.log(`Balance: $${balance.balance_cents / 100}`);
2343
+ * console.log(`Transfer capacity: $${balance.transfer_capacity_cents / 100}`);
2344
+ * ```
2345
+ */
2346
+ async getBalance() {
2347
+ return this.transport.request({
2348
+ method: "GET",
2349
+ path: "/self-serve/credits/balance"
2350
+ });
2351
+ }
2352
+ /**
2353
+ * List credits ledger entries.
2354
+ *
2355
+ * Returns a cursor-paginated list of ledger entries (purchases, deductions, refunds).
2356
+ *
2357
+ * @param params - Optional query parameters for filtering and pagination
2358
+ * @returns Ledger response with entries and has_more flag
2359
+ *
2360
+ * @example
2361
+ * ```typescript
2362
+ * // Get recent ledger entries
2363
+ * const ledger = await client.selfServe.listLedger();
2364
+ * for (const entry of ledger.entries) {
2365
+ * console.log(entry.entry_type, entry.amount_cents, entry.description);
2366
+ * }
2367
+ *
2368
+ * // Filter by type with pagination
2369
+ * const purchases = await client.selfServe.listLedger({
2370
+ * type: 'purchase',
2371
+ * limit: 50,
2372
+ * });
2373
+ * ```
2374
+ */
2375
+ async listLedger(params) {
2376
+ const query = {};
2377
+ if (params?.cursor !== void 0) query.cursor = params.cursor;
2378
+ if (params?.limit !== void 0) query.limit = params.limit;
2379
+ if (params?.type !== void 0) query.type = params.type;
2380
+ return this.transport.request({
2381
+ method: "GET",
2382
+ path: "/self-serve/credits/ledger",
2383
+ query
2384
+ });
2385
+ }
2386
+ /**
2387
+ * List available credit tiers.
2388
+ *
2389
+ * Returns all available pricing tiers for purchasing credits.
2390
+ *
2391
+ * @returns Response containing the list of available tiers
2392
+ *
2393
+ * @example
2394
+ * ```typescript
2395
+ * const { tiers } = await client.selfServe.listTiers();
2396
+ * for (const tier of tiers) {
2397
+ * console.log(`$${tier.price_cents / 100} → $${tier.transfer_capacity_cents / 100} capacity`);
2398
+ * }
2399
+ * ```
2400
+ */
2401
+ async listTiers() {
2402
+ return this.transport.request({
2403
+ method: "GET",
2404
+ path: "/self-serve/credits/tiers"
2405
+ });
2406
+ }
2407
+ };
2408
+
1990
2409
  // src/client/client.ts
1991
2410
  var DakotaClient = class {
1992
2411
  config;
@@ -2026,6 +2445,8 @@ var DakotaClient = class {
2026
2445
  info;
2027
2446
  /** Sandbox API - testing simulations (sandbox only) */
2028
2447
  sandbox;
2448
+ /** Self-Serve Credits API - manage prepaid transfer credits */
2449
+ selfServe;
2029
2450
  /**
2030
2451
  * Create a new Dakota client.
2031
2452
  *
@@ -2078,6 +2499,7 @@ var DakotaClient = class {
2078
2499
  this.webhooks = new WebhooksResource(this.transport);
2079
2500
  this.info = new InfoResource(this.transport);
2080
2501
  this.sandbox = new SandboxResource(this.transport);
2502
+ this.selfServe = new SelfServeResource(this.transport);
2081
2503
  }
2082
2504
  /**
2083
2505
  * Get the resolved base URL.
@@ -2105,6 +2527,7 @@ exports.PaginatedIterator = PaginatedIterator;
2105
2527
  exports.PoliciesResource = PoliciesResource;
2106
2528
  exports.RecipientsResource = RecipientsResource;
2107
2529
  exports.SandboxResource = SandboxResource;
2530
+ exports.SelfServeResource = SelfServeResource;
2108
2531
  exports.SignerGroupsResource = SignerGroupsResource;
2109
2532
  exports.SignersResource = SignersResource;
2110
2533
  exports.TransactionsResource = TransactionsResource;