cityworks 1.0.4 → 1.0.6
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/activity_link.d.ts +5 -0
- package/dist/attachments.d.ts +17 -1
- package/dist/case_data.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/activity_link.js +0 -219
- package/dist/briefcase.js +0 -327
- package/dist/case.d.ts +0 -114
- package/dist/case_admin.js +0 -821
- package/dist/case_assets.js +0 -129
- package/dist/case_data.js +0 -416
- package/dist/case_financial.js +0 -848
- package/dist/case_workflow.js +0 -455
- package/dist/cityworks.d.ts +0 -224
- package/dist/comments.js +0 -126
- package/dist/error.js +0 -30
- package/dist/event_layer.d.ts +0 -97
- package/dist/event_layer.js +0 -207
- package/dist/general.js +0 -212
- package/dist/gis.js +0 -250
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/inspection.js +0 -933
- package/dist/inspection_admin.js +0 -43
- package/dist/inspection_costs.js +0 -200
- package/dist/message_queue.js +0 -248
- package/dist/query.js +0 -242
- package/dist/request.js +0 -899
- package/dist/request_admin.js +0 -32
- package/dist/request_costs.js +0 -113
- package/dist/search.js +0 -371
- package/dist/workorder.js +0 -951
- package/dist/workorder_admin.js +0 -248
- package/dist/workorder_costs.js +0 -274
package/dist/request.js
DELETED
|
@@ -1,899 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Request = void 0;
|
|
4
|
-
var error_1 = require("./error");
|
|
5
|
-
var _ = require('lodash');
|
|
6
|
-
var Request = /** @class */ (function () {
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
function Request(cw) {
|
|
11
|
-
var _this = this;
|
|
12
|
-
/**
|
|
13
|
-
* Update request's map layer fields
|
|
14
|
-
*
|
|
15
|
-
* @category Requests
|
|
16
|
-
* @param {number} requestId
|
|
17
|
-
* @return {Object} Returns Promise that represents an object describing the updated map layer fields
|
|
18
|
-
*/
|
|
19
|
-
this.updateMLF = function (requestId) {
|
|
20
|
-
return new Promise(function (resolve, reject) {
|
|
21
|
-
var data = {
|
|
22
|
-
ServiceRequestId: requestId
|
|
23
|
-
};
|
|
24
|
-
_this.cw.runRequest('Ams/TemplateMapLayer/ServiceRequestInstanceMapLayersByRequestId', data).then(function (r) {
|
|
25
|
-
resolve(r.Value);
|
|
26
|
-
}).catch(function (e) {
|
|
27
|
-
reject(e);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
this.cw = cw;
|
|
32
|
-
this.admin;
|
|
33
|
-
this.comment;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create new requests
|
|
37
|
-
*
|
|
38
|
-
* @category Requests
|
|
39
|
-
* @param {Object} sr_data - See /{subdirectory}/apidocs/#/data-type-infodataType=RequestBase on the Cityworks instance
|
|
40
|
-
* @return {Object} Returns Promise that represents an object describing the newly-created request
|
|
41
|
-
*/
|
|
42
|
-
Request.prototype.create = function (sr_data) {
|
|
43
|
-
var _this = this;
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
45
|
-
if (!_.has(sr_data, 'ProblemSid')) {
|
|
46
|
-
reject(new error_1.CWError(2, 'ProblemSid must be provided.', { 'provided': sr_data }));
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
_this.cw.runRequest('Ams/ServiceRequest/Create', sr_data).then(function (r) {
|
|
50
|
-
resolve(r.Value);
|
|
51
|
-
}).catch(function (e) {
|
|
52
|
-
reject(e);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Update a request
|
|
59
|
-
*
|
|
60
|
-
* @category Requests
|
|
61
|
-
* @param {object} sr_data - See /{subdirectory}/apidocs/#/data-type-infodataType=RequestBase on the Cityworks instance
|
|
62
|
-
* @return {Object} Returns Promise that represents an object describing the updated request
|
|
63
|
-
*/
|
|
64
|
-
Request.prototype.update = function (sr_data) {
|
|
65
|
-
var _this = this;
|
|
66
|
-
return new Promise(function (resolve, reject) {
|
|
67
|
-
if (!_.has(sr_data, 'RequestId')) {
|
|
68
|
-
reject(new error_1.CWError(3, 'RequestId must be provided.', { 'provided': sr_data }));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
_this.cw.runRequest('Ams/ServiceRequest/Update', sr_data).then(function (r) {
|
|
72
|
-
resolve(r.Value);
|
|
73
|
-
}).catch(function (e) {
|
|
74
|
-
reject(e);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Move a request's point
|
|
81
|
-
*
|
|
82
|
-
* @category Requests
|
|
83
|
-
* @param {number} requestId
|
|
84
|
-
* @param {number} x
|
|
85
|
-
* @param {number} y
|
|
86
|
-
* @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
|
|
87
|
-
* @param {number} [z] - Optional Z coordinate
|
|
88
|
-
* @return {Object} Returns Promise that represents an object describing the updated GISPoint
|
|
89
|
-
*/
|
|
90
|
-
Request.prototype.move = function (requestId, x, y, projection, z) {
|
|
91
|
-
var _this = this;
|
|
92
|
-
return new Promise(function (resolve, reject) {
|
|
93
|
-
if (!_.has(projection, 'WKID') && !_.has(projection, 'WKT')) {
|
|
94
|
-
// Throw error
|
|
95
|
-
reject(new error_1.CWError(6, 'You must provide either the WKID or WKT for the x/y coordinates.', { 'projection': projection }));
|
|
96
|
-
}
|
|
97
|
-
var base_data = {
|
|
98
|
-
RequestId: requestId,
|
|
99
|
-
X: x,
|
|
100
|
-
Y: y
|
|
101
|
-
};
|
|
102
|
-
if (typeof (z) != 'undefined') {
|
|
103
|
-
_.set(base_data, 'Z', z);
|
|
104
|
-
}
|
|
105
|
-
var data = _.merge(base_data, projection);
|
|
106
|
-
_this.cw.runRequest('Ams/ServiceRequest/Move', data).then(function (r) {
|
|
107
|
-
resolve(r.Value);
|
|
108
|
-
}).catch(function (e) {
|
|
109
|
-
reject(e);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Change a request's problem code
|
|
115
|
-
*
|
|
116
|
-
* @category Requests
|
|
117
|
-
* @param {number} requestId - The request ID to change
|
|
118
|
-
* @param {number} problemSid - The request's new ProblemSID
|
|
119
|
-
* @return {Object} Returns Promise that represents an object describing the updated request
|
|
120
|
-
*/
|
|
121
|
-
Request.prototype.changeProblem = function (requestId, problemSid) {
|
|
122
|
-
var _this = this;
|
|
123
|
-
return new Promise(function (resolve, reject) {
|
|
124
|
-
var data = {
|
|
125
|
-
RequestId: requestId,
|
|
126
|
-
ProblemSid: problemSid
|
|
127
|
-
};
|
|
128
|
-
_this.cw.runRequest('Ams/ServiceRequest/ChangeProblem', data).then(function (r) {
|
|
129
|
-
resolve(r.Value);
|
|
130
|
-
}).catch(function (e) {
|
|
131
|
-
reject(e);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Get a request by ID
|
|
137
|
-
*
|
|
138
|
-
* @category Requests
|
|
139
|
-
* @param {number} requestId - The ID of the request to retrieve
|
|
140
|
-
* @return {Object} Returns Promise that represents an object describing the request
|
|
141
|
-
*/
|
|
142
|
-
Request.prototype.getById = function (requestId) {
|
|
143
|
-
var _this = this;
|
|
144
|
-
return new Promise(function (resolve, reject) {
|
|
145
|
-
var data = {
|
|
146
|
-
RequestId: requestId
|
|
147
|
-
};
|
|
148
|
-
_this.cw.runRequest('Ams/ServiceRequest/ById', data).then(function (r) {
|
|
149
|
-
resolve(r.Value);
|
|
150
|
-
}).catch(function (e) {
|
|
151
|
-
reject(e);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Get requests by array of IDs
|
|
157
|
-
*
|
|
158
|
-
* @category Requests
|
|
159
|
-
* @param {Array<number>} requestIds - The request IDs to retrieve
|
|
160
|
-
* @return {Object} Returns Promise that represents a collection of Objects describing the requests
|
|
161
|
-
*/
|
|
162
|
-
Request.prototype.getByIds = function (requestIds) {
|
|
163
|
-
var _this = this;
|
|
164
|
-
return new Promise(function (resolve, reject) {
|
|
165
|
-
var data = {
|
|
166
|
-
RequestIds: requestIds
|
|
167
|
-
};
|
|
168
|
-
_this.cw.runRequest('Ams/ServiceRequest/ByIds', data).then(function (r) {
|
|
169
|
-
resolve(r.Value);
|
|
170
|
-
}).catch(function (e) {
|
|
171
|
-
reject(e);
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Get the audit log for a specific request
|
|
177
|
-
*
|
|
178
|
-
* @category Requests
|
|
179
|
-
* @param {number} requestId - A Request ID to get the audit log for
|
|
180
|
-
* @return {Object} Returns Promise that represents a collection of Cityworks Metadata Objects
|
|
181
|
-
*/
|
|
182
|
-
Request.prototype.getAuditLog = function (requestId) {
|
|
183
|
-
var _this = this;
|
|
184
|
-
return new Promise(function (resolve, reject) {
|
|
185
|
-
var data = { RequestId: requestId };
|
|
186
|
-
_this.cw.runRequest('Ams/ServiceRequest/AuditLog', data).then(function (r) {
|
|
187
|
-
resolve(r.Value);
|
|
188
|
-
}).catch(function (e) {
|
|
189
|
-
reject(e);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Get custom fields for provided requests
|
|
195
|
-
*
|
|
196
|
-
* @category Requests
|
|
197
|
-
* @param {Array<number>} requestIds - The RequestIds whose custom fields should be returned
|
|
198
|
-
* @return {Object} Returns Promise that represents a collection of custom fields
|
|
199
|
-
*/
|
|
200
|
-
Request.prototype.getCustomFields = function (requestIds) {
|
|
201
|
-
var _this = this;
|
|
202
|
-
return new Promise(function (resolve, reject) {
|
|
203
|
-
var data = {
|
|
204
|
-
RequestIds: requestIds,
|
|
205
|
-
};
|
|
206
|
-
_this.cw.runRequest('Ams/ServiceRequest/CustomFields', data).then(function (r) {
|
|
207
|
-
resolve(r.Value);
|
|
208
|
-
}).catch(function (e) {
|
|
209
|
-
reject(e);
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* Change custom field category for provided requests
|
|
215
|
-
*
|
|
216
|
-
* @category Requests
|
|
217
|
-
* @param {Array<number>} requestIds - The RequestIds whose custom fields should be returned
|
|
218
|
-
* @param {number} categoryId - The new custom field grouping/category which should be assigned to the provided requests
|
|
219
|
-
* @return {Object} Returns Promise that represents a collection of requests
|
|
220
|
-
*/
|
|
221
|
-
Request.prototype.changeCustomFieldCategory = function (requestIds, categoryId) {
|
|
222
|
-
var _this = this;
|
|
223
|
-
return new Promise(function (resolve, reject) {
|
|
224
|
-
var data = {
|
|
225
|
-
RequestIds: requestIds,
|
|
226
|
-
CategoryId: categoryId
|
|
227
|
-
};
|
|
228
|
-
_this.cw.runRequest('Ams/ServiceRequest/ChangeCustomFieldCategory', data).then(function (r) {
|
|
229
|
-
resolve(r.Value);
|
|
230
|
-
}).catch(function (e) {
|
|
231
|
-
reject(e);
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Cancel requests
|
|
237
|
-
*
|
|
238
|
-
* @category Requests
|
|
239
|
-
* @param {Array<number>} requestIds - An array of the IDs to cancel the matched requests
|
|
240
|
-
* @param {string} [cancelReason] - A reason for cancelling the request(s)
|
|
241
|
-
* @param {datetime} [dateCancelled] - The date/time that it should be indicated the request was cancelled
|
|
242
|
-
* @return {Object} Returns object that represents a collection of requests
|
|
243
|
-
*/
|
|
244
|
-
Request.prototype.cancel = function (requestIds, cancelReason, dateCancelled) {
|
|
245
|
-
var _this = this;
|
|
246
|
-
return new Promise(function (resolve, reject) {
|
|
247
|
-
var m = new Date();
|
|
248
|
-
var data = { RequestIds: requestIds };
|
|
249
|
-
if (typeof (cancelReason) !== 'undefined')
|
|
250
|
-
_.set(data, 'CancelReason', cancelReason);
|
|
251
|
-
if (typeof (dateCancelled) !== 'undefined')
|
|
252
|
-
_.set(data, 'DateCancelled', dateCancelled);
|
|
253
|
-
_this.cw.runRequest('Ams/ServiceRequest/Cancel', data).then(function (r) {
|
|
254
|
-
resolve(r.Value);
|
|
255
|
-
}).catch(function (e) {
|
|
256
|
-
reject(e);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Uncancel requests
|
|
262
|
-
*
|
|
263
|
-
* @category Requests
|
|
264
|
-
* @param {Array<number>} requestIds - An array of the IDs to uncancel the matched requests
|
|
265
|
-
* @return {Object} Returns object that represents a collection of requests
|
|
266
|
-
*/
|
|
267
|
-
Request.prototype.uncancel = function (requestIds) {
|
|
268
|
-
var _this = this;
|
|
269
|
-
return new Promise(function (resolve, reject) {
|
|
270
|
-
var data = {
|
|
271
|
-
RequestIds: requestIds
|
|
272
|
-
};
|
|
273
|
-
_this.cw.runRequest('Ams/ServiceRequest/Uncancel', data).then(function (r) {
|
|
274
|
-
resolve(r.Value);
|
|
275
|
-
}).catch(function (e) {
|
|
276
|
-
reject(e);
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Close requests
|
|
282
|
-
*
|
|
283
|
-
* @category Requests
|
|
284
|
-
* @param {Array<number>} requestIds - An array of the IDs to close the matched requests
|
|
285
|
-
* @return {Object} Returns object that represents a collection of requests
|
|
286
|
-
*/
|
|
287
|
-
Request.prototype.close = function (requestIds) {
|
|
288
|
-
var _this = this;
|
|
289
|
-
return new Promise(function (resolve, reject) {
|
|
290
|
-
var data = {
|
|
291
|
-
RequestIds: requestIds
|
|
292
|
-
};
|
|
293
|
-
_this.cw.runRequest('Ams/ServiceRequest/Close', data).then(function (r) {
|
|
294
|
-
if (r.Status > 0) {
|
|
295
|
-
reject(new error_1.CWError(5, r.Message, { 'response': r }));
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
resolve(r.Value);
|
|
299
|
-
}
|
|
300
|
-
}).catch(function (e) {
|
|
301
|
-
reject(e);
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* Reopen closed requests
|
|
307
|
-
*
|
|
308
|
-
* @category Requests
|
|
309
|
-
* @param {Array<number>} requestIds - An array of the IDs to reopen the matched requests
|
|
310
|
-
* @return {Object} Returns object that represents a collection of requests
|
|
311
|
-
*/
|
|
312
|
-
Request.prototype.reopen = function (requestIds) {
|
|
313
|
-
var _this = this;
|
|
314
|
-
return new Promise(function (resolve, reject) {
|
|
315
|
-
var data = {
|
|
316
|
-
RequestIds: requestIds
|
|
317
|
-
};
|
|
318
|
-
_this.cw.runRequest('Ams/ServiceRequest/ReOpen', data).then(function (r) {
|
|
319
|
-
resolve(r.Value);
|
|
320
|
-
}).catch(function (e) {
|
|
321
|
-
reject(e);
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
|
-
/**
|
|
326
|
-
* Delete requests
|
|
327
|
-
*
|
|
328
|
-
* @category Requests
|
|
329
|
-
* @param {Array<number>} requestIds - An array of the IDs to delete the matched requests
|
|
330
|
-
* @return {Object} Returns object that represents a collection of request Ids which have been deleted
|
|
331
|
-
*/
|
|
332
|
-
Request.prototype.delete = function (requestIds) {
|
|
333
|
-
var _this = this;
|
|
334
|
-
return new Promise(function (resolve, reject) {
|
|
335
|
-
var data = {
|
|
336
|
-
RequestIds: requestIds
|
|
337
|
-
};
|
|
338
|
-
_this.cw.runRequest('Ams/ServiceRequest/Delete', data).then(function (r) {
|
|
339
|
-
if (r.Status > 0) {
|
|
340
|
-
reject(new error_1.CWError(4, r.Message, { 'response': r }));
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
resolve(r.Value);
|
|
344
|
-
}
|
|
345
|
-
}).catch(function (e) {
|
|
346
|
-
reject(e);
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* Search for requests
|
|
352
|
-
*
|
|
353
|
-
* @category Request Search
|
|
354
|
-
* @param {Object} searchData - The search information to retrieve matched requests, see instance docs: /{subdirectory}/apidocs/#/service-info/Ams/ServiceRequest
|
|
355
|
-
* @return {Object} Returns Promise that represents an Array of the matching request IDs
|
|
356
|
-
*/
|
|
357
|
-
Request.prototype.search = function (searchData) {
|
|
358
|
-
var _this = this;
|
|
359
|
-
return new Promise(function (resolve, reject) {
|
|
360
|
-
var data = searchData;
|
|
361
|
-
_this.cw.runRequest('Ams/ServiceRequest/Search', data).then(function (r) {
|
|
362
|
-
resolve(r.Value);
|
|
363
|
-
}).catch(function (e) {
|
|
364
|
-
reject(e);
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
};
|
|
368
|
-
/**
|
|
369
|
-
* Get the records on the basis of RequestId, only populates RequestId, Description, ProblemCode properties
|
|
370
|
-
*
|
|
371
|
-
* @category Request Object Search
|
|
372
|
-
* @param {string} requestId - ???, see instance docs: /{subdirectory}/apidocs/#/service-info/Ams/ServiceRequest
|
|
373
|
-
* @return {Object} Returns Promise that represents a collection of the matching (limited) request objects
|
|
374
|
-
*/
|
|
375
|
-
Request.prototype.searchObject = function (requestId) {
|
|
376
|
-
var _this = this;
|
|
377
|
-
return new Promise(function (resolve, reject) {
|
|
378
|
-
var data = {
|
|
379
|
-
RequestId: requestId
|
|
380
|
-
};
|
|
381
|
-
_this.cw.runRequest('Ams/ServiceRequest/SearchObject', data).then(function (r) {
|
|
382
|
-
resolve(r.Value);
|
|
383
|
-
}).catch(function (e) {
|
|
384
|
-
reject(e);
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Create a search definition. Save the definition by setting SaveDefinition = true and supplying a SearchName.
|
|
390
|
-
*
|
|
391
|
-
* @category Requests
|
|
392
|
-
* @param {Object} searchData - Search data variables. See /{subdirectory}/apidocs/#/service-info/Ams/ServiceRequest
|
|
393
|
-
* @param {number} [searchName] - What to name your search (if it should be saved)
|
|
394
|
-
* @param {number} [sharedWithin] - What group or domain to share the search to.
|
|
395
|
-
* @param {boolean} saveDefinition - Whether or not to save the search definition. Defaults to true when a search name is specified.
|
|
396
|
-
* @param {boolean} enableEurl - Whether or not to enable EURL for the saved search. Defaults to true.
|
|
397
|
-
* @return {Object} Returns Promise that represents a collection of Cityworks Metadata Objects
|
|
398
|
-
*/
|
|
399
|
-
Request.prototype.createSearchDefinition = function (searchData, searchName, sharedWithin, saveDefinition, enableEurl) {
|
|
400
|
-
var _this = this;
|
|
401
|
-
if (saveDefinition === void 0) { saveDefinition = true; }
|
|
402
|
-
if (enableEurl === void 0) { enableEurl = true; }
|
|
403
|
-
return new Promise(function (resolve, reject) {
|
|
404
|
-
var data = searchData;
|
|
405
|
-
if (_.isString(searchName)) {
|
|
406
|
-
_.set(data, 'SearchName', searchName);
|
|
407
|
-
_.set(data, 'SaveDefinition', saveDefinition);
|
|
408
|
-
_.set(data, 'EnableEurl', enableEurl);
|
|
409
|
-
// not sure how to handle sharedWithin...
|
|
410
|
-
// _.set(data, 'SharedWithin', sharedWithin)
|
|
411
|
-
}
|
|
412
|
-
_this.cw.runRequest('Ams/ServiceRequest/CreateSearchDefinition', data).then(function (r) {
|
|
413
|
-
resolve(r.Value);
|
|
414
|
-
}).catch(function (e) {
|
|
415
|
-
reject(e);
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
};
|
|
419
|
-
/**
|
|
420
|
-
* Get a list of problem nodes for a domain
|
|
421
|
-
*
|
|
422
|
-
* @category Request Categorization
|
|
423
|
-
* @param {number} domainId - The domain ID for which to retrieve problem nodes.
|
|
424
|
-
* @param {boolean} viewOnly - Return only view only problem nodes. Defaults to false.
|
|
425
|
-
* @param {Object} [displayMode] - Object that should contain two properties if you provide it: DisplayTextMode: string (C = Code, D = Description, CD = Code ~ Description). DisplayTextDelimeter: string, only impacts CD display text mode.
|
|
426
|
-
* @param {boolean} includeCancelled - Return only cancelled problem nodes as well. Defaults to false.
|
|
427
|
-
* @return {Object} Returns Promise that represents a collection of problem node objects.
|
|
428
|
-
*/
|
|
429
|
-
Request.prototype.getProblemNodes = function (domainId, viewOnly, displayMode, includeCancelled) {
|
|
430
|
-
var _this = this;
|
|
431
|
-
if (viewOnly === void 0) { viewOnly = false; }
|
|
432
|
-
if (includeCancelled === void 0) { includeCancelled = false; }
|
|
433
|
-
return new Promise(function (resolve, reject) {
|
|
434
|
-
var data = {
|
|
435
|
-
DomainId: domainId,
|
|
436
|
-
IncludeCancelled: includeCancelled,
|
|
437
|
-
ViewOnly: viewOnly
|
|
438
|
-
};
|
|
439
|
-
if (typeof displayMode != 'undefined' && displayMode !== null && _.has(displayMode, 'DisplayTextMode')) {
|
|
440
|
-
_.set(data, 'DisplayTextMode', _.get(displayMode, 'DisplayTextMode'));
|
|
441
|
-
if (_.get(displayMode, 'DisplayTextMode') == 'CD' && _.has(displayMode, 'DisplayTextDelimeter')) {
|
|
442
|
-
_.set(data, 'DisplayTextDelimeter', _.get(displayMode, 'DisplayTextDelimeter'));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
_this.cw.runRequest('Ams/ServiceRequest/ProblemNodes', data).then(function (r) {
|
|
446
|
-
// console.log(_.filter(r, function(o) { return !o.Cancel; }), 'filter');
|
|
447
|
-
// console.log(_.some(r.Value, ['Cancel', true]), 'some');
|
|
448
|
-
resolve(r.Value);
|
|
449
|
-
}).catch(function (e) {
|
|
450
|
-
reject(e);
|
|
451
|
-
});
|
|
452
|
-
});
|
|
453
|
-
};
|
|
454
|
-
/**
|
|
455
|
-
* Get a list of problem codes
|
|
456
|
-
*
|
|
457
|
-
* @category Request Options
|
|
458
|
-
* @param {boolean} forPublicOnly - Return only publicly-available service requests. Defaults to false.
|
|
459
|
-
* @param {boolean} onlyActiveTemplates - Return only active templates. Defaults to true.
|
|
460
|
-
* @return {Object} Returns Promise that represents an Array of problem name objects.
|
|
461
|
-
*/
|
|
462
|
-
Request.prototype.getProblems = function (forPublicOnly, onlyActiveTemplates, domainIds) {
|
|
463
|
-
var _this = this;
|
|
464
|
-
if (forPublicOnly === void 0) { forPublicOnly = false; }
|
|
465
|
-
if (onlyActiveTemplates === void 0) { onlyActiveTemplates = true; }
|
|
466
|
-
return new Promise(function (resolve, reject) {
|
|
467
|
-
var data = {
|
|
468
|
-
ForPublicOnly: forPublicOnly,
|
|
469
|
-
OnlyActiveTemplates: onlyActiveTemplates
|
|
470
|
-
};
|
|
471
|
-
if (typeof domainIds != 'undefined') {
|
|
472
|
-
_.set(data, 'DomainIds', domainIds);
|
|
473
|
-
}
|
|
474
|
-
_this.cw.runRequest('Ams/ServiceRequest/Problems', data).then(function (r) {
|
|
475
|
-
resolve(r.Value);
|
|
476
|
-
}).catch(function (e) {
|
|
477
|
-
reject(e);
|
|
478
|
-
});
|
|
479
|
-
});
|
|
480
|
-
};
|
|
481
|
-
/**
|
|
482
|
-
* Get a list of problem codes by keywords
|
|
483
|
-
*
|
|
484
|
-
* @category Request Options
|
|
485
|
-
* @param {string} keywords - Keywords to search for potential problem codes
|
|
486
|
-
* @return {Object} Returns Promise that represents an Array of problem name objects.
|
|
487
|
-
*/
|
|
488
|
-
Request.prototype.getProblemsByKeywords = function (keywords) {
|
|
489
|
-
var _this = this;
|
|
490
|
-
return new Promise(function (resolve, reject) {
|
|
491
|
-
var data = {
|
|
492
|
-
Keywords: keywords
|
|
493
|
-
};
|
|
494
|
-
_this.cw.runRequest('Ams/ServiceRequest/ProblemsByKeywords', data).then(function (r) {
|
|
495
|
-
resolve(r.Value);
|
|
496
|
-
}).catch(function (e) {
|
|
497
|
-
reject(e);
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
};
|
|
501
|
-
/**
|
|
502
|
-
* Get a list of a problem code's priorities
|
|
503
|
-
*
|
|
504
|
-
* @category Request Options
|
|
505
|
-
* @param {number} problemSid - Return priorities for given problemSid
|
|
506
|
-
* @return {Object} Returns Promise that represents an Array of priorities
|
|
507
|
-
*/
|
|
508
|
-
Request.prototype.getPriorities = function (problemSid) {
|
|
509
|
-
var _this = this;
|
|
510
|
-
return new Promise(function (resolve, reject) {
|
|
511
|
-
var data = {
|
|
512
|
-
ProblemSids: problemSid,
|
|
513
|
-
};
|
|
514
|
-
_this.cw.runRequest('Ams/ServiceRequest/Priorities', data).then(function (r) {
|
|
515
|
-
resolve(r.Value);
|
|
516
|
-
}).catch(function (e) {
|
|
517
|
-
reject(e);
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
};
|
|
521
|
-
/**
|
|
522
|
-
* Get custom field templates for problem code
|
|
523
|
-
*
|
|
524
|
-
* @category Request Options
|
|
525
|
-
* @param {number} problemSid - The problemSid whose template custom fields should be returned
|
|
526
|
-
* @return {Object} Returns Promise that represents a collection of custom fields
|
|
527
|
-
*/
|
|
528
|
-
Request.prototype.getCustomFieldTemplate = function (problemSid) {
|
|
529
|
-
var _this = this;
|
|
530
|
-
return new Promise(function (resolve, reject) {
|
|
531
|
-
var data = {
|
|
532
|
-
ProblemSids: problemSid,
|
|
533
|
-
};
|
|
534
|
-
_this.cw.runRequest('Ams/ServiceRequest/TemplateCustomFields', data).then(function (r) {
|
|
535
|
-
resolve(r.Value);
|
|
536
|
-
}).catch(function (e) {
|
|
537
|
-
reject(e);
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
};
|
|
541
|
-
/**
|
|
542
|
-
* Get the questions and answer options for a problem code
|
|
543
|
-
*
|
|
544
|
-
* @category Request Options
|
|
545
|
-
* @param {number} problemSid - The problemSid whose Q&A should be returned
|
|
546
|
-
* @return {Object} Returns Promise that represents a collection of questions and answer settings
|
|
547
|
-
*/
|
|
548
|
-
Request.prototype.getQASettings = function (problemSid) {
|
|
549
|
-
var _this = this;
|
|
550
|
-
return new Promise(function (resolve, reject) {
|
|
551
|
-
var data = {
|
|
552
|
-
ProblemSids: problemSid,
|
|
553
|
-
};
|
|
554
|
-
_this.cw.runRequest('Ams/ServiceRequest/QA', data).then(function (r) {
|
|
555
|
-
resolve(r.Value);
|
|
556
|
-
}).catch(function (e) {
|
|
557
|
-
reject(e);
|
|
558
|
-
});
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
|
-
/**
|
|
562
|
-
* Get problem leaf (template) by Sid
|
|
563
|
-
*
|
|
564
|
-
* @category Request Options
|
|
565
|
-
* @param {number} problemSid - Return problem leaf for given problemSid
|
|
566
|
-
* @return {Object} Returns Promise that represents an Object that describes the problem leaf (template)
|
|
567
|
-
*/
|
|
568
|
-
Request.prototype.getProblemLeaf = function (problemSid) {
|
|
569
|
-
var _this = this;
|
|
570
|
-
return new Promise(function (resolve, reject) {
|
|
571
|
-
var data = {
|
|
572
|
-
ProblemSid: problemSid
|
|
573
|
-
};
|
|
574
|
-
_this.cw.runRequest('Ams/ServiceRequest/ProblemLeafBySid', data).then(function (r) {
|
|
575
|
-
resolve(r.Value);
|
|
576
|
-
}).catch(function (e) {
|
|
577
|
-
reject(e);
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
};
|
|
581
|
-
/**
|
|
582
|
-
* Get a list of default statuses
|
|
583
|
-
*
|
|
584
|
-
* @category Request Options
|
|
585
|
-
* @param {Array<number>} domainIds - List of domains to return default statuses for
|
|
586
|
-
* @return {Object} Returns Promise that represents an Array of statuses.
|
|
587
|
-
*/
|
|
588
|
-
Request.prototype.getStatuses = function (domainIds) {
|
|
589
|
-
var _this = this;
|
|
590
|
-
return new Promise(function (resolve, reject) {
|
|
591
|
-
var data = {
|
|
592
|
-
DomainIds: domainIds
|
|
593
|
-
};
|
|
594
|
-
_this.cw.runRequest('Ams/ServiceRequest/DefaultStatus', data).then(function (r) {
|
|
595
|
-
resolve(r.Value);
|
|
596
|
-
}).catch(function (e) {
|
|
597
|
-
reject(e);
|
|
598
|
-
});
|
|
599
|
-
});
|
|
600
|
-
};
|
|
601
|
-
/**
|
|
602
|
-
* Get a list of possible Employee values
|
|
603
|
-
*
|
|
604
|
-
* @category Request Options
|
|
605
|
-
* @param {string} listType - Which list (endpoint) to get. Includes only DispatchTo & SubmitTo.
|
|
606
|
-
* @param {number} domainId - Domain to return possible dispatchTo values for
|
|
607
|
-
* @return {Object} Returns Promise that represents an Array of Employee options.
|
|
608
|
-
*/
|
|
609
|
-
Request.prototype.getEmployeeLists = function (listType, domainId) {
|
|
610
|
-
var _this = this;
|
|
611
|
-
return new Promise(function (resolve, reject) {
|
|
612
|
-
// TODO: make a default domain option on the CW object for cases like this.
|
|
613
|
-
var data = {
|
|
614
|
-
DomainId: domainId
|
|
615
|
-
};
|
|
616
|
-
if (!_.includes(['DispatchTo', 'SubmitTo'], listType)) {
|
|
617
|
-
reject(new error_1.CWError(2, 'listType must be either SubmitTo or DispatchTo.', { 'provided': listType }));
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
_this.cw.runRequest("Ams/ServiceRequest/" + listType, data).then(function (r) {
|
|
621
|
-
resolve(r.Value);
|
|
622
|
-
}).catch(function (e) {
|
|
623
|
-
reject(e);
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
/**
|
|
629
|
-
* Get a list of possible DispatchTo values
|
|
630
|
-
*
|
|
631
|
-
* @category Request Options
|
|
632
|
-
* @param {number} domainId - Domain to return possible dispatchTo values for
|
|
633
|
-
* @return {Object} Returns Promise that represents an Array of dispatchTo options.
|
|
634
|
-
*/
|
|
635
|
-
Request.prototype.getDispatchTos = function (domainId) {
|
|
636
|
-
// Fix name for choice of non-pluralized endpoint. Unlike WOs & Inspections...
|
|
637
|
-
return this.getEmployeeLists('DispatchTo', domainId);
|
|
638
|
-
};
|
|
639
|
-
/**
|
|
640
|
-
* Get a list of possible SubmitTo values
|
|
641
|
-
*
|
|
642
|
-
* @category Request Options
|
|
643
|
-
* @param {number} domainId - Domain to return possible submitTo values for
|
|
644
|
-
* @return {Object} Returns Promise that represents an Array of submitTo options.
|
|
645
|
-
*/
|
|
646
|
-
Request.prototype.getSubmitTos = function (domainId) {
|
|
647
|
-
// Fix name for choice of non-pluralized endpoint. Unlike WOs & Inspections...
|
|
648
|
-
return this.getEmployeeLists('SubmitTo', domainId);
|
|
649
|
-
};
|
|
650
|
-
/**
|
|
651
|
-
* Get street codes
|
|
652
|
-
*
|
|
653
|
-
* @category Request Options
|
|
654
|
-
* @return {Object} Returns Promise that represents an Array of Street Codes.
|
|
655
|
-
*/
|
|
656
|
-
Request.prototype.streetCodes = function () {
|
|
657
|
-
var _this = this;
|
|
658
|
-
return new Promise(function (resolve, reject) {
|
|
659
|
-
_this.cw.runRequest('Ams/ServiceRequest/AllStreetCode', {}).then(function (r) {
|
|
660
|
-
resolve(r.Value);
|
|
661
|
-
}).catch(function (e) {
|
|
662
|
-
reject(e);
|
|
663
|
-
});
|
|
664
|
-
});
|
|
665
|
-
};
|
|
666
|
-
/**
|
|
667
|
-
* Get a list of templates
|
|
668
|
-
*
|
|
669
|
-
* @category Request Templates
|
|
670
|
-
* @param {Array<number>} problemSids - An array list of problemSids to retrieve templates for
|
|
671
|
-
* @param {Date} [minimumDateModified] - ?
|
|
672
|
-
* @param {Date} [maximumDateModified] - ?
|
|
673
|
-
* @return {Object} Returns Promise that represents
|
|
674
|
-
*/
|
|
675
|
-
Request.prototype.getTemplatesById = function (problemSids, minimumDateModified, maximumDateModified) {
|
|
676
|
-
var _this = this;
|
|
677
|
-
return new Promise(function (resolve, reject) {
|
|
678
|
-
var data = {
|
|
679
|
-
ProblemSids: null
|
|
680
|
-
};
|
|
681
|
-
if (typeof minimumDateModified != 'undefined') {
|
|
682
|
-
_.set(data, 'MinimumDateModified', minimumDateModified);
|
|
683
|
-
}
|
|
684
|
-
if (typeof maximumDateModified != 'undefined') {
|
|
685
|
-
_.set(data, 'MaximumDateModified', maximumDateModified);
|
|
686
|
-
}
|
|
687
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/ByIds', data).then(function (r) {
|
|
688
|
-
resolve(r.Value);
|
|
689
|
-
}).catch(function (e) {
|
|
690
|
-
reject(e);
|
|
691
|
-
});
|
|
692
|
-
});
|
|
693
|
-
};
|
|
694
|
-
/**
|
|
695
|
-
* Create a search definition. Save the definition by setting SaveDefinition = true and supplying a SearchName.
|
|
696
|
-
*
|
|
697
|
-
* @category Request Templates
|
|
698
|
-
* @param {Object} searchData - Search data variables. See /{subdirectory}/apidocs/#/service-info/Ams/ServiceRequestTemplate
|
|
699
|
-
* @param {number} [searchName] - What to name your search (if it should be saved)
|
|
700
|
-
* @param {number} [sharedWithin] - What group or domain to share the search to.
|
|
701
|
-
* @param {boolean} saveDefinition - Whether or not to save the search definition. Defaults to true when a search name is specified.
|
|
702
|
-
* @return {Object} Returns Promise that represents a collection of Cityworks Metadata Objects. See: /{subdirectory}/apidocs/#/data-type-info;dataType=CWMetadata
|
|
703
|
-
*/
|
|
704
|
-
Request.prototype.createTemplateSearchDefinition = function (searchData, searchName, sharedWithin, saveDefinition) {
|
|
705
|
-
var _this = this;
|
|
706
|
-
if (saveDefinition === void 0) { saveDefinition = true; }
|
|
707
|
-
return new Promise(function (resolve, reject) {
|
|
708
|
-
var data = searchData;
|
|
709
|
-
if (_.isString(searchName)) {
|
|
710
|
-
_.set(data, 'SearchName', searchName);
|
|
711
|
-
_.set(data, 'SaveDefinition', saveDefinition);
|
|
712
|
-
// not sure how to handle sharedWithin...
|
|
713
|
-
// _.set(data, 'SharedWithin', sharedWithin)
|
|
714
|
-
}
|
|
715
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/CreateSearchDefinition', data).then(function (r) {
|
|
716
|
-
resolve(r.Value);
|
|
717
|
-
}).catch(function (e) {
|
|
718
|
-
reject(e);
|
|
719
|
-
});
|
|
720
|
-
});
|
|
721
|
-
};
|
|
722
|
-
/**
|
|
723
|
-
* Get the questions and answers for a(many) request template(s)
|
|
724
|
-
*
|
|
725
|
-
* @category Request Templates
|
|
726
|
-
* @param {Array<number>} problemSids - An array list of problemSids to retrieve templates for
|
|
727
|
-
* @return {Object} Returns Promise that represents a collection of ProblemQAs. See /{subdirectory}/apidocs/#/data-type-info;dataType=ProblemQA
|
|
728
|
-
*/
|
|
729
|
-
Request.prototype.getTemplateQAs = function (problemSids, minimumDateModified, maximumDateModified) {
|
|
730
|
-
var _this = this;
|
|
731
|
-
return new Promise(function (resolve, reject) {
|
|
732
|
-
var data = {
|
|
733
|
-
ProblemSids: null
|
|
734
|
-
};
|
|
735
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/QA', data).then(function (r) {
|
|
736
|
-
resolve(r.Value);
|
|
737
|
-
}).catch(function (e) {
|
|
738
|
-
reject(e);
|
|
739
|
-
});
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
/**
|
|
743
|
-
* Get a list of template id results for a provided search parameters
|
|
744
|
-
*
|
|
745
|
-
* @category Request Templates
|
|
746
|
-
* @param {Object} searchData - Search data variables. See /{subdirectory}/apidocs/#/service-info/Ams/ServiceRequestTemplate
|
|
747
|
-
* @return {Object} Returns Promise that represents a list of template IDs.
|
|
748
|
-
*/
|
|
749
|
-
Request.prototype.searchTemplates = function (searchData) {
|
|
750
|
-
var _this = this;
|
|
751
|
-
return new Promise(function (resolve, reject) {
|
|
752
|
-
var data = searchData;
|
|
753
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/Search', data).then(function (r) {
|
|
754
|
-
resolve(r.Value);
|
|
755
|
-
}).catch(function (e) {
|
|
756
|
-
reject(e);
|
|
757
|
-
});
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
/**
|
|
761
|
-
* Get request templates (problem leaf[s])
|
|
762
|
-
*
|
|
763
|
-
* @category Request Templates
|
|
764
|
-
* @param {Array<number>} [templateIds] - Array of specific template IDs to retrieve
|
|
765
|
-
* @param {number} canCreate - If true, only return templates the user can create, ignored if false or null, default is false
|
|
766
|
-
* @param {boolean} includeInactiveIf - If true, returns inactive templates, default is false
|
|
767
|
-
* @param {Date} [minimumDateModified] - ?
|
|
768
|
-
* @param {Date} [maximumDateModified] - ?
|
|
769
|
-
* @return {Object} Returns Promise that represents a collection of Problem Leafs. See /{subdirectory}/apidocs/#/data-type-info;dataType=ProblemLeaf
|
|
770
|
-
*/
|
|
771
|
-
Request.prototype.getTemplates = function (templateIds, canCreate, includeInactiveIf, minimumDateModified, maximumDateModified) {
|
|
772
|
-
var _this = this;
|
|
773
|
-
if (canCreate === void 0) { canCreate = false; }
|
|
774
|
-
if (includeInactiveIf === void 0) { includeInactiveIf = false; }
|
|
775
|
-
return new Promise(function (resolve, reject) {
|
|
776
|
-
var data = {
|
|
777
|
-
CanCreate: canCreate,
|
|
778
|
-
IncludeInactiveIf: includeInactiveIf
|
|
779
|
-
};
|
|
780
|
-
if (typeof templateIds != 'undefined') {
|
|
781
|
-
_.set(data, 'TemplateIds', templateIds);
|
|
782
|
-
}
|
|
783
|
-
if (typeof minimumDateModified != 'undefined') {
|
|
784
|
-
_.set(data, 'MinimumDateModified', minimumDateModified);
|
|
785
|
-
}
|
|
786
|
-
if (typeof maximumDateModified != 'undefined') {
|
|
787
|
-
_.set(data, 'MaximumDateModified', maximumDateModified);
|
|
788
|
-
}
|
|
789
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/Templates', data).then(function (r) {
|
|
790
|
-
resolve(r.Value);
|
|
791
|
-
}).catch(function (e) {
|
|
792
|
-
reject(e);
|
|
793
|
-
});
|
|
794
|
-
});
|
|
795
|
-
};
|
|
796
|
-
/**
|
|
797
|
-
* Get WorkOrder templates that are associated to this request template type
|
|
798
|
-
*
|
|
799
|
-
* @category Request Templates
|
|
800
|
-
* @param {Array<number>} problemSids - An array list of problemSids to retrieve Problem WO templates for
|
|
801
|
-
* @param {boolean} includeInactiveIf - Include inactive WorkOrder templates, default is false
|
|
802
|
-
* @return {Object} Returns Promise that represents a collection of Problem WO Templates. See /{subdirectory}/apidocs/#/data-type-info;dataType=ProblemWOTemplate
|
|
803
|
-
*/
|
|
804
|
-
Request.prototype.getWOTemplates = function (problemSids, includeInactive) {
|
|
805
|
-
var _this = this;
|
|
806
|
-
if (includeInactive === void 0) { includeInactive = false; }
|
|
807
|
-
return new Promise(function (resolve, reject) {
|
|
808
|
-
var data = {
|
|
809
|
-
ProblemSids: problemSids,
|
|
810
|
-
IncludeInactive: includeInactive
|
|
811
|
-
};
|
|
812
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/WorkOrderTemplates', data).then(function (r) {
|
|
813
|
-
resolve(r.Value);
|
|
814
|
-
}).catch(function (e) {
|
|
815
|
-
reject(e);
|
|
816
|
-
});
|
|
817
|
-
});
|
|
818
|
-
};
|
|
819
|
-
/**
|
|
820
|
-
* Get Map Layer Fields
|
|
821
|
-
*
|
|
822
|
-
* @category Requests
|
|
823
|
-
* @param {number} requestId - The request ID to get the map layer fields for.
|
|
824
|
-
* @return {Object} Returns Promise that represents a collection of Objects describing the request map layer fields
|
|
825
|
-
*/
|
|
826
|
-
Request.prototype.getMLFs = function (requestId) {
|
|
827
|
-
var _this = this;
|
|
828
|
-
return new Promise(function (resolve, reject) {
|
|
829
|
-
var data = {
|
|
830
|
-
ServiceRequestId: requestId
|
|
831
|
-
};
|
|
832
|
-
var path = 'Ams/TemplateMapLayer/ServiceRequestInstanceMapLayersByRequestId';
|
|
833
|
-
_this.cw.runRequest(path, data).then(function (r) {
|
|
834
|
-
resolve(r.Value);
|
|
835
|
-
}).catch(function (e) {
|
|
836
|
-
reject(e);
|
|
837
|
-
});
|
|
838
|
-
});
|
|
839
|
-
};
|
|
840
|
-
/**
|
|
841
|
-
* Update Map Layer Fields
|
|
842
|
-
*
|
|
843
|
-
* @category Requests
|
|
844
|
-
* @param {number} requestId - The service request ID to get the map layer fields for.
|
|
845
|
-
* @param {number} x
|
|
846
|
-
* @param {number} y
|
|
847
|
-
* @param {number} domainId - Domain ID
|
|
848
|
-
* @param {number} [z] - Optional Z coordinate
|
|
849
|
-
* @return {Object} Returns Promise that represents a ...
|
|
850
|
-
*/
|
|
851
|
-
Request.prototype.updateMLFs = function (requestId, x, y, domainId, z) {
|
|
852
|
-
var _this = this;
|
|
853
|
-
return new Promise(function (resolve, reject) {
|
|
854
|
-
var data = {};
|
|
855
|
-
var path = 'Ams/TemplateMapLayer/UpdateServiceRequestInstanceMapLayers';
|
|
856
|
-
_.set(data, 'ServiceRequestId', requestId);
|
|
857
|
-
if (_.isNumber(x)) {
|
|
858
|
-
_.set(data, 'X', x);
|
|
859
|
-
}
|
|
860
|
-
if (_.isNumber(y)) {
|
|
861
|
-
_.set(data, 'Y', y);
|
|
862
|
-
}
|
|
863
|
-
if (_.isNumber(z)) {
|
|
864
|
-
_.set(data, 'Z', z);
|
|
865
|
-
}
|
|
866
|
-
if (_.isNumber(domainId)) {
|
|
867
|
-
_.set(data, 'DomainId', domainId);
|
|
868
|
-
}
|
|
869
|
-
_this.cw.runRequest(path, data).then(function (r) {
|
|
870
|
-
resolve(r.Value);
|
|
871
|
-
}).catch(function (e) {
|
|
872
|
-
reject(e);
|
|
873
|
-
});
|
|
874
|
-
});
|
|
875
|
-
};
|
|
876
|
-
/**
|
|
877
|
-
* Delete Map Layer Fields
|
|
878
|
-
*
|
|
879
|
-
* @category Requests
|
|
880
|
-
* @param {number} requestId - The request ID to delete the map layer fields for.
|
|
881
|
-
* @return {Object} Returns Promise that represents a collection of Objects describing the deleted map layer fields
|
|
882
|
-
*/
|
|
883
|
-
Request.prototype.deleteMLFs = function (requestId) {
|
|
884
|
-
var _this = this;
|
|
885
|
-
return new Promise(function (resolve, reject) {
|
|
886
|
-
var data = {
|
|
887
|
-
ServiceRequestId: requestId
|
|
888
|
-
};
|
|
889
|
-
var path = 'Ams/TemplateMapLayer/DeleteServiceRequestInstancesByRequestId';
|
|
890
|
-
_this.cw.runRequest(path, data).then(function (r) {
|
|
891
|
-
resolve(r.Value);
|
|
892
|
-
}).catch(function (e) {
|
|
893
|
-
reject(e);
|
|
894
|
-
});
|
|
895
|
-
});
|
|
896
|
-
};
|
|
897
|
-
return Request;
|
|
898
|
-
}());
|
|
899
|
-
exports.Request = Request;
|