@stackup-fi/sdk 1.0.4 → 1.0.6

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
@@ -3,7 +3,6 @@ import { createStackupClient } from "./client.js";
3
3
  export function createStackup(options) {
4
4
  const client = createStackupClient({
5
5
  baseUrl: options.baseUrl ?? "https://api.stackup.finance",
6
- throwOnError: true,
7
6
  headers: {
8
7
  Authorization: `Bearer ${options.accessToken}`,
9
8
  },
@@ -1,5 +1,5 @@
1
1
  import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
2
- import type { CheckoutSessionCreateErrors, CheckoutSessionCreateResponses, CustomerCreateErrors, CustomerCreateResponses, CustomerDeleteErrors, CustomerDeleteResponses, CustomerGetErrors, CustomerGetResponses, CustomerListResponses, CustomerUpdateErrors, CustomerUpdateResponses } from "./types.gen.js";
2
+ import type { CheckoutSessionCreateErrors, CheckoutSessionCreateResponses, CustomerCreateErrors, CustomerCreateResponses, CustomerDeleteErrors, CustomerDeleteResponses, CustomerGetErrors, CustomerGetResponses, CustomerListResponses, CustomerUpdateErrors, CustomerUpdateResponses, ProductCreateErrors, ProductCreateResponses, ProductDeleteErrors, ProductDeleteResponses, ProductGetErrors, ProductGetResponses, ProductListResponses, ProductUpdateErrors, ProductUpdateResponses } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -33,6 +33,9 @@ export declare class Customer extends HeyApiClient {
33
33
  */
34
34
  create<ThrowOnError extends boolean = false>(parameters?: {
35
35
  walletAddress?: unknown;
36
+ name?: string | null;
37
+ email?: string | null;
38
+ externalID?: string | null;
36
39
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerCreateResponses, CustomerCreateErrors, ThrowOnError, "fields">;
37
40
  /**
38
41
  * List customers
@@ -59,21 +62,79 @@ export declare class Customer extends HeyApiClient {
59
62
  /**
60
63
  * Update customer
61
64
  *
62
- * Update a customer's wallet address
65
+ * Update a customer
63
66
  */
64
67
  update<ThrowOnError extends boolean = false>(parameters: {
65
68
  id: string;
66
69
  walletAddress?: unknown;
70
+ name?: string | null;
71
+ email?: string | null;
72
+ externalID?: string | null;
67
73
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CustomerUpdateResponses, CustomerUpdateErrors, ThrowOnError, "fields">;
68
74
  }
75
+ export declare class Product extends HeyApiClient {
76
+ /**
77
+ * Create product
78
+ *
79
+ * Create a new product
80
+ */
81
+ create<ThrowOnError extends boolean = false>(parameters?: {
82
+ walletID?: string;
83
+ payoutWalletID?: string;
84
+ chainID?: 1 | 8453;
85
+ token?: unknown;
86
+ price?: string;
87
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductCreateResponses, ProductCreateErrors, ThrowOnError, "fields">;
88
+ /**
89
+ * List products
90
+ *
91
+ * List all products for the current workspace
92
+ */
93
+ list<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductListResponses, unknown, ThrowOnError, "fields">;
94
+ /**
95
+ * Delete product
96
+ *
97
+ * Delete a product (soft delete)
98
+ */
99
+ delete<ThrowOnError extends boolean = false>(parameters: {
100
+ id: string;
101
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductDeleteResponses, ProductDeleteErrors, ThrowOnError, "fields">;
102
+ /**
103
+ * Get product
104
+ *
105
+ * Get a specific product by ID
106
+ */
107
+ get<ThrowOnError extends boolean = false>(parameters: {
108
+ id: string;
109
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductGetResponses, ProductGetErrors, ThrowOnError, "fields">;
110
+ /**
111
+ * Update product
112
+ *
113
+ * Update a product's price or paused status
114
+ */
115
+ update<ThrowOnError extends boolean = false>(parameters: {
116
+ id: string;
117
+ price?: string;
118
+ paused?: boolean;
119
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProductUpdateResponses, ProductUpdateErrors, ThrowOnError, "fields">;
120
+ }
69
121
  export declare class Session extends HeyApiClient {
70
122
  /**
71
123
  * Create checkout session
72
124
  *
73
- * Generate a checkout session URL for a product by product ID
125
+ * Generate a checkout session URL for a product and customer.
126
+ *
127
+ * ```ts
128
+ * const session = await client.checkout.session.create({
129
+ * productID: "prd_01ABC123",
130
+ * customerID: "cus_01DEF456"
131
+ * });
132
+ * console.log(session.url);
133
+ * ```
74
134
  */
75
- create<ThrowOnError extends boolean = false>(parameters: {
76
- id: string;
135
+ create<ThrowOnError extends boolean = false>(parameters?: {
136
+ product?: string;
137
+ customer?: string;
77
138
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CheckoutSessionCreateResponses, CheckoutSessionCreateErrors, ThrowOnError, "fields">;
78
139
  }
79
140
  export declare class Checkout extends HeyApiClient {
@@ -88,6 +149,8 @@ export declare class StackupClient extends HeyApiClient {
88
149
  });
89
150
  private _customer?;
90
151
  get customer(): Customer;
152
+ private _product?;
153
+ get product(): Product;
91
154
  private _checkout?;
92
155
  get checkout(): Checkout;
93
156
  }
@@ -28,7 +28,16 @@ export class Customer extends HeyApiClient {
28
28
  * Create a new customer with a wallet address
29
29
  */
30
30
  create(parameters, options) {
31
- const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "walletAddress" }] }]);
31
+ const params = buildClientParams([parameters], [
32
+ {
33
+ args: [
34
+ { in: "body", key: "walletAddress" },
35
+ { in: "body", key: "name" },
36
+ { in: "body", key: "email" },
37
+ { in: "body", key: "externalID" },
38
+ ],
39
+ },
40
+ ]);
32
41
  return (options?.client ?? this.client).post({
33
42
  url: "/customer/create",
34
43
  ...options,
@@ -77,7 +86,7 @@ export class Customer extends HeyApiClient {
77
86
  /**
78
87
  * Update customer
79
88
  *
80
- * Update a customer's wallet address
89
+ * Update a customer
81
90
  */
82
91
  update(parameters, options) {
83
92
  const params = buildClientParams([parameters], [
@@ -85,6 +94,9 @@ export class Customer extends HeyApiClient {
85
94
  args: [
86
95
  { in: "path", key: "id" },
87
96
  { in: "body", key: "walletAddress" },
97
+ { in: "body", key: "name" },
98
+ { in: "body", key: "email" },
99
+ { in: "body", key: "externalID" },
88
100
  ],
89
101
  },
90
102
  ]);
@@ -100,18 +112,128 @@ export class Customer extends HeyApiClient {
100
112
  });
101
113
  }
102
114
  }
115
+ export class Product extends HeyApiClient {
116
+ /**
117
+ * Create product
118
+ *
119
+ * Create a new product
120
+ */
121
+ create(parameters, options) {
122
+ const params = buildClientParams([parameters], [
123
+ {
124
+ args: [
125
+ { in: "body", key: "walletID" },
126
+ { in: "body", key: "payoutWalletID" },
127
+ { in: "body", key: "chainID" },
128
+ { in: "body", key: "token" },
129
+ { in: "body", key: "price" },
130
+ ],
131
+ },
132
+ ]);
133
+ return (options?.client ?? this.client).post({
134
+ url: "/product/create",
135
+ ...options,
136
+ ...params,
137
+ headers: {
138
+ "Content-Type": "application/json",
139
+ ...options?.headers,
140
+ ...params.headers,
141
+ },
142
+ });
143
+ }
144
+ /**
145
+ * List products
146
+ *
147
+ * List all products for the current workspace
148
+ */
149
+ list(options) {
150
+ return (options?.client ?? this.client).get({ url: "/product", ...options });
151
+ }
152
+ /**
153
+ * Delete product
154
+ *
155
+ * Delete a product (soft delete)
156
+ */
157
+ delete(parameters, options) {
158
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
159
+ return (options?.client ?? this.client).delete({
160
+ url: "/product/{id}",
161
+ ...options,
162
+ ...params,
163
+ });
164
+ }
165
+ /**
166
+ * Get product
167
+ *
168
+ * Get a specific product by ID
169
+ */
170
+ get(parameters, options) {
171
+ const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
172
+ return (options?.client ?? this.client).get({
173
+ url: "/product/{id}",
174
+ ...options,
175
+ ...params,
176
+ });
177
+ }
178
+ /**
179
+ * Update product
180
+ *
181
+ * Update a product's price or paused status
182
+ */
183
+ update(parameters, options) {
184
+ const params = buildClientParams([parameters], [
185
+ {
186
+ args: [
187
+ { in: "path", key: "id" },
188
+ { in: "body", key: "price" },
189
+ { in: "body", key: "paused" },
190
+ ],
191
+ },
192
+ ]);
193
+ return (options?.client ?? this.client).patch({
194
+ url: "/product/{id}",
195
+ ...options,
196
+ ...params,
197
+ headers: {
198
+ "Content-Type": "application/json",
199
+ ...options?.headers,
200
+ ...params.headers,
201
+ },
202
+ });
203
+ }
204
+ }
103
205
  export class Session extends HeyApiClient {
104
206
  /**
105
207
  * Create checkout session
106
208
  *
107
- * Generate a checkout session URL for a product by product ID
209
+ * Generate a checkout session URL for a product and customer.
210
+ *
211
+ * ```ts
212
+ * const session = await client.checkout.session.create({
213
+ * productID: "prd_01ABC123",
214
+ * customerID: "cus_01DEF456"
215
+ * });
216
+ * console.log(session.url);
217
+ * ```
108
218
  */
109
219
  create(parameters, options) {
110
- const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "id" }] }]);
220
+ const params = buildClientParams([parameters], [
221
+ {
222
+ args: [
223
+ { in: "body", key: "product" },
224
+ { in: "body", key: "customer" },
225
+ ],
226
+ },
227
+ ]);
111
228
  return (options?.client ?? this.client).post({
112
- url: "/checkout/session/{id}",
229
+ url: "/checkout/session",
113
230
  ...options,
114
231
  ...params,
232
+ headers: {
233
+ "Content-Type": "application/json",
234
+ ...options?.headers,
235
+ ...params.headers,
236
+ },
115
237
  });
116
238
  }
117
239
  }
@@ -131,6 +253,10 @@ export class StackupClient extends HeyApiClient {
131
253
  get customer() {
132
254
  return (this._customer ??= new Customer({ client: this.client }));
133
255
  }
256
+ _product;
257
+ get product() {
258
+ return (this._product ??= new Product({ client: this.client }));
259
+ }
134
260
  _checkout;
135
261
  get checkout() {
136
262
  return (this._checkout ??= new Checkout({ client: this.client }));
@@ -13,10 +13,10 @@ export type NotFoundError = {
13
13
  };
14
14
  export type CustomerCreateData = {
15
15
  body?: {
16
- /**
17
- * Customer's EVM-compatible wallet address
18
- */
19
16
  walletAddress: unknown;
17
+ name?: string | null;
18
+ email?: string | null;
19
+ externalID?: string | null;
20
20
  };
21
21
  path?: never;
22
22
  query?: never;
@@ -34,34 +34,15 @@ export type CustomerCreateResponses = {
34
34
  * Customer created successfully
35
35
  */
36
36
  201: {
37
- /**
38
- * Unique customer identifier
39
- */
40
37
  id: string;
41
- /**
42
- * ID of the workspace this customer belongs to
43
- */
44
38
  workspaceID: string;
45
- /**
46
- * Timestamp when the customer was created
47
- */
48
39
  timeCreated: unknown;
49
- /**
50
- * Timestamp when the customer was last updated
51
- */
52
40
  timeUpdated: unknown;
53
- /**
54
- * Timestamp when the customer was deleted, null if active
55
- */
56
41
  timeDeleted: unknown | null;
57
- /**
58
- * Customer's EVM-compatible wallet address
59
- */
60
42
  walletAddress: unknown;
61
- /**
62
- * Customer's email address
63
- */
64
43
  email: string | null;
44
+ name: string | null;
45
+ externalID: string | null;
65
46
  };
66
47
  };
67
48
  export type CustomerCreateResponse = CustomerCreateResponses[keyof CustomerCreateResponses];
@@ -76,43 +57,21 @@ export type CustomerListResponses = {
76
57
  * List of customers
77
58
  */
78
59
  200: Array<{
79
- /**
80
- * Unique customer identifier
81
- */
82
60
  id: string;
83
- /**
84
- * ID of the workspace this customer belongs to
85
- */
86
61
  workspaceID: string;
87
- /**
88
- * Timestamp when the customer was created
89
- */
90
62
  timeCreated: unknown;
91
- /**
92
- * Timestamp when the customer was last updated
93
- */
94
63
  timeUpdated: unknown;
95
- /**
96
- * Timestamp when the customer was deleted, null if active
97
- */
98
64
  timeDeleted: unknown | null;
99
- /**
100
- * Customer's EVM-compatible wallet address
101
- */
102
65
  walletAddress: unknown;
103
- /**
104
- * Customer's email address
105
- */
106
66
  email: string | null;
67
+ name: string | null;
68
+ externalID: string | null;
107
69
  }>;
108
70
  };
109
71
  export type CustomerListResponse = CustomerListResponses[keyof CustomerListResponses];
110
72
  export type CustomerDeleteData = {
111
73
  body?: never;
112
74
  path: {
113
- /**
114
- * Unique customer identifier
115
- */
116
75
  id: string;
117
76
  };
118
77
  query?: never;
@@ -139,9 +98,6 @@ export type CustomerDeleteResponse = CustomerDeleteResponses[keyof CustomerDelet
139
98
  export type CustomerGetData = {
140
99
  body?: never;
141
100
  path: {
142
- /**
143
- * Unique customer identifier
144
- */
145
101
  id: string;
146
102
  };
147
103
  query?: never;
@@ -163,48 +119,26 @@ export type CustomerGetResponses = {
163
119
  * Customer details
164
120
  */
165
121
  200: {
166
- /**
167
- * Unique customer identifier
168
- */
169
122
  id: string;
170
- /**
171
- * ID of the workspace this customer belongs to
172
- */
173
123
  workspaceID: string;
174
- /**
175
- * Timestamp when the customer was created
176
- */
177
124
  timeCreated: unknown;
178
- /**
179
- * Timestamp when the customer was last updated
180
- */
181
125
  timeUpdated: unknown;
182
- /**
183
- * Timestamp when the customer was deleted, null if active
184
- */
185
126
  timeDeleted: unknown | null;
186
- /**
187
- * Customer's EVM-compatible wallet address
188
- */
189
127
  walletAddress: unknown;
190
- /**
191
- * Customer's email address
192
- */
193
128
  email: string | null;
129
+ name: string | null;
130
+ externalID: string | null;
194
131
  };
195
132
  };
196
133
  export type CustomerGetResponse = CustomerGetResponses[keyof CustomerGetResponses];
197
134
  export type CustomerUpdateData = {
198
135
  body?: {
199
- /**
200
- * Customer's EVM-compatible wallet address
201
- */
202
136
  walletAddress?: unknown;
137
+ name?: string | null;
138
+ email?: string | null;
139
+ externalID?: string | null;
203
140
  };
204
141
  path: {
205
- /**
206
- * Unique customer identifier
207
- */
208
142
  id: string;
209
143
  };
210
144
  query?: never;
@@ -226,44 +160,202 @@ export type CustomerUpdateResponses = {
226
160
  * Customer updated successfully
227
161
  */
228
162
  200: {
229
- /**
230
- * Unique customer identifier
231
- */
232
163
  id: string;
233
- /**
234
- * ID of the workspace this customer belongs to
235
- */
236
164
  workspaceID: string;
237
- /**
238
- * Timestamp when the customer was created
239
- */
240
165
  timeCreated: unknown;
241
- /**
242
- * Timestamp when the customer was last updated
243
- */
244
166
  timeUpdated: unknown;
245
- /**
246
- * Timestamp when the customer was deleted, null if active
247
- */
248
167
  timeDeleted: unknown | null;
249
- /**
250
- * Customer's EVM-compatible wallet address
251
- */
252
168
  walletAddress: unknown;
253
- /**
254
- * Customer's email address
255
- */
256
169
  email: string | null;
170
+ name: string | null;
171
+ externalID: string | null;
257
172
  };
258
173
  };
259
174
  export type CustomerUpdateResponse = CustomerUpdateResponses[keyof CustomerUpdateResponses];
260
- export type CheckoutSessionCreateData = {
175
+ export type ProductCreateData = {
176
+ body?: {
177
+ walletID: string;
178
+ payoutWalletID: string;
179
+ chainID: 1 | 8453;
180
+ token: unknown;
181
+ price: string;
182
+ };
183
+ path?: never;
184
+ query?: never;
185
+ url: "/product/create";
186
+ };
187
+ export type ProductCreateErrors = {
188
+ /**
189
+ * Bad request
190
+ */
191
+ 400: BadRequestError;
192
+ };
193
+ export type ProductCreateError = ProductCreateErrors[keyof ProductCreateErrors];
194
+ export type ProductCreateResponses = {
195
+ /**
196
+ * Product created successfully
197
+ */
198
+ 201: {
199
+ id: string;
200
+ workspaceID: string;
201
+ timeCreated: unknown;
202
+ timeUpdated: unknown;
203
+ timeDeleted: unknown | null;
204
+ walletID: string;
205
+ payoutWalletID: string;
206
+ chainID: 1 | 8453;
207
+ token: unknown;
208
+ price: string;
209
+ paused: boolean;
210
+ name: string;
211
+ description: string | null;
212
+ };
213
+ };
214
+ export type ProductCreateResponse = ProductCreateResponses[keyof ProductCreateResponses];
215
+ export type ProductListData = {
216
+ body?: never;
217
+ path?: never;
218
+ query?: never;
219
+ url: "/product";
220
+ };
221
+ export type ProductListResponses = {
222
+ /**
223
+ * List of products
224
+ */
225
+ 200: Array<{
226
+ id: string;
227
+ workspaceID: string;
228
+ timeCreated: unknown;
229
+ timeUpdated: unknown;
230
+ timeDeleted: unknown | null;
231
+ walletID: string;
232
+ payoutWalletID: string;
233
+ chainID: 1 | 8453;
234
+ token: unknown;
235
+ price: string;
236
+ paused: boolean;
237
+ name: string;
238
+ description: string | null;
239
+ }>;
240
+ };
241
+ export type ProductListResponse = ProductListResponses[keyof ProductListResponses];
242
+ export type ProductDeleteData = {
243
+ body?: never;
244
+ path: {
245
+ id: string;
246
+ };
247
+ query?: never;
248
+ url: "/product/{id}";
249
+ };
250
+ export type ProductDeleteErrors = {
251
+ /**
252
+ * Bad request
253
+ */
254
+ 400: BadRequestError;
255
+ /**
256
+ * Not found
257
+ */
258
+ 404: NotFoundError;
259
+ };
260
+ export type ProductDeleteError = ProductDeleteErrors[keyof ProductDeleteErrors];
261
+ export type ProductDeleteResponses = {
262
+ /**
263
+ * Product deleted successfully
264
+ */
265
+ 204: void;
266
+ };
267
+ export type ProductDeleteResponse = ProductDeleteResponses[keyof ProductDeleteResponses];
268
+ export type ProductGetData = {
261
269
  body?: never;
262
270
  path: {
263
271
  id: string;
264
272
  };
265
273
  query?: never;
266
- url: "/checkout/session/{id}";
274
+ url: "/product/{id}";
275
+ };
276
+ export type ProductGetErrors = {
277
+ /**
278
+ * Bad request
279
+ */
280
+ 400: BadRequestError;
281
+ /**
282
+ * Not found
283
+ */
284
+ 404: NotFoundError;
285
+ };
286
+ export type ProductGetError = ProductGetErrors[keyof ProductGetErrors];
287
+ export type ProductGetResponses = {
288
+ /**
289
+ * Product details
290
+ */
291
+ 200: {
292
+ id: string;
293
+ workspaceID: string;
294
+ timeCreated: unknown;
295
+ timeUpdated: unknown;
296
+ timeDeleted: unknown | null;
297
+ walletID: string;
298
+ payoutWalletID: string;
299
+ chainID: 1 | 8453;
300
+ token: unknown;
301
+ price: string;
302
+ paused: boolean;
303
+ name: string;
304
+ description: string | null;
305
+ };
306
+ };
307
+ export type ProductGetResponse = ProductGetResponses[keyof ProductGetResponses];
308
+ export type ProductUpdateData = {
309
+ body?: {
310
+ price?: string;
311
+ paused?: boolean;
312
+ };
313
+ path: {
314
+ id: string;
315
+ };
316
+ query?: never;
317
+ url: "/product/{id}";
318
+ };
319
+ export type ProductUpdateErrors = {
320
+ /**
321
+ * Bad request
322
+ */
323
+ 400: BadRequestError;
324
+ /**
325
+ * Not found
326
+ */
327
+ 404: NotFoundError;
328
+ };
329
+ export type ProductUpdateError = ProductUpdateErrors[keyof ProductUpdateErrors];
330
+ export type ProductUpdateResponses = {
331
+ /**
332
+ * Product updated successfully
333
+ */
334
+ 200: {
335
+ id: string;
336
+ workspaceID: string;
337
+ timeCreated: unknown;
338
+ timeUpdated: unknown;
339
+ timeDeleted: unknown | null;
340
+ walletID: string;
341
+ payoutWalletID: string;
342
+ chainID: 1 | 8453;
343
+ token: unknown;
344
+ price: string;
345
+ paused: boolean;
346
+ name: string;
347
+ description: string | null;
348
+ };
349
+ };
350
+ export type ProductUpdateResponse = ProductUpdateResponses[keyof ProductUpdateResponses];
351
+ export type CheckoutSessionCreateData = {
352
+ body?: {
353
+ product: string;
354
+ customer: string;
355
+ };
356
+ path?: never;
357
+ query?: never;
358
+ url: "/checkout/session";
267
359
  };
268
360
  export type CheckoutSessionCreateErrors = {
269
361
  /**
@@ -281,6 +373,7 @@ export type CheckoutSessionCreateResponses = {
281
373
  * Checkout session created successfully
282
374
  */
283
375
  200: {
376
+ id: string;
284
377
  url: string;
285
378
  };
286
379
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackup-fi/sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,8 +10,8 @@
10
10
  }
11
11
  },
12
12
  "scripts": {
13
- "generate": "sst shell -- bun script/build.ts",
14
- "publish": "bun script/publish.ts"
13
+ "build": "sst shell -- bun script/build.ts",
14
+ "release": "bun script/publish.ts"
15
15
  },
16
16
  "files": [
17
17
  "dist"