cityworks 0.0.15 → 0.0.20

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.
@@ -3,6 +3,10 @@ export declare class Inspection {
3
3
  * @hidden
4
4
  */
5
5
  cw: any;
6
+ /**
7
+ * Inspection Administration methods
8
+ */
9
+ admin?: Object;
6
10
  /**
7
11
  * @hidden
8
12
  */
@@ -220,6 +224,25 @@ export declare class Inspection {
220
224
  * @return {Object} Returns Promise that represents an Array of the districts
221
225
  */
222
226
  getDistricts(): Promise<unknown>;
227
+ /**
228
+ * Get Inspection Employee lists. Abstraction done here, though only one employee list field, AFAIK.
229
+ *
230
+ * @category Inspection Options
231
+ * @param {string} listType - Which list (endpoint) to get. Includes only SubmitTos.
232
+ * @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
233
+ * @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
234
+ * @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
235
+ */
236
+ getEmployeeLists(listType: string, includeInactiveEmployees?: boolean, domainIds?: Array<number>): Promise<unknown>;
237
+ /**
238
+ * Get SubmitTo list
239
+ *
240
+ * @category WorkOrder Options
241
+ * @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
242
+ * @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
243
+ * @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
244
+ */
245
+ getSubmitTos(includeInactiveEmployees?: boolean, domainIds?: Array<number>): Promise<unknown>;
223
246
  /**
224
247
  * Move inspection by InspectionId. Must provide well known id (WKID) or well known text (WKT)
225
248
  *
@@ -227,11 +250,15 @@ export declare class Inspection {
227
250
  * @param {number} inspectionId - The ID of the inspection that should be moved
228
251
  * @param {number} x - The X coordinate for the move
229
252
  * @param {number} y - The Y coordinate for the move
230
- * @param {Object} projection_info - An object which must include either WKID: Int32 or WKT: String. Can also include VcsWKID.
231
- * @param {number} [z] - the optional z coordinate for the move
232
- * @return {Object} Returns Promise which represents a GISPoint object
233
- */
234
- move(inspectionId: number, x: number, y: number, projection_info?: Object, z?: number): Promise<unknown>;
253
+ * @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
254
+ * @param {number} [z] - the optional Z coordinate for the move
255
+ * @return {Object} Returns Promise that represents an object describing the updated GISPoint
256
+ */
257
+ move(inspectionId: number, x: number, y: number, projection: {
258
+ WKID?: string;
259
+ WKT?: string;
260
+ VcsWKID?: string;
261
+ }, z?: number): Promise<unknown>;
235
262
  /**
236
263
  * Get inspection templates
237
264
  *
@@ -0,0 +1,10 @@
1
+ export declare class InspectionAdmin {
2
+ /**
3
+ * @hidden
4
+ */
5
+ cw: any;
6
+ /**
7
+ * @hidden
8
+ */
9
+ constructor(cw: any);
10
+ }
package/dist/request.d.ts CHANGED
@@ -3,6 +3,10 @@ export declare class Request {
3
3
  * @hidden
4
4
  */
5
5
  cw: any;
6
+ /**
7
+ * Request Administration methods
8
+ */
9
+ admin?: Object;
6
10
  /**
7
11
  * @hidden
8
12
  */
@@ -30,11 +34,15 @@ export declare class Request {
30
34
  * @param {number} requestId
31
35
  * @param {number} x
32
36
  * @param {number} y
33
- * @param {Object} projection - Should include WKT or WKID attribute. Can also include VcsWKID attribute.
37
+ * @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
34
38
  * @param {number} [z] - Optional Z coordinate
35
- * @return {Object} Returns Promise that represents an object describing the updated request
39
+ * @return {Object} Returns Promise that represents an object describing the updated GISPoint
36
40
  */
37
- move(requestId: number, x: number, y: number, projection: Object, z?: number): Promise<unknown>;
41
+ move(requestId: number, x: number, y: number, projection: {
42
+ WKID?: string;
43
+ WKT?: string;
44
+ VcsWKID?: string;
45
+ }, z?: number): Promise<unknown>;
38
46
  /**
39
47
  * Change a request's problem code
40
48
  *
@@ -232,22 +240,31 @@ export declare class Request {
232
240
  * @return {Object} Returns Promise that represents an Array of statuses.
233
241
  */
234
242
  getStatuses(domainIds: Array<number>): Promise<unknown>;
243
+ /**
244
+ * Get a list of possible Employee values
245
+ *
246
+ * @category Request Options
247
+ * @param {string} listType - Which list (endpoint) to get. Includes only DispatchTo & SubmitTo.
248
+ * @param {number} domainId - Domain to return possible dispatchTo values for
249
+ * @return {Object} Returns Promise that represents an Array of Employee options.
250
+ */
251
+ getEmployeeLists(listType: string, domainId: number): Promise<unknown>;
235
252
  /**
236
253
  * Get a list of possible DispatchTo values
237
254
  *
238
255
  * @category Request Options
239
- * @param {Array<number>} domainId - Domain to return possible dispatchTo values for
256
+ * @param {number} domainId - Domain to return possible dispatchTo values for
240
257
  * @return {Object} Returns Promise that represents an Array of dispatchTo options.
241
258
  */
242
- getDispatchTo(domainId: Array<number>): Promise<unknown>;
259
+ getDispatchTos(domainId: number): Promise<unknown>;
243
260
  /**
244
261
  * Get a list of possible SubmitTo values
245
262
  *
246
263
  * @category Request Options
247
- * @param {Array<number>} domainId - Domain to return possible submitTo values for
264
+ * @param {number} domainId - Domain to return possible submitTo values for
248
265
  * @return {Object} Returns Promise that represents an Array of submitTo options.
249
266
  */
250
- getSubmitTo(domainId: Array<number>): Promise<unknown>;
267
+ getSubmitTos(domainId: number): Promise<unknown>;
251
268
  /**
252
269
  * Get street codes
253
270
  *
@@ -0,0 +1,10 @@
1
+ export declare class RequestAdmin {
2
+ /**
3
+ * @hidden
4
+ */
5
+ cw: any;
6
+ /**
7
+ * @hidden
8
+ */
9
+ constructor(cw: any);
10
+ }
@@ -3,6 +3,10 @@ export declare class WorkOrder {
3
3
  * @hidden
4
4
  */
5
5
  cw: any;
6
+ /**
7
+ * WorkOrder Administration methods
8
+ */
9
+ admin?: Object;
6
10
  /**
7
11
  * @hidden
8
12
  */
@@ -125,6 +129,16 @@ export declare class WorkOrder {
125
129
  * @return {Object} Returns object that represents a list of entities removed.
126
130
  */
127
131
  addEntities(workOrderSId: string | number, entityInfo: Object, updateXY?: boolean): Promise<unknown>;
132
+ /**
133
+ * Update a WorkOrder entity
134
+ *
135
+ * @category WorkOrders
136
+ * @param {string|number} workOrderSId - The workorder S/ID which the entities should be added to. # for SID, string for ID.
137
+ * @param {Object} entityInfo - Entity info object including: (req) EntityType: {string}, (req) EntityUid: {string}, Facility_Id: {string}, Level_Id: {string}
138
+ * @param {boolean} workComplete - Update WorkOrder completeness, default is true.
139
+ * @return {Object} Returns object that represents a list of entities removed.
140
+ */
141
+ updateEntity(workOrderSId: string | number, entityInfo: Object, workComplete?: boolean): Promise<unknown>;
128
142
  /**
129
143
  * Remove entities from a work order. Provide WorkOrderId and either ObjectIds or EntityType and EntityUids
130
144
  *
@@ -178,14 +192,68 @@ export declare class WorkOrder {
178
192
  */
179
193
  delete(workOrderIds: Array<number>): Promise<unknown>;
180
194
  /**
181
- * Get categories
195
+ * Get WorkOrderS/IDs connected to provided entities
196
+ *
197
+ * @category WorkOrder Search
198
+ * @param {string} entityType - The entity type to find connected work orders
199
+ * @param {Array<string>} entityUIDs - The list of entities to search for connected WorkOrders
200
+ * @param {boolean} s - Get WorkOrderSids. Defaults to true. When false, returned list is WorkOrderIds
201
+ * @param {Object} [search] - Any additional search properties of the work order (open/closed, etc)
202
+ * @return {Object} Returns Promise that represents an array of WorkOrderS/IDs
203
+ */
204
+ getWOsByEntities(entityType: string, entityUids: Array<string>, search?: Array<string | number>, s?: boolean): Promise<unknown>;
205
+ /**
206
+ * Get WorkOrderSid and description for provided WorkOrderId
207
+ *
208
+ * @category WorkOrder Search
209
+ * @param {string} workOrderId - The WorkOrderId for which to get the WorkOrderSid and description
210
+ * @return {Object} Returns Promise that represents an object with WorkOrderS/IDs & Description
211
+ */
212
+ getSearchList(workOrderId: string): Promise<unknown>;
213
+ /**
214
+ * Get WorkOrder Employee lists
215
+ *
216
+ * @category WorkOrder Options
217
+ * @param {string} listType - Which list (endpoint) to get. Includes Supervisors & SubmitTos.
218
+ * @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
219
+ * @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
220
+ * @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
221
+ */
222
+ getEmployeeLists(listType: string, includeInactiveEmployees?: boolean, domainIds?: Array<number>): Promise<unknown>;
223
+ /**
224
+ * Get SubmitTo list
225
+ *
226
+ * @category WorkOrder Options
227
+ * @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
228
+ * @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
229
+ * @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
230
+ */
231
+ getSubmitTos(includeInactiveEmployees?: boolean, domainIds?: Array<number>): Promise<unknown>;
232
+ /**
233
+ * Get Supervisors list
234
+ *
235
+ * @category WorkOrder Options
236
+ * @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
237
+ * @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
238
+ * @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
239
+ */
240
+ getSupervisors(includeInactiveEmployees?: boolean, domainIds?: Array<number>): Promise<unknown>;
241
+ /**
242
+ * Get Status Options
243
+ *
244
+ * @category WorkOrder Options
245
+ * @return {Object} Returns Promise that represents a collection of codes. See: /{subdirectory}/apidocs/#/data-type-info;dataType=CodeDesc
246
+ */
247
+ getStatuses(): Promise<unknown>;
248
+ /**
249
+ * Get Categories
182
250
  *
183
251
  * @category WorkOrder Options
184
252
  * @return {Object} Returns Promise that represents an array of configured workorder category code descriptions
185
253
  */
186
254
  getCategories(): Promise<unknown>;
187
255
  /**
188
- * Get priorities
256
+ * Get Priorities
189
257
  *
190
258
  * @category WorkOrder Options
191
259
  * @return {Object} Returns Promise that represents an array of configured workorder priorities
@@ -0,0 +1,10 @@
1
+ export declare class WorkOrderAdmin {
2
+ /**
3
+ * @hidden
4
+ */
5
+ cw: any;
6
+ /**
7
+ * @hidden
8
+ */
9
+ constructor(cw: any);
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cityworks",
3
- "version": "0.0.15",
3
+ "version": "0.0.20",
4
4
  "description": "A Cityworks API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "umd:main": "dist/index.umd.js",
package/src/case.ts CHANGED
@@ -4,6 +4,7 @@ const _ = require('lodash')
4
4
  import { CaseData } from './case_data'
5
5
  import { CaseFinancial } from './case_financial'
6
6
  import { CaseWorkflow} from './case_workflow'
7
+ import { CaseAdmin } from './case_admin'
7
8
 
8
9
  export class Case {
9
10
  /**
@@ -24,6 +25,11 @@ export class Case {
24
25
  * Payment, Receipt, & Fee methods
25
26
  */
26
27
  financial?: Object
28
+ /**
29
+ * PLL Administration methods
30
+ */
31
+ admin?: Object
32
+
27
33
 
28
34
  /**
29
35
  * @hidden
@@ -33,6 +39,195 @@ export class Case {
33
39
  this.data = new CaseData(cw)
34
40
  this.workflow = new CaseWorkflow(cw)
35
41
  this.financial = new CaseFinancial(cw)
42
+ this.admin = new CaseAdmin(cw)
43
+ }
44
+
45
+ /**
46
+ * Create new case
47
+ *
48
+ * @category Cases
49
+ * @param {number} caseTypeId - The case Type ID
50
+ * @param {number} subTypeId - The case subType ID
51
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
52
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
53
+ */
54
+ create(caseTypeId: number, subTypeId: number, options?: Object) {
55
+ return new Promise((resolve, reject) => {
56
+ var data_init = {
57
+ CaseTypeId: caseTypeId,
58
+ SubTypeId: subTypeId
59
+ }
60
+ var data = _.merge(data_init, options)
61
+ this.cw.runRequest('Pll/Case/Create', data).then(r => {
62
+ resolve(r.Value)
63
+ }).catch(e => {
64
+ reject(e)
65
+ })
66
+ })
67
+ }
68
+
69
+ /**
70
+ * Create a child case
71
+ *
72
+ * @category Cases
73
+ * @param {number} busCaseId - The case Type ID
74
+ * @param {number} parentCaObjectId - The case subType ID
75
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
76
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
77
+ */
78
+ createChild(busCaseId: number, parentCaObjectId: number, options?: Object) {
79
+ return new Promise((resolve, reject) => {
80
+ var data_init = {
81
+ BusCaseId: busCaseId,
82
+ ParentCaObjectId: parentCaObjectId
83
+ }
84
+ var data = _.merge(data_init, options)
85
+ this.cw.runRequest('Pll/Case/CreateChild', data).then(r => {
86
+ resolve(r.Value)
87
+ }).catch(e => {
88
+ reject(e)
89
+ })
90
+ })
91
+ }
92
+
93
+ /**
94
+ * Create a case from a Service Request
95
+ *
96
+ * @category Cases
97
+ * @param {number} caseTypeId - The case Type ID
98
+ * @param {number} subTypeId - The case subType ID
99
+ * @param {number} requestId - The service request ID
100
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
101
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
102
+ */
103
+ createFromRequest(caseTypeId: number, subTypeId: number, requestId: number, options?: Object) {
104
+ return new Promise((resolve, reject) => {
105
+ var data_init = {
106
+ CaseTypeId: caseTypeId,
107
+ SubTypeId: subTypeId,
108
+ ServiceRequestId: requestId
109
+ }
110
+ var data = _.merge(data_init, options)
111
+ this.cw.runRequest('Pll/CaseObject/CreateCaseFromServiceRequest', data).then(r => {
112
+ resolve(r.Value)
113
+ }).catch(e => {
114
+ reject(e)
115
+ })
116
+ })
117
+ }
118
+
119
+ /**
120
+ * Update a case
121
+ *
122
+ * @category Cases
123
+ * @param {number} caObjectId - The case Object ID to update
124
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
125
+ * @return {Object} Returns Promise that represents an object describing the updated case
126
+ */
127
+ update(caObjectId: number, options?: Object) {
128
+ return new Promise((resolve, reject) => {
129
+ var data_init = {
130
+ CaObjectId: caObjectId
131
+ }
132
+ var data = _.merge(data_init, options)
133
+ this.cw.runRequest('Pll/CaseObject/Update', data).then(r => {
134
+ resolve(r.Value)
135
+ }).catch(e => {
136
+ reject(e)
137
+ })
138
+ })
139
+ }
140
+
141
+ /**
142
+ * Get cases by IDs
143
+ *
144
+ * @category Cases
145
+ * @param {Array<number>} caObjectIds - The case Object ID to update
146
+ * @return {Object} Returns Promise that represents a collection of objects describing the cases
147
+ */
148
+ getByIds(caObjectIds: Array<number>) {
149
+ return new Promise((resolve, reject) => {
150
+ var data = {
151
+ CaObjectIds: caObjectIds
152
+ }
153
+ this.cw.runRequest('Pll/CaseObject/ByIds', data).then(r => {
154
+ resolve(r.Value)
155
+ }).catch(e => {
156
+ reject(e)
157
+ })
158
+ })
159
+ }
160
+
161
+ /**
162
+ * Search for Cases. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
163
+ *
164
+ * @category Cases
165
+ * @param {Object} filters - The parameter(s) to search by
166
+ * @return {Object} Returns Promise that represents an Array of case Object IDs
167
+ */
168
+ search(filters: Object) {
169
+ return new Promise((resolve, reject) => {
170
+ var data = filters
171
+ this.cw.runRequest('Pll/CaseObject/Search', data).then(r => {
172
+ resolve(r.Value)
173
+ }).catch(e => {
174
+ reject(e)
175
+ })
176
+ })
177
+ }
178
+
179
+ /**
180
+ * Move a Case point
181
+ *
182
+ * @category Cases
183
+ * @param {string} caObjectId
184
+ * @param {number} x
185
+ * @param {number} y
186
+ * @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
187
+ * @param {number} [z] - Optional Z coordinate
188
+ * @return {Object} Returns Promise that represents an object describing the updated GISPoint
189
+ */
190
+ move(caObjectId: number, x: number, y: number, projection: {WKID?: string, WKT?: string, VcsWKID?: string}, z?: number) {
191
+ return new Promise((resolve, reject) => {
192
+ if(!_.has(projection, 'WKID') && !_.has(projection, 'WKT')) {
193
+ // Throw error
194
+ reject(new CWError(1, 'You must provide either the WKID or WKT for the x/y coordinates.', {'projection': projection}))
195
+ }
196
+ var data_init = {
197
+ CaObjectId: caObjectId,
198
+ X: x,
199
+ Y: y
200
+ };
201
+ if(typeof(z)!='undefined') {
202
+ _.set(data_init, 'Z', z)
203
+ }
204
+ var data = _.merge(data_init, projection);
205
+ this.cw.runRequest('Pll/CaseObject/Move', data).then(r => {
206
+ resolve(r.Value)
207
+ }).catch(e => {
208
+ reject(e)
209
+ })
210
+ });
211
+ }
212
+
213
+ /**
214
+ * Delete case
215
+ *
216
+ * @category Cases
217
+ * @param {number} caObjectId - The case Object ID
218
+ * @return {Object} Returns Promise that represents an object describing the deleted case
219
+ */
220
+ delete(caObjectId: number) {
221
+ return new Promise((resolve, reject) => {
222
+ var data = {
223
+ CaObjectId: caObjectId,
224
+ }
225
+ this.cw.runRequest('Pll/CaseObject/DeleteCase', data).then(r => {
226
+ resolve(r.Value)
227
+ }).catch(e => {
228
+ reject(e)
229
+ })
230
+ })
36
231
  }
37
232
 
38
233
  }