@firebolt-js/core-client 1.0.0-next.5

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/LICENSE +202 -0
  4. package/NOTICE +24 -0
  5. package/README.md +26 -0
  6. package/dist/docs/Accessibility/index.md +384 -0
  7. package/dist/docs/Accessibility/schemas/index.md +52 -0
  8. package/dist/docs/Advertising/index.md +120 -0
  9. package/dist/docs/Device/index.md +297 -0
  10. package/dist/docs/Discovery/index.md +128 -0
  11. package/dist/docs/Display/index.md +87 -0
  12. package/dist/docs/Internal/index.md +68 -0
  13. package/dist/docs/Lifecycle2/index.md +160 -0
  14. package/dist/docs/Localization/index.md +314 -0
  15. package/dist/docs/Localization/schemas/index.md +41 -0
  16. package/dist/docs/Metrics/index.md +987 -0
  17. package/dist/docs/Network/index.md +128 -0
  18. package/dist/docs/Policies/schemas/index.md +25 -0
  19. package/dist/docs/Presentation/index.md +53 -0
  20. package/dist/docs/Stats/index.md +63 -0
  21. package/dist/docs/TextToSpeech/index.md +524 -0
  22. package/dist/docs/Types/schemas/index.md +37 -0
  23. package/dist/firebolt-core-app-open-rpc.json +1082 -0
  24. package/dist/firebolt-core-open-rpc.json +3773 -0
  25. package/dist/lib/Accessibility/defaults.mjs +61 -0
  26. package/dist/lib/Accessibility/index.mjs +148 -0
  27. package/dist/lib/Advertising/defaults.mjs +26 -0
  28. package/dist/lib/Advertising/index.mjs +31 -0
  29. package/dist/lib/Device/defaults.mjs +34 -0
  30. package/dist/lib/Device/index.mjs +84 -0
  31. package/dist/lib/Discovery/defaults.mjs +22 -0
  32. package/dist/lib/Discovery/index.mjs +34 -0
  33. package/dist/lib/Events/index.mjs +345 -0
  34. package/dist/lib/Gateway/AppApi.mjs +125 -0
  35. package/dist/lib/Gateway/Bidirectional.mjs +113 -0
  36. package/dist/lib/Gateway/PlatformApi.mjs +130 -0
  37. package/dist/lib/Gateway/index.mjs +48 -0
  38. package/dist/lib/Localization/defaults.mjs +44 -0
  39. package/dist/lib/Localization/index.mjs +123 -0
  40. package/dist/lib/Log/index.mjs +57 -0
  41. package/dist/lib/Metrics/defaults.mjs +40 -0
  42. package/dist/lib/Metrics/index.mjs +206 -0
  43. package/dist/lib/Network/defaults.mjs +24 -0
  44. package/dist/lib/Network/index.mjs +70 -0
  45. package/dist/lib/Platform/defaults.mjs +27 -0
  46. package/dist/lib/Platform/index.mjs +28 -0
  47. package/dist/lib/Prop/MockProps.mjs +28 -0
  48. package/dist/lib/Prop/Router.mjs +25 -0
  49. package/dist/lib/Prop/index.mjs +60 -0
  50. package/dist/lib/Settings/index.mjs +86 -0
  51. package/dist/lib/Transport/MockTransport.mjs +191 -0
  52. package/dist/lib/Transport/WebsocketTransport.mjs +55 -0
  53. package/dist/lib/Transport/index.mjs +81 -0
  54. package/dist/lib/firebolt.d.ts +795 -0
  55. package/dist/lib/firebolt.mjs +51 -0
  56. package/firebolt-js-core-client-1.0.0-next.5.tgz +0 -0
  57. package/package.json +54 -0
