2
2
3
3
import * as Core from 'orb-billing/core' ;
4
4
import { APIResource } from 'orb-billing/resource' ;
5
- import { isRequestOptions } from 'orb-billing/core' ;
6
5
import * as EventsAPI from 'orb-billing/resources/events/events' ;
7
6
import * as BackfillsAPI from 'orb-billing/resources/events/backfills' ;
8
7
@@ -26,7 +25,7 @@ export class Events extends APIResource {
26
25
* event in cases where you need to:
27
26
*
28
27
* - update an event with new metadata as you iterate on your pricing model
29
- * - update an event based on the result of an external API call (ex . call to a
28
+ * - update an event based on the result of an external API call (e.g . call to a
30
29
* payment gateway succeeded or failed)
31
30
*
32
31
* This amendment API is always audit-safe. The process will still retain the
@@ -74,7 +73,7 @@ export class Events extends APIResource {
74
73
* event in cases where you need to:
75
74
*
76
75
* - no longer bill for an event that was improperly reported
77
- * - no longer bill for an event based on the result of an external API call (ex .
76
+ * - no longer bill for an event based on the result of an external API call (e.g .
78
77
* call to a payment gateway failed and the user should not be billed)
79
78
*
80
79
* If you want to only change specific properties of an event, but keep the event
@@ -323,46 +322,14 @@ export class Events extends APIResource {
323
322
*
324
323
* - `event_ids`: This is an explicit array of IDs to filter by. Note that an
325
324
* event's ID is the `idempotency_key` that was originally used for ingestion.
326
- * - `invoice_id`: This is an issued Orb invoice ID (see also
327
- * [List Invoices](list-invoices)). Orb will fetch all events that were used to
328
- * calculate the invoice. In the common case, this will be a list of events whose
329
- * `timestamp` property falls within the billing period specified by the invoice.
330
325
*
331
326
* By default, Orb does not return _deprecated_ events in this endpoint.
332
327
*
333
328
* By default, Orb will not throw a `404` if no events matched, Orb will return an
334
329
* empty array for `data` instead.
335
330
*/
336
- search ( params ?: EventSearchParams , options ?: Core . RequestOptions ) : Core . APIPromise < EventSearchResponse > ;
337
- search ( options ?: Core . RequestOptions ) : Core . APIPromise < EventSearchResponse > ;
338
- search (
339
- params : EventSearchParams | Core . RequestOptions = { } ,
340
- options ?: Core . RequestOptions ,
341
- ) : Core . APIPromise < EventSearchResponse > {
342
- if ( isRequestOptions ( params ) ) {
343
- return this . search ( { } , params ) ;
344
- }
345
- const {
346
- cursor,
347
- limit,
348
- 'timestamp[gt]' : timestampGt ,
349
- 'timestamp[gte]' : timestampGte ,
350
- 'timestamp[lt]' : timestampLt ,
351
- 'timestamp[lte]' : timestampLte ,
352
- ...body
353
- } = params ;
354
- return this . post ( '/events/search' , {
355
- query : {
356
- cursor,
357
- limit,
358
- 'timestamp[gt]' : timestampGt ,
359
- 'timestamp[gte]' : timestampGte ,
360
- 'timestamp[lt]' : timestampLt ,
361
- 'timestamp[lte]' : timestampLte ,
362
- } ,
363
- body,
364
- ...options ,
365
- } ) ;
331
+ search ( body : EventSearchParams , options ?: Core . RequestOptions ) : Core . APIPromise < EventSearchResponse > {
332
+ return this . post ( '/events/search' , { body, ...options } ) ;
366
333
}
367
334
}
368
335
@@ -421,8 +388,6 @@ export namespace EventIngestResponse {
421
388
422
389
export interface EventSearchResponse {
423
390
data : Array < EventSearchResponse . Data > ;
424
-
425
- pagination_metadata : EventSearchResponse . PaginationMetadata ;
426
391
}
427
392
428
393
export namespace EventSearchResponse {
@@ -469,12 +434,6 @@ export namespace EventSearchResponse {
469
434
*/
470
435
timestamp : string ;
471
436
}
472
-
473
- export interface PaginationMetadata {
474
- has_more : boolean ;
475
-
476
- next_cursor : string | null ;
477
- }
478
437
}
479
438
480
439
export interface EventUpdateParams {
@@ -569,50 +528,11 @@ export namespace EventIngestParams {
569
528
570
529
export interface EventSearchParams {
571
530
/**
572
- * Query param: Cursor for pagination. This can be populated by the `next_cursor`
573
- * value returned from the initial request.
574
- */
575
- cursor ?: string | null ;
576
-
577
- /**
578
- * Query param: The number of items to fetch. Defaults to 20.
579
- */
580
- limit ?: number ;
581
-
582
- /**
583
- * Query param:
584
- */
585
- 'timestamp[gt]' ?: string | null ;
586
-
587
- /**
588
- * Query param:
589
- */
590
- 'timestamp[gte]' ?: string | null ;
591
-
592
- /**
593
- * Query param:
594
- */
595
- 'timestamp[lt]' ?: string | null ;
596
-
597
- /**
598
- * Query param:
599
- */
600
- 'timestamp[lte]' ?: string | null ;
601
-
602
- /**
603
- * Body param: This is an explicit array of IDs to filter by. Note that an event's
604
- * ID is the idempotency_key that was originally used for ingestion. Values in this
605
- * array will be treated case sensitively.
606
- */
607
- event_ids ?: Array < string > | null ;
608
-
609
- /**
610
- * Body param: This is an issued Orb invoice ID (see also List Invoices). Orb will
611
- * fetch all events that were used to calculate the invoice. In the common case,
612
- * this will be a list of events whose timestamp property falls within the billing
613
- * period specified by the invoice.
531
+ * This is an explicit array of IDs to filter by. Note that an event's ID is the
532
+ * idempotency_key that was originally used for ingestion. Values in this array
533
+ * will be treated case sensitively.
614
534
*/
615
- invoice_id ?: string | null ;
535
+ event_ids : Array < string > ;
616
536
}
617
537
618
538
export namespace Events {
0 commit comments