@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,795 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ export module Settings {
20
+ type LogLevel = 'WARN' | 'INFO' | 'DEBUG' | 'ERROR'
21
+ function setLogLevel(logLevel: LogLevel): void
22
+ function getLogLevel(): LogLevel
23
+ }
24
+
25
+ export module Log {
26
+ function info(...args: any[]): void
27
+ function debug(...args: any[]): void
28
+ function error(...args: any[]): void
29
+ function warn(...args: any[]): void
30
+ }
31
+
32
+ export module Events {
33
+ function listen(...args: any[]): Promise<number>
34
+ function once(...args: any[]): Promise<number>
35
+ function clear(...args: any[]): boolean
36
+ }
37
+
38
+ export module Accessibility {
39
+ type Event =
40
+ | 'onAudioDescriptionChanged'
41
+ | 'onClosedCaptionsSettingsChanged'
42
+ | 'onHighContrastUIChanged'
43
+ | 'onVoiceGuidanceSettingsChanged'
44
+
45
+ // Types
46
+
47
+ /**
48
+ *
49
+ */
50
+ type ClosedCaptionsSettings = {
51
+ enabled: boolean // Whether or not closed-captions should be enabled by default
52
+ preferredLanguages?: string[]
53
+ }
54
+
55
+ /**
56
+ *
57
+ */
58
+ type VoiceGuidanceSettings = {
59
+ enabled: boolean // Whether or not voice guidance should be enabled by default
60
+ rate: SpeechRate // The rate at which voice guidance speech will be read back to the user
61
+ navigationHints: boolean // Whether or not voice guidance should include additional navigation hints
62
+ }
63
+
64
+ /**
65
+ *
66
+ */
67
+ type SpeechRate = number
68
+
69
+ /**
70
+ *
71
+ */
72
+ type ISO639_2Language = string
73
+
74
+ /**
75
+ * Getter: Returns the audio description setting of the device
76
+ *
77
+ */
78
+ function audioDescription(): Promise<boolean>
79
+
80
+ /**
81
+ * Subscriber: Returns the audio description setting of the device
82
+ *
83
+ */
84
+ function audioDescription(
85
+ subscriber: (setting: boolean) => void,
86
+ ): Promise<number>
87
+
88
+ /**
89
+ * Turn off all listeners previously registered from this module.
90
+ */
91
+ function clear(): boolean
92
+
93
+ /**
94
+ * Clear a specific listen by the listener ID.
95
+ *
96
+ * @param {number} id The id of the listener to clear
97
+ */
98
+ function clear(id: number): boolean
99
+
100
+ /**
101
+ * Getter: Returns captions settings: enabled, and a list of zero or more languages in order of decreasing preference
102
+ *
103
+ */
104
+ function closedCaptionsSettings(): Promise<ClosedCaptionsSettings>
105
+
106
+ /**
107
+ * Subscriber: Returns captions settings: enabled, and a list of zero or more languages in order of decreasing preference
108
+ *
109
+ */
110
+ function closedCaptionsSettings(
111
+ subscriber: (closedCaptionsSettings: ClosedCaptionsSettings) => void,
112
+ ): Promise<number>
113
+
114
+ /**
115
+ * Getter: Returns the high contrast UI device setting
116
+ *
117
+ */
118
+ function highContrastUI(): Promise<boolean>
119
+
120
+ /**
121
+ * Subscriber: Returns the high contrast UI device setting
122
+ *
123
+ */
124
+ function highContrastUI(
125
+ subscriber: (highContrastUI: boolean) => void,
126
+ ): Promise<number>
127
+
128
+ /**
129
+ * Returns the audio description setting of the device
130
+ *
131
+ * @param {'onAudioDescriptionChanged'} event
132
+ * @param {Function} callback
133
+ */
134
+ function listen(
135
+ event: 'onAudioDescriptionChanged',
136
+ callback: (setting: boolean) => void,
137
+ ): Promise<number>
138
+
139
+ /**
140
+ * Returns the audio description setting of the device
141
+ * When using `once` the callback method will only fire once, and then disconnect your listener
142
+ *
143
+ * @param {'onAudioDescriptionChanged'} event
144
+ * @param {Function} callback
145
+ */
146
+ function once(
147
+ event: 'onAudioDescriptionChanged',
148
+ callback: (setting: boolean) => void,
149
+ ): Promise<number>
150
+
151
+ /**
152
+ * Returns captions settings: enabled, and a list of zero or more languages in order of decreasing preference
153
+ *
154
+ * @param {'onClosedCaptionsSettingsChanged'} event
155
+ * @param {Function} callback
156
+ */
157
+ function listen(
158
+ event: 'onClosedCaptionsSettingsChanged',
159
+ callback: (enabled: boolean, preferredLanguages: string[]) => void,
160
+ ): Promise<number>
161
+
162
+ /**
163
+ * Returns captions settings: enabled, and a list of zero or more languages in order of decreasing preference
164
+ * When using `once` the callback method will only fire once, and then disconnect your listener
165
+ *
166
+ * @param {'onClosedCaptionsSettingsChanged'} event
167
+ * @param {Function} callback
168
+ */
169
+ function once(
170
+ event: 'onClosedCaptionsSettingsChanged',
171
+ callback: (enabled: boolean, preferredLanguages: string[]) => void,
172
+ ): Promise<number>
173
+
174
+ /**
175
+ * Returns the high contrast UI device setting
176
+ *
177
+ * @param {'onHighContrastUIChanged'} event
178
+ * @param {Function} callback
179
+ */
180
+ function listen(
181
+ event: 'onHighContrastUIChanged',
182
+ callback: (highContrastUI: boolean) => void,
183
+ ): Promise<number>
184
+
185
+ /**
186
+ * Returns the high contrast UI device setting
187
+ * When using `once` the callback method will only fire once, and then disconnect your listener
188
+ *
189
+ * @param {'onHighContrastUIChanged'} event
190
+ * @param {Function} callback
191
+ */
192
+ function once(
193
+ event: 'onHighContrastUIChanged',
194
+ callback: (highContrastUI: boolean) => void,
195
+ ): Promise<number>
196
+
197
+ /**
198
+ * Returns voice guidance settings: enabled, rate, and verbosity
199
+ *
200
+ * @param {'onVoiceGuidanceSettingsChanged'} event
201
+ * @param {Function} callback
202
+ */
203
+ function listen(
204
+ event: 'onVoiceGuidanceSettingsChanged',
205
+ callback: (
206
+ enabled: boolean,
207
+ rate: SpeechRate,
208
+ navigationHints: boolean,
209
+ ) => void,
210
+ ): Promise<number>
211
+
212
+ /**
213
+ * Returns voice guidance settings: enabled, rate, and verbosity
214
+ * When using `once` the callback method will only fire once, and then disconnect your listener
215
+ *
216
+ * @param {'onVoiceGuidanceSettingsChanged'} event
217
+ * @param {Function} callback
218
+ */
219
+ function once(
220
+ event: 'onVoiceGuidanceSettingsChanged',
221
+ callback: (
222
+ enabled: boolean,
223
+ rate: SpeechRate,
224
+ navigationHints: boolean,
225
+ ) => void,
226
+ ): Promise<number>
227
+
228
+ /**
229
+ * Getter: Returns voice guidance settings: enabled, rate, and verbosity
230
+ *
231
+ */
232
+ function voiceGuidanceSettings(): Promise<VoiceGuidanceSettings>
233
+
234
+ /**
235
+ * Subscriber: Returns voice guidance settings: enabled, rate, and verbosity
236
+ *
237
+ */
238
+ function voiceGuidanceSettings(
239
+ subscriber: (settings: VoiceGuidanceSettings) => void,
240
+ ): Promise<number>
241
+ }
242
+
243
+ export module Advertising {
244
+ // Types
245
+
246
+ /**
247
+ *
248
+ */
249
+ type AdvertisingIdResult = {
250
+ ifa: string // UUID conforming to IAB standard
251
+ ifa_type: 'dpid' | 'sspid' | 'sessionid' // Source of the IFA as defined by IAB
252
+ lmt: '0' | '1' // Boolean that if set to 1, user has requested ad tracking and measurement is disabled
253
+ }
254
+
255
+ /**
256
+ * Returns the IFA.
257
+ *
258
+ */
259
+ function advertisingId(): Promise<AdvertisingIdResult>
260
+ }
261
+
262
+ export module Device {
263
+ type Event = 'onHdrChanged'
264
+
265
+ // Types
266
+
267
+ /**
268
+ * The type of device
269
+ */
270
+ enum DeviceClass {
271
+ OTT = 'ott',
272
+ STB = 'stb',
273
+ TV = 'tv',
274
+ }
275
+
276
+ /**
277
+ * The type of HDR format
278
+ */
279
+ type HDRFormatMap = {
280
+ hdr10: boolean
281
+ hdr10Plus: boolean
282
+ dolbyVision: boolean
283
+ hlg: boolean
284
+ }
285
+
286
+ /**
287
+ * Turn off all listeners previously registered from this module.
288
+ */
289
+ function clear(): boolean
290
+
291
+ /**
292
+ * Clear a specific listen by the listener ID.
293
+ *
294
+ * @param {number} id The id of the listener to clear
295
+ */
296
+ function clear(id: number): boolean
297
+
298
+ /**
299
+ * Returns the class of the device
300
+ *
301
+ */
302
+ function deviceClass(): Promise<DeviceClass>
303
+
304
+ /**
305
+ * Getter: Returns the HDR standards that are supported by the attached TV or the integral display
306
+ *
307
+ */
308
+ function hdr(): Promise<HDRFormatMap>
309
+
310
+ /**
311
+ * Subscriber: Returns the HDR standards that are supported by the attached TV or the integral display
312
+ *
313
+ */
314
+ function hdr(
315
+ subscriber: (negotiatedHdrFormats: HDRFormatMap) => void,
316
+ ): Promise<number>
317
+
318
+ /**
319
+ * Returns the HDR standards that are supported by the attached TV or the integral display
320
+ *
321
+ * @param {'onHdrChanged'} event
322
+ * @param {Function} callback
323
+ */
324
+ function listen(
325
+ event: 'onHdrChanged',
326
+ callback: (negotiatedHdrFormats: HDRFormatMap) => void,
327
+ ): Promise<number>
328
+
329
+ /**
330
+ * Returns the HDR standards that are supported by the attached TV or the integral display
331
+ * When using `once` the callback method will only fire once, and then disconnect your listener
332
+ *
333
+ * @param {'onHdrChanged'} event
334
+ * @param {Function} callback
335
+ */
336
+ function once(
337
+ event: 'onHdrChanged',
338
+ callback: (negotiatedHdrFormats: HDRFormatMap) => void,
339
+ ): Promise<number>
340
+
341
+ /**
342
+ * Returns a persistent unique UUID for the current app and device. The UUID is reset when the app or device is reset
343
+ *
344
+ */
345
+ function uid(): Promise<string>
346
+ }
347
+
348
+ export module Localization {
349
+ type Event =
350
+ | 'onCountryChanged'
351
+ | 'onPreferredAudioLanguagesChanged'
352
+ | 'onPresentationLanguageChanged'
353
+
354
+ // Types
355
+
356
+ /**
357
+ *
358
+ */
359
+ type ISO639_2Language = string
360
+
361
+ /**
362
+ *
363
+ */
364
+ type CountryCode = string
365
+
366
+ /**
367
+ *
368
+ */
369
+ type Locale = string
370
+
371
+ /**
372
+ * Turn off all listeners previously registered from this module.
373
+ */
374
+ function clear(): boolean
375
+
376
+ /**
377
+ * Clear a specific listen by the listener ID.
378
+ *
379
+ * @param {number} id The id of the listener to clear
380
+ */
381
+ function clear(id: number): boolean
382
+
383
+ /**
384
+ * Getter: Returns the ISO 3166-1 alpha-2 code for the country device is located in.
385
+ *
386
+ */
387
+ function country(): Promise<string>
388
+
389
+ /**
390
+ * Subscriber: Returns the ISO 3166-1 alpha-2 code for the country device is located in.
391
+ *
392
+ */
393
+ function country(subscriber: (code: string) => void): Promise<number>
394
+
395
+ /**
396
+ * Returns the ISO 3166-1 alpha-2 code for the country device is located in.
397
+ *
398
+ * @param {'onCountryChanged'} event
399
+ * @param {Function} callback
400
+ */
401
+ function listen(
402
+ event: 'onCountryChanged',
403
+ callback: (code: string) => void,
404
+ ): Promise<number>
405
+
406
+ /**
407
+ * Returns the ISO 3166-1 alpha-2 code for the country device is located in.
408
+ * When using `once` the callback method will only fire once, and then disconnect your listener
409
+ *
410
+ * @param {'onCountryChanged'} event
411
+ * @param {Function} callback
412
+ */
413
+ function once(
414
+ event: 'onCountryChanged',
415
+ callback: (code: string) => void,
416
+ ): Promise<number>
417
+
418
+ /**
419
+ * Returns a list of ISO 639-2/B codes for the preferred audio languages on this device.
420
+ *
421
+ * @param {'onPreferredAudioLanguagesChanged'} event
422
+ * @param {Function} callback
423
+ */
424
+ function listen(
425
+ event: 'onPreferredAudioLanguagesChanged',
426
+ callback: (languages: string[]) => void,
427
+ ): Promise<number>
428
+
429
+ /**
430
+ * Returns a list of ISO 639-2/B codes for the preferred audio languages on this device.
431
+ * When using `once` the callback method will only fire once, and then disconnect your listener
432
+ *
433
+ * @param {'onPreferredAudioLanguagesChanged'} event
434
+ * @param {Function} callback
435
+ */
436
+ function once(
437
+ event: 'onPreferredAudioLanguagesChanged',
438
+ callback: (languages: string[]) => void,
439
+ ): Promise<number>
440
+
441
+ /**
442
+ * Get the *full* BCP 47 code, including script, region, variant, etc., for the preferred locale
443
+ *
444
+ * @param {'onPresentationLanguageChanged'} event
445
+ * @param {Function} callback
446
+ */
447
+ function listen(
448
+ event: 'onPresentationLanguageChanged',
449
+ callback: (locale: string) => void,
450
+ ): Promise<number>
451
+
452
+ /**
453
+ * Get the *full* BCP 47 code, including script, region, variant, etc., for the preferred locale
454
+ * When using `once` the callback method will only fire once, and then disconnect your listener
455
+ *
456
+ * @param {'onPresentationLanguageChanged'} event
457
+ * @param {Function} callback
458
+ */
459
+ function once(
460
+ event: 'onPresentationLanguageChanged',
461
+ callback: (locale: string) => void,
462
+ ): Promise<number>
463
+
464
+ /**
465
+ * Getter: Returns a list of ISO 639-2/B codes for the preferred audio languages on this device.
466
+ *
467
+ */
468
+ function preferredAudioLanguages(): Promise<string[]>
469
+
470
+ /**
471
+ * Subscriber: Returns a list of ISO 639-2/B codes for the preferred audio languages on this device.
472
+ *
473
+ */
474
+ function preferredAudioLanguages(
475
+ subscriber: (languages: string[]) => void,
476
+ ): Promise<number>
477
+
478
+ /**
479
+ * Getter: Get the *full* BCP 47 code, including script, region, variant, etc., for the preferred locale
480
+ *
481
+ */
482
+ function presentationLanguage(): Promise<string>
483
+
484
+ /**
485
+ * Subscriber: Get the *full* BCP 47 code, including script, region, variant, etc., for the preferred locale
486
+ *
487
+ */
488
+ function presentationLanguage(
489
+ subscriber: (locale: string) => void,
490
+ ): Promise<number>
491
+ }
492
+
493
+ export module Metrics {
494
+ // Types
495
+
496
+ /**
497
+ *
498
+ */
499
+ enum ErrorType {
500
+ NETWORK = 'network',
501
+ MEDIA = 'media',
502
+ RESTRICTION = 'restriction',
503
+ ENTITLEMENT = 'entitlement',
504
+ OTHER = 'other',
505
+ }
506
+
507
+ /**
508
+ * 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.
509
+ */
510
+ type MediaPosition = void | number | number
511
+
512
+ /**
513
+ *
514
+ */
515
+ type FlatMap = {}
516
+
517
+ /**
518
+ * The policy that describes various age groups to which content is directed. See distributor documentation for further details.
519
+ */
520
+ type AgePolicy = string | 'app:adult' | 'app:child' | 'app:teen'
521
+
522
+ /**
523
+ * Inform the platform about an app's build info.
524
+ *
525
+ * @param {string} build The build / version of this app.
526
+ */
527
+ function appInfo(build: string): Promise<null>
528
+
529
+ /**
530
+ * Inform the platform of an error that has occurred in your app.
531
+ *
532
+ * @param {ErrorType} type The type of error
533
+ * @param {string} code an app-specific error code
534
+ * @param {string} description A short description of the error
535
+ * @param {boolean} visible Whether or not this error was visible to the user.
536
+ * @param {object} parameters Optional additional parameters to be logged with the error
537
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
538
+ */
539
+ function error(
540
+ type: ErrorType,
541
+ code: string,
542
+ description: string,
543
+ visible: boolean,
544
+ parameters?: object,
545
+ agePolicy?: AgePolicy,
546
+ ): Promise<boolean>
547
+
548
+ /**
549
+ * Inform the platform of 1st party distributor metrics. 'data' parameter is a JSON document
550
+ *
551
+ * @param {string} schema The schema URI of the metric type
552
+ * @param {string} data A JSON payload
553
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
554
+ */
555
+ function event(
556
+ schema: string,
557
+ data: string,
558
+ agePolicy?: AgePolicy,
559
+ ): Promise<boolean>
560
+
561
+ /**
562
+ * Called when playback has stopped because the end of the media was reached.
563
+ *
564
+ * @param {string} entityId The entityId of the media.
565
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
566
+ */
567
+ function mediaEnded(entityId: string, agePolicy?: AgePolicy): Promise<boolean>
568
+
569
+ /**
570
+ * Called when setting the URL of a media asset to play, in order to infer load time.
571
+ *
572
+ * @param {string} entityId The entityId of the media.
573
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
574
+ */
575
+ function mediaLoadStart(
576
+ entityId: string,
577
+ agePolicy?: AgePolicy,
578
+ ): Promise<boolean>
579
+
580
+ /**
581
+ * Called when media playback will pause due to an intentional pause operation.
582
+ *
583
+ * @param {string} entityId The entityId of the media.
584
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
585
+ */
586
+ function mediaPause(entityId: string, agePolicy?: AgePolicy): Promise<boolean>
587
+
588
+ /**
589
+ * Called when media playback should start due to autoplay, user-initiated play, or unpausing.
590
+ *
591
+ * @param {string} entityId The entityId of the media.
592
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
593
+ */
594
+ function mediaPlay(entityId: string, agePolicy?: AgePolicy): Promise<boolean>
595
+
596
+ /**
597
+ * Called when media playback actually starts due to autoplay, user-initiated play, unpausing, or recovering from a buffering interruption.
598
+ *
599
+ * @param {string} entityId The entityId of the media.
600
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
601
+ */
602
+ function mediaPlaying(
603
+ entityId: string,
604
+ agePolicy?: AgePolicy,
605
+ ): Promise<boolean>
606
+
607
+ /**
608
+ * Called when the playback rate of media is changed.
609
+ *
610
+ * @param {string} entityId The entityId of the media.
611
+ * @param {number} rate The new playback rate.
612
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
613
+ */
614
+ function mediaRateChanged(
615
+ entityId: string,
616
+ rate: number,
617
+ agePolicy?: AgePolicy,
618
+ ): Promise<boolean>
619
+
620
+ /**
621
+ * Called when the playback rendition (e.g. bitrate, dimensions, profile, etc) is changed.
622
+ *
623
+ * @param {string} entityId The entityId of the media.
624
+ * @param {number} bitrate The new bitrate in kbps.
625
+ * @param {number} width The new resolution width.
626
+ * @param {number} height The new resolution height.
627
+ * @param {string} profile A description of the new profile, e.g. 'HDR' etc.
628
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
629
+ */
630
+ function mediaRenditionChanged(
631
+ entityId: string,
632
+ bitrate: number,
633
+ width: number,
634
+ height: number,
635
+ profile?: string,
636
+ agePolicy?: AgePolicy,
637
+ ): Promise<boolean>
638
+
639
+ /**
640
+ * Called when a seek is completed during media playback.
641
+ *
642
+ * @param {string} entityId The entityId of the media.
643
+ * @param {MediaPosition} position 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.
644
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
645
+ */
646
+ function mediaSeeked(
647
+ entityId: string,
648
+ position: MediaPosition,
649
+ agePolicy?: AgePolicy,
650
+ ): Promise<boolean>
651
+
652
+ /**
653
+ * Called when a seek is initiated during media playback.
654
+ *
655
+ * @param {string} entityId The entityId of the media.
656
+ * @param {MediaPosition} target 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.
657
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
658
+ */
659
+ function mediaSeeking(
660
+ entityId: string,
661
+ target: MediaPosition,
662
+ agePolicy?: AgePolicy,
663
+ ): Promise<boolean>
664
+
665
+ /**
666
+ * Called when media playback will halt due to a network, buffer, or other unintentional constraint.
667
+ *
668
+ * @param {string} entityId The entityId of the media.
669
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
670
+ */
671
+ function mediaWaiting(
672
+ entityId: string,
673
+ agePolicy?: AgePolicy,
674
+ ): Promise<boolean>
675
+
676
+ /**
677
+ * Inform the platform that your user has navigated to a page or view.
678
+ *
679
+ * @param {string} pageId Page ID of the content.
680
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
681
+ */
682
+ function page(pageId: string, agePolicy?: AgePolicy): Promise<boolean>
683
+
684
+ /**
685
+ * Inform the platform that your app is minimally usable. This method is called automatically by `Lifecycle.ready()`
686
+ *
687
+ */
688
+ function ready(): Promise<boolean>
689
+
690
+ /**
691
+ * Inform the platform that your user has started content.
692
+ *
693
+ * @param {string} entityId Optional entity ID of the content.
694
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
695
+ */
696
+ function startContent(
697
+ entityId?: string,
698
+ agePolicy?: AgePolicy,
699
+ ): Promise<boolean>
700
+
701
+ /**
702
+ * Inform the platform that your user has stopped content.
703
+ *
704
+ * @param {string} entityId Optional entity ID of the content.
705
+ * @param {AgePolicy} agePolicy The age policy to associate with the metrics event. The age policy describes the age group to which content is directed.
706
+ */
707
+ function stopContent(
708
+ entityId?: string,
709
+ agePolicy?: AgePolicy,
710
+ ): Promise<boolean>
711
+ }
712
+
713
+ export module Network {
714
+ type Event = 'onConnectedChanged'
715
+
716
+ // Types
717
+
718
+ /**
719
+ * Indicates whether the device currently has a usable network connection.
720
+ */
721
+ type Connected = boolean
722
+
723
+ /**
724
+ * Turn off all listeners previously registered from this module.
725
+ */
726
+ function clear(): boolean
727
+
728
+ /**
729
+ * Clear a specific listen by the listener ID.
730
+ *
731
+ * @param {number} id The id of the listener to clear
732
+ */
733
+ function clear(id: number): boolean
734
+
735
+ /**
736
+ * Getter: Returns whether the device currently has a usable network connection.
737
+ *
738
+ */
739
+ function connected(): Promise<boolean>
740
+
741
+ /**
742
+ * Subscriber: Returns whether the device currently has a usable network connection.
743
+ *
744
+ */
745
+ function connected(subscriber: (success: boolean) => void): Promise<number>
746
+
747
+ /**
748
+ * Returns whether the device currently has a usable network connection.
749
+ *
750
+ * @param {'onConnectedChanged'} event
751
+ * @param {Function} callback
752
+ */
753
+ function listen(
754
+ event: 'onConnectedChanged',
755
+ callback: (success: boolean) => void,
756
+ ): Promise<number>
757
+
758
+ /**
759
+ * Returns whether the device currently has a usable network connection.
760
+ * When using `once` the callback method will only fire once, and then disconnect your listener
761
+ *
762
+ * @param {'onConnectedChanged'} event
763
+ * @param {Function} callback
764
+ */
765
+ function once(
766
+ event: 'onConnectedChanged',
767
+ callback: (success: boolean) => void,
768
+ ): Promise<number>
769
+ }
770
+
771
+ export module Discovery {
772
+ // Types
773
+
774
+ /**
775
+ * The policy that describes various age groups to which content is directed. See distributor documentation for further details.
776
+ */
777
+ type AgePolicy = string | 'app:adult' | 'app:child' | 'app:teen'
778
+
779
+ /**
780
+ * Notify the platform that content was partially or completely watched
781
+ *
782
+ * @param {string} entityId The entity Id of the watched content.
783
+ * @param {number} progress How much of the content has been watched (percentage as (0-0.999) for VOD, number of seconds for live)
784
+ * @param {boolean} completed Whether or not this viewing is considered "complete," per the app's definition thereof
785
+ * @param {string} watchedOn Date/Time the content was watched, ISO 8601 Date/Time
786
+ * @param {AgePolicy} agePolicy
787
+ */
788
+ function watched(
789
+ entityId: string,
790
+ progress?: number,
791
+ completed?: boolean,
792
+ watchedOn?: string,
793
+ agePolicy?: AgePolicy,
794
+ ): Promise<boolean>
795
+ }