pyrus-api 3.2.0 → 3.3.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 +292 -292
- package/build/types/index.d.ts +14 -9
- package/package.json +48 -48
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Pyrus
|
|
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) 2024 Pyrus
|
|
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,293 +1,293 @@
|
|
|
1
|
-
# PyrusAPI Client
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/js/pyrus-api)
|
|
4
|
-
|
|
5
|
-
A TypeScript client for the Pyrus API.
|
|
6
|
-
The full documentation for API can be found [here](https://pyrus.com/en/help/api/)
|
|
7
|
-
|
|
8
|
-
## Getting Started
|
|
9
|
-
|
|
10
|
-
* Install
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
npm install pyrus-api
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
* Import client
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
import {PyrusApiClient} from "pyrus-api";
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
* Create and authenticate API client
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
const client = new PyrusApiClient(
|
|
26
|
-
{
|
|
27
|
-
login: "pyrus@login.com",
|
|
28
|
-
security_key: "security_key_from_profile"
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Forms
|
|
34
|
-
|
|
35
|
-
* Get all form templates
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
const formsResponse = await client.forms.getAll();
|
|
39
|
-
const forms = formsResponse.forms;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
* Get tasks list by form template
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import {OperatorId, toDateString} from "pyrus-api";
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
const maxDate = new Date("2024-01-12");
|
|
50
|
-
const formId = 19963;
|
|
51
|
-
const formRegisterResponse = await client.forms.getTasks(
|
|
52
|
-
formId,
|
|
53
|
-
{
|
|
54
|
-
filters: [
|
|
55
|
-
{
|
|
56
|
-
operator_id: OperatorId.Equals,
|
|
57
|
-
field_id: 6,
|
|
58
|
-
values: ['555']
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
operator_id: OperatorId.LessThan,
|
|
62
|
-
field_id: 4,
|
|
63
|
-
values: [toDateString(maxDate)]
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
include_archived: "y"
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
const tasks = formRegisterResponse.tasks;
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Tasks
|
|
73
|
-
|
|
74
|
-
* Get task with all comments
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
const taskResponse = await client.tasks.get({id: 2512});
|
|
78
|
-
const task = taskResponse.task;
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
* Add task comment
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
import type {FormFieldTable} from "pyrus-api";
|
|
85
|
-
import {ApprovalChoice} from "pyrus-api";
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
const taskId = 2512;
|
|
90
|
-
const fieldToAdd: FormFieldTable = {
|
|
91
|
-
id: 1,
|
|
92
|
-
type: FormFieldType.Table,
|
|
93
|
-
value: [
|
|
94
|
-
{
|
|
95
|
-
row_id: 15,
|
|
96
|
-
cells: [
|
|
97
|
-
{
|
|
98
|
-
type: FormFieldType.Text,
|
|
99
|
-
name: "Comment",
|
|
100
|
-
value: "That's right"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
position: 1
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
};
|
|
107
|
-
const taskResponse = await client.tasks.addComment(
|
|
108
|
-
taskId,
|
|
109
|
-
{
|
|
110
|
-
approval_choice: ApprovalChoice.Approved,
|
|
111
|
-
field_updates: [fieldToAdd]
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
const task = taskResponse.task;
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
* Create a task
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
const taskResponse = await client.tasks.create(
|
|
121
|
-
{
|
|
122
|
-
text: "Help me",
|
|
123
|
-
participants: [
|
|
124
|
-
{id: 1731},
|
|
125
|
-
{email: "Amanda.Smith@gmail.com"}
|
|
126
|
-
],
|
|
127
|
-
due_date: new Date("2024-11-03")
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
const task = taskResponse.task;
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Files
|
|
134
|
-
|
|
135
|
-
* Upload a file
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const file = await fs.openAsBlob("C:\\path\\to\\file");
|
|
139
|
-
const fileResponse = await client.files.upload(file, "filename");
|
|
140
|
-
const fileId = fileResponse.guid;
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Catalogs
|
|
144
|
-
|
|
145
|
-
* Get catalog with all items
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
const catalogResponse = await client.catalogs.get({id: 1525});
|
|
149
|
-
const items = catalogResponse.items;
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
* Create catalog
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
const catalogResponse = await client.catalogs.create(
|
|
156
|
-
{
|
|
157
|
-
name: "NewCatalog",
|
|
158
|
-
catalog_headers: ["Header1", "Header2"],
|
|
159
|
-
items: [
|
|
160
|
-
{values: ["A1", "A2"]},
|
|
161
|
-
{values: ["B1", "B2"]}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
const catalogId = catalogResponse.catalog_id;
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
* Sync catalog (All unspecified catalog items and text columns will be deleted)
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
const catalogResponse = await client.catalogs.sync(
|
|
172
|
-
{
|
|
173
|
-
id: 1236,
|
|
174
|
-
apply: true,
|
|
175
|
-
|
|
176
|
-
catalog_headers: ["Header1", "Header3"],
|
|
177
|
-
items: [
|
|
178
|
-
{values: ["A1", "A3"]},
|
|
179
|
-
{values: ["C1", "C2"]}
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Contacts
|
|
186
|
-
|
|
187
|
-
* Get all available contacts
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
const contactsResponse = await client.contacts.getAll();
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Lists
|
|
194
|
-
|
|
195
|
-
* Get all lists
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
const listsResponse = await client.lists.getAll();
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
* Get all tasks in list
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
const listId = 1322;
|
|
205
|
-
const listsResponse = await client.lists.getTasksInList(listId);
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Roles
|
|
209
|
-
|
|
210
|
-
* Get all organization roles
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
const rolesResponse = await client.role.getAll();
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
* Create role
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
const roleResponse = await client.role.create(
|
|
220
|
-
{
|
|
221
|
-
name: "TechSupport",
|
|
222
|
-
member_add: [1732, 4368]
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
* Update role
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
const roleResponse = await client.role.update(
|
|
231
|
-
{
|
|
232
|
-
id: 6476,
|
|
233
|
-
member_add: [2434],
|
|
234
|
-
member_remove: [1732, 4368],
|
|
235
|
-
external_id: "CustomIdentifier"
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## Profile
|
|
241
|
-
|
|
242
|
-
* Get profile
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
const profileResponse = await client.profile.get();
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
## Inbox
|
|
250
|
-
|
|
251
|
-
* Get inbox
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
const inboxResponse = await client.lists.getInbox({item_count: 10});
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Announcements
|
|
258
|
-
|
|
259
|
-
* Get announcement with all comments
|
|
260
|
-
|
|
261
|
-
```typescript
|
|
262
|
-
const announcementResponse = await client.announcements.get({id: 15353});
|
|
263
|
-
const announcement = announcementResponse.announcement;
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
* Get announcements with all comments
|
|
267
|
-
|
|
268
|
-
```typescript
|
|
269
|
-
const announcementsResponse = await client.announcements.getAll();
|
|
270
|
-
const announcements = announcementsResponse.announcements;
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
* Add announcement comment
|
|
274
|
-
|
|
275
|
-
```typescript
|
|
276
|
-
const announcementId = 15353;
|
|
277
|
-
const announcementResponse = await client.announcements.addComment(
|
|
278
|
-
announcementId,
|
|
279
|
-
{
|
|
280
|
-
text: "SomeText"
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
* Create an announcement
|
|
286
|
-
|
|
287
|
-
```typescript
|
|
288
|
-
const announcementResponse = await client.announcements.create(
|
|
289
|
-
{
|
|
290
|
-
text: "New announcement"
|
|
291
|
-
}
|
|
292
|
-
);
|
|
1
|
+
# PyrusAPI Client
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/pyrus-api)
|
|
4
|
+
|
|
5
|
+
A TypeScript client for the Pyrus API.
|
|
6
|
+
The full documentation for API can be found [here](https://pyrus.com/en/help/api/)
|
|
7
|
+
|
|
8
|
+
## Getting Started
|
|
9
|
+
|
|
10
|
+
* Install
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm install pyrus-api
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* Import client
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import {PyrusApiClient} from "pyrus-api";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
* Create and authenticate API client
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
const client = new PyrusApiClient(
|
|
26
|
+
{
|
|
27
|
+
login: "pyrus@login.com",
|
|
28
|
+
security_key: "security_key_from_profile"
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Forms
|
|
34
|
+
|
|
35
|
+
* Get all form templates
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const formsResponse = await client.forms.getAll();
|
|
39
|
+
const forms = formsResponse.forms;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
* Get tasks list by form template
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import {OperatorId, toDateString} from "pyrus-api";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const maxDate = new Date("2024-01-12");
|
|
50
|
+
const formId = 19963;
|
|
51
|
+
const formRegisterResponse = await client.forms.getTasks(
|
|
52
|
+
formId,
|
|
53
|
+
{
|
|
54
|
+
filters: [
|
|
55
|
+
{
|
|
56
|
+
operator_id: OperatorId.Equals,
|
|
57
|
+
field_id: 6,
|
|
58
|
+
values: ['555']
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
operator_id: OperatorId.LessThan,
|
|
62
|
+
field_id: 4,
|
|
63
|
+
values: [toDateString(maxDate)]
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
include_archived: "y"
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const tasks = formRegisterResponse.tasks;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Tasks
|
|
73
|
+
|
|
74
|
+
* Get task with all comments
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
const taskResponse = await client.tasks.get({id: 2512});
|
|
78
|
+
const task = taskResponse.task;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
* Add task comment
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import type {FormFieldTable} from "pyrus-api";
|
|
85
|
+
import {ApprovalChoice} from "pyrus-api";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const taskId = 2512;
|
|
90
|
+
const fieldToAdd: FormFieldTable = {
|
|
91
|
+
id: 1,
|
|
92
|
+
type: FormFieldType.Table,
|
|
93
|
+
value: [
|
|
94
|
+
{
|
|
95
|
+
row_id: 15,
|
|
96
|
+
cells: [
|
|
97
|
+
{
|
|
98
|
+
type: FormFieldType.Text,
|
|
99
|
+
name: "Comment",
|
|
100
|
+
value: "That's right"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
position: 1
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
const taskResponse = await client.tasks.addComment(
|
|
108
|
+
taskId,
|
|
109
|
+
{
|
|
110
|
+
approval_choice: ApprovalChoice.Approved,
|
|
111
|
+
field_updates: [fieldToAdd]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const task = taskResponse.task;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
* Create a task
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const taskResponse = await client.tasks.create(
|
|
121
|
+
{
|
|
122
|
+
text: "Help me",
|
|
123
|
+
participants: [
|
|
124
|
+
{id: 1731},
|
|
125
|
+
{email: "Amanda.Smith@gmail.com"}
|
|
126
|
+
],
|
|
127
|
+
due_date: new Date("2024-11-03")
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
const task = taskResponse.task;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Files
|
|
134
|
+
|
|
135
|
+
* Upload a file
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const file = await fs.openAsBlob("C:\\path\\to\\file");
|
|
139
|
+
const fileResponse = await client.files.upload(file, "filename");
|
|
140
|
+
const fileId = fileResponse.guid;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Catalogs
|
|
144
|
+
|
|
145
|
+
* Get catalog with all items
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
const catalogResponse = await client.catalogs.get({id: 1525});
|
|
149
|
+
const items = catalogResponse.items;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
* Create catalog
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const catalogResponse = await client.catalogs.create(
|
|
156
|
+
{
|
|
157
|
+
name: "NewCatalog",
|
|
158
|
+
catalog_headers: ["Header1", "Header2"],
|
|
159
|
+
items: [
|
|
160
|
+
{values: ["A1", "A2"]},
|
|
161
|
+
{values: ["B1", "B2"]}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
const catalogId = catalogResponse.catalog_id;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
* Sync catalog (All unspecified catalog items and text columns will be deleted)
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
const catalogResponse = await client.catalogs.sync(
|
|
172
|
+
{
|
|
173
|
+
id: 1236,
|
|
174
|
+
apply: true,
|
|
175
|
+
|
|
176
|
+
catalog_headers: ["Header1", "Header3"],
|
|
177
|
+
items: [
|
|
178
|
+
{values: ["A1", "A3"]},
|
|
179
|
+
{values: ["C1", "C2"]}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Contacts
|
|
186
|
+
|
|
187
|
+
* Get all available contacts
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
const contactsResponse = await client.contacts.getAll();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Lists
|
|
194
|
+
|
|
195
|
+
* Get all lists
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
const listsResponse = await client.lists.getAll();
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
* Get all tasks in list
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const listId = 1322;
|
|
205
|
+
const listsResponse = await client.lists.getTasksInList(listId);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Roles
|
|
209
|
+
|
|
210
|
+
* Get all organization roles
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const rolesResponse = await client.role.getAll();
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
* Create role
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
const roleResponse = await client.role.create(
|
|
220
|
+
{
|
|
221
|
+
name: "TechSupport",
|
|
222
|
+
member_add: [1732, 4368]
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
* Update role
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const roleResponse = await client.role.update(
|
|
231
|
+
{
|
|
232
|
+
id: 6476,
|
|
233
|
+
member_add: [2434],
|
|
234
|
+
member_remove: [1732, 4368],
|
|
235
|
+
external_id: "CustomIdentifier"
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Profile
|
|
241
|
+
|
|
242
|
+
* Get profile
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
const profileResponse = await client.profile.get();
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
## Inbox
|
|
250
|
+
|
|
251
|
+
* Get inbox
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
const inboxResponse = await client.lists.getInbox({item_count: 10});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Announcements
|
|
258
|
+
|
|
259
|
+
* Get announcement with all comments
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
const announcementResponse = await client.announcements.get({id: 15353});
|
|
263
|
+
const announcement = announcementResponse.announcement;
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
* Get announcements with all comments
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
const announcementsResponse = await client.announcements.getAll();
|
|
270
|
+
const announcements = announcementsResponse.announcements;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
* Add announcement comment
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
const announcementId = 15353;
|
|
277
|
+
const announcementResponse = await client.announcements.addComment(
|
|
278
|
+
announcementId,
|
|
279
|
+
{
|
|
280
|
+
text: "SomeText"
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
* Create an announcement
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const announcementResponse = await client.announcements.create(
|
|
289
|
+
{
|
|
290
|
+
text: "New announcement"
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
293
|
```
|
package/build/types/index.d.ts
CHANGED
|
@@ -398,10 +398,10 @@ declare module "pyrus-api" {
|
|
|
398
398
|
};
|
|
399
399
|
export type FormFieldCatalog = FormFieldBase & {
|
|
400
400
|
type?: typeof FormFieldType.Catalog;
|
|
401
|
-
value?:
|
|
401
|
+
value?: CatalogValue;
|
|
402
402
|
};
|
|
403
|
-
export type
|
|
404
|
-
item_id
|
|
403
|
+
export type CatalogValue = {
|
|
404
|
+
item_id?: number;
|
|
405
405
|
item_ids?: number[];
|
|
406
406
|
item_names?: string[];
|
|
407
407
|
headers?: string[];
|
|
@@ -475,7 +475,7 @@ declare module "pyrus-api" {
|
|
|
475
475
|
choice_id?: number;
|
|
476
476
|
choice_ids?: number[];
|
|
477
477
|
choice_names?: string[];
|
|
478
|
-
fields?:
|
|
478
|
+
fields?: FormFieldCommon[];
|
|
479
479
|
};
|
|
480
480
|
export type FormFieldNewFile = FormFieldFile & {
|
|
481
481
|
value?: NewFile[];
|
|
@@ -527,7 +527,7 @@ declare module "pyrus-api" {
|
|
|
527
527
|
};
|
|
528
528
|
export type TableRow = {
|
|
529
529
|
row_id: number;
|
|
530
|
-
cells?:
|
|
530
|
+
cells?: FormFieldCommon[];
|
|
531
531
|
delete?: boolean;
|
|
532
532
|
deleted?: boolean;
|
|
533
533
|
position?: number;
|
|
@@ -546,7 +546,7 @@ declare module "pyrus-api" {
|
|
|
546
546
|
};
|
|
547
547
|
export type Title = {
|
|
548
548
|
checkmark?: Checkmark;
|
|
549
|
-
fields?:
|
|
549
|
+
fields?: FormFieldCommon[];
|
|
550
550
|
};
|
|
551
551
|
export type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
552
552
|
export type IdRequired = {
|
|
@@ -555,11 +555,15 @@ declare module "pyrus-api" {
|
|
|
555
555
|
export type CodeRequired = {
|
|
556
556
|
code: string;
|
|
557
557
|
};
|
|
558
|
+
export type NameRequired = {
|
|
559
|
+
name: string;
|
|
560
|
+
};
|
|
558
561
|
export type ById = IdRequired;
|
|
559
|
-
export type
|
|
562
|
+
export type FormFieldIdentifier = IdRequired | CodeRequired | NameRequired;
|
|
560
563
|
export type FormFieldCommon = FormFieldAuthor | FormFieldCatalog | FormFieldCheckmark | FormFieldCreateDate | FormFieldDate | FormFieldDueDate | FormFieldDueDateTime | FormFieldEmail | FormFieldFile | FormFieldFlag | FormFieldFormLink | FormFieldMoney | FormFieldMultipleChoice | FormFieldNewFile | FormFieldNote | FormFieldNumber | FormFieldPerson | FormFieldPhone | FormFieldProject | FormFieldStatus | FormFieldStep | FormFieldTable | FormFieldText | FormFieldTime | FormFieldTitle;
|
|
561
|
-
export type
|
|
562
|
-
export type
|
|
564
|
+
export type IdAndNameRequired = IdRequired & NameRequired;
|
|
565
|
+
export type FormField = FormFieldCommon & IdAndNameRequired;
|
|
566
|
+
export type FormFieldIdentified = FormFieldCommon & FormFieldIdentifier;
|
|
563
567
|
const ChannelType: {
|
|
564
568
|
readonly Email: "email";
|
|
565
569
|
readonly Telegram: "telegram";
|
|
@@ -632,6 +636,7 @@ declare module "pyrus-api" {
|
|
|
632
636
|
skip_satisfaction?: boolean;
|
|
633
637
|
edit_comment_id?: number;
|
|
634
638
|
skip_notification?: boolean;
|
|
639
|
+
skip_auto_reopen?: boolean;
|
|
635
640
|
};
|
|
636
641
|
export type CommentDescription = {
|
|
637
642
|
task_id: number;
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pyrus-api",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "Pyrus API client for TypeScript",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/simplygoodsoftware/pyrusapi-typescript.git"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"main": "./build/cjs/index.js",
|
|
11
|
-
"module": "./build/esm/index.js",
|
|
12
|
-
"types": "./build/types/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
"require": {
|
|
15
|
-
"default": "./build/cjs/index.cjs"
|
|
16
|
-
},
|
|
17
|
-
"import": {
|
|
18
|
-
"default": "./build/esm/index.js"
|
|
19
|
-
},
|
|
20
|
-
"types": {
|
|
21
|
-
"default": "./build/types/index.d.ts"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript && dts-bundle-generator --project tsconfig.types.json --no-banner -o ./build/types/index.d.ts index.ts && node ./module-wrapper.js",
|
|
26
|
-
"
|
|
27
|
-
},
|
|
28
|
-
"author": {
|
|
29
|
-
"name": "Pyrus",
|
|
30
|
-
"email": "contact@pyrus.com"
|
|
31
|
-
},
|
|
32
|
-
"license": "MIT",
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
35
|
-
"@types/node": "^22.5.4",
|
|
36
|
-
"@types/rollup": "^0.54.0",
|
|
37
|
-
"dts-bundle-generator": "^9.5.1",
|
|
38
|
-
"husky": "^9.1.6",
|
|
39
|
-
"lint-staged": "^15.2.10",
|
|
40
|
-
"prettier": "2.5.1",
|
|
41
|
-
"rollup": "^4.21.2",
|
|
42
|
-
"rollup-plugin-cleandir": "^3.0.0",
|
|
43
|
-
"rollup-plugin-typescript2": "^0.36.0"
|
|
44
|
-
},
|
|
45
|
-
"lint-staged": {
|
|
46
|
-
"**/*": "prettier --write --ignore-unknown"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pyrus-api",
|
|
3
|
+
"version": "3.3.1",
|
|
4
|
+
"description": "Pyrus API client for TypeScript",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/simplygoodsoftware/pyrusapi-typescript.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./build/cjs/index.js",
|
|
11
|
+
"module": "./build/esm/index.js",
|
|
12
|
+
"types": "./build/types/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"require": {
|
|
15
|
+
"default": "./build/cjs/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"import": {
|
|
18
|
+
"default": "./build/esm/index.js"
|
|
19
|
+
},
|
|
20
|
+
"types": {
|
|
21
|
+
"default": "./build/types/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript && dts-bundle-generator --project tsconfig.types.json --no-banner -o ./build/types/index.d.ts index.ts && node ./module-wrapper.js",
|
|
26
|
+
"check:version": "node .husky/check-version.mjs"
|
|
27
|
+
},
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "Pyrus",
|
|
30
|
+
"email": "contact@pyrus.com"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
35
|
+
"@types/node": "^22.5.4",
|
|
36
|
+
"@types/rollup": "^0.54.0",
|
|
37
|
+
"dts-bundle-generator": "^9.5.1",
|
|
38
|
+
"husky": "^9.1.6",
|
|
39
|
+
"lint-staged": "^15.2.10",
|
|
40
|
+
"prettier": "2.5.1",
|
|
41
|
+
"rollup": "^4.21.2",
|
|
42
|
+
"rollup-plugin-cleandir": "^3.0.0",
|
|
43
|
+
"rollup-plugin-typescript2": "^0.36.0"
|
|
44
|
+
},
|
|
45
|
+
"lint-staged": {
|
|
46
|
+
"**/*": "prettier --write --ignore-unknown"
|
|
47
|
+
}
|
|
48
|
+
}
|