@placeos/ts-client 4.5.0 → 4.7.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.
- package/dist/alerts/functions.d.ts +7 -10
- package/dist/alerts/interfaces.d.ts +22 -0
- package/dist/api.d.ts +32 -19
- package/dist/applications/functions.d.ts +2 -5
- package/dist/applications/interfaces.d.ts +5 -11
- package/dist/assets/assets.class.d.ts +62 -0
- package/dist/assets/functions.d.ts +146 -0
- package/dist/assets/interfaces.d.ts +38 -0
- package/dist/clusters/functions.d.ts +16 -7
- package/dist/clusters/interfaces.d.ts +18 -3
- package/dist/domains/functions.d.ts +10 -6
- package/dist/drivers/functions.d.ts +3 -5
- package/dist/drivers/interfaces.d.ts +9 -7
- package/dist/edge/functions.d.ts +8 -7
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2695 -2081
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/ldap-sources/functions.d.ts +2 -5
- package/dist/metadata/functions.d.ts +8 -9
- package/dist/metadata/interfaces.d.ts +18 -4
- package/dist/modules/functions.d.ts +10 -4
- package/dist/modules/interfaces.d.ts +14 -12
- package/dist/oauth-sources/functions.d.ts +2 -5
- package/dist/repositories/functions.d.ts +17 -29
- package/dist/repositories/interfaces.d.ts +31 -3
- package/dist/resources/interface.d.ts +9 -4
- package/dist/saml-sources/functions.d.ts +4 -7
- package/dist/settings/functions.d.ts +6 -8
- package/dist/settings/interfaces.d.ts +7 -0
- package/dist/short-url/functions.d.ts +60 -0
- package/dist/short-url/interfaces.d.ts +22 -0
- package/dist/short-url/short-url.class.d.ts +17 -0
- package/dist/signage/interfaces.d.ts +9 -1
- package/dist/storages/functions.d.ts +31 -0
- package/dist/storages/interfaces.d.ts +6 -0
- package/dist/storages/storage.class.d.ts +18 -0
- package/dist/systems/functions.d.ts +38 -10
- package/dist/systems/interfaces.d.ts +58 -5
- package/dist/triggers/functions.d.ts +5 -7
- package/dist/triggers/interfaces.d.ts +9 -0
- package/dist/users/functions.d.ts +50 -10
- package/dist/users/interfaces.d.ts +35 -2
- package/dist/webrtc/functions.d.ts +52 -0
- package/dist/webrtc/interfaces.d.ts +73 -0
- package/dist/zones/functions.d.ts +12 -6
- package/dist/zones/interfaces.d.ts +9 -4
- package/package.json +1 -1
- package/src/alerts/functions.ts +14 -22
- package/src/alerts/interfaces.ts +25 -0
- package/src/api.ts +148 -3
- package/src/applications/functions.ts +4 -7
- package/src/applications/interfaces.ts +6 -12
- package/src/assets/assets.class.ts +123 -0
- package/src/assets/functions.ts +440 -0
- package/src/assets/interfaces.ts +41 -0
- package/src/clusters/functions.ts +39 -8
- package/src/clusters/interfaces.ts +21 -3
- package/src/domains/functions.ts +17 -6
- package/src/drivers/functions.ts +4 -6
- package/src/drivers/interfaces.ts +11 -7
- package/src/edge/functions.ts +18 -10
- package/src/ldap-sources/functions.ts +4 -7
- package/src/metadata/functions.ts +16 -10
- package/src/metadata/interfaces.ts +20 -4
- package/src/modules/functions.ts +29 -7
- package/src/modules/interfaces.ts +15 -12
- package/src/oauth-sources/functions.ts +4 -7
- package/src/repositories/functions.ts +35 -35
- package/src/repositories/interfaces.ts +35 -3
- package/src/resources/interface.ts +9 -4
- package/src/saml-sources/functions.ts +6 -9
- package/src/settings/functions.ts +14 -10
- package/src/settings/interfaces.ts +8 -0
- package/src/short-url/functions.ts +155 -0
- package/src/short-url/interfaces.ts +25 -0
- package/src/short-url/short-url.class.ts +33 -0
- package/src/signage/interfaces.ts +10 -1
- package/src/storages/functions.ts +88 -0
- package/src/storages/interfaces.ts +7 -0
- package/src/storages/storage.class.ts +34 -0
- package/src/systems/functions.ts +113 -13
- package/src/systems/interfaces.ts +65 -5
- package/src/triggers/functions.ts +9 -8
- package/src/triggers/interfaces.ts +10 -0
- package/src/users/functions.ts +104 -9
- package/src/users/interfaces.ts +40 -2
- package/src/webrtc/functions.ts +120 -0
- package/src/webrtc/interfaces.ts +77 -0
- package/src/zones/functions.ts +28 -7
- package/src/zones/interfaces.ts +10 -4
|
@@ -14,18 +14,78 @@ export interface PlaceModuleFunction {
|
|
|
14
14
|
|
|
15
15
|
/** Allowable query parameters for systems index endpoint */
|
|
16
16
|
export interface PlaceSystemsQueryOptions extends PlaceResourceQueryOptions {
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/** Return only bookable or non-bookable rooms (returns both when not specified) */
|
|
18
|
+
bookable?: boolean;
|
|
19
|
+
/** Return only rooms with capacity equal or greater than provided */
|
|
20
|
+
capacity?: number;
|
|
21
|
+
/** Return only systems whose resource address matches one of the emails provided */
|
|
22
|
+
email?: string;
|
|
23
|
+
/** Comma separated list of features. Return only rooms with all requested features */
|
|
24
|
+
features?: string;
|
|
25
|
+
/** Return only systems which have this module ID */
|
|
26
|
+
module_id?: string;
|
|
27
|
+
/** Return systems using this trigger ID */
|
|
28
|
+
trigger_id?: string;
|
|
19
29
|
/** Zone ID to filter the returned values on */
|
|
20
30
|
zone_id?: string;
|
|
21
|
-
/**
|
|
22
|
-
|
|
31
|
+
/** Return systems which are public */
|
|
32
|
+
public?: boolean;
|
|
23
33
|
/** Only return systems that have signage capabilities */
|
|
24
34
|
signage?: boolean;
|
|
25
35
|
}
|
|
26
36
|
|
|
37
|
+
/** Allowable query parameters for systems with_emails endpoint */
|
|
38
|
+
export interface PlaceSystemsWithEmailsOptions {
|
|
39
|
+
/** Comma separated list of email addresses (required) */
|
|
40
|
+
in: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
/** Allowable query parameters for systems show endpoint */
|
|
28
44
|
export interface PlaceSystemShowOptions {
|
|
29
|
-
/**
|
|
45
|
+
/** Return the system with zone, module, and driver information collected */
|
|
46
|
+
complete?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Allowable query parameters for systems update endpoint */
|
|
50
|
+
export interface PlaceSystemUpdateOptions {
|
|
51
|
+
/** Version number to prevent overwriting newer config (required for PUT/PATCH) */
|
|
52
|
+
version: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Allowable query parameters for system start/stop endpoints */
|
|
56
|
+
export interface PlaceSystemStartStopOptions {
|
|
57
|
+
/** Start/stop modules that only occur in the selected system */
|
|
58
|
+
single_occurrence?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Allowable query parameters for system triggers index endpoint */
|
|
62
|
+
export interface PlaceSystemTriggersQueryOptions extends PlaceResourceQueryOptions {
|
|
63
|
+
/** Provide the control system details */
|
|
64
|
+
complete?: boolean;
|
|
65
|
+
/** Only return triggers marked as important */
|
|
66
|
+
important?: boolean;
|
|
67
|
+
/** Only return triggers that have recently been triggered */
|
|
68
|
+
triggered?: boolean;
|
|
69
|
+
/** Filter by a particular trigger type */
|
|
70
|
+
trigger_id?: string;
|
|
71
|
+
/** Return triggers updated before the time specified (unix epoch) */
|
|
72
|
+
as_of?: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Allowable query parameters for systems control endpoint */
|
|
76
|
+
export interface PlaceSystemControlOptions {
|
|
77
|
+
/** Fixed device identifier */
|
|
78
|
+
fixed_device?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Allowable query parameters for system metadata endpoint */
|
|
82
|
+
export interface PlaceSystemMetadataOptions {
|
|
83
|
+
/** Name of the metadata key */
|
|
84
|
+
name?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Allowable query parameters for system trigger show endpoint */
|
|
88
|
+
export interface PlaceSystemTriggerShowOptions {
|
|
89
|
+
/** Return the full trigger details */
|
|
30
90
|
complete?: boolean;
|
|
31
91
|
}
|
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
task,
|
|
8
8
|
update,
|
|
9
9
|
} from '../resources/functions';
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
PlaceTriggerQueryOptions,
|
|
12
|
+
PlaceTriggerShowOptions,
|
|
13
|
+
} from './interfaces';
|
|
12
14
|
import { PlaceTrigger } from './trigger';
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -25,7 +27,7 @@ function process(item: Partial<PlaceTrigger>) {
|
|
|
25
27
|
* Query the available triggers
|
|
26
28
|
* @param query_params Query parameters to add the to request URL
|
|
27
29
|
*/
|
|
28
|
-
export function queryTriggers(query_params:
|
|
30
|
+
export function queryTriggers(query_params: PlaceTriggerQueryOptions = {}) {
|
|
29
31
|
return query({ query_params, fn: process, path: PATH });
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -36,7 +38,7 @@ export function queryTriggers(query_params: PlaceResourceQueryOptions = {}) {
|
|
|
36
38
|
*/
|
|
37
39
|
export function showTrigger(
|
|
38
40
|
id: string,
|
|
39
|
-
query_params:
|
|
41
|
+
query_params: PlaceTriggerShowOptions = {},
|
|
40
42
|
) {
|
|
41
43
|
return show({ id, query_params, fn: process, path: PATH });
|
|
42
44
|
}
|
|
@@ -73,12 +75,11 @@ export function addTrigger(form_data: Partial<PlaceTrigger>) {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
|
-
* Remove
|
|
78
|
+
* Remove a trigger from the database
|
|
77
79
|
* @param id ID of the trigger
|
|
78
|
-
* @param query_params Query parameters to add the to request URL
|
|
79
80
|
*/
|
|
80
|
-
export function removeTrigger(id: string
|
|
81
|
-
return remove({ id, query_params, path: PATH });
|
|
81
|
+
export function removeTrigger(id: string) {
|
|
82
|
+
return remove({ id, query_params: {}, path: PATH });
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
/**
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
1
2
|
import { HashMap } from '../utilities/types';
|
|
2
3
|
|
|
4
|
+
/** Mapping of available query parameters for the triggers index endpoint */
|
|
5
|
+
export interface PlaceTriggerQueryOptions extends PlaceResourceQueryOptions {}
|
|
6
|
+
|
|
7
|
+
/** Mapping of available query parameters for the triggers show endpoint */
|
|
8
|
+
export interface PlaceTriggerShowOptions {
|
|
9
|
+
/** Return the instances associated with this trigger */
|
|
10
|
+
instances?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
export interface TriggerActions {
|
|
4
14
|
/** List of functions to execute when the trigger is activated */
|
|
5
15
|
functions: TriggerFunction[];
|
package/src/users/functions.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { map } from 'rxjs/operators';
|
|
3
|
+
import { apiEndpoint } from '../auth/functions';
|
|
4
|
+
import { del, get, post } from '../http/functions';
|
|
5
|
+
import { create, query, remove, show, task, update } from '../resources/functions';
|
|
6
|
+
import { toQueryString } from '../utilities/api';
|
|
2
7
|
import { HashMap } from '../utilities/types';
|
|
3
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
PlaceUserDeleteOptions,
|
|
10
|
+
PlaceUserGroupsOptions,
|
|
11
|
+
PlaceUserMetadataOptions,
|
|
12
|
+
PlaceUserMetadataSearchOptions,
|
|
13
|
+
PlaceUserQueryOptions,
|
|
14
|
+
PlaceUserShowOptions,
|
|
15
|
+
} from './interfaces';
|
|
4
16
|
import { PlaceUser } from './user';
|
|
5
17
|
|
|
6
18
|
/**
|
|
@@ -22,11 +34,11 @@ export function queryUsers(query_params: PlaceUserQueryOptions = {}) {
|
|
|
22
34
|
}
|
|
23
35
|
|
|
24
36
|
/**
|
|
25
|
-
* Get the data for a
|
|
26
|
-
* @param id ID of the
|
|
37
|
+
* Get the data for a user
|
|
38
|
+
* @param id ID of the user to retrieve
|
|
27
39
|
* @param query_params Query parameters to add the to request URL
|
|
28
40
|
*/
|
|
29
|
-
export function showUser(id: string, query_params:
|
|
41
|
+
export function showUser(id: string, query_params: PlaceUserShowOptions = {}) {
|
|
30
42
|
return show({ id, query_params, fn: process, path: PATH });
|
|
31
43
|
}
|
|
32
44
|
|
|
@@ -34,7 +46,7 @@ export function showUser(id: string, query_params: PlaceUserQueryOptions = {}) {
|
|
|
34
46
|
* Get the data for the currently logged in user
|
|
35
47
|
* @param query_params Query parameters to add the to request URL
|
|
36
48
|
*/
|
|
37
|
-
export function currentUser(query_params:
|
|
49
|
+
export function currentUser(query_params: PlaceUserShowOptions = {}) {
|
|
38
50
|
return show({ id: 'current', query_params, fn: process, path: PATH });
|
|
39
51
|
}
|
|
40
52
|
|
|
@@ -70,10 +82,93 @@ export function addUser(form_data: Partial<PlaceUser>) {
|
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
/**
|
|
73
|
-
* Remove
|
|
74
|
-
* @param id ID of the
|
|
85
|
+
* Remove a user from the database
|
|
86
|
+
* @param id ID of the user
|
|
75
87
|
* @param query_params Query parameters to add the to request URL
|
|
76
88
|
*/
|
|
77
|
-
export function removeUser(id: string, query_params:
|
|
89
|
+
export function removeUser(id: string, query_params: PlaceUserDeleteOptions = {}) {
|
|
78
90
|
return remove({ id, query_params, path: PATH });
|
|
79
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get the groups that users are in
|
|
95
|
+
* @param query_params Query parameters including email addresses
|
|
96
|
+
*/
|
|
97
|
+
export function queryUserGroups(
|
|
98
|
+
query_params: PlaceUserGroupsOptions,
|
|
99
|
+
): Observable<HashMap<string[]>> {
|
|
100
|
+
const q = toQueryString(query_params);
|
|
101
|
+
const url = `${apiEndpoint()}${PATH}/groups${q ? '?' + q : ''}`;
|
|
102
|
+
return get(url).pipe(map((resp: HashMap) => resp as HashMap<string[]>));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Search user metadata with provided JSON Path query
|
|
107
|
+
* @param query_params Query parameters including filter
|
|
108
|
+
*/
|
|
109
|
+
export function searchUserMetadata(
|
|
110
|
+
query_params: PlaceUserMetadataSearchOptions,
|
|
111
|
+
): Observable<HashMap[]> {
|
|
112
|
+
const q = toQueryString(query_params);
|
|
113
|
+
const url = `${apiEndpoint()}${PATH}/metadata/search${q ? '?' + q : ''}`;
|
|
114
|
+
return get(url).pipe(map((resp: HashMap) => resp as HashMap[]));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Obtain a token to the current user's SSO resources
|
|
119
|
+
*/
|
|
120
|
+
export function currentUserResourceToken(): Observable<{ token: string }> {
|
|
121
|
+
const url = `${apiEndpoint()}${PATH}/resource_token`;
|
|
122
|
+
return post(url, {}).pipe(map((resp: HashMap) => resp as { token: string }));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get a user's metadata
|
|
127
|
+
* @param id User ID
|
|
128
|
+
* @param query_params Query parameters to add to the request
|
|
129
|
+
*/
|
|
130
|
+
export function userMetadata(
|
|
131
|
+
id: string,
|
|
132
|
+
query_params: PlaceUserMetadataOptions = {},
|
|
133
|
+
): Observable<HashMap> {
|
|
134
|
+
return task({
|
|
135
|
+
id,
|
|
136
|
+
task_name: 'metadata',
|
|
137
|
+
form_data: query_params,
|
|
138
|
+
method: 'get',
|
|
139
|
+
path: PATH,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Remove the saved resource token of a user
|
|
145
|
+
* @param id User ID
|
|
146
|
+
*/
|
|
147
|
+
export function removeUserResourceToken(id: string): Observable<void> {
|
|
148
|
+
const url = `${apiEndpoint()}${PATH}/${encodeURIComponent(id)}/resource_token`;
|
|
149
|
+
return del(url, { response_type: 'void' });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Obtain a token to the specified user's SSO resources
|
|
154
|
+
* @param id User ID
|
|
155
|
+
*/
|
|
156
|
+
export function userResourceToken(id: string): Observable<{ token: string }> {
|
|
157
|
+
const url = `${apiEndpoint()}${PATH}/${encodeURIComponent(id)}/resource_token`;
|
|
158
|
+
return post(url, {}).pipe(map((resp: HashMap) => resp as { token: string }));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Undelete a user
|
|
163
|
+
* @param id User ID
|
|
164
|
+
*/
|
|
165
|
+
export function reviveUser(id: string): Observable<PlaceUser> {
|
|
166
|
+
return task({
|
|
167
|
+
id,
|
|
168
|
+
task_name: 'revive',
|
|
169
|
+
form_data: {},
|
|
170
|
+
method: 'post',
|
|
171
|
+
callback: (item: Partial<PlaceUser>) => process(item),
|
|
172
|
+
path: PATH,
|
|
173
|
+
});
|
|
174
|
+
}
|
package/src/users/interfaces.ts
CHANGED
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
2
2
|
|
|
3
|
-
/** Mapping of available query
|
|
3
|
+
/** Mapping of available query parameters for the users index endpoint */
|
|
4
4
|
export interface PlaceUserQueryOptions extends PlaceResourceQueryOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** Include soft deleted users in the results */
|
|
6
|
+
include_deleted?: boolean;
|
|
7
|
+
/** Include user metadata in the response */
|
|
8
|
+
include_metadata?: boolean;
|
|
9
|
+
/** Admin users can view other domains (ignored for other users) */
|
|
6
10
|
authority_id?: string;
|
|
7
11
|
}
|
|
12
|
+
|
|
13
|
+
/** Mapping of available query parameters for the users show endpoint */
|
|
14
|
+
export interface PlaceUserShowOptions {
|
|
15
|
+
/** Include user metadata in the response */
|
|
16
|
+
include_metadata?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Mapping of available query parameters for the users delete endpoint */
|
|
20
|
+
export interface PlaceUserDeleteOptions {
|
|
21
|
+
/** Force permanent removal of user */
|
|
22
|
+
force_removal?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Mapping of available query parameters for the users groups endpoint */
|
|
26
|
+
export interface PlaceUserGroupsOptions {
|
|
27
|
+
/** Comma-separated list of email addresses */
|
|
28
|
+
emails: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Mapping of available query parameters for the users metadata search endpoint */
|
|
32
|
+
export interface PlaceUserMetadataSearchOptions {
|
|
33
|
+
/** JSON Path query filter */
|
|
34
|
+
filter: string;
|
|
35
|
+
/** Maximum number of results to return */
|
|
36
|
+
limit?: number;
|
|
37
|
+
/** Offset for pagination */
|
|
38
|
+
offset?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Mapping of available query parameters for the user metadata endpoint */
|
|
42
|
+
export interface PlaceUserMetadataOptions {
|
|
43
|
+
/** Name of the metadata key */
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { map } from 'rxjs/operators';
|
|
3
|
+
import { apiEndpoint } from '../auth';
|
|
4
|
+
import { get, post } from '../http/functions';
|
|
5
|
+
import { toQueryString } from '../utilities/api';
|
|
6
|
+
import { HashMap } from '../utilities/types';
|
|
7
|
+
import {
|
|
8
|
+
PlaceGuestParticipant,
|
|
9
|
+
PlaceKickReason,
|
|
10
|
+
PlaceWebrtcMember,
|
|
11
|
+
PlaceWebrtcRoomDetails,
|
|
12
|
+
PlaceWebrtcRoomsQueryOptions,
|
|
13
|
+
} from './interfaces';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
const PATH = 'webrtc';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Query the list of public chat rooms for the current domain
|
|
22
|
+
* @param query_params Query parameters to add to the request URL
|
|
23
|
+
*/
|
|
24
|
+
export function queryWebrtcRooms(
|
|
25
|
+
query_params: PlaceWebrtcRoomsQueryOptions = {},
|
|
26
|
+
): Observable<PlaceWebrtcRoomDetails[]> {
|
|
27
|
+
const query = toQueryString(query_params);
|
|
28
|
+
const url = `${apiEndpoint()}${PATH}/rooms${query ? '?' + query : ''}`;
|
|
29
|
+
return get(url).pipe(map((resp: HashMap) => resp as PlaceWebrtcRoomDetails[]));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get the details of a public chat room
|
|
34
|
+
* @param system_id Either a system ID or a unique permalink
|
|
35
|
+
*/
|
|
36
|
+
export function showWebrtcRoom(
|
|
37
|
+
system_id: string,
|
|
38
|
+
): Observable<PlaceWebrtcRoomDetails> {
|
|
39
|
+
const url = `${apiEndpoint()}${PATH}/room/${encodeURIComponent(system_id)}`;
|
|
40
|
+
return get(url).pipe(map((resp: HashMap) => resp as PlaceWebrtcRoomDetails));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get a list of connected users in a chat session
|
|
45
|
+
* @param session_id ID of the chat session
|
|
46
|
+
*/
|
|
47
|
+
export function webrtcSessionMembers(
|
|
48
|
+
session_id: string,
|
|
49
|
+
): Observable<PlaceWebrtcMember[]> {
|
|
50
|
+
const url = `${apiEndpoint()}${PATH}/members/${encodeURIComponent(session_id)}`;
|
|
51
|
+
return get(url).pipe(map((resp: HashMap) => resp as PlaceWebrtcMember[]));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Request guest access to an anonymous chat room.
|
|
56
|
+
* The guest participant details will be forwarded to any listening systems.
|
|
57
|
+
* Additional fields provided as part of the guest post will also be forwarded.
|
|
58
|
+
* @param system_id Either a system ID or a unique permalink
|
|
59
|
+
* @param participant Guest participant details
|
|
60
|
+
*/
|
|
61
|
+
export function webrtcGuestEntry(
|
|
62
|
+
system_id: string,
|
|
63
|
+
participant: PlaceGuestParticipant,
|
|
64
|
+
): Observable<void> {
|
|
65
|
+
const url = `${apiEndpoint()}${PATH}/guest_entry/${encodeURIComponent(system_id)}`;
|
|
66
|
+
return post(url, participant).pipe(map(() => undefined));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* End a guest call gracefully.
|
|
71
|
+
* This will remove the authentication token and close any open websockets.
|
|
72
|
+
*/
|
|
73
|
+
export function webrtcGuestExit(): Observable<void> {
|
|
74
|
+
const url = `${apiEndpoint()}${PATH}/guest/exit`;
|
|
75
|
+
return post(url, {}).pipe(map(() => undefined));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Kick a user from a chat session.
|
|
80
|
+
* Similar to guest exit without the token expiration.
|
|
81
|
+
* Other members of the call will stop communicating with them.
|
|
82
|
+
* @param user_id ID of the user to kick
|
|
83
|
+
* @param session_id ID of the chat session
|
|
84
|
+
* @param reason Reason for kicking the user
|
|
85
|
+
*/
|
|
86
|
+
export function webrtcKickUser(
|
|
87
|
+
user_id: string,
|
|
88
|
+
session_id: string,
|
|
89
|
+
reason: PlaceKickReason,
|
|
90
|
+
): Observable<void> {
|
|
91
|
+
const url = `${apiEndpoint()}${PATH}/kick/${encodeURIComponent(user_id)}/${encodeURIComponent(session_id)}`;
|
|
92
|
+
return post(url, reason).pipe(map(() => undefined));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Transfer a user from one chat to another.
|
|
97
|
+
* For authorized users to move people from one chat to another.
|
|
98
|
+
* @param user_id ID of the user to transfer
|
|
99
|
+
* @param session_id ID of the current chat session
|
|
100
|
+
* @param connection_details Optional custom connection details for the transfer
|
|
101
|
+
*/
|
|
102
|
+
export function webrtcTransferUser(
|
|
103
|
+
user_id: string,
|
|
104
|
+
session_id: string,
|
|
105
|
+
connection_details?: Record<string, unknown>,
|
|
106
|
+
): Observable<void> {
|
|
107
|
+
const url = `${apiEndpoint()}${PATH}/transfer/${encodeURIComponent(user_id)}/${encodeURIComponent(session_id)}`;
|
|
108
|
+
return post(url, connection_details || {}).pipe(map(() => undefined));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get the WebRTC signaller websocket URL.
|
|
113
|
+
* This is the endpoint for managing call participants.
|
|
114
|
+
*/
|
|
115
|
+
export function webrtcSignallerUrl(): string {
|
|
116
|
+
const endpoint = apiEndpoint();
|
|
117
|
+
const wsProtocol = endpoint.startsWith('https') ? 'wss:' : 'ws:';
|
|
118
|
+
const httpProtocol = endpoint.startsWith('https') ? 'https:' : 'http:';
|
|
119
|
+
return endpoint.replace(httpProtocol, wsProtocol) + `${PATH}/signaller`;
|
|
120
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
2
|
+
|
|
3
|
+
/** Mapping of available query parameters for the webrtc rooms index endpoint */
|
|
4
|
+
export interface PlaceWebrtcRoomsQueryOptions extends PlaceResourceQueryOptions {}
|
|
5
|
+
|
|
6
|
+
/** Guest participant details for joining an anonymous chat room */
|
|
7
|
+
export interface PlaceGuestParticipant {
|
|
8
|
+
/** Captcha token for verification (required) */
|
|
9
|
+
captcha: string;
|
|
10
|
+
/** Display name for the guest (required) */
|
|
11
|
+
name: string;
|
|
12
|
+
/** User ID for the guest (required) */
|
|
13
|
+
user_id: string;
|
|
14
|
+
/** Session ID for the chat (required) */
|
|
15
|
+
session_id: string;
|
|
16
|
+
/** Email address of the guest */
|
|
17
|
+
email?: string;
|
|
18
|
+
/** Phone number of the guest */
|
|
19
|
+
phone?: string;
|
|
20
|
+
/** Type of participant */
|
|
21
|
+
type?: string;
|
|
22
|
+
/** User ID of the person to chat with directly */
|
|
23
|
+
chat_to_user_id?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Reason for kicking a user from a chat */
|
|
27
|
+
export interface PlaceKickReason {
|
|
28
|
+
/** Reason for ending the call (required) */
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Details of a WebRTC public chat room */
|
|
33
|
+
export interface PlaceWebrtcRoomDetails {
|
|
34
|
+
/** System information for the room */
|
|
35
|
+
system?: {
|
|
36
|
+
created_at?: number;
|
|
37
|
+
updated_at?: number;
|
|
38
|
+
name?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
features?: string[];
|
|
41
|
+
email?: string;
|
|
42
|
+
bookable?: boolean;
|
|
43
|
+
public?: boolean;
|
|
44
|
+
display_name?: string;
|
|
45
|
+
code?: string;
|
|
46
|
+
type?: string;
|
|
47
|
+
capacity?: number;
|
|
48
|
+
map_id?: string;
|
|
49
|
+
approval?: boolean;
|
|
50
|
+
images?: string[];
|
|
51
|
+
timezone?: Record<string, unknown>;
|
|
52
|
+
support_url?: string;
|
|
53
|
+
timetable_url?: string;
|
|
54
|
+
camera_snapshot_url?: string;
|
|
55
|
+
camera_url?: string;
|
|
56
|
+
room_booking_url?: string;
|
|
57
|
+
version?: number;
|
|
58
|
+
installed_ui_devices?: number;
|
|
59
|
+
zones?: string[];
|
|
60
|
+
modules?: string[];
|
|
61
|
+
orientation?: 'unspecified' | 'landscape' | 'portrait' | 'square';
|
|
62
|
+
playlists?: string[];
|
|
63
|
+
signage?: boolean;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Member details in a WebRTC chat session */
|
|
68
|
+
export interface PlaceWebrtcMember {
|
|
69
|
+
/** User ID of the member */
|
|
70
|
+
user_id?: string;
|
|
71
|
+
/** Display name of the member */
|
|
72
|
+
name?: string;
|
|
73
|
+
/** Email of the member */
|
|
74
|
+
email?: string;
|
|
75
|
+
/** Whether the member is a guest */
|
|
76
|
+
is_guest?: boolean;
|
|
77
|
+
}
|
package/src/zones/functions.ts
CHANGED
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
task,
|
|
8
8
|
update,
|
|
9
9
|
} from '../resources/functions';
|
|
10
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
10
11
|
import { PlaceTrigger } from '../triggers/trigger';
|
|
11
12
|
import { HashMap } from '../utilities/types';
|
|
12
|
-
import { PlaceZoneQueryOptions, PlaceZoneShowOptions } from './interfaces';
|
|
13
|
+
import { PlaceZoneMetadataQueryOptions, PlaceZoneQueryOptions, PlaceZoneShowOptions } from './interfaces';
|
|
13
14
|
import { PlaceZone } from './zone';
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -84,12 +85,11 @@ export function addZone(form_data: Partial<PlaceZone>) {
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* Remove
|
|
88
|
-
* @param id ID of the
|
|
89
|
-
* @param query_params Query parameters to add the to request URL
|
|
88
|
+
* Remove a zone from the database
|
|
89
|
+
* @param id ID of the zone
|
|
90
90
|
*/
|
|
91
|
-
export function removeZone(id: string
|
|
92
|
-
return remove({ id, query_params, path: PATH });
|
|
91
|
+
export function removeZone(id: string) {
|
|
92
|
+
return remove({ id, query_params: {}, path: PATH });
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
@@ -97,7 +97,10 @@ export function removeZone(id: string, query_params: HashMap = {}) {
|
|
|
97
97
|
* @param id ID of the zone
|
|
98
98
|
* @param query_params Query parameters to add the to request URL
|
|
99
99
|
*/
|
|
100
|
-
export function listZoneTriggers(
|
|
100
|
+
export function listZoneTriggers(
|
|
101
|
+
id: string,
|
|
102
|
+
query_params: PlaceResourceQueryOptions = {},
|
|
103
|
+
) {
|
|
101
104
|
return query({
|
|
102
105
|
query_params,
|
|
103
106
|
fn: (i: Partial<PlaceTrigger>) => new PlaceTrigger(i),
|
|
@@ -129,3 +132,21 @@ export function executeOnZone(
|
|
|
129
132
|
path: PATH,
|
|
130
133
|
});
|
|
131
134
|
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get metadata associated with the selected zone
|
|
138
|
+
* @param id Zone ID
|
|
139
|
+
* @param query_params Query parameters to add to the request
|
|
140
|
+
*/
|
|
141
|
+
export function zoneMetadata(
|
|
142
|
+
id: string,
|
|
143
|
+
query_params: PlaceZoneMetadataQueryOptions = {},
|
|
144
|
+
): Observable<HashMap> {
|
|
145
|
+
return task({
|
|
146
|
+
id,
|
|
147
|
+
task_name: 'metadata',
|
|
148
|
+
form_data: query_params,
|
|
149
|
+
method: 'get',
|
|
150
|
+
path: PATH,
|
|
151
|
+
});
|
|
152
|
+
}
|
package/src/zones/interfaces.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
2
2
|
|
|
3
|
-
/** Mapping of available query
|
|
3
|
+
/** Mapping of available query parameters for the zones index endpoint */
|
|
4
4
|
export interface PlaceZoneQueryOptions extends PlaceResourceQueryOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** ID of the parent zone to filter the results (supports comma-separated list) */
|
|
6
|
+
parent_id?: string;
|
|
7
|
+
/** List of space separated tags to filter the results */
|
|
6
8
|
tags?: string;
|
|
7
9
|
/** ID of the system to filter the results */
|
|
8
10
|
control_system_id?: string;
|
|
9
|
-
/** ID of the parent zone to filter the results */
|
|
10
|
-
parent_id?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/** Mapping of available query parameters for the zones show endpoint */
|
|
@@ -20,3 +20,9 @@ export interface PlaceZoneShowOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
data?: string;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/** Mapping of available query parameters for the zone metadata endpoint */
|
|
25
|
+
export interface PlaceZoneMetadataQueryOptions {
|
|
26
|
+
/** The name of the metadata key to retrieve */
|
|
27
|
+
name?: string;
|
|
28
|
+
}
|