files.com 1.0.165 → 1.0.168
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -5
- package/_VERSION +1 -1
- package/lib/models/ActionWebhookFailure.js +8 -2
- package/lib/models/ApiKey.js +16 -4
- package/lib/models/As2Partner.js +78 -14
- package/lib/models/As2Station.js +74 -80
- package/lib/models/Automation.js +16 -4
- package/lib/models/Behavior.js +16 -4
- package/lib/models/Bundle.js +24 -6
- package/lib/models/Clickwrap.js +16 -4
- package/lib/models/File.js +309 -311
- package/lib/models/FileComment.js +16 -4
- package/lib/models/FileCommentReaction.js +8 -2
- package/lib/models/FormFieldSet.js +16 -4
- package/lib/models/Group.js +16 -4
- package/lib/models/GroupUser.js +16 -4
- package/lib/models/Lock.js +8 -2
- package/lib/models/Message.js +16 -4
- package/lib/models/MessageComment.js +16 -4
- package/lib/models/MessageCommentReaction.js +8 -2
- package/lib/models/MessageReaction.js +8 -2
- package/lib/models/Notification.js +16 -4
- package/lib/models/Permission.js +8 -2
- package/lib/models/Project.js +16 -4
- package/lib/models/PublicKey.js +16 -4
- package/lib/models/RemoteServer.js +16 -4
- package/lib/models/Request.js +8 -2
- package/lib/models/SsoStrategy.js +8 -2
- package/lib/models/Style.js +16 -4
- package/lib/models/User.js +40 -10
- package/lib/models/UserRequest.js +8 -2
- package/package.json +1 -1
- package/src/models/ActionWebhookFailure.js +3 -1
- package/src/models/ApiKey.js +6 -2
- package/src/models/As2Partner.js +57 -2
- package/src/models/As2Station.js +48 -35
- package/src/models/Automation.js +6 -2
- package/src/models/Behavior.js +6 -2
- package/src/models/Bundle.js +9 -3
- package/src/models/Clickwrap.js +6 -2
- package/src/models/File.js +26 -19
- package/src/models/FileComment.js +6 -2
- package/src/models/FileCommentReaction.js +3 -1
- package/src/models/FormFieldSet.js +6 -2
- package/src/models/Group.js +6 -2
- package/src/models/GroupUser.js +6 -2
- package/src/models/Lock.js +3 -1
- package/src/models/Message.js +6 -2
- package/src/models/MessageComment.js +6 -2
- package/src/models/MessageCommentReaction.js +3 -1
- package/src/models/MessageReaction.js +3 -1
- package/src/models/Notification.js +6 -2
- package/src/models/Permission.js +3 -1
- package/src/models/Project.js +6 -2
- package/src/models/PublicKey.js +6 -2
- package/src/models/RemoteServer.js +6 -2
- package/src/models/Request.js +3 -1
- package/src/models/SsoStrategy.js +3 -1
- package/src/models/Style.js +6 -2
- package/src/models/User.js +15 -5
- package/src/models/UserRequest.js +3 -1
- package/test/src/index.js +7 -3
package/src/models/File.js
CHANGED
@@ -157,12 +157,14 @@ class File {
|
|
157
157
|
throw new Error('Stream downloads are only available in a NodeJS environment')
|
158
158
|
}
|
159
159
|
|
160
|
-
|
160
|
+
const downloadUri = this.getDownloadUri()
|
161
|
+
|
162
|
+
if (!downloadUri) {
|
161
163
|
throw new Error('Current object has no download URI')
|
162
164
|
}
|
163
165
|
|
164
166
|
const { saveUrlToStream } = require('../isomorphic/File.node.js')
|
165
|
-
return saveUrlToStream(
|
167
|
+
return saveUrlToStream(downloadUri, writableStream)
|
166
168
|
}
|
167
169
|
|
168
170
|
downloadToFile = async destinationPath => {
|
@@ -170,21 +172,14 @@ class File {
|
|
170
172
|
throw new Error('Disk file downloads are only available in a NodeJS environment')
|
171
173
|
}
|
172
174
|
|
173
|
-
|
175
|
+
const downloadUri = this.getDownloadUri()
|
176
|
+
|
177
|
+
if (!downloadUri) {
|
174
178
|
throw new Error('Current object has no download URI')
|
175
179
|
}
|
176
180
|
|
177
181
|
const { saveUrlToFile } = require('../isomorphic/File.node.js')
|
178
|
-
return saveUrlToFile(
|
179
|
-
}
|
180
|
-
|
181
|
-
static findDownload = async path => {
|
182
|
-
const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'GET')
|
183
|
-
return new File(response.data)
|
184
|
-
}
|
185
|
-
|
186
|
-
get = async path => {
|
187
|
-
return File.find(path)
|
182
|
+
return saveUrlToFile(downloadUri, destinationPath)
|
188
183
|
}
|
189
184
|
|
190
185
|
copyTo = async destinationFilePath => {
|
@@ -408,7 +403,9 @@ class File {
|
|
408
403
|
}
|
409
404
|
}
|
410
405
|
|
411
|
-
|
406
|
+
const response = await Api.sendRequest(`/files/${params['path']}`, 'GET', params, this.options)
|
407
|
+
|
408
|
+
return new File(response?.data, this.options)
|
412
409
|
}
|
413
410
|
|
414
411
|
// Parameters:
|
@@ -442,7 +439,9 @@ class File {
|
|
442
439
|
}
|
443
440
|
}
|
444
441
|
|
445
|
-
|
442
|
+
const response = await Api.sendRequest(`/files/${params['path']}`, 'PATCH', params, this.options)
|
443
|
+
|
444
|
+
return new File(response?.data, this.options)
|
446
445
|
}
|
447
446
|
|
448
447
|
// Parameters:
|
@@ -469,7 +468,9 @@ class File {
|
|
469
468
|
}
|
470
469
|
}
|
471
470
|
|
472
|
-
|
471
|
+
const response = await Api.sendRequest(`/files/${params['path']}`, 'DELETE', params, this.options)
|
472
|
+
|
473
|
+
return response?.data
|
473
474
|
}
|
474
475
|
|
475
476
|
destroy = (params = {}) =>
|
@@ -513,7 +514,9 @@ class File {
|
|
513
514
|
}
|
514
515
|
}
|
515
516
|
|
516
|
-
|
517
|
+
const response = await Api.sendRequest(`/file_actions/copy/${params['path']}`, 'POST', params, this.options)
|
518
|
+
|
519
|
+
return new FileAction(response?.data, this.options)
|
517
520
|
}
|
518
521
|
|
519
522
|
// Move file/folder
|
@@ -553,7 +556,9 @@ class File {
|
|
553
556
|
}
|
554
557
|
}
|
555
558
|
|
556
|
-
|
559
|
+
const response = await Api.sendRequest(`/file_actions/move/${params['path']}`, 'POST', params, this.options)
|
560
|
+
|
561
|
+
return new FileAction(response?.data, this.options)
|
557
562
|
}
|
558
563
|
|
559
564
|
// Begin file upload
|
@@ -603,7 +608,9 @@ class File {
|
|
603
608
|
}
|
604
609
|
}
|
605
610
|
|
606
|
-
|
611
|
+
const response = await Api.sendRequest(`/file_actions/begin_upload/${params['path']}`, 'POST', params, this.options)
|
612
|
+
|
613
|
+
return response?.data?.map(obj => new FileUploadPart(obj, this.options)) || []
|
607
614
|
}
|
608
615
|
|
609
616
|
save = () => {
|
@@ -86,7 +86,9 @@ class FileComment {
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
89
|
-
|
89
|
+
const response = await Api.sendRequest(`/file_comments/${params['id']}`, 'PATCH', params, this.options)
|
90
|
+
|
91
|
+
return new FileComment(response?.data, this.options)
|
90
92
|
}
|
91
93
|
|
92
94
|
delete = async (params = {}) => {
|
@@ -111,7 +113,9 @@ class FileComment {
|
|
111
113
|
}
|
112
114
|
}
|
113
115
|
|
114
|
-
|
116
|
+
const response = await Api.sendRequest(`/file_comments/${params['id']}`, 'DELETE', params, this.options)
|
117
|
+
|
118
|
+
return response?.data
|
115
119
|
}
|
116
120
|
|
117
121
|
destroy = (params = {}) =>
|
@@ -73,7 +73,9 @@ class FileCommentReaction {
|
|
73
73
|
}
|
74
74
|
}
|
75
75
|
|
76
|
-
|
76
|
+
const response = await Api.sendRequest(`/file_comment_reactions/${params['id']}`, 'DELETE', params, this.options)
|
77
|
+
|
78
|
+
return response?.data
|
77
79
|
}
|
78
80
|
|
79
81
|
destroy = (params = {}) =>
|
@@ -113,7 +113,9 @@ class FormFieldSet {
|
|
113
113
|
}
|
114
114
|
}
|
115
115
|
|
116
|
-
|
116
|
+
const response = await Api.sendRequest(`/form_field_sets/${params['id']}`, 'PATCH', params, this.options)
|
117
|
+
|
118
|
+
return new FormFieldSet(response?.data, this.options)
|
117
119
|
}
|
118
120
|
|
119
121
|
delete = async (params = {}) => {
|
@@ -138,7 +140,9 @@ class FormFieldSet {
|
|
138
140
|
}
|
139
141
|
}
|
140
142
|
|
141
|
-
|
143
|
+
const response = await Api.sendRequest(`/form_field_sets/${params['id']}`, 'DELETE', params, this.options)
|
144
|
+
|
145
|
+
return response?.data
|
142
146
|
}
|
143
147
|
|
144
148
|
destroy = (params = {}) =>
|
package/src/models/Group.js
CHANGED
@@ -104,7 +104,9 @@ class Group {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
|
-
|
107
|
+
const response = await Api.sendRequest(`/groups/${params['id']}`, 'PATCH', params, this.options)
|
108
|
+
|
109
|
+
return new Group(response?.data, this.options)
|
108
110
|
}
|
109
111
|
|
110
112
|
delete = async (params = {}) => {
|
@@ -129,7 +131,9 @@ class Group {
|
|
129
131
|
}
|
130
132
|
}
|
131
133
|
|
132
|
-
|
134
|
+
const response = await Api.sendRequest(`/groups/${params['id']}`, 'DELETE', params, this.options)
|
135
|
+
|
136
|
+
return response?.data
|
133
137
|
}
|
134
138
|
|
135
139
|
destroy = (params = {}) =>
|
package/src/models/GroupUser.js
CHANGED
@@ -113,7 +113,9 @@ class GroupUser {
|
|
113
113
|
}
|
114
114
|
}
|
115
115
|
|
116
|
-
|
116
|
+
const response = await Api.sendRequest(`/group_users/${params['id']}`, 'PATCH', params, this.options)
|
117
|
+
|
118
|
+
return new GroupUser(response?.data, this.options)
|
117
119
|
}
|
118
120
|
|
119
121
|
// Parameters:
|
@@ -163,7 +165,9 @@ class GroupUser {
|
|
163
165
|
}
|
164
166
|
}
|
165
167
|
|
166
|
-
|
168
|
+
const response = await Api.sendRequest(`/group_users/${params['id']}`, 'DELETE', params, this.options)
|
169
|
+
|
170
|
+
return response?.data
|
167
171
|
}
|
168
172
|
|
169
173
|
destroy = (params = {}) =>
|
package/src/models/Lock.js
CHANGED
@@ -142,7 +142,9 @@ class Lock {
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
145
|
-
|
145
|
+
const response = await Api.sendRequest(`/locks/${params['path']}`, 'DELETE', params, this.options)
|
146
|
+
|
147
|
+
return response?.data
|
146
148
|
}
|
147
149
|
|
148
150
|
destroy = (params = {}) =>
|
package/src/models/Message.js
CHANGED
@@ -124,7 +124,9 @@ class Message {
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
-
|
127
|
+
const response = await Api.sendRequest(`/messages/${params['id']}`, 'PATCH', params, this.options)
|
128
|
+
|
129
|
+
return new Message(response?.data, this.options)
|
128
130
|
}
|
129
131
|
|
130
132
|
delete = async (params = {}) => {
|
@@ -149,7 +151,9 @@ class Message {
|
|
149
151
|
}
|
150
152
|
}
|
151
153
|
|
152
|
-
|
154
|
+
const response = await Api.sendRequest(`/messages/${params['id']}`, 'DELETE', params, this.options)
|
155
|
+
|
156
|
+
return response?.data
|
153
157
|
}
|
154
158
|
|
155
159
|
destroy = (params = {}) =>
|
@@ -86,7 +86,9 @@ class MessageComment {
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
89
|
-
|
89
|
+
const response = await Api.sendRequest(`/message_comments/${params['id']}`, 'PATCH', params, this.options)
|
90
|
+
|
91
|
+
return new MessageComment(response?.data, this.options)
|
90
92
|
}
|
91
93
|
|
92
94
|
delete = async (params = {}) => {
|
@@ -111,7 +113,9 @@ class MessageComment {
|
|
111
113
|
}
|
112
114
|
}
|
113
115
|
|
114
|
-
|
116
|
+
const response = await Api.sendRequest(`/message_comments/${params['id']}`, 'DELETE', params, this.options)
|
117
|
+
|
118
|
+
return response?.data
|
115
119
|
}
|
116
120
|
|
117
121
|
destroy = (params = {}) =>
|
@@ -66,7 +66,9 @@ class MessageCommentReaction {
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
const response = await Api.sendRequest(`/message_comment_reactions/${params['id']}`, 'DELETE', params, this.options)
|
70
|
+
|
71
|
+
return response?.data
|
70
72
|
}
|
71
73
|
|
72
74
|
destroy = (params = {}) =>
|
@@ -66,7 +66,9 @@ class MessageReaction {
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
const response = await Api.sendRequest(`/message_reactions/${params['id']}`, 'DELETE', params, this.options)
|
70
|
+
|
71
|
+
return response?.data
|
70
72
|
}
|
71
73
|
|
72
74
|
destroy = (params = {}) =>
|
@@ -144,7 +144,9 @@ class Notification {
|
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
147
|
-
|
147
|
+
const response = await Api.sendRequest(`/notifications/${params['id']}`, 'PATCH', params, this.options)
|
148
|
+
|
149
|
+
return new Notification(response?.data, this.options)
|
148
150
|
}
|
149
151
|
|
150
152
|
delete = async (params = {}) => {
|
@@ -169,7 +171,9 @@ class Notification {
|
|
169
171
|
}
|
170
172
|
}
|
171
173
|
|
172
|
-
|
174
|
+
const response = await Api.sendRequest(`/notifications/${params['id']}`, 'DELETE', params, this.options)
|
175
|
+
|
176
|
+
return response?.data
|
173
177
|
}
|
174
178
|
|
175
179
|
destroy = (params = {}) =>
|
package/src/models/Permission.js
CHANGED
@@ -101,7 +101,9 @@ class Permission {
|
|
101
101
|
}
|
102
102
|
}
|
103
103
|
|
104
|
-
|
104
|
+
const response = await Api.sendRequest(`/permissions/${params['id']}`, 'DELETE', params, this.options)
|
105
|
+
|
106
|
+
return response?.data
|
105
107
|
}
|
106
108
|
|
107
109
|
destroy = (params = {}) =>
|
package/src/models/Project.js
CHANGED
@@ -72,7 +72,9 @@ class Project {
|
|
72
72
|
}
|
73
73
|
}
|
74
74
|
|
75
|
-
|
75
|
+
const response = await Api.sendRequest(`/projects/${params['id']}`, 'PATCH', params, this.options)
|
76
|
+
|
77
|
+
return new Project(response?.data, this.options)
|
76
78
|
}
|
77
79
|
|
78
80
|
delete = async (params = {}) => {
|
@@ -97,7 +99,9 @@ class Project {
|
|
97
99
|
}
|
98
100
|
}
|
99
101
|
|
100
|
-
|
102
|
+
const response = await Api.sendRequest(`/projects/${params['id']}`, 'DELETE', params, this.options)
|
103
|
+
|
104
|
+
return response?.data
|
101
105
|
}
|
102
106
|
|
103
107
|
destroy = (params = {}) =>
|
package/src/models/PublicKey.js
CHANGED
@@ -96,7 +96,9 @@ class PublicKey {
|
|
96
96
|
}
|
97
97
|
}
|
98
98
|
|
99
|
-
|
99
|
+
const response = await Api.sendRequest(`/public_keys/${params['id']}`, 'PATCH', params, this.options)
|
100
|
+
|
101
|
+
return new PublicKey(response?.data, this.options)
|
100
102
|
}
|
101
103
|
|
102
104
|
delete = async (params = {}) => {
|
@@ -121,7 +123,9 @@ class PublicKey {
|
|
121
123
|
}
|
122
124
|
}
|
123
125
|
|
124
|
-
|
126
|
+
const response = await Api.sendRequest(`/public_keys/${params['id']}`, 'DELETE', params, this.options)
|
127
|
+
|
128
|
+
return response?.data
|
125
129
|
}
|
126
130
|
|
127
131
|
destroy = (params = {}) =>
|
@@ -551,7 +551,9 @@ class RemoteServer {
|
|
551
551
|
}
|
552
552
|
}
|
553
553
|
|
554
|
-
|
554
|
+
const response = await Api.sendRequest(`/remote_servers/${params['id']}`, 'PATCH', params, this.options)
|
555
|
+
|
556
|
+
return new RemoteServer(response?.data, this.options)
|
555
557
|
}
|
556
558
|
|
557
559
|
delete = async (params = {}) => {
|
@@ -576,7 +578,9 @@ class RemoteServer {
|
|
576
578
|
}
|
577
579
|
}
|
578
580
|
|
579
|
-
|
581
|
+
const response = await Api.sendRequest(`/remote_servers/${params['id']}`, 'DELETE', params, this.options)
|
582
|
+
|
583
|
+
return response?.data
|
580
584
|
}
|
581
585
|
|
582
586
|
destroy = (params = {}) =>
|
package/src/models/Request.js
CHANGED
@@ -101,7 +101,9 @@ class Request {
|
|
101
101
|
}
|
102
102
|
}
|
103
103
|
|
104
|
-
|
104
|
+
const response = await Api.sendRequest(`/requests/${params['id']}`, 'DELETE', params, this.options)
|
105
|
+
|
106
|
+
return response?.data
|
105
107
|
}
|
106
108
|
|
107
109
|
destroy = (params = {}) =>
|
@@ -175,7 +175,9 @@ class SsoStrategy {
|
|
175
175
|
}
|
176
176
|
}
|
177
177
|
|
178
|
-
|
178
|
+
const response = await Api.sendRequest(`/sso_strategies/${params['id']}/sync`, 'POST', params, this.options)
|
179
|
+
|
180
|
+
return response?.data
|
179
181
|
}
|
180
182
|
|
181
183
|
// Parameters:
|
package/src/models/Style.js
CHANGED
@@ -90,7 +90,9 @@ class Style {
|
|
90
90
|
}
|
91
91
|
}
|
92
92
|
|
93
|
-
|
93
|
+
const response = await Api.sendRequest(`/styles/${params['path']}`, 'PATCH', params, this.options)
|
94
|
+
|
95
|
+
return new Style(response?.data, this.options)
|
94
96
|
}
|
95
97
|
|
96
98
|
delete = async (params = {}) => {
|
@@ -115,7 +117,9 @@ class Style {
|
|
115
117
|
}
|
116
118
|
}
|
117
119
|
|
118
|
-
|
120
|
+
const response = await Api.sendRequest(`/styles/${params['path']}`, 'DELETE', params, this.options)
|
121
|
+
|
122
|
+
return response?.data
|
119
123
|
}
|
120
124
|
|
121
125
|
destroy = (params = {}) =>
|
package/src/models/User.js
CHANGED
@@ -448,7 +448,9 @@ class User {
|
|
448
448
|
}
|
449
449
|
}
|
450
450
|
|
451
|
-
|
451
|
+
const response = await Api.sendRequest(`/users/${params['id']}/unlock`, 'POST', params, this.options)
|
452
|
+
|
453
|
+
return response?.data
|
452
454
|
}
|
453
455
|
|
454
456
|
// Resend user welcome email
|
@@ -474,7 +476,9 @@ class User {
|
|
474
476
|
}
|
475
477
|
}
|
476
478
|
|
477
|
-
|
479
|
+
const response = await Api.sendRequest(`/users/${params['id']}/resend_welcome_email`, 'POST', params, this.options)
|
480
|
+
|
481
|
+
return response?.data
|
478
482
|
}
|
479
483
|
|
480
484
|
// Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
|
@@ -500,7 +504,9 @@ class User {
|
|
500
504
|
}
|
501
505
|
}
|
502
506
|
|
503
|
-
|
507
|
+
const response = await Api.sendRequest(`/users/${params['id']}/2fa/reset`, 'POST', params, this.options)
|
508
|
+
|
509
|
+
return response?.data
|
504
510
|
}
|
505
511
|
|
506
512
|
// Parameters:
|
@@ -645,7 +651,9 @@ class User {
|
|
645
651
|
}
|
646
652
|
}
|
647
653
|
|
648
|
-
|
654
|
+
const response = await Api.sendRequest(`/users/${params['id']}`, 'PATCH', params, this.options)
|
655
|
+
|
656
|
+
return new User(response?.data, this.options)
|
649
657
|
}
|
650
658
|
|
651
659
|
delete = async (params = {}) => {
|
@@ -670,7 +678,9 @@ class User {
|
|
670
678
|
}
|
671
679
|
}
|
672
680
|
|
673
|
-
|
681
|
+
const response = await Api.sendRequest(`/users/${params['id']}`, 'DELETE', params, this.options)
|
682
|
+
|
683
|
+
return response?.data
|
674
684
|
}
|
675
685
|
|
676
686
|
destroy = (params = {}) =>
|
@@ -73,7 +73,9 @@ class UserRequest {
|
|
73
73
|
}
|
74
74
|
}
|
75
75
|
|
76
|
-
|
76
|
+
const response = await Api.sendRequest(`/user_requests/${params['id']}`, 'DELETE', params, this.options)
|
77
|
+
|
78
|
+
return response?.data
|
77
79
|
}
|
78
80
|
|
79
81
|
destroy = (params = {}) =>
|
package/test/src/index.js
CHANGED
@@ -70,14 +70,18 @@ const testSuite = async () => {
|
|
70
70
|
assert(!!file.path)
|
71
71
|
assert(file.display_name === displayName)
|
72
72
|
|
73
|
-
const foundFile = await File.
|
74
|
-
|
73
|
+
const foundFile = await File.find(destinationPath)
|
74
|
+
|
75
75
|
assert(foundFile.path === destinationPath)
|
76
76
|
assert(foundFile.display_name === displayName)
|
77
|
+
assert(typeof foundFile.getDownloadUri() === 'undefined')
|
77
78
|
|
78
79
|
if (!isBrowser()) {
|
80
|
+
const downloadableFile = await foundFile.download()
|
81
|
+
assert(typeof downloadableFile.getDownloadUri() !== 'undefined')
|
82
|
+
|
79
83
|
const downloadPath = `./${displayName}`
|
80
|
-
await
|
84
|
+
await downloadableFile.downloadToFile(downloadPath)
|
81
85
|
|
82
86
|
const fs = require('fs')
|
83
87
|
const originalBuffer = fs.readFileSync(sourceFilePath)
|