@placeos/ts-client 4.4.4 → 4.6.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/api.d.ts +2 -0
- package/dist/assets/assets.class.d.ts +62 -0
- package/dist/assets/functions.d.ts +146 -0
- package/dist/assets/types.d.ts +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2159 -1874
- 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/systems/system.d.ts +8 -0
- package/package.json +1 -1
- package/src/api.ts +32 -0
- package/src/assets/assets.class.ts +123 -0
- package/src/assets/functions.ts +435 -0
- package/src/assets/types.ts +0 -0
- package/src/systems/system.ts +12 -0
package/dist/systems/system.d.ts
CHANGED
|
@@ -35,6 +35,14 @@ export declare class PlaceSystem extends PlaceResource {
|
|
|
35
35
|
readonly installed_ui_devices: number;
|
|
36
36
|
/** Support URL for the system */
|
|
37
37
|
readonly support_url: string;
|
|
38
|
+
/** URL for the timetable UI linked to the system */
|
|
39
|
+
readonly timetable_url: string;
|
|
40
|
+
/** URL for requesting snapshots of the assosiated camera */
|
|
41
|
+
readonly camera_snapshot_url: string;
|
|
42
|
+
/** URL for managing the attached camera */
|
|
43
|
+
readonly camera_url: string;
|
|
44
|
+
/** External booking URL for the system */
|
|
45
|
+
readonly room_booking_url: string;
|
|
38
46
|
/** ID on the SVG Map associated with this system */
|
|
39
47
|
readonly map_id: string;
|
|
40
48
|
/** List of module IDs that belong to the system */
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -377,3 +377,35 @@ export type {
|
|
|
377
377
|
SurveyShowOptions,
|
|
378
378
|
} from './staff/surveys/interfaces';
|
|
379
379
|
export { Survey, type SurveyPage } from './staff/surveys/model';
|
|
380
|
+
|
|
381
|
+
export {
|
|
382
|
+
PlaceAsset,
|
|
383
|
+
PlaceAssetCategory,
|
|
384
|
+
PlaceAssetPurchaseOrder,
|
|
385
|
+
PlaceAssetType,
|
|
386
|
+
} from './assets/assets.class';
|
|
387
|
+
export {
|
|
388
|
+
addAsset,
|
|
389
|
+
addAssetCategory,
|
|
390
|
+
addAssetPurchaseOrder,
|
|
391
|
+
addAssetType,
|
|
392
|
+
addAssets,
|
|
393
|
+
queryAssetCategories,
|
|
394
|
+
queryAssetPurchaseOrders,
|
|
395
|
+
queryAssetTypes,
|
|
396
|
+
queryAssets,
|
|
397
|
+
removeAsset,
|
|
398
|
+
removeAssetCategory,
|
|
399
|
+
removeAssetPurchaseOrder,
|
|
400
|
+
removeAssetType,
|
|
401
|
+
removeAssets,
|
|
402
|
+
showAsset,
|
|
403
|
+
showAssetCategory,
|
|
404
|
+
showAssetPurchaseOrder,
|
|
405
|
+
showAssetType,
|
|
406
|
+
updateAsset,
|
|
407
|
+
updateAssetCategory,
|
|
408
|
+
updateAssetPurchaseOrder,
|
|
409
|
+
updateAssetType,
|
|
410
|
+
updateAssets,
|
|
411
|
+
} from './assets/functions';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export class PlaceAssetCategory {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly parent_category_id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly hidden: boolean;
|
|
7
|
+
readonly created_at: number;
|
|
8
|
+
readonly updated_at: number;
|
|
9
|
+
|
|
10
|
+
constructor(data: Partial<PlaceAssetCategory>) {
|
|
11
|
+
this.id = data.id || '';
|
|
12
|
+
this.parent_category_id = data.parent_category_id || '';
|
|
13
|
+
this.name = data.name || '';
|
|
14
|
+
this.description = data.description || '';
|
|
15
|
+
this.hidden = data.hidden || false;
|
|
16
|
+
this.created_at = data.created_at || 0;
|
|
17
|
+
this.updated_at = data.updated_at || 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class PlaceAssetPurchaseOrder {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly purchase_order_number: string;
|
|
24
|
+
readonly invoice_number: string;
|
|
25
|
+
readonly supplier_details: Record<string, string>;
|
|
26
|
+
readonly purchase_date: number;
|
|
27
|
+
readonly unit_price: number;
|
|
28
|
+
readonly expected_service_start_date: number;
|
|
29
|
+
readonly expected_service_end_date: number;
|
|
30
|
+
readonly created_at: number;
|
|
31
|
+
readonly updated_at: number;
|
|
32
|
+
|
|
33
|
+
constructor(data: Partial<PlaceAssetPurchaseOrder>) {
|
|
34
|
+
this.id = data.id || '';
|
|
35
|
+
this.purchase_order_number = data.purchase_order_number || '';
|
|
36
|
+
this.invoice_number = data.invoice_number || '';
|
|
37
|
+
this.supplier_details = data.supplier_details || {};
|
|
38
|
+
this.purchase_date = data.purchase_date || 0;
|
|
39
|
+
this.unit_price = data.unit_price || 0;
|
|
40
|
+
this.expected_service_start_date = data.expected_service_start_date || 0;
|
|
41
|
+
this.expected_service_end_date = data.expected_service_end_date || 0;
|
|
42
|
+
this.created_at = data.created_at || 0;
|
|
43
|
+
this.updated_at = data.updated_at || 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class PlaceAssetType {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly category_id: string;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly brand: string;
|
|
52
|
+
readonly description: string;
|
|
53
|
+
readonly model_number: string;
|
|
54
|
+
readonly images: string[];
|
|
55
|
+
readonly created_at: number;
|
|
56
|
+
readonly updated_at: number;
|
|
57
|
+
|
|
58
|
+
constructor(data: Partial<PlaceAssetType>) {
|
|
59
|
+
this.id = data.id || '';
|
|
60
|
+
this.category_id = data.category_id || '';
|
|
61
|
+
this.name = data.name || '';
|
|
62
|
+
this.brand = data.brand || '';
|
|
63
|
+
this.description = data.description || '';
|
|
64
|
+
this.model_number = data.model_number || '';
|
|
65
|
+
this.images = data.images || [];
|
|
66
|
+
this.created_at = data.created_at || 0;
|
|
67
|
+
this.updated_at = data.updated_at || 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class PlaceAsset {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly parent_id: string;
|
|
74
|
+
readonly asset_type_id: string;
|
|
75
|
+
readonly purchase_order_id: string;
|
|
76
|
+
readonly zone_id: string;
|
|
77
|
+
readonly identifier: string;
|
|
78
|
+
readonly serial_number: string;
|
|
79
|
+
readonly other_data: Record<string, string>;
|
|
80
|
+
readonly barcode: string;
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly client_ids: Record<string, string>;
|
|
83
|
+
readonly map_id: string;
|
|
84
|
+
readonly bookable: boolean;
|
|
85
|
+
readonly accessible: boolean;
|
|
86
|
+
readonly zones: string[];
|
|
87
|
+
readonly place_groups: string[];
|
|
88
|
+
readonly assigned_to: string;
|
|
89
|
+
readonly assigned_name: string;
|
|
90
|
+
readonly features: string[];
|
|
91
|
+
readonly images: string[];
|
|
92
|
+
readonly notes: string;
|
|
93
|
+
readonly security_system_groups: string[];
|
|
94
|
+
readonly created_at: number;
|
|
95
|
+
readonly updated_at: number;
|
|
96
|
+
|
|
97
|
+
constructor(data: Partial<PlaceAsset>) {
|
|
98
|
+
this.id = data.id || '';
|
|
99
|
+
this.parent_id = data.parent_id || '';
|
|
100
|
+
this.asset_type_id = data.asset_type_id || '';
|
|
101
|
+
this.purchase_order_id = data.purchase_order_id || '';
|
|
102
|
+
this.zone_id = data.zone_id || '';
|
|
103
|
+
this.identifier = data.identifier || '';
|
|
104
|
+
this.serial_number = data.serial_number || '';
|
|
105
|
+
this.other_data = data.other_data || {};
|
|
106
|
+
this.barcode = data.barcode || '';
|
|
107
|
+
this.name = data.name || '';
|
|
108
|
+
this.client_ids = data.client_ids || {};
|
|
109
|
+
this.map_id = data.map_id || '';
|
|
110
|
+
this.bookable = data.bookable || false;
|
|
111
|
+
this.accessible = data.accessible || false;
|
|
112
|
+
this.zones = data.zones || [];
|
|
113
|
+
this.place_groups = data.place_groups || [];
|
|
114
|
+
this.assigned_to = data.assigned_to || '';
|
|
115
|
+
this.assigned_name = data.assigned_name || '';
|
|
116
|
+
this.features = data.features || [];
|
|
117
|
+
this.images = data.images || [];
|
|
118
|
+
this.notes = data.notes || '';
|
|
119
|
+
this.security_system_groups = data.security_system_groups || [];
|
|
120
|
+
this.created_at = data.created_at || 0;
|
|
121
|
+
this.updated_at = data.updated_at || 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { map } from 'rxjs';
|
|
2
|
+
import {
|
|
3
|
+
create,
|
|
4
|
+
del,
|
|
5
|
+
patch,
|
|
6
|
+
post,
|
|
7
|
+
put,
|
|
8
|
+
query,
|
|
9
|
+
remove,
|
|
10
|
+
show,
|
|
11
|
+
update,
|
|
12
|
+
} from '../api';
|
|
13
|
+
import { apiEndpoint } from '../auth';
|
|
14
|
+
import { PlaceResourceQueryOptions } from '../resources/interface';
|
|
15
|
+
import { toQueryString } from '../utilities/api';
|
|
16
|
+
import {
|
|
17
|
+
PlaceAsset,
|
|
18
|
+
PlaceAssetCategory,
|
|
19
|
+
PlaceAssetPurchaseOrder,
|
|
20
|
+
PlaceAssetType,
|
|
21
|
+
} from './assets.class';
|
|
22
|
+
|
|
23
|
+
///////////////////////////////////////////////////////////////
|
|
24
|
+
////////////////////////// Assets /////////////////////////
|
|
25
|
+
///////////////////////////////////////////////////////////////
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
const ASSET_PATH = 'assets';
|
|
31
|
+
|
|
32
|
+
/** Convert raw server data to an asset object */
|
|
33
|
+
function processAsset(item: Partial<PlaceAsset>) {
|
|
34
|
+
return new PlaceAsset(item);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Query the available assets
|
|
39
|
+
* @param query_params Query parameters to add the to request URL
|
|
40
|
+
*/
|
|
41
|
+
export function queryAssets(query_params: PlaceResourceQueryOptions = {}) {
|
|
42
|
+
return query({
|
|
43
|
+
query_params,
|
|
44
|
+
fn: processAsset,
|
|
45
|
+
path: ASSET_PATH,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the data for an asset
|
|
51
|
+
* @param id ID of the asset to retrieve
|
|
52
|
+
* @param query_params Query parameters to add the to request URL
|
|
53
|
+
*/
|
|
54
|
+
export function showAsset(id: string, query_params: Record<string, any> = {}) {
|
|
55
|
+
return show({
|
|
56
|
+
id,
|
|
57
|
+
query_params,
|
|
58
|
+
fn: processAsset,
|
|
59
|
+
path: ASSET_PATH,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Update the asset in the database
|
|
65
|
+
* @param id ID of the asset
|
|
66
|
+
* @param form_data New values for the asset
|
|
67
|
+
* @param query_params Query parameters to add the to request URL
|
|
68
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
69
|
+
*/
|
|
70
|
+
export function updateAsset(
|
|
71
|
+
id: string,
|
|
72
|
+
form_data: Partial<PlaceAsset>,
|
|
73
|
+
method: 'put' | 'patch' = 'patch',
|
|
74
|
+
) {
|
|
75
|
+
return update({
|
|
76
|
+
id,
|
|
77
|
+
form_data,
|
|
78
|
+
query_params: {},
|
|
79
|
+
method,
|
|
80
|
+
fn: processAsset,
|
|
81
|
+
path: ASSET_PATH,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Add a new asset to the database
|
|
87
|
+
* @param form_data Application data
|
|
88
|
+
* @param query_params Query parameters to add the to request URL
|
|
89
|
+
*/
|
|
90
|
+
export function addAsset(form_data: Partial<PlaceAsset>) {
|
|
91
|
+
return create({
|
|
92
|
+
form_data,
|
|
93
|
+
query_params: {},
|
|
94
|
+
fn: processAsset,
|
|
95
|
+
path: ASSET_PATH,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Remove an asset from the database
|
|
101
|
+
* @param id ID of the asset
|
|
102
|
+
* @param query_params Query parameters to add the to request URL
|
|
103
|
+
*/
|
|
104
|
+
export function removeAsset(
|
|
105
|
+
id: string,
|
|
106
|
+
query_params: Record<string, any> = {},
|
|
107
|
+
) {
|
|
108
|
+
return remove({ id, query_params, path: ASSET_PATH });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Add a list of new assets to the database
|
|
113
|
+
* @param form_data List of asset data
|
|
114
|
+
* @param query_params Query parameters to add the to request URL
|
|
115
|
+
*/
|
|
116
|
+
export function addAssets(form_data: Partial<PlaceAsset>[]) {
|
|
117
|
+
return post(
|
|
118
|
+
`${apiEndpoint()}${ASSET_PATH}/bulk`,
|
|
119
|
+
JSON.stringify(form_data),
|
|
120
|
+
{},
|
|
121
|
+
).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Update a list of assets in the database
|
|
126
|
+
* @param id ID of the asset
|
|
127
|
+
* @param form_data New values for the asset
|
|
128
|
+
* @param query_params Query parameters to add the to request URL
|
|
129
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
130
|
+
*/
|
|
131
|
+
export function updateAssets(
|
|
132
|
+
form_data: Partial<PlaceAsset>[],
|
|
133
|
+
method: 'put' | 'patch' = 'patch',
|
|
134
|
+
) {
|
|
135
|
+
const verb = method === 'put' ? put : patch;
|
|
136
|
+
return verb(
|
|
137
|
+
`${apiEndpoint()}${ASSET_PATH}/bulk`,
|
|
138
|
+
JSON.stringify(form_data),
|
|
139
|
+
{},
|
|
140
|
+
).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Remove an asset from the database
|
|
145
|
+
* @param id ID of the asset
|
|
146
|
+
* @param query_params Query parameters to add the to request URL
|
|
147
|
+
*/
|
|
148
|
+
export function removeAssets(
|
|
149
|
+
id_list: string[],
|
|
150
|
+
query_params: Record<string, any> = {},
|
|
151
|
+
) {
|
|
152
|
+
const q = toQueryString(query_params);
|
|
153
|
+
return del(`${apiEndpoint()}${ASSET_PATH}/bulk${q ? '?' + q : ''}`, {
|
|
154
|
+
body: JSON.stringify(id_list),
|
|
155
|
+
}).pipe(map((l: any) => l.map((_: any) => processAsset(_))));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
///////////////////////////////////////////////////////////////
|
|
159
|
+
//////////////////////// Asset Types //////////////////////
|
|
160
|
+
///////////////////////////////////////////////////////////////
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
165
|
+
const ASSET_TYPE_PATH = 'asset_types';
|
|
166
|
+
|
|
167
|
+
/** Convert raw server data to an asset type object */
|
|
168
|
+
function processAssetType(item: Partial<PlaceAssetType>) {
|
|
169
|
+
return new PlaceAssetType(item);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Query the available asset types
|
|
174
|
+
* @param query_params Query parameters to add the to request URL
|
|
175
|
+
*/
|
|
176
|
+
export function queryAssetTypes(query_params: PlaceResourceQueryOptions = {}) {
|
|
177
|
+
return query({
|
|
178
|
+
query_params,
|
|
179
|
+
fn: processAssetType,
|
|
180
|
+
path: ASSET_TYPE_PATH,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get the data for an asset type
|
|
186
|
+
* @param id ID of the asset type to retrieve
|
|
187
|
+
* @param query_params Query parameters to add the to request URL
|
|
188
|
+
*/
|
|
189
|
+
export function showAssetType(
|
|
190
|
+
id: string,
|
|
191
|
+
query_params: Record<string, any> = {},
|
|
192
|
+
) {
|
|
193
|
+
return show({
|
|
194
|
+
id,
|
|
195
|
+
query_params,
|
|
196
|
+
fn: processAssetType,
|
|
197
|
+
path: ASSET_TYPE_PATH,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Update the asset type in the database
|
|
203
|
+
* @param id ID of the asset type
|
|
204
|
+
* @param form_data New values for the asset
|
|
205
|
+
* @param query_params Query parameters to add the to request URL
|
|
206
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
207
|
+
*/
|
|
208
|
+
export function updateAssetType(
|
|
209
|
+
id: string,
|
|
210
|
+
form_data: Partial<PlaceAssetType>,
|
|
211
|
+
method: 'put' | 'patch' = 'patch',
|
|
212
|
+
) {
|
|
213
|
+
return update({
|
|
214
|
+
id,
|
|
215
|
+
form_data,
|
|
216
|
+
query_params: {},
|
|
217
|
+
method,
|
|
218
|
+
fn: processAssetType,
|
|
219
|
+
path: ASSET_TYPE_PATH,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Add a new asset type to the database
|
|
225
|
+
* @param form_data Application data
|
|
226
|
+
* @param query_params Query parameters to add the to request URL
|
|
227
|
+
*/
|
|
228
|
+
export function addAssetType(form_data: Partial<PlaceAssetType>) {
|
|
229
|
+
return create({
|
|
230
|
+
form_data,
|
|
231
|
+
query_params: {},
|
|
232
|
+
fn: processAssetType,
|
|
233
|
+
path: ASSET_TYPE_PATH,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Remove an asset type from the database
|
|
239
|
+
* @param id ID of the asset type
|
|
240
|
+
* @param query_params Query parameters to add the to request URL
|
|
241
|
+
*/
|
|
242
|
+
export function removeAssetType(
|
|
243
|
+
id: string,
|
|
244
|
+
query_params: Record<string, any> = {},
|
|
245
|
+
) {
|
|
246
|
+
return remove({ id, query_params, path: ASSET_TYPE_PATH });
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
///////////////////////////////////////////////////////////////
|
|
250
|
+
///////////////////// Asset Categories ////////////////////
|
|
251
|
+
///////////////////////////////////////////////////////////////
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @private
|
|
255
|
+
*/
|
|
256
|
+
const ASSET_CATEGORY_PATH = 'asset_categories';
|
|
257
|
+
|
|
258
|
+
/** Convert raw server data to an asset category object */
|
|
259
|
+
function processAssetCategory(item: Partial<PlaceAssetCategory>) {
|
|
260
|
+
return new PlaceAssetCategory(item);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Query the available asset categories
|
|
265
|
+
* @param query_params Query parameters to add the to request URL
|
|
266
|
+
*/
|
|
267
|
+
export function queryAssetCategories(
|
|
268
|
+
query_params: PlaceResourceQueryOptions = {},
|
|
269
|
+
) {
|
|
270
|
+
return query({
|
|
271
|
+
query_params,
|
|
272
|
+
fn: processAssetCategory,
|
|
273
|
+
path: ASSET_CATEGORY_PATH,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Get the data for an asset category
|
|
279
|
+
* @param id ID of the asset category to retrieve
|
|
280
|
+
* @param query_params Query parameters to add the to request URL
|
|
281
|
+
*/
|
|
282
|
+
export function showAssetCategory(
|
|
283
|
+
id: string,
|
|
284
|
+
query_params: Record<string, any> = {},
|
|
285
|
+
) {
|
|
286
|
+
return show({
|
|
287
|
+
id,
|
|
288
|
+
query_params,
|
|
289
|
+
fn: processAssetCategory,
|
|
290
|
+
path: ASSET_CATEGORY_PATH,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Update the asset category in the database
|
|
296
|
+
* @param id ID of the asset category
|
|
297
|
+
* @param form_data New values for the asset category
|
|
298
|
+
* @param query_params Query parameters to add the to request URL
|
|
299
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
300
|
+
*/
|
|
301
|
+
export function updateAssetCategory(
|
|
302
|
+
id: string,
|
|
303
|
+
form_data: Partial<PlaceAssetCategory>,
|
|
304
|
+
method: 'put' | 'patch' = 'patch',
|
|
305
|
+
) {
|
|
306
|
+
return update({
|
|
307
|
+
id,
|
|
308
|
+
form_data,
|
|
309
|
+
query_params: {},
|
|
310
|
+
method,
|
|
311
|
+
fn: processAssetCategory,
|
|
312
|
+
path: ASSET_CATEGORY_PATH,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Add a new asset category to the database
|
|
318
|
+
* @param form_data Asset category data
|
|
319
|
+
* @param query_params Query parameters to add the to request URL
|
|
320
|
+
*/
|
|
321
|
+
export function addAssetCategory(form_data: Partial<PlaceAssetCategory>) {
|
|
322
|
+
return create({
|
|
323
|
+
form_data,
|
|
324
|
+
query_params: {},
|
|
325
|
+
fn: processAssetCategory,
|
|
326
|
+
path: ASSET_CATEGORY_PATH,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Remove an asset category from the database
|
|
332
|
+
* @param id ID of the asset category
|
|
333
|
+
* @param query_params Query parameters to add the to request URL
|
|
334
|
+
*/
|
|
335
|
+
export function removeAssetCategory(
|
|
336
|
+
id: string,
|
|
337
|
+
query_params: Record<string, any> = {},
|
|
338
|
+
) {
|
|
339
|
+
return remove({ id, query_params, path: ASSET_CATEGORY_PATH });
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
///////////////////////////////////////////////////////////////
|
|
343
|
+
////////////////// Asset Purchase Orders //////////////////
|
|
344
|
+
///////////////////////////////////////////////////////////////
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
const ASSET_PURCHASE_ORDER_PATH = 'asset_purchase_orders';
|
|
350
|
+
|
|
351
|
+
/** Convert raw server data to an asset purchase order object */
|
|
352
|
+
function processAssetPurchaseOrder(item: Partial<PlaceAssetPurchaseOrder>) {
|
|
353
|
+
return new PlaceAssetPurchaseOrder(item);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Query the available asset purchase orders
|
|
358
|
+
* @param query_params Query parameters to add the to request URL
|
|
359
|
+
*/
|
|
360
|
+
export function queryAssetPurchaseOrders(
|
|
361
|
+
query_params: PlaceResourceQueryOptions = {},
|
|
362
|
+
) {
|
|
363
|
+
return query({
|
|
364
|
+
query_params,
|
|
365
|
+
fn: processAssetPurchaseOrder,
|
|
366
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Get the data for an asset purchase order
|
|
372
|
+
* @param id ID of the asset purchase order to retrieve
|
|
373
|
+
* @param query_params Query parameters to add the to request URL
|
|
374
|
+
*/
|
|
375
|
+
export function showAssetPurchaseOrder(
|
|
376
|
+
id: string,
|
|
377
|
+
query_params: Record<string, any> = {},
|
|
378
|
+
) {
|
|
379
|
+
return show({
|
|
380
|
+
id,
|
|
381
|
+
query_params,
|
|
382
|
+
fn: processAssetPurchaseOrder,
|
|
383
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Update the asset purchase order in the database
|
|
389
|
+
* @param id ID of the asset purchase order
|
|
390
|
+
* @param form_data New values for the asset purchase order
|
|
391
|
+
* @param query_params Query parameters to add the to request URL
|
|
392
|
+
* @param method HTTP verb to use on request. Defaults to `patch`
|
|
393
|
+
*/
|
|
394
|
+
export function updateAssetPurchaseOrder(
|
|
395
|
+
id: string,
|
|
396
|
+
form_data: Partial<PlaceAssetPurchaseOrder>,
|
|
397
|
+
method: 'put' | 'patch' = 'patch',
|
|
398
|
+
) {
|
|
399
|
+
return update({
|
|
400
|
+
id,
|
|
401
|
+
form_data,
|
|
402
|
+
query_params: {},
|
|
403
|
+
method,
|
|
404
|
+
fn: processAssetPurchaseOrder,
|
|
405
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Add a new asset purchase order to the database
|
|
411
|
+
* @param form_data Asset purchase order data
|
|
412
|
+
* @param query_params Query parameters to add the to request URL
|
|
413
|
+
*/
|
|
414
|
+
export function addAssetPurchaseOrder(
|
|
415
|
+
form_data: Partial<PlaceAssetPurchaseOrder>,
|
|
416
|
+
) {
|
|
417
|
+
return create({
|
|
418
|
+
form_data,
|
|
419
|
+
query_params: {},
|
|
420
|
+
fn: processAssetPurchaseOrder,
|
|
421
|
+
path: ASSET_PURCHASE_ORDER_PATH,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Remove an asset purchase order from the database
|
|
427
|
+
* @param id ID of the asset purchase order
|
|
428
|
+
* @param query_params Query parameters to add the to request URL
|
|
429
|
+
*/
|
|
430
|
+
export function removeAssetPurchaseOrder(
|
|
431
|
+
id: string,
|
|
432
|
+
query_params: Record<string, any> = {},
|
|
433
|
+
) {
|
|
434
|
+
return remove({ id, query_params, path: ASSET_PURCHASE_ORDER_PATH });
|
|
435
|
+
}
|
|
File without changes
|
package/src/systems/system.ts
CHANGED
|
@@ -38,6 +38,14 @@ export class PlaceSystem extends PlaceResource {
|
|
|
38
38
|
public readonly installed_ui_devices: number;
|
|
39
39
|
/** Support URL for the system */
|
|
40
40
|
public readonly support_url: string;
|
|
41
|
+
/** URL for the timetable UI linked to the system */
|
|
42
|
+
public readonly timetable_url: string;
|
|
43
|
+
/** URL for requesting snapshots of the assosiated camera */
|
|
44
|
+
public readonly camera_snapshot_url: string;
|
|
45
|
+
/** URL for managing the attached camera */
|
|
46
|
+
public readonly camera_url: string;
|
|
47
|
+
/** External booking URL for the system */
|
|
48
|
+
public readonly room_booking_url: string;
|
|
41
49
|
/** ID on the SVG Map associated with this system */
|
|
42
50
|
public readonly map_id: string;
|
|
43
51
|
/** List of module IDs that belong to the system */
|
|
@@ -77,6 +85,10 @@ export class PlaceSystem extends PlaceResource {
|
|
|
77
85
|
this.public = raw_data.public ?? false;
|
|
78
86
|
this.installed_ui_devices = raw_data.installed_ui_devices || 0;
|
|
79
87
|
this.support_url = raw_data.support_url || '';
|
|
88
|
+
this.camera_snapshot_url = raw_data.camera_snapshot_url || '';
|
|
89
|
+
this.camera_url = raw_data.camera_url || '';
|
|
90
|
+
this.timetable_url = raw_data.timetable_url || '';
|
|
91
|
+
this.room_booking_url = raw_data.room_booking_url || '';
|
|
80
92
|
this.map_id = raw_data.map_id || '';
|
|
81
93
|
this.modules = raw_data.modules || [];
|
|
82
94
|
this.images = raw_data.images || [];
|