cityworks 1.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,13 +4,20 @@ This API wrapper for Cityworks follows the Cityworks release schedule as closely
4
4
 
5
5
  Require the class:
6
6
 
7
- const Cityworks = require('cityworks')
7
+ const cw = require('cityworks')
8
+
9
+ or
8
10
 
9
11
  import * as cw from 'cityworks'
10
12
 
11
13
  Instantiate the Class for the instance of Cityworks available given a domain:
12
14
 
13
- cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 15})
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
+
14
21
 
15
22
  ## Authentication
16
23
 
@@ -1,84 +1,84 @@
1
- import ReversibleMap from 'reversible-map';
2
- /**
3
- * ActivityLink interface for ActivityLinks
4
- *
5
- */
6
- export interface ActivityLink {
7
- linkTypes: ReversibleMap<string, number>;
8
- activityTypes: ReversibleMap<string, number>;
9
- cw: any;
10
- }
11
- /**
12
- * ActivityLinks implements the activity link functions via using the ActivityLink interface
13
- *
14
- */
15
- export declare class ActivityLinks implements ActivityLink {
16
- /**
17
- * Activity types to map string to number for internal use. Activity types available are: "null", "case", "inspection", "request", "workorder", "wipcase"
18
- */
19
- activityTypes: ReversibleMap<string, number>;
20
- /**
21
- * Link types to map string to number for internal use. Link types available are: "null", "parent", "related"
22
- */
23
- linkTypes: ReversibleMap<string, number>;
24
- /**
25
- * @hidden
26
- */
27
- cw: any;
28
- /**
29
- * @hidden
30
- */
31
- constructor(cw: any);
32
- private setActivityTypes;
33
- private setLinkTypes;
34
- private validateType;
35
- private transformLinksData;
36
- private runRequest;
37
- /**
38
- * Create a new activity link between two items.
39
- *
40
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
41
- * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
42
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
43
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
44
- * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
45
- * @return {Object} Returns Promise object that represents a
46
- */
47
- add(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
48
- /**
49
- * Get the links for a particular node type by ID.
50
- *
51
- * @param {string} type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
52
- * @param {Array<number>} sids - Array of numeric (S)IDs you wish to get of the specified type
53
- * @return {Object} Returns Promise object that represents a collection
54
- */
55
- get(type: string, sids: Array<number>): Promise<unknown>;
56
- /**
57
- * Clone a current activity link.
58
- *
59
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
60
- * @param {number} source_sid - Source SID (numeric ID) one wishes to clone a link between SID as source and a particular destination
61
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
62
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to clone a link between SID as destination and a particular source
63
- * @return {Object} Returns Promise object that represents a
64
- */
65
- clone(source_type: string, source_sid: number, destination_type: string, destination_sid: number): Promise<unknown>;
66
- /**
67
- * Delete an activity link by ID
68
- *
69
- * @param {number} activity_link_id - The ID of the activity link one wishes to delete
70
- * @return {Object} Returns Promise object that represents a
71
- */
72
- delete(activity_link_id: number): Promise<unknown>;
73
- /**
74
- * Remove a link by specifying everything.
75
- *
76
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
77
- * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
78
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
79
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
80
- * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
81
- * @return {Object} Returns Promise object that represents a
82
- */
83
- remove(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
84
- }
1
+ import ReversibleMap from 'reversible-map';
2
+ /**
3
+ * ActivityLink interface for ActivityLinks
4
+ *
5
+ */
6
+ export interface ActivityLink {
7
+ linkTypes: ReversibleMap<string, number>;
8
+ activityTypes: ReversibleMap<string, number>;
9
+ cw: any;
10
+ }
11
+ /**
12
+ * ActivityLinks implements the activity link functions via using the ActivityLink interface
13
+ *
14
+ */
15
+ export declare class ActivityLinks implements ActivityLink {
16
+ /**
17
+ * Activity types to map string to number for internal use. Activity types available are: "null", "case", "inspection", "request", "workorder", "wipcase"
18
+ */
19
+ activityTypes: ReversibleMap<string, number>;
20
+ /**
21
+ * Link types to map string to number for internal use. Link types available are: "null", "parent", "related"
22
+ */
23
+ linkTypes: ReversibleMap<string, number>;
24
+ /**
25
+ * @hidden
26
+ */
27
+ cw: any;
28
+ /**
29
+ * @hidden
30
+ */
31
+ constructor(cw: any);
32
+ private setActivityTypes;
33
+ private setLinkTypes;
34
+ private validateType;
35
+ private transformLinksData;
36
+ private runRequest;
37
+ /**
38
+ * Create a new activity link between two items.
39
+ *
40
+ * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
41
+ * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
42
+ * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
43
+ * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
44
+ * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
45
+ * @return {Object} Returns Promise object that represents a
46
+ */
47
+ add(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
48
+ /**
49
+ * Get the links for a particular node type by ID.
50
+ *
51
+ * @param {string} type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
52
+ * @param {Array<number>} sids - Array of numeric (S)IDs you wish to get of the specified type
53
+ * @return {Object} Returns Promise object that represents a collection
54
+ */
55
+ get(type: string, sids: Array<number>): Promise<unknown>;
56
+ /**
57
+ * Clone a current activity link.
58
+ *
59
+ * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
60
+ * @param {number} source_sid - Source SID (numeric ID) one wishes to clone a link between SID as source and a particular destination
61
+ * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
62
+ * @param {number} destination_sid - Destination SID (numeric ID) one wishes to clone a link between SID as destination and a particular source
63
+ * @return {Object} Returns Promise object that represents a
64
+ */
65
+ clone(source_type: string, source_sid: number, destination_type: string, destination_sid: number): Promise<unknown>;
66
+ /**
67
+ * Delete an activity link by ID
68
+ *
69
+ * @param {number} activity_link_id - The ID of the activity link one wishes to delete
70
+ * @return {Object} Returns Promise object that represents a
71
+ */
72
+ delete(activity_link_id: number): Promise<unknown>;
73
+ /**
74
+ * Remove a link by specifying everything.
75
+ *
76
+ * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
77
+ * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
78
+ * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
79
+ * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
80
+ * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
81
+ * @return {Object} Returns Promise object that represents a
82
+ */
83
+ remove(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
84
+ }
@@ -1,75 +1,134 @@
1
- export declare class Attachments {
2
- /**
3
- * @hidden
4
- */
5
- cw: any;
6
- /**
7
- * Storage of object's active activityType
8
- */
9
- currentActivityType: string;
10
- /**
11
- * @hidden
12
- */
13
- constructor(cw: any, current_type: any);
14
- /**
15
- * Add inspection attachments (doesn't handle URL or Signature type properly, currently)
16
- *
17
- * @category Inspection Attachments
18
- * @param {number} id - The ID of the node to add the attachment to (CA_OBJECT_ID, REQUESTID, WORKORDERSID, WORKORDERID, INSPECTIONID). If WORKORDERID, you _must_ feed in as a string.
19
- * @param {string} the_file - The loca path of the file to upload to the Cityworks instance
20
- * @param {number} [task_id] - ID of WorkOrder task, if current activity is a work order and the attachment should be on the task
21
- * @param {string} [filename] - The filename for the attachment
22
- * @param {string} [attachment_type] - The filename for the attachment, values: attachment, signature, url
23
- * @param {string} [comments] - The filename for the attachment
24
- * @return {Object} Returns object that represents a boolean for action resolution
25
- */
26
- add(node_id: number | string, the_file: string, filename?: string, attachment_type?: string, task_id?: number, comments?: string): Promise<unknown>;
27
- /**
28
- * Delete inspection attachments
29
- *
30
- * @category Inspection Attachments
31
- * @param {Array<number>|number} attachmentIds - An array of attachment IDs or a single attachment ID to delete.
32
- * @return {Object} Returns object that represents a boolean for action resolution
33
- */
34
- delete(attachmentIds: Array<number> | number): Promise<unknown>;
35
- /**
36
- * Download an attachment
37
- *
38
- * @category Attachments
39
- * @param {number} attachmentId - ID of an attachment to download
40
- * @return {Object} Returns object that represents a file stream
41
- */
42
- download(attachmentId: number): Promise<unknown>;
43
- /**
44
- * Get attachment by ID (not implemented)
45
- *
46
- * @category Attachments
47
- * @param {number} attachmentId - An attachment ID to get info for
48
- * @return {Object} Returns object that represents an object that describes the matched inspection attachment
49
- */
50
- getById(attachmentId: number): Promise<unknown>;
51
- /**
52
- * Get attachments related to Inspection, WorkOrder, or Request
53
- *
54
- * @category Attachments
55
- * @param {Array<number>|number} ids - An array of IDs or a single ID (inspectionIds, WorkOrderSids, WorkOrderIds, or RequestIds) for which to get attachments. Only one node (Inspection, WorkOrder, Request, or Case) type at a time. Don't mix-and-match WorkOrderIds with WorkOrderSids.
56
- * @return {Object} Returns Promise that represents a collection of attachments from the matched inspections, service requests, or work orders
57
- */
58
- getAttachments(ids: Array<number> | number): Promise<unknown>;
59
- /**
60
- * Get Related Documents from Case
61
- *
62
- * @category Attachments
63
- * @param {number} id - An array of CaseIDs or a single CaseID for which to get related documents.
64
- * @return {Object} Returns Promise that represents a collection of related documents from the matched cases
65
- */
66
- getRelatedDocs(id: number): Promise<unknown>;
67
- /**
68
- * Get attachment by node (Inspection, WorkOrder, Request, or Case) IDs
69
- *
70
- * @category Attachments
71
- * @param {Array<number>|number} ids - An array of IDs or a single ID (inspectionIds, WorkOrderSids, WorkOrderIds, RequestIds, or CaseIds) to get attachments for. Only one node (Inspection, WorkOrder, Request, or Case) type at a time. Don't mix-and-match WorkOrderIds with WorkOrderSids.
72
- * @return {Object} Returns Promise that represents a collection of attachments from the matched inspections
73
- */
74
- getByNodesId(ids: Array<number> | number): Promise<unknown>;
75
- }
1
+ export declare class Attachments {
2
+ /**
3
+ * @hidden
4
+ */
5
+ cw: any;
6
+ /**
7
+ * Storage of object's active activityType
8
+ */
9
+ currentActivityType: string;
10
+ /**
11
+ * @hidden
12
+ */
13
+ constructor(cw: any, current_type: any);
14
+ /**
15
+ * Add attachments (doesn't handle URL or Signature type attachments properly, currently)
16
+ *
17
+ * @category Attachments
18
+ * @param {number} id - The ID of the node to add the attachment to (CA_OBJECT_ID, REQUESTID, WORKORDERSID, WORKORDERID, INSPECTIONID). If WORKORDERID, you _must_ feed in as a string.
19
+ * @param {string} the_file - The loca path of the file to upload to the Cityworks instance
20
+ * @param {number} [task_id] - ID of WorkOrder task, if current activity is a work order and the attachment should be on the task
21
+ * @param {string} [filename] - The filename for the attachment
22
+ * @param {string} [attachment_type] - The filename for the attachment, values: attachment, signature, url
23
+ * @param {string} [comments] - The filename for the attachment
24
+ * @param {string} [label] - The label to apply to the (PLL only)
25
+ * @return {Object} Returns object that represents a boolean for action resolution
26
+ */
27
+ add(node_id: number | string, the_file: string, filename?: string, attachment_type?: string, task_id?: number, comments?: string, label?: string): Promise<unknown>;
28
+ /**
29
+ * Update attachment
30
+ *
31
+ * @category Attachments
32
+ * @param {number} id - The ID of the node to add the attachment to (CA_OBJECT_ID, REQUESTID, WORKORDERSID, WORKORDERID, INSPECTIONID). If WORKORDERID, you _must_ feed in as a string.
33
+ * @param {string} [title] - The filename for the attachment
34
+ * @param {string} [description] - The filename for the attachment
35
+ * @param {string} [label] - The label to apply to the (PLL only)
36
+ * @return {Object} Returns object that represents a boolean for action resolution
37
+ */
38
+ update(attachment_id: number, title?: string, description?: string, label?: string): Promise<unknown>;
39
+ /**
40
+ * Delete inspection attachments
41
+ *
42
+ * @category Inspection Attachments
43
+ * @param {Array<number>|number} attachmentIds - An array of attachment IDs or a single attachment ID to delete.
44
+ * @return {Object} Returns object that represents a boolean for action resolution
45
+ */
46
+ delete(attachmentIds: Array<number> | number): Promise<unknown>;
47
+ /**
48
+ * Get attachment URLs in array
49
+ *
50
+ * @category Attachments
51
+ * @return {Object} Returns array of attachment URLs
52
+ */
53
+ static downloadUrls(): string[];
54
+ /**
55
+ * Download an attachment
56
+ *
57
+ * @category Attachments
58
+ * @param {number} attachmentId - ID of an attachment to download
59
+ * @return {Object} Returns object that represents a file stream
60
+ */
61
+ download(attachmentId: number): Promise<unknown>;
62
+ /**
63
+ * Get attachment by ID (not implemented)
64
+ *
65
+ * @category Attachments
66
+ * @param {number} attachmentId - An attachment ID to get info for
67
+ * @return {Object} Returns object that represents an object that describes the matched inspection attachment
68
+ */
69
+ getById(attachmentId: number): Promise<unknown>;
70
+ /**
71
+ * Get attachments related to Inspection, WorkOrder, or Request
72
+ *
73
+ * @category Attachments
74
+ * @param {Array<number>|number} ids - An array of IDs or a single ID (inspectionIds, WorkOrderSids, WorkOrderIds, or RequestIds) for which to get attachments. Only one node (Inspection, WorkOrder, Request, or Case) type at a time. Don't mix-and-match WorkOrderIds with WorkOrderSids.
75
+ * @return {Object} Returns Promise that represents a collection of attachments from the matched inspections, service requests, or work orders
76
+ */
77
+ getAttachments(ids: Array<number> | number): Promise<unknown>;
78
+ /**
79
+ * Get Related Documents from Case
80
+ *
81
+ * @category Attachments
82
+ * @param {number} id - An array of CaseIDs or a single CaseID for which to get related documents.
83
+ * @return {Object} Returns Promise that represents a collection of related documents from the matched cases
84
+ */
85
+ getRelatedDocs(id: number): Promise<unknown>;
86
+ /**
87
+ * Get attachment by node (Inspection, WorkOrder, Request, or Case) IDs
88
+ *
89
+ * @category Attachments
90
+ * @param {Array<number>|number} ids - An array of IDs or a single ID (inspectionIds, WorkOrderSids, WorkOrderIds, RequestIds, or CaseIds) to get attachments for. Only one node (Inspection, WorkOrder, Request, or Case) type at a time. Don't mix-and-match WorkOrderIds with WorkOrderSids.
91
+ * @return {Object} Returns Promise that represents a collection of attachments from the matched inspections
92
+ */
93
+ getByNodesId(ids: Array<number> | number): Promise<unknown>;
94
+ /**
95
+ * Get Tags available with which to tag attachments
96
+ *
97
+ * @category Attachments
98
+ * @return {Object} Returns Promise that represents a collection of tags that can be added to attachments
99
+ */
100
+ getTags(): Promise<unknown>;
101
+ private syncTags;
102
+ private loopSyncTags;
103
+ /**
104
+ * Set Tags on an attachment
105
+ *
106
+ * @category Attachments
107
+ * @return {Object} Returns Promise that represents a collection of tags that can be added to attachments
108
+ */
109
+ setTags(attachmentId: number, tags: {
110
+ tagid: number;
111
+ tagtext: string;
112
+ }[], activityType: string): Promise<unknown>;
113
+ /**
114
+ * Set Tags on an many attachments
115
+ *
116
+ * @category Attachments
117
+ * @param {Array<number>|number} attachmentIds - An array of attachment IDs to add tags to.
118
+ * @param {Array<{tagid: number, tagtext: string}>} tags - An array of tag objects to add to the attachments
119
+ * @param {string} activityType - The type of activity to which the attachments belong
120
+ * @return {Object} Returns Promise that represents a collection of documents which have had their tags set
121
+ */
122
+ setTagsOnMany(attachmentIds: number[], tags: {
123
+ tagid: number;
124
+ tagtext: string;
125
+ }[]): Promise<unknown>;
126
+ /**
127
+ * Get Doc labels for a case template
128
+ *
129
+ * @category Attachments
130
+ * @param {number} busCaseId - The ID of the Business Case to get Document Labels for
131
+ * @return {Object} Returns Promise that represents a collection of tags that can be added to attachments
132
+ */
133
+ getDocLabels(busCaseId: number): Promise<unknown>;
134
+ }