cityworks 2.1.5 → 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 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)
@@ -45,12 +45,14 @@ export declare class Attachments {
45
45
  */
46
46
  delete(attachmentIds: Array<number> | number): Promise<unknown>;
47
47
  /**
48
- * Get attachment URLs in array
49
- *
50
- * @category Attachments
51
- * @return {Object} Returns array of attachment URLs
48
+ * @hidden
52
49
  */
53
- static downloadUrls(): string[];
50
+ static downloadUrls(): {
51
+ case: string;
52
+ inspection: string;
53
+ request: string;
54
+ workorder: string;
55
+ };
54
56
  /**
55
57
  * Download an attachment
56
58
  *
@@ -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 - The Case Object ID for the case to which to add the fee
34
- * @param {Array<number>} caseFees - Fees this payment should be applied to. Array of CaFeeIds values.
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
  *
@@ -29,8 +29,7 @@ export declare class CaseFlags {
29
29
  * Delete specific flag from case
30
30
  *
31
31
  * @category Case Flags
32
- * @param {number} caObjectId - The Case Object to attach the data group to.
33
- * @param {boolean} updateXY - Whether or not to update the Case's X/Y values when detaching the flags. Defaults to true.
32
+ * @param {number} caFlagId - The CaFlagId (case flag instance ID) that should be deleted
34
33
  * @return {Object} Returns Promise that represents the CaFlag that has been deleted.
35
34
  */
36
35
  delete(caFlagId: number): Promise<unknown>;
@@ -38,7 +37,7 @@ export declare class CaseFlags {
38
37
  * Delete all flags from case
39
38
  *
40
39
  * @category Case Flags
41
- * @param {number} caObjectId - The Case Object to detach the flags from.
40
+ * @param {number} caObjectId - The Case Object to delete the flags from.
42
41
  * @return {Object} Returns Promise that represents the number of flags deleted from the case provided.
43
42
  */
44
43
  deleteAll(caObjectId: number): Promise<unknown>;
package/dist/error.d.ts CHANGED
@@ -14,11 +14,11 @@ export interface CWErrorMsgs {
14
14
  *
15
15
  */
16
16
  export interface CWErrorInt {
17
- name: string;
18
- code: number;
19
- message: string;
20
- error_messages?: Array<CWErrorMsgs>;
21
- info?: string;
17
+ Name: string;
18
+ Code: number;
19
+ Message: string;
20
+ Error_messages?: Array<CWErrorMsgs>;
21
+ Info?: string;
22
22
  }
23
23
  /**
24
24
  * CWError implements a custom error class for this codebase with additional information
@@ -28,23 +28,23 @@ export declare class CWError implements CWErrorInt {
28
28
  /**
29
29
  * Just statically set to "Cityworks Exception" for now
30
30
  */
31
- name: string;
31
+ Name: string;
32
32
  /**
33
33
  * Number for the thrown error (Efforts were made to make these unique when thrown throughout the codebase)
34
34
  */
35
- code: number;
35
+ Code: number;
36
36
  /**
37
37
  * The error message
38
38
  */
39
- message: string;
39
+ Message: string;
40
40
  /**
41
41
  * The error message
42
42
  */
43
- error_messages: Array<CWErrorMsgs>;
43
+ Error_messages: Array<CWErrorMsgs>;
44
44
  /**
45
45
  * Object stuffed with any other information one wishes to include in the thrown error
46
46
  */
47
- info?: string;
47
+ Info?: string;
48
48
  /**
49
49
  * CWError implements a custom error class for this codebase with additional information
50
50
  *
package/dist/index.d.ts CHANGED
@@ -222,10 +222,10 @@ declare const activity_link: ActivityLinks;
222
222
  declare const message_queue: MessageQueue;
223
223
  declare const search: Search;
224
224
  declare const query: Query;
225
- declare const report: Report;
226
225
  declare const gis: Gis;
227
226
  declare const request: Request;
228
227
  declare const inspection: Inspection;
229
228
  declare const workorder: WorkOrder;
230
229
  declare const briefcase: Briefcase;
230
+ declare const report: Report;
231
231
  export { cw as Cityworks, general, activity_link, message_queue, search, query, gis, request, inspection, workorder, briefcase, report };