@placeos/ts-client 4.7.10 → 4.8.1
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/api.d.ts +4 -3
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1651 -1589
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/signage/functions.d.ts +31 -1
- package/dist/signage/interfaces.d.ts +3 -0
- package/dist/signage/media.class.d.ts +4 -1
- package/dist/signage/plugin.class.d.ts +16 -0
- package/dist/systems/system.d.ts +2 -0
- package/package.json +1 -1
- package/src/api.ts +11 -0
- package/src/signage/functions.ts +89 -1
- package/src/signage/interfaces.ts +3 -0
- package/src/signage/media.class.ts +7 -1
- package/src/signage/plugin.class.ts +31 -0
- package/src/systems/system.ts +3 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { HttpJsonOptions } from '../http/interfaces';
|
|
2
|
-
import { SignageMediaQueryOptions, SignageMetrics } from './interfaces';
|
|
2
|
+
import { SignageMediaQueryOptions, SignageMetrics, SignagePluginQueryOptions } from './interfaces';
|
|
3
3
|
import { SignageMedia } from './media.class';
|
|
4
4
|
import { SignagePlaylist, SignagePlaylistMedia } from './playlist.class';
|
|
5
|
+
import { SignagePlugin } from './plugin.class';
|
|
5
6
|
/**
|
|
6
7
|
* Get the data for a signage item
|
|
7
8
|
* @param id ID of the signage item to retrieve
|
|
@@ -104,3 +105,32 @@ export declare function approveSignagePlaylist(id: string): import('rxjs').Obser
|
|
|
104
105
|
* @param form_data New list of media IDs for the playlist
|
|
105
106
|
*/
|
|
106
107
|
export declare function updateSignagePlaylistMedia(id: string, form_data: string[]): import('rxjs').Observable<SignagePlaylistMedia>;
|
|
108
|
+
/**
|
|
109
|
+
* Query the available signage plugins
|
|
110
|
+
* @param query_params Query parameters to add the to request URL
|
|
111
|
+
*/
|
|
112
|
+
export declare function querySignagePlugins(query_params?: SignagePluginQueryOptions): import('..').QueryResponse<SignagePlugin>;
|
|
113
|
+
/**
|
|
114
|
+
* Get the data for a signage plugin
|
|
115
|
+
* @param id ID of the signage plugin to retrieve
|
|
116
|
+
* @param query_params Query parameters to add the to request URL
|
|
117
|
+
*/
|
|
118
|
+
export declare function showSignagePlugin(id: string, query_params?: SignagePluginQueryOptions): import('rxjs').Observable<SignagePlugin>;
|
|
119
|
+
/**
|
|
120
|
+
* Update the signage plugin in the database
|
|
121
|
+
* @param id ID of the signage plugin
|
|
122
|
+
* @param form_data New values for the signage plugin
|
|
123
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
124
|
+
*/
|
|
125
|
+
export declare function updateSignagePlugin(id: string, form_data: Partial<SignagePlugin>, method?: 'put' | 'patch'): import('rxjs').Observable<SignagePlugin>;
|
|
126
|
+
/**
|
|
127
|
+
* Add a new signage plugin to the database
|
|
128
|
+
* @param form_data Signage plugin data
|
|
129
|
+
*/
|
|
130
|
+
export declare function addSignagePlugin(form_data: Partial<SignagePlugin>): import('rxjs').Observable<SignagePlugin>;
|
|
131
|
+
/**
|
|
132
|
+
* Remove a signage plugin from the database
|
|
133
|
+
* @param id ID of the signage plugin
|
|
134
|
+
* @param query_params Query parameters to add the to request URL
|
|
135
|
+
*/
|
|
136
|
+
export declare function removeSignagePlugin(id: string, query_params?: Record<string, any>): import('rxjs').Observable<import('../utilities/types').HashMap<any>>;
|
|
@@ -17,3 +17,6 @@ export interface SignagePlaylistRevisionsOptions {
|
|
|
17
17
|
/** Maximum number of revisions to return */
|
|
18
18
|
limit?: number;
|
|
19
19
|
}
|
|
20
|
+
/** Allowable query parameters for signage plugins index endpoint */
|
|
21
|
+
export interface SignagePluginQueryOptions extends PlaceResourceQueryOptions {
|
|
22
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { HashMap } from '../utilities/types';
|
|
2
|
+
export type MediaType = 'unknown' | 'image' | 'video' | 'audio' | 'plugin' | 'webpage' | 'externalimage' | 'external_image';
|
|
2
3
|
export declare enum MediaAnimation {
|
|
3
4
|
Default = 0,
|
|
4
5
|
Cut = 1,
|
|
@@ -25,6 +26,8 @@ export declare class SignageMedia {
|
|
|
25
26
|
readonly media_uri: string;
|
|
26
27
|
readonly media_id: string;
|
|
27
28
|
readonly thumbnail_id: string;
|
|
29
|
+
readonly plugin_id: string;
|
|
30
|
+
readonly plugin_params: HashMap;
|
|
28
31
|
readonly play_count: number;
|
|
29
32
|
readonly valid_from?: number;
|
|
30
33
|
readonly valid_until?: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HashMap } from '../utilities/types';
|
|
2
|
+
export type SignagePlaybackType = 'static' | 'interactive' | 'playsthrough';
|
|
3
|
+
export declare class SignagePlugin {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly created_at: number;
|
|
6
|
+
readonly updated_at: number;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly uri: string;
|
|
10
|
+
readonly playback_type: SignagePlaybackType;
|
|
11
|
+
readonly authority_id: string;
|
|
12
|
+
readonly enabled: boolean;
|
|
13
|
+
readonly params: HashMap;
|
|
14
|
+
readonly defaults: HashMap;
|
|
15
|
+
constructor(data?: Partial<SignagePlugin>);
|
|
16
|
+
}
|
package/dist/systems/system.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export declare class PlaceSystem extends PlaceResource {
|
|
|
38
38
|
/** URL for the timetable UI linked to the system */
|
|
39
39
|
readonly timetable_url: string;
|
|
40
40
|
/** URLs for requesting snapshots of the assosiated camera */
|
|
41
|
+
readonly camera_snapshot_url: string;
|
|
42
|
+
/** URLs for requesting snapshots of the assosiated camera */
|
|
41
43
|
readonly camera_snapshot_urls: string[];
|
|
42
44
|
/** URL for managing the attached camera */
|
|
43
45
|
readonly camera_url: string;
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -363,37 +363,48 @@ export { PlaceZone } from './zones/zone';
|
|
|
363
363
|
export {
|
|
364
364
|
addSignageMedia,
|
|
365
365
|
addSignagePlaylist,
|
|
366
|
+
addSignagePlugin,
|
|
366
367
|
approveSignagePlaylist,
|
|
367
368
|
listSignagePlaylistMedia,
|
|
368
369
|
listSignagePlaylistMediaRevisions,
|
|
369
370
|
mediaThumbnail,
|
|
370
371
|
querySignageMedia,
|
|
371
372
|
querySignagePlaylists,
|
|
373
|
+
querySignagePlugins,
|
|
372
374
|
removeSignageMedia,
|
|
373
375
|
removeSignagePlaylist,
|
|
376
|
+
removeSignagePlugin,
|
|
374
377
|
showSignage,
|
|
375
378
|
showSignageMedia,
|
|
376
379
|
showSignageMetrics,
|
|
377
380
|
showSignagePlaylist,
|
|
381
|
+
showSignagePlugin,
|
|
378
382
|
updateSignageMedia,
|
|
379
383
|
updateSignagePlaylist,
|
|
380
384
|
updateSignagePlaylistMedia,
|
|
385
|
+
updateSignagePlugin,
|
|
381
386
|
} from './signage/functions';
|
|
382
387
|
export type {
|
|
383
388
|
SignageMediaQueryOptions,
|
|
384
389
|
SignageMetrics,
|
|
385
390
|
SignagePlaylistQueryOptions,
|
|
386
391
|
SignagePlaylistRevisionsOptions,
|
|
392
|
+
SignagePluginQueryOptions,
|
|
387
393
|
} from './signage/interfaces';
|
|
388
394
|
export {
|
|
389
395
|
MediaAnimation,
|
|
390
396
|
SignageMedia,
|
|
391
397
|
type MediaOrientation,
|
|
398
|
+
type MediaType,
|
|
392
399
|
} from './signage/media.class';
|
|
393
400
|
export {
|
|
394
401
|
SignagePlaylist,
|
|
395
402
|
SignagePlaylistMedia,
|
|
396
403
|
} from './signage/playlist.class';
|
|
404
|
+
export {
|
|
405
|
+
SignagePlugin,
|
|
406
|
+
type SignagePlaybackType,
|
|
407
|
+
} from './signage/plugin.class';
|
|
397
408
|
|
|
398
409
|
export { addAnswer, queryAnswers } from './staff/answers/functions';
|
|
399
410
|
export type { AnswerQueryOptions } from './staff/answers/interfaces';
|
package/src/signage/functions.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { create, query, remove, show, update } from '../api';
|
|
|
2
2
|
import { apiEndpoint } from '../auth';
|
|
3
3
|
import { HttpJsonOptions } from '../http/interfaces';
|
|
4
4
|
import { task } from '../resources/functions';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
SignageMediaQueryOptions,
|
|
7
|
+
SignageMetrics,
|
|
8
|
+
SignagePluginQueryOptions,
|
|
9
|
+
} from './interfaces';
|
|
6
10
|
import { SignageMedia } from './media.class';
|
|
7
11
|
import { SignagePlaylist, SignagePlaylistMedia } from './playlist.class';
|
|
12
|
+
import { SignagePlugin } from './plugin.class';
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* @private
|
|
@@ -282,3 +287,86 @@ export function updateSignagePlaylistMedia(id: string, form_data: string[]) {
|
|
|
282
287
|
new SignagePlaylistMedia(value),
|
|
283
288
|
});
|
|
284
289
|
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
const PLUGINS_PATH = 'signage/plugins';
|
|
295
|
+
|
|
296
|
+
/** Convert raw server data to a signage plugin object */
|
|
297
|
+
function processPlugin(item: Partial<SignagePlugin>) {
|
|
298
|
+
return new SignagePlugin(item);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Query the available signage plugins
|
|
303
|
+
* @param query_params Query parameters to add the to request URL
|
|
304
|
+
*/
|
|
305
|
+
export function querySignagePlugins(
|
|
306
|
+
query_params: SignagePluginQueryOptions = {},
|
|
307
|
+
) {
|
|
308
|
+
return query({ query_params, fn: processPlugin, path: PLUGINS_PATH });
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Get the data for a signage plugin
|
|
313
|
+
* @param id ID of the signage plugin to retrieve
|
|
314
|
+
* @param query_params Query parameters to add the to request URL
|
|
315
|
+
*/
|
|
316
|
+
export function showSignagePlugin(
|
|
317
|
+
id: string,
|
|
318
|
+
query_params: SignagePluginQueryOptions = {},
|
|
319
|
+
) {
|
|
320
|
+
return show({
|
|
321
|
+
id,
|
|
322
|
+
query_params,
|
|
323
|
+
fn: processPlugin,
|
|
324
|
+
path: PLUGINS_PATH,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Update the signage plugin in the database
|
|
330
|
+
* @param id ID of the signage plugin
|
|
331
|
+
* @param form_data New values for the signage plugin
|
|
332
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
333
|
+
*/
|
|
334
|
+
export function updateSignagePlugin(
|
|
335
|
+
id: string,
|
|
336
|
+
form_data: Partial<SignagePlugin>,
|
|
337
|
+
method: 'put' | 'patch' = 'patch',
|
|
338
|
+
) {
|
|
339
|
+
return update({
|
|
340
|
+
id,
|
|
341
|
+
form_data,
|
|
342
|
+
query_params: {},
|
|
343
|
+
method,
|
|
344
|
+
fn: processPlugin,
|
|
345
|
+
path: PLUGINS_PATH,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Add a new signage plugin to the database
|
|
351
|
+
* @param form_data Signage plugin data
|
|
352
|
+
*/
|
|
353
|
+
export function addSignagePlugin(form_data: Partial<SignagePlugin>) {
|
|
354
|
+
return create({
|
|
355
|
+
form_data,
|
|
356
|
+
query_params: {},
|
|
357
|
+
fn: processPlugin,
|
|
358
|
+
path: PLUGINS_PATH,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Remove a signage plugin from the database
|
|
364
|
+
* @param id ID of the signage plugin
|
|
365
|
+
* @param query_params Query parameters to add the to request URL
|
|
366
|
+
*/
|
|
367
|
+
export function removeSignagePlugin(
|
|
368
|
+
id: string,
|
|
369
|
+
query_params: Record<string, any> = {},
|
|
370
|
+
) {
|
|
371
|
+
return remove({ id, query_params, path: PLUGINS_PATH });
|
|
372
|
+
}
|
|
@@ -20,3 +20,6 @@ export interface SignagePlaylistRevisionsOptions {
|
|
|
20
20
|
/** Maximum number of revisions to return */
|
|
21
21
|
limit?: number;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/** Allowable query parameters for signage plugins index endpoint */
|
|
25
|
+
export interface SignagePluginQueryOptions extends PlaceResourceQueryOptions {}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getUnixTime } from 'date-fns';
|
|
2
|
+
import { HashMap } from '../utilities/types';
|
|
2
3
|
|
|
3
4
|
export type MediaType =
|
|
4
5
|
| 'unknown'
|
|
@@ -7,7 +8,8 @@ export type MediaType =
|
|
|
7
8
|
| 'audio'
|
|
8
9
|
| 'plugin'
|
|
9
10
|
| 'webpage'
|
|
10
|
-
| 'externalimage'
|
|
11
|
+
| 'externalimage'
|
|
12
|
+
| 'external_image';
|
|
11
13
|
|
|
12
14
|
export enum MediaAnimation {
|
|
13
15
|
Default = 0,
|
|
@@ -41,6 +43,8 @@ export class SignageMedia {
|
|
|
41
43
|
public readonly media_uri: string;
|
|
42
44
|
public readonly media_id: string;
|
|
43
45
|
public readonly thumbnail_id: string;
|
|
46
|
+
public readonly plugin_id: string;
|
|
47
|
+
public readonly plugin_params: HashMap;
|
|
44
48
|
public readonly play_count: number;
|
|
45
49
|
public readonly valid_from?: number;
|
|
46
50
|
public readonly valid_until?: number;
|
|
@@ -71,6 +75,8 @@ export class SignageMedia {
|
|
|
71
75
|
this.media_uri = data.media_uri || '';
|
|
72
76
|
this.media_id = data.media_id || '';
|
|
73
77
|
this.thumbnail_id = data.thumbnail_id || '';
|
|
78
|
+
this.plugin_id = data.plugin_id || '';
|
|
79
|
+
this.plugin_params = data.plugin_params || {};
|
|
74
80
|
this.play_count = data.play_count || 0;
|
|
75
81
|
this.valid_from = data.valid_from;
|
|
76
82
|
this.valid_until = data.valid_until;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HashMap } from '../utilities/types';
|
|
2
|
+
|
|
3
|
+
export type SignagePlaybackType = 'static' | 'interactive' | 'playsthrough';
|
|
4
|
+
|
|
5
|
+
export class SignagePlugin {
|
|
6
|
+
public readonly id: string;
|
|
7
|
+
public readonly created_at: number;
|
|
8
|
+
public readonly updated_at: number;
|
|
9
|
+
public readonly name: string;
|
|
10
|
+
public readonly description: string;
|
|
11
|
+
public readonly uri: string;
|
|
12
|
+
public readonly playback_type: SignagePlaybackType;
|
|
13
|
+
public readonly authority_id: string;
|
|
14
|
+
public readonly enabled: boolean;
|
|
15
|
+
public readonly params: HashMap;
|
|
16
|
+
public readonly defaults: HashMap;
|
|
17
|
+
|
|
18
|
+
constructor(data: Partial<SignagePlugin> = {}) {
|
|
19
|
+
this.id = data.id || '';
|
|
20
|
+
this.created_at = data.created_at || 0;
|
|
21
|
+
this.updated_at = data.updated_at || 0;
|
|
22
|
+
this.name = data.name || '';
|
|
23
|
+
this.description = data.description || '';
|
|
24
|
+
this.uri = data.uri || '';
|
|
25
|
+
this.playback_type = data.playback_type || 'static';
|
|
26
|
+
this.authority_id = data.authority_id || '';
|
|
27
|
+
this.enabled = data.enabled ?? true;
|
|
28
|
+
this.params = data.params || {};
|
|
29
|
+
this.defaults = data.defaults || {};
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/systems/system.ts
CHANGED
|
@@ -41,6 +41,8 @@ export class PlaceSystem extends PlaceResource {
|
|
|
41
41
|
/** URL for the timetable UI linked to the system */
|
|
42
42
|
public readonly timetable_url: string;
|
|
43
43
|
/** URLs for requesting snapshots of the assosiated camera */
|
|
44
|
+
public readonly camera_snapshot_url: string;
|
|
45
|
+
/** URLs for requesting snapshots of the assosiated camera */
|
|
44
46
|
public readonly camera_snapshot_urls: string[];
|
|
45
47
|
/** URL for managing the attached camera */
|
|
46
48
|
public readonly camera_url: string;
|
|
@@ -85,6 +87,7 @@ export class PlaceSystem extends PlaceResource {
|
|
|
85
87
|
this.public = raw_data.public ?? false;
|
|
86
88
|
this.installed_ui_devices = raw_data.installed_ui_devices || 0;
|
|
87
89
|
this.support_url = raw_data.support_url || '';
|
|
90
|
+
this.camera_snapshot_url = raw_data.camera_snapshot_url || '';
|
|
88
91
|
this.camera_snapshot_urls = raw_data.camera_snapshot_urls || [];
|
|
89
92
|
this.camera_url = raw_data.camera_url || '';
|
|
90
93
|
this.timetable_url = raw_data.timetable_url || '';
|