@capgo/capacitor-stream-call 0.0.70 → 0.0.77

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/README.md CHANGED
@@ -252,6 +252,8 @@ export class CallService {
252
252
  * [`setSpeaker(...)`](#setspeaker)
253
253
  * [`switchCamera(...)`](#switchcamera)
254
254
  * [`getCallInfo(...)`](#getcallinfo)
255
+ * [`setDynamicStreamVideoApikey(...)`](#setdynamicstreamvideoapikey)
256
+ * [`getDynamicStreamVideoApikey()`](#getdynamicstreamvideoapikey)
255
257
  * [Interfaces](#interfaces)
256
258
  * [Type Aliases](#type-aliases)
257
259
  * [Enums](#enums)
@@ -506,6 +508,36 @@ Get detailed information about an active call including caller details
506
508
  --------------------
507
509
 
508
510
 
511
+ ### setDynamicStreamVideoApikey(...)
512
+
513
+ ```typescript
514
+ setDynamicStreamVideoApikey(options: { apiKey: string; }) => Promise<SuccessResponse>
515
+ ```
516
+
517
+ Set a dynamic Stream Video API key that overrides the static one
518
+
519
+ | Param | Type | Description |
520
+ | ------------- | -------------------------------- | -------------------- |
521
+ | **`options`** | <code>{ apiKey: string; }</code> | - The API key to set |
522
+
523
+ **Returns:** <code>Promise&lt;<a href="#successresponse">SuccessResponse</a>&gt;</code>
524
+
525
+ --------------------
526
+
527
+
528
+ ### getDynamicStreamVideoApikey()
529
+
530
+ ```typescript
531
+ getDynamicStreamVideoApikey() => Promise<DynamicApiKeyResponse>
532
+ ```
533
+
534
+ Get the currently set dynamic Stream Video API key
535
+
536
+ **Returns:** <code>Promise&lt;<a href="#dynamicapikeyresponse">DynamicApiKeyResponse</a>&gt;</code>
537
+
538
+ --------------------
539
+
540
+
509
541
  ### Interfaces
510
542
 
511
543
 
@@ -539,13 +571,14 @@ Get detailed information about an active call including caller details
539
571
 
540
572
  #### CallOptions
541
573
 
542
- | Prop | Type | Description |
543
- | ------------- | --------------------------------------------- | --------------------------------------------------------------- |
544
- | **`userIds`** | <code>string[]</code> | User ID of the person to call |
545
- | **`type`** | <code><a href="#calltype">CallType</a></code> | Type of call, defaults to 'default' |
546
- | **`ring`** | <code>boolean</code> | Whether to ring the other user, defaults to true |
547
- | **`team`** | <code>string</code> | Team name to call |
548
- | **`video`** | <code>boolean</code> | Whether to start the call with video enabled, defaults to false |
574
+ | Prop | Type | Description |
575
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
576
+ | **`userIds`** | <code>string[]</code> | User ID of the person to call |
577
+ | **`type`** | <code><a href="#calltype">CallType</a></code> | Type of call, defaults to 'default' |
578
+ | **`ring`** | <code>boolean</code> | Whether to ring the other user, defaults to true |
579
+ | **`team`** | <code>string</code> | Team name to call |
580
+ | **`video`** | <code>boolean</code> | Whether to start the call with video enabled, defaults to false |
581
+ | **`custom`** | <code><a href="#record">Record</a>&lt; string, \| string \| boolean \| number \| null \| <a href="#record">Record</a>&lt;string, string \| boolean \| number \| null&gt; \| string[] \| boolean[] \| number[] &gt;</code> | Custom data to be passed to the call |
549
582
 
550
583
 
551
584
  #### CallEvent
@@ -763,11 +796,12 @@ The JSON representation for <a href="#listvalue">`ListValue`</a> is JSON array.
763
796
 
764
797
  #### IncomingCallPayload
765
798
 
766
- | Prop | Type | Description |
767
- | ------------ | ------------------------------------------------- | ---------------------------------------- |
768
- | **`cid`** | <code>string</code> | Full call CID (e.g. default:123) |
769
- | **`type`** | <code>'incoming'</code> | Event type (currently always "incoming") |
770
- | **`caller`** | <code><a href="#callmember">CallMember</a></code> | Information about the caller |
799
+ | Prop | Type | Description |
800
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
801
+ | **`cid`** | <code>string</code> | Full call CID (e.g. default:123) |
802
+ | **`type`** | <code>'incoming'</code> | Event type (currently always "incoming") |
803
+ | **`caller`** | <code><a href="#callmember">CallMember</a></code> | Information about the caller |
804
+ | **`custom`** | <code><a href="#record">Record</a>&lt; string, \| string \| boolean \| number \| null \| <a href="#record">Record</a>&lt;string, string \| boolean \| number \| null&gt; \| string[] \| boolean[] \| number[] &gt;</code> | Custom data to be passed to the call |
771
805
 
772
806
 
773
807
  #### CameraEnabledResponse
@@ -777,6 +811,14 @@ The JSON representation for <a href="#listvalue">`ListValue`</a> is JSON array.
777
811
  | **`enabled`** | <code>boolean</code> |
778
812
 
779
813
 
814
+ #### DynamicApiKeyResponse
815
+
816
+ | Prop | Type | Description |
817
+ | ------------------- | --------------------------- | --------------------------------------- |
818
+ | **`apiKey`** | <code>string \| null</code> | The dynamic API key if set, null if not |
819
+ | **`hasDynamicKey`** | <code>boolean</code> | Whether a dynamic key is currently set |
820
+
821
+
780
822
  ### Type Aliases
781
823
 
782
824
 
@@ -785,9 +827,16 @@ The JSON representation for <a href="#listvalue">`ListValue`</a> is JSON array.
785
827
  <code>'default' | 'audio_room' | 'livestream' | 'development'</code>
786
828
 
787
829
 
830
+ #### Record
831
+
832
+ Construct a type with a set of properties K of type T
833
+
834
+ <code>{
788
835
  [P in K]: T;
789
836
  }</code>
837
+
838
+
790
839
  #### CallState
791
840
 
792
- <code>'idle' | 'ringing' | 'joining' | 'reconnecting' | 'joined' | 'leaving' | 'left' | 'created' | 'session_started' | 'rejected' | 'missed' | 'accepted' | 'ended' | 'unknown'</code>
841
+ <code>'idle' | 'ringing' | 'joining' | 'reconnecting' | 'joined' | 'leaving' | 'left' | 'created' | 'session_started' | 'rejected' | 'missed' | 'accepted' | 'ended' | 'camera_enabled' | 'camera_disabled' | 'microphone_enabled' | 'microphone_disabled' | 'unknown'</code>
793
842
 
794
843
 
795
844
  ### Enums
@@ -0,0 +1,38 @@
1
+ package ee.forgr.capacitor.streamcall
2
+
3
+ import org.json.JSONArray
4
+ import org.json.JSONObject
5
+
6
+ fun JSONObject.toMap(): Map<String, Any> {
7
+ val map = mutableMapOf<String, Any>()
8
+ val keys = this.keys()
9
+ while (keys.hasNext()) {
10
+ val key = keys.next()
11
+ var value = this.get(key)
12
+
13
+ // Handle nested JSONObjects and JSONArrays
14
+ value = when (value) {
15
+ is JSONObject -> value.toMap()
16
+ is JSONArray -> value.toList()
17
+ else -> value
18
+ }
19
+
20
+ map[key] = value
21
+ }
22
+ return map
23
+ }
24
+
25
+ // Helper for JSONArray
26
+ fun JSONArray.toList(): List<Any> {
27
+ val list = mutableListOf<Any>()
28
+ for (i in 0 until this.length()) {
29
+ var value = this.get(i)
30
+ value = when (value) {
31
+ is JSONObject -> value.toMap()
32
+ is JSONArray -> value.toList()
33
+ else -> value
34
+ }
35
+ list.add(value)
36
+ }
37
+ return list
38
+ }