@garuhq/node 0.1.1 → 0.3.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/CHANGELOG.md +14 -0
- package/README.md +150 -50
- package/dist/index.cjs +157 -4
- package/dist/index.d.cts +205 -3
- package/dist/index.d.ts +205 -3
- package/dist/index.js +157 -4
- package/package.json +4 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -181,6 +181,119 @@ interface RefundChargeParams {
|
|
|
181
181
|
reason?: string;
|
|
182
182
|
idempotencyKey?: string;
|
|
183
183
|
}
|
|
184
|
+
interface ListChargesParams {
|
|
185
|
+
/** Page number (1-based). Default: 1. */
|
|
186
|
+
page?: number;
|
|
187
|
+
/** Items per page (1–100). Default: 20. */
|
|
188
|
+
limit?: number;
|
|
189
|
+
/** Filter by status (e.g. `paid`, `pending`). */
|
|
190
|
+
status?: string;
|
|
191
|
+
/** Search by customer name, email, or document. */
|
|
192
|
+
search?: string;
|
|
193
|
+
/** Filter by payment method (`pix`, `creditcard`, `boleto`). */
|
|
194
|
+
paymentMethod?: string;
|
|
195
|
+
}
|
|
196
|
+
interface PaginatedList<T> {
|
|
197
|
+
data: T[];
|
|
198
|
+
meta: {
|
|
199
|
+
page: number;
|
|
200
|
+
limit: number;
|
|
201
|
+
total: number;
|
|
202
|
+
totalPages: number;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
type ChargeList = PaginatedList<Charge>;
|
|
206
|
+
interface CustomerRecord {
|
|
207
|
+
id: number;
|
|
208
|
+
name: string;
|
|
209
|
+
email: string;
|
|
210
|
+
document: string;
|
|
211
|
+
phone: string;
|
|
212
|
+
personType: string;
|
|
213
|
+
zipCode?: string | null;
|
|
214
|
+
street?: string | null;
|
|
215
|
+
number?: string | null;
|
|
216
|
+
complement?: string | null;
|
|
217
|
+
neighborhood?: string | null;
|
|
218
|
+
city?: string | null;
|
|
219
|
+
state?: string | null;
|
|
220
|
+
createdAt: string;
|
|
221
|
+
updatedAt: string;
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
type CustomerList = PaginatedList<CustomerRecord>;
|
|
225
|
+
interface CreateCustomerParams {
|
|
226
|
+
name: string;
|
|
227
|
+
email: string;
|
|
228
|
+
/** CPF (11 digits) or CNPJ (14 digits), digits only. */
|
|
229
|
+
document: string;
|
|
230
|
+
/** 10 or 11 digits with area code. */
|
|
231
|
+
phone: string;
|
|
232
|
+
/** `fisica` or `juridica`. */
|
|
233
|
+
personType: 'fisica' | 'juridica';
|
|
234
|
+
zipCode?: string;
|
|
235
|
+
street?: string;
|
|
236
|
+
number?: string;
|
|
237
|
+
complement?: string;
|
|
238
|
+
neighborhood?: string;
|
|
239
|
+
city?: string;
|
|
240
|
+
/** 2-letter uppercase state code, e.g. `SP`. */
|
|
241
|
+
state?: string;
|
|
242
|
+
}
|
|
243
|
+
interface UpdateCustomerParams {
|
|
244
|
+
name?: string;
|
|
245
|
+
email?: string;
|
|
246
|
+
document?: string;
|
|
247
|
+
phone?: string;
|
|
248
|
+
personType?: 'fisica' | 'juridica';
|
|
249
|
+
zipCode?: string;
|
|
250
|
+
street?: string;
|
|
251
|
+
number?: string;
|
|
252
|
+
complement?: string;
|
|
253
|
+
neighborhood?: string;
|
|
254
|
+
city?: string;
|
|
255
|
+
state?: string;
|
|
256
|
+
}
|
|
257
|
+
interface ListCustomersParams {
|
|
258
|
+
page?: number;
|
|
259
|
+
limit?: number;
|
|
260
|
+
search?: string;
|
|
261
|
+
}
|
|
262
|
+
interface Product {
|
|
263
|
+
id: number;
|
|
264
|
+
uuid: string;
|
|
265
|
+
name: string;
|
|
266
|
+
description: string;
|
|
267
|
+
image: string;
|
|
268
|
+
/** Price in centavos (BRL × 100). */
|
|
269
|
+
value: number;
|
|
270
|
+
sellerId: number;
|
|
271
|
+
sellerName?: string;
|
|
272
|
+
pix: boolean;
|
|
273
|
+
boleto: boolean;
|
|
274
|
+
creditCard: boolean;
|
|
275
|
+
installments: number[];
|
|
276
|
+
tags?: string[];
|
|
277
|
+
isSubscription?: boolean;
|
|
278
|
+
subscriptionType?: string;
|
|
279
|
+
unitLabel?: string;
|
|
280
|
+
comission?: string;
|
|
281
|
+
valueWithComission?: number;
|
|
282
|
+
returnUrl?: string;
|
|
283
|
+
returnUrlButtonText?: string;
|
|
284
|
+
createdAt: string;
|
|
285
|
+
updatedAt: string;
|
|
286
|
+
[key: string]: unknown;
|
|
287
|
+
}
|
|
288
|
+
type ProductList = PaginatedList<Product>;
|
|
289
|
+
interface ListProductsParams {
|
|
290
|
+
page?: number;
|
|
291
|
+
limit?: number;
|
|
292
|
+
/** Search by product name. */
|
|
293
|
+
search?: string;
|
|
294
|
+
/** Backend tab filter (e.g. `active`, `archived`). Backend default is used when omitted. */
|
|
295
|
+
tab?: string;
|
|
296
|
+
}
|
|
184
297
|
interface MetaFeatures {
|
|
185
298
|
subscriptions: boolean;
|
|
186
299
|
checkout_sessions: boolean;
|
|
@@ -191,7 +304,7 @@ interface MetaFeatures {
|
|
|
191
304
|
interface MetaResponse {
|
|
192
305
|
name: string;
|
|
193
306
|
version: string;
|
|
194
|
-
environment:
|
|
307
|
+
environment: string;
|
|
195
308
|
api_version: string;
|
|
196
309
|
payment_methods: string[];
|
|
197
310
|
currencies: string[];
|
|
@@ -233,7 +346,7 @@ declare class Charges {
|
|
|
233
346
|
* phone: '11987654321'
|
|
234
347
|
* }
|
|
235
348
|
* });
|
|
236
|
-
*
|
|
349
|
+
* // charge.id, charge.status
|
|
237
350
|
*
|
|
238
351
|
* @example
|
|
239
352
|
* // Credit card charge, 3 installments
|
|
@@ -251,6 +364,14 @@ declare class Charges {
|
|
|
251
364
|
* });
|
|
252
365
|
*/
|
|
253
366
|
create(params: CreateChargeParams): Promise<Charge>;
|
|
367
|
+
/**
|
|
368
|
+
* List charges for the authenticated seller, with pagination and filters.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* const { data, meta } = await garu.charges.list({ status: 'paid', limit: 10 });
|
|
372
|
+
* // meta.total paid charges
|
|
373
|
+
*/
|
|
374
|
+
list(params?: ListChargesParams): Promise<ChargeList>;
|
|
254
375
|
/**
|
|
255
376
|
* Fetch a single charge by numeric ID.
|
|
256
377
|
*
|
|
@@ -274,6 +395,59 @@ declare class Charges {
|
|
|
274
395
|
private buildCreateBody;
|
|
275
396
|
}
|
|
276
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Customers — manage your customer base.
|
|
400
|
+
*
|
|
401
|
+
* Customers are scoped to the seller identified by the API key. The backend
|
|
402
|
+
* uses a junction table (`customer_seller_profile`) so the same person can
|
|
403
|
+
* exist across multiple sellers without duplication.
|
|
404
|
+
*/
|
|
405
|
+
declare class Customers {
|
|
406
|
+
private readonly http;
|
|
407
|
+
constructor(http: HttpClient);
|
|
408
|
+
/**
|
|
409
|
+
* Create a customer and link it to the current seller.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* const customer = await garu.customers.create({
|
|
413
|
+
* name: 'Maria Silva',
|
|
414
|
+
* email: 'maria@exemplo.com.br',
|
|
415
|
+
* document: '12345678909',
|
|
416
|
+
* phone: '11987654321',
|
|
417
|
+
* personType: 'fisica'
|
|
418
|
+
* });
|
|
419
|
+
*/
|
|
420
|
+
create(params: CreateCustomerParams): Promise<CustomerRecord>;
|
|
421
|
+
/**
|
|
422
|
+
* List customers for the authenticated seller, with pagination and search.
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* const { data, meta } = await garu.customers.list({ search: 'maria', limit: 10 });
|
|
426
|
+
*/
|
|
427
|
+
list(params?: ListCustomersParams): Promise<CustomerList>;
|
|
428
|
+
/**
|
|
429
|
+
* Fetch a single customer by numeric ID.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* const customer = await garu.customers.get(42);
|
|
433
|
+
*/
|
|
434
|
+
get(id: number): Promise<CustomerRecord>;
|
|
435
|
+
/**
|
|
436
|
+
* Update a customer's profile for the current seller.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* const updated = await garu.customers.update(42, { name: 'Maria Santos' });
|
|
440
|
+
*/
|
|
441
|
+
update(id: number, params: UpdateCustomerParams): Promise<CustomerRecord>;
|
|
442
|
+
/**
|
|
443
|
+
* Remove a customer from the current seller.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* await garu.customers.delete(42);
|
|
447
|
+
*/
|
|
448
|
+
delete(id: number): Promise<void>;
|
|
449
|
+
}
|
|
450
|
+
|
|
277
451
|
/**
|
|
278
452
|
* Meta — capability introspection.
|
|
279
453
|
*
|
|
@@ -295,6 +469,32 @@ declare class Meta {
|
|
|
295
469
|
get(): Promise<MetaResponse>;
|
|
296
470
|
}
|
|
297
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Products — discover products available to charge.
|
|
474
|
+
*
|
|
475
|
+
* Products are scoped to the seller identified by the API key. The UUID
|
|
476
|
+
* returned here is the same identifier accepted by `charges.create({ productId })`.
|
|
477
|
+
*/
|
|
478
|
+
declare class Products {
|
|
479
|
+
private readonly http;
|
|
480
|
+
constructor(http: HttpClient);
|
|
481
|
+
/**
|
|
482
|
+
* List products for the authenticated seller, with pagination and search.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* const { data, meta } = await garu.products.list({ search: 'curso', limit: 10 });
|
|
486
|
+
*/
|
|
487
|
+
list(params?: ListProductsParams): Promise<ProductList>;
|
|
488
|
+
/**
|
|
489
|
+
* Fetch a single product by UUID — the same identifier used by
|
|
490
|
+
* `charges.create({ productId })`.
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* const product = await garu.products.get('b3f2c1e8-6e4a-4b9f-9d1c-2a1f6c3d4e5f');
|
|
494
|
+
*/
|
|
495
|
+
get(uuid: string): Promise<Product>;
|
|
496
|
+
}
|
|
497
|
+
|
|
298
498
|
interface GaruOptions {
|
|
299
499
|
/**
|
|
300
500
|
* Your Garu API key. `sk_live_…` for production, `sk_test_…` for test mode.
|
|
@@ -331,7 +531,9 @@ interface GaruOptions {
|
|
|
331
531
|
*/
|
|
332
532
|
declare class Garu {
|
|
333
533
|
readonly charges: Charges;
|
|
534
|
+
readonly customers: Customers;
|
|
334
535
|
readonly meta: Meta;
|
|
536
|
+
readonly products: Products;
|
|
335
537
|
/**
|
|
336
538
|
* Webhook helpers. Available both as an instance member and as a static —
|
|
337
539
|
* `Garu.webhooks.verify(...)` works without constructing a client.
|
|
@@ -390,4 +592,4 @@ declare class GaruServerError extends GaruAPIError {
|
|
|
390
592
|
constructor(message: string, status: number, requestId: string | null, body: unknown);
|
|
391
593
|
}
|
|
392
594
|
|
|
393
|
-
export { type CardInfo, type Charge, type ChargeStatus, type CreateChargeParams, type Customer, Garu, GaruAPIError, GaruAuthenticationError, GaruConnectionError, GaruError, type GaruErrorCode, GaruNotFoundError, type GaruOptions, GaruPermissionError, GaruRateLimitError, GaruServerError, GaruSignatureVerificationError, GaruValidationError, type MetaFeatures, type MetaResponse, type PaymentMethod, type RefundChargeParams, type VerifiedWebhook, type VerifyWebhookParams, type WirePaymentMethodId, webhooks };
|
|
595
|
+
export { type CardInfo, type Charge, type ChargeList, type ChargeStatus, type CreateChargeParams, type CreateCustomerParams, type Customer, type CustomerList, type CustomerRecord, Garu, GaruAPIError, GaruAuthenticationError, GaruConnectionError, GaruError, type GaruErrorCode, GaruNotFoundError, type GaruOptions, GaruPermissionError, GaruRateLimitError, GaruServerError, GaruSignatureVerificationError, GaruValidationError, type ListChargesParams, type ListCustomersParams, type ListProductsParams, type MetaFeatures, type MetaResponse, type PaginatedList, type PaymentMethod, type Product, type ProductList, type RefundChargeParams, type UpdateCustomerParams, type VerifiedWebhook, type VerifyWebhookParams, type WirePaymentMethodId, webhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,119 @@ interface RefundChargeParams {
|
|
|
181
181
|
reason?: string;
|
|
182
182
|
idempotencyKey?: string;
|
|
183
183
|
}
|
|
184
|
+
interface ListChargesParams {
|
|
185
|
+
/** Page number (1-based). Default: 1. */
|
|
186
|
+
page?: number;
|
|
187
|
+
/** Items per page (1–100). Default: 20. */
|
|
188
|
+
limit?: number;
|
|
189
|
+
/** Filter by status (e.g. `paid`, `pending`). */
|
|
190
|
+
status?: string;
|
|
191
|
+
/** Search by customer name, email, or document. */
|
|
192
|
+
search?: string;
|
|
193
|
+
/** Filter by payment method (`pix`, `creditcard`, `boleto`). */
|
|
194
|
+
paymentMethod?: string;
|
|
195
|
+
}
|
|
196
|
+
interface PaginatedList<T> {
|
|
197
|
+
data: T[];
|
|
198
|
+
meta: {
|
|
199
|
+
page: number;
|
|
200
|
+
limit: number;
|
|
201
|
+
total: number;
|
|
202
|
+
totalPages: number;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
type ChargeList = PaginatedList<Charge>;
|
|
206
|
+
interface CustomerRecord {
|
|
207
|
+
id: number;
|
|
208
|
+
name: string;
|
|
209
|
+
email: string;
|
|
210
|
+
document: string;
|
|
211
|
+
phone: string;
|
|
212
|
+
personType: string;
|
|
213
|
+
zipCode?: string | null;
|
|
214
|
+
street?: string | null;
|
|
215
|
+
number?: string | null;
|
|
216
|
+
complement?: string | null;
|
|
217
|
+
neighborhood?: string | null;
|
|
218
|
+
city?: string | null;
|
|
219
|
+
state?: string | null;
|
|
220
|
+
createdAt: string;
|
|
221
|
+
updatedAt: string;
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
type CustomerList = PaginatedList<CustomerRecord>;
|
|
225
|
+
interface CreateCustomerParams {
|
|
226
|
+
name: string;
|
|
227
|
+
email: string;
|
|
228
|
+
/** CPF (11 digits) or CNPJ (14 digits), digits only. */
|
|
229
|
+
document: string;
|
|
230
|
+
/** 10 or 11 digits with area code. */
|
|
231
|
+
phone: string;
|
|
232
|
+
/** `fisica` or `juridica`. */
|
|
233
|
+
personType: 'fisica' | 'juridica';
|
|
234
|
+
zipCode?: string;
|
|
235
|
+
street?: string;
|
|
236
|
+
number?: string;
|
|
237
|
+
complement?: string;
|
|
238
|
+
neighborhood?: string;
|
|
239
|
+
city?: string;
|
|
240
|
+
/** 2-letter uppercase state code, e.g. `SP`. */
|
|
241
|
+
state?: string;
|
|
242
|
+
}
|
|
243
|
+
interface UpdateCustomerParams {
|
|
244
|
+
name?: string;
|
|
245
|
+
email?: string;
|
|
246
|
+
document?: string;
|
|
247
|
+
phone?: string;
|
|
248
|
+
personType?: 'fisica' | 'juridica';
|
|
249
|
+
zipCode?: string;
|
|
250
|
+
street?: string;
|
|
251
|
+
number?: string;
|
|
252
|
+
complement?: string;
|
|
253
|
+
neighborhood?: string;
|
|
254
|
+
city?: string;
|
|
255
|
+
state?: string;
|
|
256
|
+
}
|
|
257
|
+
interface ListCustomersParams {
|
|
258
|
+
page?: number;
|
|
259
|
+
limit?: number;
|
|
260
|
+
search?: string;
|
|
261
|
+
}
|
|
262
|
+
interface Product {
|
|
263
|
+
id: number;
|
|
264
|
+
uuid: string;
|
|
265
|
+
name: string;
|
|
266
|
+
description: string;
|
|
267
|
+
image: string;
|
|
268
|
+
/** Price in centavos (BRL × 100). */
|
|
269
|
+
value: number;
|
|
270
|
+
sellerId: number;
|
|
271
|
+
sellerName?: string;
|
|
272
|
+
pix: boolean;
|
|
273
|
+
boleto: boolean;
|
|
274
|
+
creditCard: boolean;
|
|
275
|
+
installments: number[];
|
|
276
|
+
tags?: string[];
|
|
277
|
+
isSubscription?: boolean;
|
|
278
|
+
subscriptionType?: string;
|
|
279
|
+
unitLabel?: string;
|
|
280
|
+
comission?: string;
|
|
281
|
+
valueWithComission?: number;
|
|
282
|
+
returnUrl?: string;
|
|
283
|
+
returnUrlButtonText?: string;
|
|
284
|
+
createdAt: string;
|
|
285
|
+
updatedAt: string;
|
|
286
|
+
[key: string]: unknown;
|
|
287
|
+
}
|
|
288
|
+
type ProductList = PaginatedList<Product>;
|
|
289
|
+
interface ListProductsParams {
|
|
290
|
+
page?: number;
|
|
291
|
+
limit?: number;
|
|
292
|
+
/** Search by product name. */
|
|
293
|
+
search?: string;
|
|
294
|
+
/** Backend tab filter (e.g. `active`, `archived`). Backend default is used when omitted. */
|
|
295
|
+
tab?: string;
|
|
296
|
+
}
|
|
184
297
|
interface MetaFeatures {
|
|
185
298
|
subscriptions: boolean;
|
|
186
299
|
checkout_sessions: boolean;
|
|
@@ -191,7 +304,7 @@ interface MetaFeatures {
|
|
|
191
304
|
interface MetaResponse {
|
|
192
305
|
name: string;
|
|
193
306
|
version: string;
|
|
194
|
-
environment:
|
|
307
|
+
environment: string;
|
|
195
308
|
api_version: string;
|
|
196
309
|
payment_methods: string[];
|
|
197
310
|
currencies: string[];
|
|
@@ -233,7 +346,7 @@ declare class Charges {
|
|
|
233
346
|
* phone: '11987654321'
|
|
234
347
|
* }
|
|
235
348
|
* });
|
|
236
|
-
*
|
|
349
|
+
* // charge.id, charge.status
|
|
237
350
|
*
|
|
238
351
|
* @example
|
|
239
352
|
* // Credit card charge, 3 installments
|
|
@@ -251,6 +364,14 @@ declare class Charges {
|
|
|
251
364
|
* });
|
|
252
365
|
*/
|
|
253
366
|
create(params: CreateChargeParams): Promise<Charge>;
|
|
367
|
+
/**
|
|
368
|
+
* List charges for the authenticated seller, with pagination and filters.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* const { data, meta } = await garu.charges.list({ status: 'paid', limit: 10 });
|
|
372
|
+
* // meta.total paid charges
|
|
373
|
+
*/
|
|
374
|
+
list(params?: ListChargesParams): Promise<ChargeList>;
|
|
254
375
|
/**
|
|
255
376
|
* Fetch a single charge by numeric ID.
|
|
256
377
|
*
|
|
@@ -274,6 +395,59 @@ declare class Charges {
|
|
|
274
395
|
private buildCreateBody;
|
|
275
396
|
}
|
|
276
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Customers — manage your customer base.
|
|
400
|
+
*
|
|
401
|
+
* Customers are scoped to the seller identified by the API key. The backend
|
|
402
|
+
* uses a junction table (`customer_seller_profile`) so the same person can
|
|
403
|
+
* exist across multiple sellers without duplication.
|
|
404
|
+
*/
|
|
405
|
+
declare class Customers {
|
|
406
|
+
private readonly http;
|
|
407
|
+
constructor(http: HttpClient);
|
|
408
|
+
/**
|
|
409
|
+
* Create a customer and link it to the current seller.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* const customer = await garu.customers.create({
|
|
413
|
+
* name: 'Maria Silva',
|
|
414
|
+
* email: 'maria@exemplo.com.br',
|
|
415
|
+
* document: '12345678909',
|
|
416
|
+
* phone: '11987654321',
|
|
417
|
+
* personType: 'fisica'
|
|
418
|
+
* });
|
|
419
|
+
*/
|
|
420
|
+
create(params: CreateCustomerParams): Promise<CustomerRecord>;
|
|
421
|
+
/**
|
|
422
|
+
* List customers for the authenticated seller, with pagination and search.
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* const { data, meta } = await garu.customers.list({ search: 'maria', limit: 10 });
|
|
426
|
+
*/
|
|
427
|
+
list(params?: ListCustomersParams): Promise<CustomerList>;
|
|
428
|
+
/**
|
|
429
|
+
* Fetch a single customer by numeric ID.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* const customer = await garu.customers.get(42);
|
|
433
|
+
*/
|
|
434
|
+
get(id: number): Promise<CustomerRecord>;
|
|
435
|
+
/**
|
|
436
|
+
* Update a customer's profile for the current seller.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* const updated = await garu.customers.update(42, { name: 'Maria Santos' });
|
|
440
|
+
*/
|
|
441
|
+
update(id: number, params: UpdateCustomerParams): Promise<CustomerRecord>;
|
|
442
|
+
/**
|
|
443
|
+
* Remove a customer from the current seller.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* await garu.customers.delete(42);
|
|
447
|
+
*/
|
|
448
|
+
delete(id: number): Promise<void>;
|
|
449
|
+
}
|
|
450
|
+
|
|
277
451
|
/**
|
|
278
452
|
* Meta — capability introspection.
|
|
279
453
|
*
|
|
@@ -295,6 +469,32 @@ declare class Meta {
|
|
|
295
469
|
get(): Promise<MetaResponse>;
|
|
296
470
|
}
|
|
297
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Products — discover products available to charge.
|
|
474
|
+
*
|
|
475
|
+
* Products are scoped to the seller identified by the API key. The UUID
|
|
476
|
+
* returned here is the same identifier accepted by `charges.create({ productId })`.
|
|
477
|
+
*/
|
|
478
|
+
declare class Products {
|
|
479
|
+
private readonly http;
|
|
480
|
+
constructor(http: HttpClient);
|
|
481
|
+
/**
|
|
482
|
+
* List products for the authenticated seller, with pagination and search.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* const { data, meta } = await garu.products.list({ search: 'curso', limit: 10 });
|
|
486
|
+
*/
|
|
487
|
+
list(params?: ListProductsParams): Promise<ProductList>;
|
|
488
|
+
/**
|
|
489
|
+
* Fetch a single product by UUID — the same identifier used by
|
|
490
|
+
* `charges.create({ productId })`.
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* const product = await garu.products.get('b3f2c1e8-6e4a-4b9f-9d1c-2a1f6c3d4e5f');
|
|
494
|
+
*/
|
|
495
|
+
get(uuid: string): Promise<Product>;
|
|
496
|
+
}
|
|
497
|
+
|
|
298
498
|
interface GaruOptions {
|
|
299
499
|
/**
|
|
300
500
|
* Your Garu API key. `sk_live_…` for production, `sk_test_…` for test mode.
|
|
@@ -331,7 +531,9 @@ interface GaruOptions {
|
|
|
331
531
|
*/
|
|
332
532
|
declare class Garu {
|
|
333
533
|
readonly charges: Charges;
|
|
534
|
+
readonly customers: Customers;
|
|
334
535
|
readonly meta: Meta;
|
|
536
|
+
readonly products: Products;
|
|
335
537
|
/**
|
|
336
538
|
* Webhook helpers. Available both as an instance member and as a static —
|
|
337
539
|
* `Garu.webhooks.verify(...)` works without constructing a client.
|
|
@@ -390,4 +592,4 @@ declare class GaruServerError extends GaruAPIError {
|
|
|
390
592
|
constructor(message: string, status: number, requestId: string | null, body: unknown);
|
|
391
593
|
}
|
|
392
594
|
|
|
393
|
-
export { type CardInfo, type Charge, type ChargeStatus, type CreateChargeParams, type Customer, Garu, GaruAPIError, GaruAuthenticationError, GaruConnectionError, GaruError, type GaruErrorCode, GaruNotFoundError, type GaruOptions, GaruPermissionError, GaruRateLimitError, GaruServerError, GaruSignatureVerificationError, GaruValidationError, type MetaFeatures, type MetaResponse, type PaymentMethod, type RefundChargeParams, type VerifiedWebhook, type VerifyWebhookParams, type WirePaymentMethodId, webhooks };
|
|
595
|
+
export { type CardInfo, type Charge, type ChargeList, type ChargeStatus, type CreateChargeParams, type CreateCustomerParams, type Customer, type CustomerList, type CustomerRecord, Garu, GaruAPIError, GaruAuthenticationError, GaruConnectionError, GaruError, type GaruErrorCode, GaruNotFoundError, type GaruOptions, GaruPermissionError, GaruRateLimitError, GaruServerError, GaruSignatureVerificationError, GaruValidationError, type ListChargesParams, type ListCustomersParams, type ListProductsParams, type MetaFeatures, type MetaResponse, type PaginatedList, type PaymentMethod, type Product, type ProductList, type RefundChargeParams, type UpdateCustomerParams, type VerifiedWebhook, type VerifyWebhookParams, type WirePaymentMethodId, webhooks };
|