@@ -0,0 +1,987 @@
1
+ ---
2
+ title: Metrics
3
+ ---
4
+
5
+ # Metrics Module
6
+
7
+ ---
8
+
9
+ Version Metrics 1.0.0-next.5
10
+
11
+ ## Table of Contents
12
+
13
+ - [Table of Contents](#table-of-contents)
14
+ - [Usage](#usage)
15
+ - [Overview](#overview)
16
+ - [Methods](#methods)
17
+ - [appInfo](#appinfo)
18
+ - [error](#error)
19
+ - [event](#event)
20
+ - [mediaEnded](#mediaended)
21
+ - [mediaLoadStart](#medialoadstart)
22
+ - [mediaPause](#mediapause)
23
+ - [mediaPlay](#mediaplay)
24
+ - [mediaPlaying](#mediaplaying)
25
+ - [mediaRateChanged](#mediaratechanged)
26
+ - [mediaRenditionChanged](#mediarenditionchanged)
27
+ - [mediaSeeked](#mediaseeked)
28
+ - [mediaSeeking](#mediaseeking)
29
+ - [mediaWaiting](#mediawaiting)
30
+ - [page](#page)
31
+ - [ready](#ready)
32
+ - [signIn](#signin)
33
+ - [signOut](#signout)
34
+ - [startContent](#startcontent)
35
+ - [stopContent](#stopcontent)
36
+ - [Types](#types)
37
+ - [ErrorType](#errortype)
38
+ - [MediaPosition](#mediaposition)
39
+
40
+ ## Usage
41
+
42
+ To use the Metrics module, you can import it into your project from the Firebolt SDK:
43
+
44
+ ```javascript
45
+ import { Metrics } from '@firebolt-js/core-client'
46
+ ```
47
+
48
+ ## Overview
49
+
50
+ Methods for sending metrics
51
+
52
+ ## Methods
53
+
54
+ ### appInfo
55
+
56
+ Inform the platform about an app's build info.
57
+
58
+ ```typescript
59
+ function appInfo(build: string): Promise<null>
60
+ ```
61
+
62
+ Parameters:
63
+
64
+ | Param | Type | Required | Description |
65
+ | ------- | -------- | -------- | -------------------------------- |
66
+ | `build` | `string` | true | The build / version of this app. |
67
+
68
+ Promise resolution:
69
+
70
+ Capabilities:
71
+
72
+ | Role | Capability |
73
+ | ---- | --------------------------------------- |
74
+ | uses | xrn:firebolt:capability:metrics:general |
75
+
76
+ #### Examples
77
+
78
+ Send appInfo metric
79
+
80
+ JavaScript:
81
+
82
+ ```javascript
83
+ import { Metrics } from '@firebolt-js/core-client'
84
+
85
+ let result = await Metrics.appInfo('1.2.2')
86
+ console.log(result)
87
+ ```
88
+
89
+ Value of `result`:
90
+
91
+ ```javascript
92
+ null
93
+ ```
94
+
95
+ ---
96
+
97
+ ### error
98
+
99
+ Inform the platform of an error that has occurred in your app.
100
+
101
+ ```typescript
102
+ function error(
103
+ type: ErrorType,
104
+ code: string,
105
+ description: string,
106
+ visible: boolean,
107
+ parameters: object,
108
+ agePolicy: AgePolicy,
109
+ ): Promise<boolean>
110
+ ```
111
+
112
+ Parameters:
113
+
114
+ | Param | Type | Required | Description |
115
+ | ------------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
116
+ | `type` | [`ErrorType`](#errortype) | true | The type of error <br/>values: `'network' \| 'media' \| 'restriction' \| 'entitlement' \| 'other'` |
117
+ | `code` | `string` | true | an app-specific error code |
118
+ | `description` | `string` | true | A short description of the error |
119
+ | `visible` | `boolean` | true | Whether or not this error was visible to the user. |
120
+ | `parameters` | `object` | false | Optional additional parameters to be logged with the error |
121
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
122
+
123
+ Promise resolution:
124
+
125
+ Capabilities:
126
+
127
+ | Role | Capability |
128
+ | ---- | --------------------------------------- |
129
+ | uses | xrn:firebolt:capability:metrics:general |
130
+
131
+ #### Examples
132
+
133
+ Send error metric
134
+
135
+ JavaScript:
136
+
137
+ ```javascript
138
+ import { Metrics } from '@firebolt-js/core-client'
139
+
140
+ let success = await Metrics.error(
141
+ 'media',
142
+ 'MEDIA-STALLED',
143
+ 'playback stalled',
144
+ true,
145
+ undefined,
146
+ )
147
+ console.log(success)
148
+ ```
149
+
150
+ Value of `success`:
151
+
152
+ ```javascript
153
+ true
154
+ ```
155
+
156
+ ---
157
+
158
+ ### event
159
+
160
+ Inform the platform of 1st party distributor metrics. 'data' parameter is a JSON document
161
+
162
+ ```typescript
163
+ function event(
164
+ schema: string,
165
+ data: string,
166
+ agePolicy: AgePolicy,
167
+ ): Promise<boolean>
168
+ ```
169
+
170
+ Parameters:
171
+
172
+ | Param | Type | Required | Description |
173
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
174
+ | `schema` | `string` | true | The schema URI of the metric type <br/>format: uri |
175
+ | `data` | `string` | true | A JSON payload |
176
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
177
+
178
+ Promise resolution:
179
+
180
+ Capabilities:
181
+
182
+ | Role | Capability |
183
+ | ---- | ------------------------------------------- |
184
+ | uses | xrn:firebolt:capability:metrics:distributor |
185
+
186
+ #### Examples
187
+
188
+ Send foo event
189
+
190
+ JavaScript:
191
+
192
+ ```javascript
193
+ import { Metrics } from '@firebolt-js/core-client'
194
+
195
+ let result = await Metrics.event(
196
+ 'http://meta.rdkcentral.com/some/schema',
197
+ 'foo',
198
+ )
199
+ console.log(result)
200
+ ```
201
+
202
+ Value of `result`:
203
+
204
+ ```javascript
205
+ true
206
+ ```
207
+
208
+ ---
209
+
210
+ ### mediaEnded
211
+
212
+ Called when playback has stopped because the end of the media was reached.
213
+
214
+ ```typescript
215
+ function mediaEnded(entityId: string, agePolicy: AgePolicy): Promise<boolean>
216
+ ```
217
+
218
+ Parameters:
219
+
220
+ | Param | Type | Required | Description |
221
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
222
+ | `entityId` | `string` | true | The entityId of the media. |
223
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
224
+
225
+ Promise resolution:
226
+
227
+ Capabilities:
228
+
229
+ | Role | Capability |
230
+ | ---- | ------------------------------------- |
231
+ | uses | xrn:firebolt:capability:metrics:media |
232
+
233
+ #### Examples
234
+
235
+ Send ended metric.
236
+
237
+ JavaScript:
238
+
239
+ ```javascript
240
+ import { Metrics } from '@firebolt-js/core-client'
241
+
242
+ let success = await Metrics.mediaEnded('345')
243
+ console.log(success)
244
+ ```
245
+
246
+ Value of `success`:
247
+
248
+ ```javascript
249
+ true
250
+ ```
251
+
252
+ ---
253
+
254
+ ### mediaLoadStart
255
+
256
+ Called when setting the URL of a media asset to play, in order to infer load time.
257
+
258
+ ```typescript
259
+ function mediaLoadStart(
260
+ entityId: string,
261
+ agePolicy: AgePolicy,
262
+ ): Promise<boolean>
263
+ ```
264
+
265
+ Parameters:
266
+
267
+ | Param | Type | Required | Description |
268
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
269
+ | `entityId` | `string` | true | The entityId of the media. |
270
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
271
+
272
+ Promise resolution:
273
+
274
+ Capabilities:
275
+
276
+ | Role | Capability |
277
+ | ---- | ------------------------------------- |
278
+ | uses | xrn:firebolt:capability:metrics:media |
279
+
280
+ #### Examples
281
+
282
+ Send loadstart metric.
283
+
284
+ JavaScript:
285
+
286
+ ```javascript
287
+ import { Metrics } from '@firebolt-js/core-client'
288
+
289
+ let success = await Metrics.mediaLoadStart('345')
290
+ console.log(success)
291
+ ```
292
+
293
+ Value of `success`:
294
+
295
+ ```javascript
296
+ true
297
+ ```
298
+
299
+ ---
300
+
301
+ ### mediaPause
302
+
303
+ Called when media playback will pause due to an intentional pause operation.
304
+
305
+ ```typescript
306
+ function mediaPause(entityId: string, agePolicy: AgePolicy): Promise<boolean>
307
+ ```
308
+
309
+ Parameters:
310
+
311
+ | Param | Type | Required | Description |
312
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
313
+ | `entityId` | `string` | true | The entityId of the media. |
314
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
315
+
316
+ Promise resolution:
317
+
318
+ Capabilities:
319
+
320
+ | Role | Capability |
321
+ | ---- | ------------------------------------- |
322
+ | uses | xrn:firebolt:capability:metrics:media |
323
+
324
+ #### Examples
325
+
326
+ Send pause metric.
327
+
328
+ JavaScript:
329
+
330
+ ```javascript
331
+ import { Metrics } from '@firebolt-js/core-client'
332
+
333
+ let success = await Metrics.mediaPause('345')
334
+ console.log(success)
335
+ ```
336
+
337
+ Value of `success`:
338
+
339
+ ```javascript
340
+ true
341
+ ```
342
+
343
+ ---
344
+
345
+ ### mediaPlay
346
+
347
+ Called when media playback should start due to autoplay, user-initiated play, or unpausing.
348
+
349
+ ```typescript
350
+ function mediaPlay(entityId: string, agePolicy: AgePolicy): Promise<boolean>
351
+ ```
352
+
353
+ Parameters:
354
+
355
+ | Param | Type | Required | Description |
356
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
357
+ | `entityId` | `string` | true | The entityId of the media. |
358
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
359
+
360
+ Promise resolution:
361
+
362
+ Capabilities:
363
+
364
+ | Role | Capability |
365
+ | ---- | ------------------------------------- |
366
+ | uses | xrn:firebolt:capability:metrics:media |
367
+
368
+ #### Examples
369
+
370
+ Send play metric.
371
+
372
+ JavaScript:
373
+
374
+ ```javascript
375
+ import { Metrics } from '@firebolt-js/core-client'
376
+
377
+ let success = await Metrics.mediaPlay('345')
378
+ console.log(success)
379
+ ```
380
+
381
+ Value of `success`:
382
+
383
+ ```javascript
384
+ true
385
+ ```
386
+
387
+ ---
388
+
389
+ ### mediaPlaying
390
+
391
+ Called when media playback actually starts due to autoplay, user-initiated play, unpausing, or recovering from a buffering interruption.
392
+
393
+ ```typescript
394
+ function mediaPlaying(entityId: string, agePolicy: AgePolicy): Promise<boolean>
395
+ ```
396
+
397
+ Parameters:
398
+
399
+ | Param | Type | Required | Description |
400
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
401
+ | `entityId` | `string` | true | The entityId of the media. |
402
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
403
+
404
+ Promise resolution:
405
+
406
+ Capabilities:
407
+
408
+ | Role | Capability |
409
+ | ---- | ------------------------------------- |
410
+ | uses | xrn:firebolt:capability:metrics:media |
411
+
412
+ #### Examples
413
+
414
+ Send playing metric.
415
+
416
+ JavaScript:
417
+
418
+ ```javascript
419
+ import { Metrics } from '@firebolt-js/core-client'
420
+
421
+ let success = await Metrics.mediaPlaying('345')
422
+ console.log(success)
423
+ ```
424
+
425
+ Value of `success`:
426
+
427
+ ```javascript
428
+ true
429
+ ```
430
+
431
+ ---
432
+
433
+ ### mediaRateChanged
434
+
435
+ Called when the playback rate of media is changed.
436
+
437
+ ```typescript
438
+ function mediaRateChanged(
439
+ entityId: string,
440
+ rate: number,
441
+ agePolicy: AgePolicy,
442
+ ): Promise<boolean>
443
+ ```
444
+
445
+ Parameters:
446
+
447
+ | Param | Type | Required | Description |
448
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
449
+ | `entityId` | `string` | true | The entityId of the media. |
450
+ | `rate` | `number` | true | The new playback rate. |
451
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
452
+
453
+ Promise resolution:
454
+
455
+ Capabilities:
456
+
457
+ | Role | Capability |
458
+ | ---- | ------------------------------------- |
459
+ | uses | xrn:firebolt:capability:metrics:media |
460
+
461
+ #### Examples
462
+
463
+ Send ratechange metric.
464
+
465
+ JavaScript:
466
+
467
+ ```javascript
468
+ import { Metrics } from '@firebolt-js/core-client'
469
+
470
+ let success = await Metrics.mediaRateChanged('345', 2)
471
+ console.log(success)
472
+ ```
473
+
474
+ Value of `success`:
475
+
476
+ ```javascript
477
+ true
478
+ ```
479
+
480
+ ---
481
+
482
+ ### mediaRenditionChanged
483
+
484
+ Called when the playback rendition (e.g. bitrate, dimensions, profile, etc) is changed.
485
+
486
+ ```typescript
487
+ function mediaRenditionChanged(
488
+ entityId: string,
489
+ bitrate: number,
490
+ width: number,
491
+ height: number,
492
+ profile: string,
493
+ agePolicy: AgePolicy,
494
+ ): Promise<boolean>
495
+ ```
496
+
497
+ Parameters:
498
+
499
+ | Param | Type | Required | Description |
500
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
501
+ | `entityId` | `string` | true | The entityId of the media. |
502
+ | `bitrate` | `number` | true | The new bitrate in kbps. |
503
+ | `width` | `number` | true | The new resolution width. |
504
+ | `height` | `number` | true | The new resolution height. |
505
+ | `profile` | `string` | false | A description of the new profile, e.g. 'HDR' etc. |
506
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
507
+
508
+ Promise resolution:
509
+
510
+ Capabilities:
511
+
512
+ | Role | Capability |
513
+ | ---- | ------------------------------------- |
514
+ | uses | xrn:firebolt:capability:metrics:media |
515
+
516
+ #### Examples
517
+
518
+ Send renditionchange metric.
519
+
520
+ JavaScript:
521
+
522
+ ```javascript
523
+ import { Metrics } from '@firebolt-js/core-client'
524
+
525
+ let success = await Metrics.mediaRenditionChanged(
526
+ '345',
527
+ 5000,
528
+ 1920,
529
+ 1080,
530
+ 'HDR+',
531
+ )
532
+ console.log(success)
533
+ ```
534
+
535
+ Value of `success`:
536
+
537
+ ```javascript
538
+ true
539
+ ```
540
+
541
+ ---
542
+
543
+ ### mediaSeeked
544
+
545
+ Called when a seek is completed during media playback.
546
+
547
+ ```typescript
548
+ function mediaSeeked(
549
+ entityId: string,
550
+ position: MediaPosition,
551
+ agePolicy: AgePolicy,
552
+ ): Promise<boolean>
553
+ ```
554
+
555
+ Parameters:
556
+
557
+ | Param | Type | Required | Description |
558
+ | ----------- | --------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
559
+ | `entityId` | `string` | true | The entityId of the media. |
560
+ | `position` | [`MediaPosition`](#mediaposition) | true | Resulting position of the seek operation, as a decimal percentage (0-0.999) for content with a known duration, or an integer number of seconds (0-86400) for content with an unknown duration. |
561
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
562
+
563
+ Promise resolution:
564
+
565
+ Capabilities:
566
+
567
+ | Role | Capability |
568
+ | ---- | ------------------------------------- |
569
+ | uses | xrn:firebolt:capability:metrics:media |
570
+
571
+ #### Examples
572
+
573
+ Send seeked metric.
574
+
575
+ JavaScript:
576
+
577
+ ```javascript
578
+ import { Metrics } from '@firebolt-js/core-client'
579
+
580
+ let success = await Metrics.mediaSeeked('345', 0.51)
581
+ console.log(success)
582
+ ```
583
+
584
+ Value of `success`:
585
+
586
+ ```javascript
587
+ true
588
+ ```
589
+
590
+ ---
591
+
592
+ ### mediaSeeking
593
+
594
+ Called when a seek is initiated during media playback.
595
+
596
+ ```typescript
597
+ function mediaSeeking(
598
+ entityId: string,
599
+ target: MediaPosition,
600
+ agePolicy: AgePolicy,
601
+ ): Promise<boolean>
602
+ ```
603
+
604
+ Parameters:
605
+
606
+ | Param | Type | Required | Description |
607
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
608
+ | `entityId` | `string` | true | The entityId of the media. |
609
+ | `target` | [`MediaPosition`](#mediaposition) | true | Target destination of the seek, as a decimal percentage (0-0.999) for content with a known duration, or an integer number of seconds (0-86400) for content with an unknown duration. |
610
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
611
+
612
+ Promise resolution:
613
+
614
+ Capabilities:
615
+
616
+ | Role | Capability |
617
+ | ---- | ------------------------------------- |
618
+ | uses | xrn:firebolt:capability:metrics:media |
619
+
620
+ #### Examples
621
+
622
+ Send seeking metric.
623
+
624
+ JavaScript:
625
+
626
+ ```javascript
627
+ import { Metrics } from '@firebolt-js/core-client'
628
+
629
+ let success = await Metrics.mediaSeeking('345', 0.5)
630
+ console.log(success)
631
+ ```
632
+
633
+ Value of `success`:
634
+
635
+ ```javascript
636
+ true
637
+ ```
638
+
639
+ ---
640
+
641
+ ### mediaWaiting
642
+
643
+ Called when media playback will halt due to a network, buffer, or other unintentional constraint.
644
+
645
+ ```typescript
646
+ function mediaWaiting(entityId: string, agePolicy: AgePolicy): Promise<boolean>
647
+ ```
648
+
649
+ Parameters:
650
+
651
+ | Param | Type | Required | Description |
652
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
653
+ | `entityId` | `string` | true | The entityId of the media. |
654
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
655
+
656
+ Promise resolution:
657
+
658
+ Capabilities:
659
+
660
+ | Role | Capability |
661
+ | ---- | ------------------------------------- |
662
+ | uses | xrn:firebolt:capability:metrics:media |
663
+
664
+ #### Examples
665
+
666
+ Send waiting metric.
667
+
668
+ JavaScript:
669
+
670
+ ```javascript
671
+ import { Metrics } from '@firebolt-js/core-client'
672
+
673
+ let success = await Metrics.mediaWaiting('345')
674
+ console.log(success)
675
+ ```
676
+
677
+ Value of `success`:
678
+
679
+ ```javascript
680
+ true
681
+ ```
682
+
683
+ ---
684
+
685
+ ### page
686
+
687
+ Inform the platform that your user has navigated to a page or view.
688
+
689
+ ```typescript
690
+ function page(pageId: string, agePolicy: AgePolicy): Promise<boolean>
691
+ ```
692
+
693
+ Parameters:
694
+
695
+ | Param | Type | Required | Description |
696
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
697
+ | `pageId` | `string` | true | Page ID of the content. |
698
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
699
+
700
+ Promise resolution:
701
+
702
+ Capabilities:
703
+
704
+ | Role | Capability |
705
+ | ---- | --------------------------------------- |
706
+ | uses | xrn:firebolt:capability:metrics:general |
707
+
708
+ #### Examples
709
+
710
+ Send page metric
711
+
712
+ JavaScript:
713
+
714
+ ```javascript
715
+ import { Metrics } from '@firebolt-js/core-client'
716
+
717
+ let success = await Metrics.page('xyz')
718
+ console.log(success)
719
+ ```
720
+
721
+ Value of `success`:
722
+
723
+ ```javascript
724
+ true
725
+ ```
726
+
727
+ Send page metric w/ pageId
728
+
729
+ JavaScript:
730
+
731
+ ```javascript
732
+ import { Metrics } from '@firebolt-js/core-client'
733
+
734
+ let success = await Metrics.page('home')
735
+ console.log(success)
736
+ ```
737
+
738
+ Value of `success`:
739
+
740
+ ```javascript
741
+ true
742
+ ```
743
+
744
+ ---
745
+
746
+ ### ready
747
+
748
+ Inform the platform that your app is minimally usable. This method is called automatically by `Lifecycle.ready()`
749
+
750
+ ```typescript
751
+ function ready(): Promise<boolean>
752
+ ```
753
+
754
+ Promise resolution:
755
+
756
+ Capabilities:
757
+
758
+ | Role | Capability |
759
+ | ---- | --------------------------------------- |
760
+ | uses | xrn:firebolt:capability:metrics:general |
761
+
762
+ #### Examples
763
+
764
+ Send ready metric
765
+
766
+ JavaScript:
767
+
768
+ ```javascript
769
+ import { Metrics } from '@firebolt-js/core-client'
770
+
771
+ let success = await Metrics.ready()
772
+ console.log(success)
773
+ ```
774
+
775
+ Value of `success`:
776
+
777
+ ```javascript
778
+ true
779
+ ```
780
+
781
+ ---
782
+
783
+ ### signIn
784
+
785
+ _This is a private RPC method._
786
+
787
+ Log a sign in event, called by Discovery.signIn().
788
+
789
+ Result:
790
+
791
+ Capabilities:
792
+
793
+ | Role | Capability |
794
+ | ---- | --------------------------------------- |
795
+ | uses | xrn:firebolt:capability:metrics:general |
796
+
797
+ #### Examples
798
+
799
+ Send signIn metric
800
+
801
+ ---
802
+
803
+ ### signOut
804
+
805
+ _This is a private RPC method._
806
+
807
+ Log a sign out event, called by Discovery.signOut().
808
+
809
+ Result:
810
+
811
+ Capabilities:
812
+
813
+ | Role | Capability |
814
+ | ---- | --------------------------------------- |
815
+ | uses | xrn:firebolt:capability:metrics:general |
816
+
817
+ #### Examples
818
+
819
+ Send signOut metric
820
+
821
+ ---
822
+
823
+ ### startContent
824
+
825
+ Inform the platform that your user has started content.
826
+
827
+ ```typescript
828
+ function startContent(entityId: string, agePolicy: AgePolicy): Promise<boolean>
829
+ ```
830
+
831
+ Parameters:
832
+
833
+ | Param | Type | Required | Description |
834
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
835
+ | `entityId` | `string` | false | Optional entity ID of the content. |
836
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
837
+
838
+ Promise resolution:
839
+
840
+ Capabilities:
841
+
842
+ | Role | Capability |
843
+ | ---- | --------------------------------------- |
844
+ | uses | xrn:firebolt:capability:metrics:general |
845
+
846
+ #### Examples
847
+
848
+ Send startContent metric
849
+
850
+ JavaScript:
851
+
852
+ ```javascript
853
+ import { Metrics } from '@firebolt-js/core-client'
854
+
855
+ let success = await Metrics.startContent(undefined)
856
+ console.log(success)
857
+ ```
858
+
859
+ Value of `success`:
860
+
861
+ ```javascript
862
+ true
863
+ ```
864
+
865
+ Send startContent metric w/ entity
866
+
867
+ JavaScript:
868
+
869
+ ```javascript
870
+ import { Metrics } from '@firebolt-js/core-client'
871
+
872
+ let success = await Metrics.startContent('abc')
873
+ console.log(success)
874
+ ```
875
+
876
+ Value of `success`:
877
+
878
+ ```javascript
879
+ true
880
+ ```
881
+
882
+ Send startContent metric and notify the platform that the content is child-directed
883
+
884
+ JavaScript:
885
+
886
+ ```javascript
887
+ import { Metrics } from '@firebolt-js/core-client'
888
+
889
+ let success = await Metrics.startContent('abc', 'app:child')
890
+ console.log(success)
891
+ ```
892
+
893
+ Value of `success`:
894
+
895
+ ```javascript
896
+ true
897
+ ```
898
+
899
+ ---
900
+
901
+ ### stopContent
902
+
903
+ Inform the platform that your user has stopped content.
904
+
905
+ ```typescript
906
+ function stopContent(entityId: string, agePolicy: AgePolicy): Promise<boolean>
907
+ ```
908
+
909
+ Parameters:
910
+
911
+ | Param | Type | Required | Description |
912
+ | ----------- | --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
913
+ | `entityId` | `string` | false | Optional entity ID of the content. |
914
+ | `agePolicy` | [`AgePolicy`](../Policies/schemas/#AgePolicy) | false | The age policy to associate with the metrics event. The age policy describes the age group to which content is directed. |
915
+
916
+ Promise resolution:
917
+
918
+ Capabilities:
919
+
920
+ | Role | Capability |
921
+ | ---- | --------------------------------------- |
922
+ | uses | xrn:firebolt:capability:metrics:general |
923
+
924
+ #### Examples
925
+
926
+ Send stopContent metric
927
+
928
+ JavaScript:
929
+
930
+ ```javascript
931
+ import { Metrics } from '@firebolt-js/core-client'
932
+
933
+ let success = await Metrics.stopContent(undefined)
934
+ console.log(success)
935
+ ```
936
+
937
+ Value of `success`:
938
+
939
+ ```javascript
940
+ true
941
+ ```
942
+
943
+ Send stopContent metric w/ entity
944
+
945
+ JavaScript:
946
+
947
+ ```javascript
948
+ import { Metrics } from '@firebolt-js/core-client'
949
+
950
+ let success = await Metrics.stopContent('abc')
951
+ console.log(success)
952
+ ```
953
+
954
+ Value of `success`:
955
+
956
+ ```javascript
957
+ true
958
+ ```
959
+
960
+ ---
961
+
962
+ ## Types
963
+
964
+ ### ErrorType
965
+
966
+ ```typescript
967
+ ErrorType: {
968
+ NETWORK: 'network',
969
+ MEDIA: 'media',
970
+ RESTRICTION: 'restriction',
971
+ ENTITLEMENT: 'entitlement',
972
+ OTHER: 'other',
973
+ },
974
+
975
+ ```
976
+
977
+ ---
978
+
979
+ ### MediaPosition
980
+
981
+ Represents a position inside playback content, as a decimal percentage (0-0.999) for content with a known duration, or an integer number of seconds (0-86400) for content with an unknown duration.
982
+
983
+ ```typescript
984
+ type MediaPosition = void | number | number
985
+ ```
986
+
987
+ ---