cityworks 2.2.0 → 2.2.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/LICENSE +21 -21
- package/README.md +119 -119
- package/dist/case_financial.d.ts +24 -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 +59 -58
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Walker Hamilton <3987+walker@users.noreply.github.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Walker Hamilton <3987+walker@users.noreply.github.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
# Cityworks node.js API wrapper
|
|
2
|
-
|
|
3
|
-
This API wrapper for Cityworks follows the Cityworks release schedule as closely as possible. Functionality may be missing depending on necessity or use.
|
|
4
|
-
|
|
5
|
-
Require the class:
|
|
6
|
-
|
|
7
|
-
const cw = require('cityworks')
|
|
8
|
-
|
|
9
|
-
or
|
|
10
|
-
|
|
11
|
-
import * as cw from 'cityworks'
|
|
12
|
-
|
|
13
|
-
Instantiate the Class for the instance of Cityworks available given a domain:
|
|
14
|
-
|
|
15
|
-
cw.Cityworks.configure('cwoffice.domain.tld', {path: 'cityworks', version: 15})
|
|
16
|
-
|
|
17
|
-
or
|
|
18
|
-
|
|
19
|
-
cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 23});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Authentication
|
|
23
|
-
|
|
24
|
-
Authenticate with the Cityworks install:
|
|
25
|
-
|
|
26
|
-
cw.Cityworks.authenticate('myuser', 'mypassword').then(resp => {}).catch(error => {
|
|
27
|
-
console.log(error.message)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Get the currently valid token in order to store it in a session or cookie:
|
|
32
|
-
|
|
33
|
-
cw.Cityworks.getToken()
|
|
34
|
-
|
|
35
|
-
Provide a saved token instead of the standard u/p auth:
|
|
36
|
-
|
|
37
|
-
cw.Cityworks.setToken('mytoken')
|
|
38
|
-
|
|
39
|
-
## Main method calls
|
|
40
|
-
|
|
41
|
-
Access the primary AMS ([Inspection](https://walker.github.io/cityworks/classes/inspection.Inspection.html), [WorkOrder](https://walker.github.io/cityworks/classes/workorder.WorkOrder.html), & [Service Request](https://walker.github.io/cityworks/classes/request.Request.html)) & [PLL](https://walker.github.io/cityworks/classes/case.Briefcase.html) object libraries like so:
|
|
42
|
-
|
|
43
|
-
cw.inspection.methodHere().then(resp => {})
|
|
44
|
-
cw.workorder.methodHere().then(resp => {})
|
|
45
|
-
cw.request.methodHere().then(resp => {})
|
|
46
|
-
cw.briefcase.methodHere().then(resp => {})
|
|
47
|
-
|
|
48
|
-
Some of the methods are general or top-level, and so, are accessed separately are at the same level of reference from the cityworks object:
|
|
49
|
-
|
|
50
|
-
[General methods](https://walker.github.io/cityworks/classes/general.General.html) including authentication:
|
|
51
|
-
|
|
52
|
-
cw.general.methodHere().then(resp => {})
|
|
53
|
-
|
|
54
|
-
[Message queue](https://walker.github.io/cityworks/classes/message_queue.MessageQueue.html) methods for examining, processing, and troubleshooting webhooks and activity events:
|
|
55
|
-
|
|
56
|
-
cw.message_queue.methodHere().then(resp => {})
|
|
57
|
-
|
|
58
|
-
[Activity link](https://walker.github.io/cityworks/classes/activity_link.ActivityLinks.html) for linking one node/object to another:
|
|
59
|
-
|
|
60
|
-
cw.activity_link.methodHere().then(resp => {})
|
|
61
|
-
|
|
62
|
-
[Mapping and GIS methods](https://walker.github.io/cityworks/classes/gis.Gis.html) not specific to a single object type:
|
|
63
|
-
|
|
64
|
-
cw.gis.methodHere().then(resp => {})
|
|
65
|
-
|
|
66
|
-
[General query methods](https://walker.github.io/cityworks/classes/query.Query.html):
|
|
67
|
-
|
|
68
|
-
cw.query.methodHere().then(resp => {})
|
|
69
|
-
|
|
70
|
-
[(Deprecated) General search methods](https://walker.github.io/cityworks/classes/search.Search.html):
|
|
71
|
-
|
|
72
|
-
cw.search.methodHere().then(resp => {})
|
|
73
|
-
|
|
74
|
-
## Case financials, data details, and admin
|
|
75
|
-
|
|
76
|
-
For the sake of organizing some of the other methods needed by the primary and secondary libraries, there are also objects and methods accessed within those main libraries:
|
|
77
|
-
|
|
78
|
-
For [PLL case financial actions](https://walker.github.io/cityworks/classes/case_financial.CaseFinancial.html):
|
|
79
|
-
|
|
80
|
-
cw.briefcase.financial.methodHere().then(resp => {})
|
|
81
|
-
|
|
82
|
-
For [PLL case data details & data groups](https://walker.github.io/cityworks/classes/case_data.CaseData.html):
|
|
83
|
-
|
|
84
|
-
cw.briefcase.data.methodHere().then(resp => {})
|
|
85
|
-
|
|
86
|
-
For PLL case [workflow and task actions](https://walker.github.io/cityworks/classes/case_workflow.CaseWorkflow.html):
|
|
87
|
-
|
|
88
|
-
cw.briefcase.workflow.methodHere().then(resp => {})
|
|
89
|
-
|
|
90
|
-
For [PLL administration actions](https://walker.github.io/cityworks/classes/case_admin.CaseAdmin.html):
|
|
91
|
-
|
|
92
|
-
cw.briefcase.admin.methodHere().then(resp => {})
|
|
93
|
-
|
|
94
|
-
## Commenting
|
|
95
|
-
|
|
96
|
-
For any object in Cityworks which can be commented on, use the [Comments class](https://walker.github.io/cityworks/classes/comments.Comments.html) via the class the comment is to be made on:
|
|
97
|
-
|
|
98
|
-
cw.briefcase.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {})
|
|
99
|
-
|
|
100
|
-
cw.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {})
|
|
101
|
-
|
|
102
|
-
cw.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {})
|
|
103
|
-
|
|
104
|
-
## Attachments
|
|
105
|
-
|
|
106
|
-
For any object in Cityworks which has attachments, (including cases as CaRelDocs), use the [Attachments class](https://walker.github.io/cityworks/modules/attachments.html) via the class the attachment is to be made on:
|
|
107
|
-
|
|
108
|
-
cw.briefcase.attachment.add(CaObjectIdGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
109
|
-
|
|
110
|
-
cw.workorder.attachment.add(WorkOrderSIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
111
|
-
|
|
112
|
-
cw.request.attachment.add(RequestIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
113
|
-
|
|
114
|
-
cw.inspection.attachment.add(InspectionIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
## Activity Links
|
|
118
|
-
|
|
119
|
-
cw.activity_link.add(source_type, source_sid, destination_type, destination_sid)
|
|
1
|
+
# Cityworks node.js API wrapper
|
|
2
|
+
|
|
3
|
+
This API wrapper for Cityworks follows the Cityworks release schedule as closely as possible. Functionality may be missing depending on necessity or use.
|
|
4
|
+
|
|
5
|
+
Require the class:
|
|
6
|
+
|
|
7
|
+
const cw = require('cityworks')
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
import * as cw from 'cityworks'
|
|
12
|
+
|
|
13
|
+
Instantiate the Class for the instance of Cityworks available given a domain:
|
|
14
|
+
|
|
15
|
+
cw.Cityworks.configure('cwoffice.domain.tld', {path: 'cityworks', version: 15})
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 23});
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Authentication
|
|
23
|
+
|
|
24
|
+
Authenticate with the Cityworks install:
|
|
25
|
+
|
|
26
|
+
cw.Cityworks.authenticate('myuser', 'mypassword').then(resp => {}).catch(error => {
|
|
27
|
+
console.log(error.message)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Get the currently valid token in order to store it in a session or cookie:
|
|
32
|
+
|
|
33
|
+
cw.Cityworks.getToken()
|
|
34
|
+
|
|
35
|
+
Provide a saved token instead of the standard u/p auth:
|
|
36
|
+
|
|
37
|
+
cw.Cityworks.setToken('mytoken')
|
|
38
|
+
|
|
39
|
+
## Main method calls
|
|
40
|
+
|
|
41
|
+
Access the primary AMS ([Inspection](https://walker.github.io/cityworks/classes/inspection.Inspection.html), [WorkOrder](https://walker.github.io/cityworks/classes/workorder.WorkOrder.html), & [Service Request](https://walker.github.io/cityworks/classes/request.Request.html)) & [PLL](https://walker.github.io/cityworks/classes/case.Briefcase.html) object libraries like so:
|
|
42
|
+
|
|
43
|
+
cw.inspection.methodHere().then(resp => {})
|
|
44
|
+
cw.workorder.methodHere().then(resp => {})
|
|
45
|
+
cw.request.methodHere().then(resp => {})
|
|
46
|
+
cw.briefcase.methodHere().then(resp => {})
|
|
47
|
+
|
|
48
|
+
Some of the methods are general or top-level, and so, are accessed separately are at the same level of reference from the cityworks object:
|
|
49
|
+
|
|
50
|
+
[General methods](https://walker.github.io/cityworks/classes/general.General.html) including authentication:
|
|
51
|
+
|
|
52
|
+
cw.general.methodHere().then(resp => {})
|
|
53
|
+
|
|
54
|
+
[Message queue](https://walker.github.io/cityworks/classes/message_queue.MessageQueue.html) methods for examining, processing, and troubleshooting webhooks and activity events:
|
|
55
|
+
|
|
56
|
+
cw.message_queue.methodHere().then(resp => {})
|
|
57
|
+
|
|
58
|
+
[Activity link](https://walker.github.io/cityworks/classes/activity_link.ActivityLinks.html) for linking one node/object to another:
|
|
59
|
+
|
|
60
|
+
cw.activity_link.methodHere().then(resp => {})
|
|
61
|
+
|
|
62
|
+
[Mapping and GIS methods](https://walker.github.io/cityworks/classes/gis.Gis.html) not specific to a single object type:
|
|
63
|
+
|
|
64
|
+
cw.gis.methodHere().then(resp => {})
|
|
65
|
+
|
|
66
|
+
[General query methods](https://walker.github.io/cityworks/classes/query.Query.html):
|
|
67
|
+
|
|
68
|
+
cw.query.methodHere().then(resp => {})
|
|
69
|
+
|
|
70
|
+
[(Deprecated) General search methods](https://walker.github.io/cityworks/classes/search.Search.html):
|
|
71
|
+
|
|
72
|
+
cw.search.methodHere().then(resp => {})
|
|
73
|
+
|
|
74
|
+
## Case financials, data details, and admin
|
|
75
|
+
|
|
76
|
+
For the sake of organizing some of the other methods needed by the primary and secondary libraries, there are also objects and methods accessed within those main libraries:
|
|
77
|
+
|
|
78
|
+
For [PLL case financial actions](https://walker.github.io/cityworks/classes/case_financial.CaseFinancial.html):
|
|
79
|
+
|
|
80
|
+
cw.briefcase.financial.methodHere().then(resp => {})
|
|
81
|
+
|
|
82
|
+
For [PLL case data details & data groups](https://walker.github.io/cityworks/classes/case_data.CaseData.html):
|
|
83
|
+
|
|
84
|
+
cw.briefcase.data.methodHere().then(resp => {})
|
|
85
|
+
|
|
86
|
+
For PLL case [workflow and task actions](https://walker.github.io/cityworks/classes/case_workflow.CaseWorkflow.html):
|
|
87
|
+
|
|
88
|
+
cw.briefcase.workflow.methodHere().then(resp => {})
|
|
89
|
+
|
|
90
|
+
For [PLL administration actions](https://walker.github.io/cityworks/classes/case_admin.CaseAdmin.html):
|
|
91
|
+
|
|
92
|
+
cw.briefcase.admin.methodHere().then(resp => {})
|
|
93
|
+
|
|
94
|
+
## Commenting
|
|
95
|
+
|
|
96
|
+
For any object in Cityworks which can be commented on, use the [Comments class](https://walker.github.io/cityworks/classes/comments.Comments.html) via the class the comment is to be made on:
|
|
97
|
+
|
|
98
|
+
cw.briefcase.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {})
|
|
99
|
+
|
|
100
|
+
cw.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {})
|
|
101
|
+
|
|
102
|
+
cw.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {})
|
|
103
|
+
|
|
104
|
+
## Attachments
|
|
105
|
+
|
|
106
|
+
For any object in Cityworks which has attachments, (including cases as CaRelDocs), use the [Attachments class](https://walker.github.io/cityworks/modules/attachments.html) via the class the attachment is to be made on:
|
|
107
|
+
|
|
108
|
+
cw.briefcase.attachment.add(CaObjectIdGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
109
|
+
|
|
110
|
+
cw.workorder.attachment.add(WorkOrderSIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
111
|
+
|
|
112
|
+
cw.request.attachment.add(RequestIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
113
|
+
|
|
114
|
+
cw.inspection.attachment.add(InspectionIDGoesHere, path.join('uploads', 'filename.pdf')).then(resp => {})
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## Activity Links
|
|
118
|
+
|
|
119
|
+
cw.activity_link.add(source_type, source_sid, destination_type, destination_sid)
|
package/dist/case_financial.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export declare class CaseFinancial {
|
|
|
30
30
|
* Make a Payment. Adds a payment to the case fee(s) specified.
|
|
31
31
|
*
|
|
32
32
|
* @category Case Payments
|
|
33
|
-
* @param {Array<Array<string>>} payments -
|
|
34
|
-
* @param {Array<number>} caseFees -
|
|
33
|
+
* @param {Array<Array<string>>} payments - A collection of Payments to add: [Payment Tender Type, Amount, Comment, Date Received, Reference String] (All as strings)
|
|
34
|
+
* @param {Array<number>} caseFees - The Ca Fee IDs to which to apply the payment.
|
|
35
35
|
* @param {stringName:string,AddressLine1?:string,AddressLine2?:string,AddressLine3?:string,CityName?:string,CommentText?:string,Email?:string,FaxNumber?:string,PhoneHome?:string,PhoneMobile?:string,PhoneWork?:string,PhoneWorkExt?:string,StateCode?:string,WebSiteUrl?:string,ZipCode?:string,CountryCode?:string} payerInfo - Payer info for the payment being made.
|
|
36
36
|
* @return {Object} Returns Promise that represents an object describing the newly-added payment.
|
|
37
37
|
*/
|
|
@@ -155,6 +155,28 @@ export declare class CaseFinancial {
|
|
|
155
155
|
* @return {Object} Returns Promise that represents a collection of Case Payments.
|
|
156
156
|
*/
|
|
157
157
|
getPayments(caObjectId: number): Promise<unknown>;
|
|
158
|
+
/**
|
|
159
|
+
* Get Receipts by Case ObjectId
|
|
160
|
+
*
|
|
161
|
+
* @category Case Payments
|
|
162
|
+
* @param {number} caObjectId - The Case Object ID for the case to get the payment receipts for
|
|
163
|
+
* @return {Object} Returns Promise that represents a collection of Case Receipts.
|
|
164
|
+
*/
|
|
165
|
+
getReceipts(caObjectId: number): Promise<unknown>;
|
|
166
|
+
/**
|
|
167
|
+
* @hidden
|
|
168
|
+
*/
|
|
169
|
+
static downloadUrls(): {
|
|
170
|
+
receipt: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Download a Receipt by Receipt Id or Receipt Name.
|
|
174
|
+
*
|
|
175
|
+
* @category Case Payments
|
|
176
|
+
* @param {string | number} receipt - The Receipt Name or Receipt ID for the receipt to download
|
|
177
|
+
* @return {Object} Returns Promise that represents the downloaded Receipt PDF and Filename.
|
|
178
|
+
*/
|
|
179
|
+
downloadReceipt(receipt: string | number): Promise<unknown>;
|
|
158
180
|
/**
|
|
159
181
|
* Gets the instruments from the case specified by the CaObectId.
|
|
160
182
|
*
|