@limrun/api 0.33.5 → 0.34.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.
@@ -0,0 +1,743 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Analytics extends APIResource {
8
+ /**
9
+ * Get analytics for the authenticated organization
10
+ */
11
+ get(query: AnalyticsGetParams, options?: RequestOptions): APIPromise<AnalyticsResponse> {
12
+ return this._client.get('/v1/analytics', { query, ...options });
13
+ }
14
+
15
+ /**
16
+ * Returns per-instance analytics grouped by minute bucket for detailed chart
17
+ * views.
18
+ */
19
+ getInstances(
20
+ query: AnalyticsGetInstancesParams,
21
+ options?: RequestOptions,
22
+ ): APIPromise<AnalyticsInstancesResponse> {
23
+ return this._client.get('/v1/analytics/instances', { query, ...options });
24
+ }
25
+ }
26
+
27
+ export interface AnalyticsInstancesResponse {
28
+ asOf: string;
29
+
30
+ from: string;
31
+
32
+ series: Array<AnalyticsInstancesResponse.Series>;
33
+
34
+ /**
35
+ * IANA timezone used for time bucket grouping
36
+ */
37
+ timezone: string;
38
+
39
+ to: string;
40
+ }
41
+
42
+ export namespace AnalyticsInstancesResponse {
43
+ export interface Series {
44
+ instances: Array<Series.Instance>;
45
+
46
+ /**
47
+ * RFC3339 timestamp for the start of the minute bucket in the requested timezone,
48
+ * including the local offset
49
+ */
50
+ timestamp: string;
51
+ }
52
+
53
+ export namespace Series {
54
+ /**
55
+ * Analytics details for a single instance within a time bucket
56
+ */
57
+ export interface Instance {
58
+ /**
59
+ * Billed minutes with platform multiplier applied
60
+ */
61
+ billedMinutes: number;
62
+
63
+ /**
64
+ * Total cost in dollars for this instance
65
+ */
66
+ cost: number;
67
+
68
+ /**
69
+ * Instance type ID (e.g., ios_xxx, android_xxx)
70
+ */
71
+ instanceTid: string;
72
+
73
+ /**
74
+ * Platform name.
75
+ */
76
+ platform: 'android' | 'ios' | 'xcode';
77
+
78
+ /**
79
+ * Actual runtime minutes before platform multiplier
80
+ */
81
+ runtimeMinutes: number;
82
+
83
+ billedBreakdown?: Instance.BilledBreakdown;
84
+
85
+ /**
86
+ * Cost breakdown by billing source in dollars
87
+ */
88
+ costBreakdown?: Instance.CostBreakdown;
89
+
90
+ /**
91
+ * Instance labels at billing time
92
+ */
93
+ labels?: { [key: string]: string };
94
+
95
+ /**
96
+ * Region where the instance ran
97
+ */
98
+ region?: string;
99
+ }
100
+
101
+ export namespace Instance {
102
+ export interface BilledBreakdown {
103
+ creditsBilledMinutes: number;
104
+
105
+ onDemandBilledMinutes: number;
106
+
107
+ /**
108
+ * Map of plan ID to billed minutes
109
+ */
110
+ planBilledMinutes?: { [key: string]: number };
111
+
112
+ /**
113
+ * Map of subscription ID to billed minutes
114
+ */
115
+ subscriptionBilledMinutes?: { [key: string]: number };
116
+ }
117
+
118
+ /**
119
+ * Cost breakdown by billing source in dollars
120
+ */
121
+ export interface CostBreakdown {
122
+ /**
123
+ * Cost from credits (always 0)
124
+ */
125
+ creditsCost: number;
126
+
127
+ /**
128
+ * Cost from on-demand billing in dollars
129
+ */
130
+ onDemandCost: number;
131
+
132
+ /**
133
+ * Map of plan ID to cost in dollars
134
+ */
135
+ planCost?: { [key: string]: number };
136
+
137
+ /**
138
+ * Map of subscription ID to cost in dollars
139
+ */
140
+ subscriptionCost?: { [key: string]: number };
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ export interface AnalyticsResponse {
147
+ asOf: string;
148
+
149
+ bucket: 'hour' | 'day' | 'week' | 'minute';
150
+
151
+ from: string;
152
+
153
+ series: Array<AnalyticsResponse.Series>;
154
+
155
+ /**
156
+ * Summary of analytics across all time buckets, broken down by platform and region
157
+ */
158
+ summary: AnalyticsResponse.Summary;
159
+
160
+ /**
161
+ * IANA timezone used for time bucket grouping
162
+ */
163
+ timezone: string;
164
+
165
+ to: string;
166
+ }
167
+
168
+ export namespace AnalyticsResponse {
169
+ /**
170
+ * Analytics data for a single time bucket, broken down by platform and region
171
+ */
172
+ export interface Series {
173
+ /**
174
+ * Map of region to analytics stats for Android
175
+ */
176
+ android: { [key: string]: Series.Android };
177
+
178
+ /**
179
+ * Map of region to analytics stats for iOS
180
+ */
181
+ ios: { [key: string]: Series.Ios };
182
+
183
+ /**
184
+ * RFC3339 timestamp for the start of the bucket in the requested timezone,
185
+ * including the local offset
186
+ */
187
+ timestamp: string;
188
+
189
+ /**
190
+ * Map of region to analytics stats for Xcode
191
+ */
192
+ xcode: { [key: string]: Series.Xcode };
193
+
194
+ /**
195
+ * Individual instance details for this time bucket
196
+ */
197
+ instances?: Array<Series.Instance>;
198
+ }
199
+
200
+ export namespace Series {
201
+ /**
202
+ * Complete analytics for a specific region including billing breakdown
203
+ */
204
+ export interface Android {
205
+ /**
206
+ * Average instance duration in minutes
207
+ */
208
+ avgDurationMinutes: number;
209
+
210
+ /**
211
+ * Billed minutes with platform multiplier applied
212
+ */
213
+ billedMinutes: number;
214
+
215
+ /**
216
+ * Total cost in dollars
217
+ */
218
+ cost: number;
219
+
220
+ /**
221
+ * Number of unique instances
222
+ */
223
+ count: number;
224
+
225
+ /**
226
+ * Minutes billed to credits
227
+ */
228
+ creditsBilledMinutes: number;
229
+
230
+ /**
231
+ * Cost from credits (always 0)
232
+ */
233
+ creditsCost: number;
234
+
235
+ /**
236
+ * Minutes billed on-demand
237
+ */
238
+ onDemandBilledMinutes: number;
239
+
240
+ /**
241
+ * Cost from on-demand billing in dollars
242
+ */
243
+ onDemandCost: number;
244
+
245
+ /**
246
+ * Actual runtime minutes before platform multiplier
247
+ */
248
+ runtimeMinutes: number;
249
+
250
+ /**
251
+ * Map of subscription ID to billed minutes
252
+ */
253
+ subscriptionBilledMinutes?: { [key: string]: number };
254
+
255
+ /**
256
+ * Map of subscription ID to cost in dollars
257
+ */
258
+ subscriptionCost?: { [key: string]: number };
259
+ }
260
+
261
+ /**
262
+ * Complete analytics for a specific region including billing breakdown
263
+ */
264
+ export interface Ios {
265
+ /**
266
+ * Average instance duration in minutes
267
+ */
268
+ avgDurationMinutes: number;
269
+
270
+ /**
271
+ * Billed minutes with platform multiplier applied
272
+ */
273
+ billedMinutes: number;
274
+
275
+ /**
276
+ * Total cost in dollars
277
+ */
278
+ cost: number;
279
+
280
+ /**
281
+ * Number of unique instances
282
+ */
283
+ count: number;
284
+
285
+ /**
286
+ * Minutes billed to credits
287
+ */
288
+ creditsBilledMinutes: number;
289
+
290
+ /**
291
+ * Cost from credits (always 0)
292
+ */
293
+ creditsCost: number;
294
+
295
+ /**
296
+ * Minutes billed on-demand
297
+ */
298
+ onDemandBilledMinutes: number;
299
+
300
+ /**
301
+ * Cost from on-demand billing in dollars
302
+ */
303
+ onDemandCost: number;
304
+
305
+ /**
306
+ * Actual runtime minutes before platform multiplier
307
+ */
308
+ runtimeMinutes: number;
309
+
310
+ /**
311
+ * Map of subscription ID to billed minutes
312
+ */
313
+ subscriptionBilledMinutes?: { [key: string]: number };
314
+
315
+ /**
316
+ * Map of subscription ID to cost in dollars
317
+ */
318
+ subscriptionCost?: { [key: string]: number };
319
+ }
320
+
321
+ /**
322
+ * Complete analytics for a specific region including billing breakdown
323
+ */
324
+ export interface Xcode {
325
+ /**
326
+ * Average instance duration in minutes
327
+ */
328
+ avgDurationMinutes: number;
329
+
330
+ /**
331
+ * Billed minutes with platform multiplier applied
332
+ */
333
+ billedMinutes: number;
334
+
335
+ /**
336
+ * Total cost in dollars
337
+ */
338
+ cost: number;
339
+
340
+ /**
341
+ * Number of unique instances
342
+ */
343
+ count: number;
344
+
345
+ /**
346
+ * Minutes billed to credits
347
+ */
348
+ creditsBilledMinutes: number;
349
+
350
+ /**
351
+ * Cost from credits (always 0)
352
+ */
353
+ creditsCost: number;
354
+
355
+ /**
356
+ * Minutes billed on-demand
357
+ */
358
+ onDemandBilledMinutes: number;
359
+
360
+ /**
361
+ * Cost from on-demand billing in dollars
362
+ */
363
+ onDemandCost: number;
364
+
365
+ /**
366
+ * Actual runtime minutes before platform multiplier
367
+ */
368
+ runtimeMinutes: number;
369
+
370
+ /**
371
+ * Map of subscription ID to billed minutes
372
+ */
373
+ subscriptionBilledMinutes?: { [key: string]: number };
374
+
375
+ /**
376
+ * Map of subscription ID to cost in dollars
377
+ */
378
+ subscriptionCost?: { [key: string]: number };
379
+ }
380
+
381
+ /**
382
+ * Analytics details for a single instance within a time bucket
383
+ */
384
+ export interface Instance {
385
+ /**
386
+ * Billed minutes with platform multiplier applied
387
+ */
388
+ billedMinutes: number;
389
+
390
+ /**
391
+ * Total cost in dollars for this instance
392
+ */
393
+ cost: number;
394
+
395
+ /**
396
+ * Instance type ID (e.g., ios_xxx, android_xxx)
397
+ */
398
+ instanceTid: string;
399
+
400
+ /**
401
+ * Platform name.
402
+ */
403
+ platform: 'android' | 'ios' | 'xcode';
404
+
405
+ /**
406
+ * Actual runtime minutes before platform multiplier
407
+ */
408
+ runtimeMinutes: number;
409
+
410
+ billedBreakdown?: Instance.BilledBreakdown;
411
+
412
+ /**
413
+ * Cost breakdown by billing source in dollars
414
+ */
415
+ costBreakdown?: Instance.CostBreakdown;
416
+
417
+ /**
418
+ * Instance labels at billing time
419
+ */
420
+ labels?: { [key: string]: string };
421
+
422
+ /**
423
+ * Region where the instance ran
424
+ */
425
+ region?: string;
426
+ }
427
+
428
+ export namespace Instance {
429
+ export interface BilledBreakdown {
430
+ creditsBilledMinutes: number;
431
+
432
+ onDemandBilledMinutes: number;
433
+
434
+ /**
435
+ * Map of plan ID to billed minutes
436
+ */
437
+ planBilledMinutes?: { [key: string]: number };
438
+
439
+ /**
440
+ * Map of subscription ID to billed minutes
441
+ */
442
+ subscriptionBilledMinutes?: { [key: string]: number };
443
+ }
444
+
445
+ /**
446
+ * Cost breakdown by billing source in dollars
447
+ */
448
+ export interface CostBreakdown {
449
+ /**
450
+ * Cost from credits (always 0)
451
+ */
452
+ creditsCost: number;
453
+
454
+ /**
455
+ * Cost from on-demand billing in dollars
456
+ */
457
+ onDemandCost: number;
458
+
459
+ /**
460
+ * Map of plan ID to cost in dollars
461
+ */
462
+ planCost?: { [key: string]: number };
463
+
464
+ /**
465
+ * Map of subscription ID to cost in dollars
466
+ */
467
+ subscriptionCost?: { [key: string]: number };
468
+ }
469
+ }
470
+ }
471
+
472
+ /**
473
+ * Summary of analytics across all time buckets, broken down by platform and region
474
+ */
475
+ export interface Summary {
476
+ /**
477
+ * Map of region to analytics stats for Android
478
+ */
479
+ android: { [key: string]: Summary.Android };
480
+
481
+ /**
482
+ * Map of region to analytics stats for iOS
483
+ */
484
+ ios: { [key: string]: Summary.Ios };
485
+
486
+ /**
487
+ * Map of region to analytics stats for Xcode
488
+ */
489
+ xcode: { [key: string]: Summary.Xcode };
490
+ }
491
+
492
+ export namespace Summary {
493
+ /**
494
+ * Complete analytics for a specific region including billing breakdown
495
+ */
496
+ export interface Android {
497
+ /**
498
+ * Average instance duration in minutes
499
+ */
500
+ avgDurationMinutes: number;
501
+
502
+ /**
503
+ * Billed minutes with platform multiplier applied
504
+ */
505
+ billedMinutes: number;
506
+
507
+ /**
508
+ * Total cost in dollars
509
+ */
510
+ cost: number;
511
+
512
+ /**
513
+ * Number of unique instances
514
+ */
515
+ count: number;
516
+
517
+ /**
518
+ * Minutes billed to credits
519
+ */
520
+ creditsBilledMinutes: number;
521
+
522
+ /**
523
+ * Cost from credits (always 0)
524
+ */
525
+ creditsCost: number;
526
+
527
+ /**
528
+ * Minutes billed on-demand
529
+ */
530
+ onDemandBilledMinutes: number;
531
+
532
+ /**
533
+ * Cost from on-demand billing in dollars
534
+ */
535
+ onDemandCost: number;
536
+
537
+ /**
538
+ * Actual runtime minutes before platform multiplier
539
+ */
540
+ runtimeMinutes: number;
541
+
542
+ /**
543
+ * Map of subscription ID to billed minutes
544
+ */
545
+ subscriptionBilledMinutes?: { [key: string]: number };
546
+
547
+ /**
548
+ * Map of subscription ID to cost in dollars
549
+ */
550
+ subscriptionCost?: { [key: string]: number };
551
+ }
552
+
553
+ /**
554
+ * Complete analytics for a specific region including billing breakdown
555
+ */
556
+ export interface Ios {
557
+ /**
558
+ * Average instance duration in minutes
559
+ */
560
+ avgDurationMinutes: number;
561
+
562
+ /**
563
+ * Billed minutes with platform multiplier applied
564
+ */
565
+ billedMinutes: number;
566
+
567
+ /**
568
+ * Total cost in dollars
569
+ */
570
+ cost: number;
571
+
572
+ /**
573
+ * Number of unique instances
574
+ */
575
+ count: number;
576
+
577
+ /**
578
+ * Minutes billed to credits
579
+ */
580
+ creditsBilledMinutes: number;
581
+
582
+ /**
583
+ * Cost from credits (always 0)
584
+ */
585
+ creditsCost: number;
586
+
587
+ /**
588
+ * Minutes billed on-demand
589
+ */
590
+ onDemandBilledMinutes: number;
591
+
592
+ /**
593
+ * Cost from on-demand billing in dollars
594
+ */
595
+ onDemandCost: number;
596
+
597
+ /**
598
+ * Actual runtime minutes before platform multiplier
599
+ */
600
+ runtimeMinutes: number;
601
+
602
+ /**
603
+ * Map of subscription ID to billed minutes
604
+ */
605
+ subscriptionBilledMinutes?: { [key: string]: number };
606
+
607
+ /**
608
+ * Map of subscription ID to cost in dollars
609
+ */
610
+ subscriptionCost?: { [key: string]: number };
611
+ }
612
+
613
+ /**
614
+ * Complete analytics for a specific region including billing breakdown
615
+ */
616
+ export interface Xcode {
617
+ /**
618
+ * Average instance duration in minutes
619
+ */
620
+ avgDurationMinutes: number;
621
+
622
+ /**
623
+ * Billed minutes with platform multiplier applied
624
+ */
625
+ billedMinutes: number;
626
+
627
+ /**
628
+ * Total cost in dollars
629
+ */
630
+ cost: number;
631
+
632
+ /**
633
+ * Number of unique instances
634
+ */
635
+ count: number;
636
+
637
+ /**
638
+ * Minutes billed to credits
639
+ */
640
+ creditsBilledMinutes: number;
641
+
642
+ /**
643
+ * Cost from credits (always 0)
644
+ */
645
+ creditsCost: number;
646
+
647
+ /**
648
+ * Minutes billed on-demand
649
+ */
650
+ onDemandBilledMinutes: number;
651
+
652
+ /**
653
+ * Cost from on-demand billing in dollars
654
+ */
655
+ onDemandCost: number;
656
+
657
+ /**
658
+ * Actual runtime minutes before platform multiplier
659
+ */
660
+ runtimeMinutes: number;
661
+
662
+ /**
663
+ * Map of subscription ID to billed minutes
664
+ */
665
+ subscriptionBilledMinutes?: { [key: string]: number };
666
+
667
+ /**
668
+ * Map of subscription ID to cost in dollars
669
+ */
670
+ subscriptionCost?: { [key: string]: number };
671
+ }
672
+ }
673
+ }
674
+
675
+ export interface AnalyticsGetParams {
676
+ /**
677
+ * Start of the time range (inclusive, RFC3339)
678
+ */
679
+ from: string;
680
+
681
+ /**
682
+ * End of the time range (exclusive, RFC3339)
683
+ */
684
+ to: string;
685
+
686
+ /**
687
+ * Time bucket granularity for the analytics series
688
+ */
689
+ bucket?: 'hour' | 'day' | 'week' | 'minute';
690
+
691
+ /**
692
+ * Label selector to filter instances (e.g., "env=prod,team=backend")
693
+ */
694
+ labels?: string;
695
+
696
+ /**
697
+ * Optional region filter
698
+ */
699
+ region?: string;
700
+
701
+ /**
702
+ * Optional IANA timezone used for time bucket grouping. Defaults to
703
+ * America/Los_Angeles when omitted.
704
+ */
705
+ timezone?: string;
706
+ }
707
+
708
+ export interface AnalyticsGetInstancesParams {
709
+ /**
710
+ * Start of the time range (inclusive, RFC3339)
711
+ */
712
+ from: string;
713
+
714
+ /**
715
+ * End of the time range (exclusive, RFC3339)
716
+ */
717
+ to: string;
718
+
719
+ /**
720
+ * Label selector to filter instances (e.g., "env=prod,team=backend")
721
+ */
722
+ labels?: string;
723
+
724
+ /**
725
+ * Optional region filter
726
+ */
727
+ region?: string;
728
+
729
+ /**
730
+ * Optional IANA timezone used for minute bucket grouping. Defaults to
731
+ * America/Los_Angeles when omitted.
732
+ */
733
+ timezone?: string;
734
+ }
735
+
736
+ export declare namespace Analytics {
737
+ export {
738
+ type AnalyticsInstancesResponse as AnalyticsInstancesResponse,
739
+ type AnalyticsResponse as AnalyticsResponse,
740
+ type AnalyticsGetParams as AnalyticsGetParams,
741
+ type AnalyticsGetInstancesParams as AnalyticsGetInstancesParams,
742
+ };
743
+ }