@stackbe/sdk 0.7.1 → 0.7.2

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.d.mts CHANGED
@@ -13,7 +13,7 @@ declare class HttpClient {
13
13
  post<T>(path: string, body?: unknown, params?: Record<string, string | number | undefined>): Promise<T>;
14
14
  put<T>(path: string, body?: unknown, params?: Record<string, string | number | undefined>): Promise<T>;
15
15
  patch<T>(path: string, body?: unknown): Promise<T>;
16
- delete<T>(path: string): Promise<T>;
16
+ delete<T>(path: string, body?: unknown): Promise<T>;
17
17
  }
18
18
 
19
19
  interface StackBEConfig {
@@ -1512,28 +1512,36 @@ declare class FeatureRequestsClient {
1512
1512
  }>;
1513
1513
  /**
1514
1514
  * Upvote a feature request.
1515
- * Requires customer session token. Idempotent.
1515
+ * Requires customer session token, OR API key with customerId.
1516
1516
  *
1517
1517
  * @example
1518
1518
  * ```typescript
1519
+ * // With customer session token
1519
1520
  * await stackbe.featureRequests.vote('req_123');
1521
+ *
1522
+ * // With API key (server-side)
1523
+ * await stackbe.featureRequests.vote('req_123', 'cust_456');
1520
1524
  * ```
1521
1525
  */
1522
- vote(requestId: string): Promise<{
1526
+ vote(requestId: string, customerId?: string): Promise<{
1523
1527
  success?: boolean;
1524
1528
  alreadyVoted?: boolean;
1525
1529
  voteCount: number;
1526
1530
  }>;
1527
1531
  /**
1528
1532
  * Remove your vote from a feature request.
1529
- * Requires customer session token.
1533
+ * Requires customer session token, OR API key with customerId.
1530
1534
  *
1531
1535
  * @example
1532
1536
  * ```typescript
1537
+ * // With customer session token
1533
1538
  * await stackbe.featureRequests.removeVote('req_123');
1539
+ *
1540
+ * // With API key (server-side)
1541
+ * await stackbe.featureRequests.removeVote('req_123', 'cust_456');
1534
1542
  * ```
1535
1543
  */
1536
- removeVote(requestId: string): Promise<{
1544
+ removeVote(requestId: string, customerId?: string): Promise<{
1537
1545
  success: boolean;
1538
1546
  voteCount: number;
1539
1547
  }>;
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare class HttpClient {
13
13
  post<T>(path: string, body?: unknown, params?: Record<string, string | number | undefined>): Promise<T>;
14
14
  put<T>(path: string, body?: unknown, params?: Record<string, string | number | undefined>): Promise<T>;
15
15
  patch<T>(path: string, body?: unknown): Promise<T>;
16
- delete<T>(path: string): Promise<T>;
16
+ delete<T>(path: string, body?: unknown): Promise<T>;
17
17
  }
18
18
 
19
19
  interface StackBEConfig {
@@ -1512,28 +1512,36 @@ declare class FeatureRequestsClient {
1512
1512
  }>;
1513
1513
  /**
1514
1514
  * Upvote a feature request.
1515
- * Requires customer session token. Idempotent.
1515
+ * Requires customer session token, OR API key with customerId.
1516
1516
  *
1517
1517
  * @example
1518
1518
  * ```typescript
1519
+ * // With customer session token
1519
1520
  * await stackbe.featureRequests.vote('req_123');
1521
+ *
1522
+ * // With API key (server-side)
1523
+ * await stackbe.featureRequests.vote('req_123', 'cust_456');
1520
1524
  * ```
1521
1525
  */
1522
- vote(requestId: string): Promise<{
1526
+ vote(requestId: string, customerId?: string): Promise<{
1523
1527
  success?: boolean;
1524
1528
  alreadyVoted?: boolean;
1525
1529
  voteCount: number;
1526
1530
  }>;
1527
1531
  /**
1528
1532
  * Remove your vote from a feature request.
1529
- * Requires customer session token.
1533
+ * Requires customer session token, OR API key with customerId.
1530
1534
  *
1531
1535
  * @example
1532
1536
  * ```typescript
1537
+ * // With customer session token
1533
1538
  * await stackbe.featureRequests.removeVote('req_123');
1539
+ *
1540
+ * // With API key (server-side)
1541
+ * await stackbe.featureRequests.removeVote('req_123', 'cust_456');
1534
1542
  * ```
1535
1543
  */
1536
- removeVote(requestId: string): Promise<{
1544
+ removeVote(requestId: string, customerId?: string): Promise<{
1537
1545
  success: boolean;
1538
1546
  voteCount: number;
1539
1547
  }>;
package/dist/index.js CHANGED
@@ -169,8 +169,8 @@ var HttpClient = class {
169
169
  async patch(path, body) {
170
170
  return this.request("PATCH", path, { body });
171
171
  }
172
- async delete(path) {
173
- return this.request("DELETE", path);
172
+ async delete(path, body) {
173
+ return this.request("DELETE", path, body ? { body } : void 0);
174
174
  }
175
175
  };
176
176
 
@@ -1529,30 +1529,40 @@ var FeatureRequestsClient = class {
1529
1529
  }
1530
1530
  /**
1531
1531
  * Upvote a feature request.
1532
- * Requires customer session token. Idempotent.
1532
+ * Requires customer session token, OR API key with customerId.
1533
1533
  *
1534
1534
  * @example
1535
1535
  * ```typescript
1536
+ * // With customer session token
1536
1537
  * await stackbe.featureRequests.vote('req_123');
1538
+ *
1539
+ * // With API key (server-side)
1540
+ * await stackbe.featureRequests.vote('req_123', 'cust_456');
1537
1541
  * ```
1538
1542
  */
1539
- async vote(requestId) {
1543
+ async vote(requestId, customerId) {
1540
1544
  return this.http.post(
1541
- `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`
1545
+ `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`,
1546
+ customerId ? { customerId } : void 0
1542
1547
  );
1543
1548
  }
1544
1549
  /**
1545
1550
  * Remove your vote from a feature request.
1546
- * Requires customer session token.
1551
+ * Requires customer session token, OR API key with customerId.
1547
1552
  *
1548
1553
  * @example
1549
1554
  * ```typescript
1555
+ * // With customer session token
1550
1556
  * await stackbe.featureRequests.removeVote('req_123');
1557
+ *
1558
+ * // With API key (server-side)
1559
+ * await stackbe.featureRequests.removeVote('req_123', 'cust_456');
1551
1560
  * ```
1552
1561
  */
1553
- async removeVote(requestId) {
1562
+ async removeVote(requestId, customerId) {
1554
1563
  return this.http.delete(
1555
- `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`
1564
+ `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`,
1565
+ customerId ? { customerId } : void 0
1556
1566
  );
1557
1567
  }
1558
1568
  /**
package/dist/index.mjs CHANGED
@@ -132,8 +132,8 @@ var HttpClient = class {
132
132
  async patch(path, body) {
133
133
  return this.request("PATCH", path, { body });
134
134
  }
135
- async delete(path) {
136
- return this.request("DELETE", path);
135
+ async delete(path, body) {
136
+ return this.request("DELETE", path, body ? { body } : void 0);
137
137
  }
138
138
  };
139
139
 
@@ -1492,30 +1492,40 @@ var FeatureRequestsClient = class {
1492
1492
  }
1493
1493
  /**
1494
1494
  * Upvote a feature request.
1495
- * Requires customer session token. Idempotent.
1495
+ * Requires customer session token, OR API key with customerId.
1496
1496
  *
1497
1497
  * @example
1498
1498
  * ```typescript
1499
+ * // With customer session token
1499
1500
  * await stackbe.featureRequests.vote('req_123');
1501
+ *
1502
+ * // With API key (server-side)
1503
+ * await stackbe.featureRequests.vote('req_123', 'cust_456');
1500
1504
  * ```
1501
1505
  */
1502
- async vote(requestId) {
1506
+ async vote(requestId, customerId) {
1503
1507
  return this.http.post(
1504
- `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`
1508
+ `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`,
1509
+ customerId ? { customerId } : void 0
1505
1510
  );
1506
1511
  }
1507
1512
  /**
1508
1513
  * Remove your vote from a feature request.
1509
- * Requires customer session token.
1514
+ * Requires customer session token, OR API key with customerId.
1510
1515
  *
1511
1516
  * @example
1512
1517
  * ```typescript
1518
+ * // With customer session token
1513
1519
  * await stackbe.featureRequests.removeVote('req_123');
1520
+ *
1521
+ * // With API key (server-side)
1522
+ * await stackbe.featureRequests.removeVote('req_123', 'cust_456');
1514
1523
  * ```
1515
1524
  */
1516
- async removeVote(requestId) {
1525
+ async removeVote(requestId, customerId) {
1517
1526
  return this.http.delete(
1518
- `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`
1527
+ `/v1/apps/${this.appId}/feature-requests/${requestId}/vote`,
1528
+ customerId ? { customerId } : void 0
1519
1529
  );
1520
1530
  }
1521
1531
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbe/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Official JavaScript/TypeScript SDK for StackBE - the billing backend for your side project",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",