files.com 1.0.149 → 1.0.150

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.
@@ -0,0 +1,233 @@
1
+ import Api from '../Api'
2
+ import Logger from '../Logger'
3
+ import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
+
5
+ /**
6
+ * Class As2Partner
7
+ */
8
+ class As2Partner {
9
+ attributes = {}
10
+ options = {}
11
+
12
+ constructor(attributes = {}, options = {}) {
13
+ Object.entries(attributes).forEach(([key, value]) => {
14
+ const normalizedKey = key.replace('?', '')
15
+
16
+ this.attributes[normalizedKey] = value
17
+
18
+ Object.defineProperty(this, normalizedKey, { value, writable: false })
19
+ })
20
+
21
+ this.options = { ...options }
22
+ }
23
+
24
+ isLoaded = () => !!this.attributes.id
25
+ // int64 # Id of the AS2 Partner.
26
+ getId = () => this.attributes.id
27
+
28
+ setId = value => {
29
+ this.attributes.id = value
30
+ }
31
+
32
+ // int64 # Id of the AS2 Station associated with this partner.
33
+ getAs2StationId = () => this.attributes.as2_station_id
34
+
35
+ setAs2StationId = value => {
36
+ this.attributes.as2_station_id = value
37
+ }
38
+
39
+ // string # The partner's formal AS2 name.
40
+ getName = () => this.attributes.name
41
+
42
+ setName = value => {
43
+ this.attributes.name = value
44
+ }
45
+
46
+ // string # Public URI for sending AS2 message to.
47
+ getUri = () => this.attributes.uri
48
+
49
+ setUri = value => {
50
+ this.attributes.uri = value
51
+ }
52
+
53
+ // string # MD5 hash of public certificate used for message security.
54
+ getPublicCertificateMd5 = () => this.attributes.public_certificate_md5
55
+
56
+ setPublicCertificateMd5 = value => {
57
+ this.attributes.public_certificate_md5 = value
58
+ }
59
+
60
+ // string
61
+ getPublicCertificate = () => this.attributes.public_certificate
62
+
63
+ setPublicCertificate = value => {
64
+ this.attributes.public_certificate = value
65
+ }
66
+
67
+
68
+ // Parameters:
69
+ // name - string - AS2 Name
70
+ // uri - string - URL base for AS2 responses
71
+ // public_certificate - string
72
+ update = async (params = {}) => {
73
+ if (!this.attributes.id) {
74
+ throw new Error('Current object has no id')
75
+ }
76
+
77
+ if (!isObject(params)) {
78
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
79
+ }
80
+
81
+ params.id = this.attributes.id
82
+ if (params['id'] && !isInt(params['id'])) {
83
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
84
+ }
85
+ if (params['name'] && !isString(params['name'])) {
86
+ throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
87
+ }
88
+ if (params['uri'] && !isString(params['uri'])) {
89
+ throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
90
+ }
91
+ if (params['public_certificate'] && !isString(params['public_certificate'])) {
92
+ throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
93
+ }
94
+
95
+ if (!params['id']) {
96
+ if (this.attributes.id) {
97
+ params['id'] = this.id
98
+ } else {
99
+ throw new Error('Parameter missing: id')
100
+ }
101
+ }
102
+
103
+ return Api.sendRequest(`/as2_partners/${params['id']}`, 'PATCH', params, this.options)
104
+ }
105
+
106
+ delete = async (params = {}) => {
107
+ if (!this.attributes.id) {
108
+ throw new Error('Current object has no id')
109
+ }
110
+
111
+ if (!isObject(params)) {
112
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
113
+ }
114
+
115
+ params.id = this.attributes.id
116
+ if (params['id'] && !isInt(params['id'])) {
117
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
118
+ }
119
+
120
+ if (!params['id']) {
121
+ if (this.attributes.id) {
122
+ params['id'] = this.id
123
+ } else {
124
+ throw new Error('Parameter missing: id')
125
+ }
126
+ }
127
+
128
+ return Api.sendRequest(`/as2_partners/${params['id']}`, 'DELETE', params, this.options)
129
+ }
130
+
131
+ destroy = (params = {}) =>
132
+ this.delete(params)
133
+
134
+ save = () => {
135
+ if (this.attributes['id']) {
136
+ return this.update(this.attributes)
137
+ } else {
138
+ const newObject = As2Partner.create(this.attributes, this.options)
139
+ this.attributes = { ...newObject.attributes }
140
+ return true
141
+ }
142
+ }
143
+
144
+ // Parameters:
145
+ // cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
146
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
147
+ static list = async (params = {}, options = {}) => {
148
+ if (params['cursor'] && !isString(params['cursor'])) {
149
+ throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
150
+ }
151
+
152
+ if (params['per_page'] && !isInt(params['per_page'])) {
153
+ throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
154
+ }
155
+
156
+ const response = await Api.sendRequest(`/as2_partners`, 'GET', params, options)
157
+
158
+ return response?.data?.map(obj => new As2Partner(obj, options)) || []
159
+ }
160
+
161
+ static all = (params = {}, options = {}) =>
162
+ As2Partner.list(params, options)
163
+
164
+ // Parameters:
165
+ // id (required) - int64 - As2 Partner ID.
166
+ static find = async (id, params = {}, options = {}) => {
167
+ if (!isObject(params)) {
168
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
169
+ }
170
+
171
+ params['id'] = id
172
+
173
+ if (!params['id']) {
174
+ throw new Error('Parameter missing: id')
175
+ }
176
+
177
+ if (params['id'] && !isInt(params['id'])) {
178
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
179
+ }
180
+
181
+ const response = await Api.sendRequest(`/as2_partners/${params['id']}`, 'GET', params, options)
182
+
183
+ return new As2Partner(response?.data, options)
184
+ }
185
+
186
+ static get = (id, params = {}, options = {}) =>
187
+ As2Partner.find(id, params, options)
188
+
189
+ // Parameters:
190
+ // name (required) - string - AS2 Name
191
+ // uri (required) - string - URL base for AS2 responses
192
+ // public_certificate (required) - string
193
+ // as2_station_id (required) - int64 - Id of As2Station for this partner
194
+ static create = async (params = {}, options = {}) => {
195
+ if (!params['name']) {
196
+ throw new Error('Parameter missing: name')
197
+ }
198
+
199
+ if (!params['uri']) {
200
+ throw new Error('Parameter missing: uri')
201
+ }
202
+
203
+ if (!params['public_certificate']) {
204
+ throw new Error('Parameter missing: public_certificate')
205
+ }
206
+
207
+ if (!params['as2_station_id']) {
208
+ throw new Error('Parameter missing: as2_station_id')
209
+ }
210
+
211
+ if (params['name'] && !isString(params['name'])) {
212
+ throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
213
+ }
214
+
215
+ if (params['uri'] && !isString(params['uri'])) {
216
+ throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
217
+ }
218
+
219
+ if (params['public_certificate'] && !isString(params['public_certificate'])) {
220
+ throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
221
+ }
222
+
223
+ if (params['as2_station_id'] && !isInt(params['as2_station_id'])) {
224
+ throw new Error(`Bad parameter: as2_station_id must be of type Int, received ${getType(as2_station_id)}`)
225
+ }
226
+
227
+ const response = await Api.sendRequest(`/as2_partners`, 'POST', params, options)
228
+
229
+ return new As2Partner(response?.data, options)
230
+ }
231
+ }
232
+
233
+ export default As2Partner
@@ -0,0 +1,264 @@
1
+ import Api from '../Api'
2
+ import Logger from '../Logger'
3
+ import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
+
5
+ /**
6
+ * Class As2Station
7
+ */
8
+ class As2Station {
9
+ attributes = {}
10
+ options = {}
11
+
12
+ constructor(attributes = {}, options = {}) {
13
+ Object.entries(attributes).forEach(([key, value]) => {
14
+ const normalizedKey = key.replace('?', '')
15
+
16
+ this.attributes[normalizedKey] = value
17
+
18
+ Object.defineProperty(this, normalizedKey, { value, writable: false })
19
+ })
20
+
21
+ this.options = { ...options }
22
+ }
23
+
24
+ isLoaded = () => !!this.attributes.id
25
+ // int64 # Id of the AS2 Station.
26
+ getId = () => this.attributes.id
27
+
28
+ setId = value => {
29
+ this.attributes.id = value
30
+ }
31
+
32
+ // string # The station's formal AS2 name.
33
+ getName = () => this.attributes.name
34
+
35
+ setName = value => {
36
+ this.attributes.name = value
37
+ }
38
+
39
+ // string # Public URI for sending AS2 message to.
40
+ getUri = () => this.attributes.uri
41
+
42
+ setUri = value => {
43
+ this.attributes.uri = value
44
+ }
45
+
46
+ // string # The station's AS2 domain name.
47
+ getDomain = () => this.attributes.domain
48
+
49
+ setDomain = value => {
50
+ this.attributes.domain = value
51
+ }
52
+
53
+ // string # Public certificate used for message security.
54
+ getPublicCertificate = () => this.attributes.public_certificate
55
+
56
+ setPublicCertificate = value => {
57
+ this.attributes.public_certificate = value
58
+ }
59
+
60
+ // string # MD5 hash of public certificate used for message security.
61
+ getPublicCertificateMd5 = () => this.attributes.public_certificate_md5
62
+
63
+ setPublicCertificateMd5 = value => {
64
+ this.attributes.public_certificate_md5 = value
65
+ }
66
+
67
+ // string # MD5 hash of private key used for message security.
68
+ getPrivateKeyMd5 = () => this.attributes.private_key_md5
69
+
70
+ setPrivateKeyMd5 = value => {
71
+ this.attributes.private_key_md5 = value
72
+ }
73
+
74
+ // string
75
+ getPrivateKey = () => this.attributes.private_key
76
+
77
+ setPrivateKey = value => {
78
+ this.attributes.private_key = value
79
+ }
80
+
81
+
82
+ // Parameters:
83
+ // name - string - AS2 Name
84
+ // domain - string - AS2 Domain
85
+ // uri - string - URL base for AS2 responses
86
+ // public_certificate - string
87
+ // private_key - string
88
+ update = async (params = {}) => {
89
+ if (!this.attributes.id) {
90
+ throw new Error('Current object has no id')
91
+ }
92
+
93
+ if (!isObject(params)) {
94
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
95
+ }
96
+
97
+ params.id = this.attributes.id
98
+ if (params['id'] && !isInt(params['id'])) {
99
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
100
+ }
101
+ if (params['name'] && !isString(params['name'])) {
102
+ throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
103
+ }
104
+ if (params['domain'] && !isString(params['domain'])) {
105
+ throw new Error(`Bad parameter: domain must be of type String, received ${getType(domain)}`)
106
+ }
107
+ if (params['uri'] && !isString(params['uri'])) {
108
+ throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
109
+ }
110
+ if (params['public_certificate'] && !isString(params['public_certificate'])) {
111
+ throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
112
+ }
113
+ if (params['private_key'] && !isString(params['private_key'])) {
114
+ throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
115
+ }
116
+
117
+ if (!params['id']) {
118
+ if (this.attributes.id) {
119
+ params['id'] = this.id
120
+ } else {
121
+ throw new Error('Parameter missing: id')
122
+ }
123
+ }
124
+
125
+ return Api.sendRequest(`/as2_stations/${params['id']}`, 'PATCH', params, this.options)
126
+ }
127
+
128
+ delete = async (params = {}) => {
129
+ if (!this.attributes.id) {
130
+ throw new Error('Current object has no id')
131
+ }
132
+
133
+ if (!isObject(params)) {
134
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
135
+ }
136
+
137
+ params.id = this.attributes.id
138
+ if (params['id'] && !isInt(params['id'])) {
139
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
140
+ }
141
+
142
+ if (!params['id']) {
143
+ if (this.attributes.id) {
144
+ params['id'] = this.id
145
+ } else {
146
+ throw new Error('Parameter missing: id')
147
+ }
148
+ }
149
+
150
+ return Api.sendRequest(`/as2_stations/${params['id']}`, 'DELETE', params, this.options)
151
+ }
152
+
153
+ destroy = (params = {}) =>
154
+ this.delete(params)
155
+
156
+ save = () => {
157
+ if (this.attributes['id']) {
158
+ return this.update(this.attributes)
159
+ } else {
160
+ const newObject = As2Station.create(this.attributes, this.options)
161
+ this.attributes = { ...newObject.attributes }
162
+ return true
163
+ }
164
+ }
165
+
166
+ // Parameters:
167
+ // cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
168
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
169
+ static list = async (params = {}, options = {}) => {
170
+ if (params['cursor'] && !isString(params['cursor'])) {
171
+ throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
172
+ }
173
+
174
+ if (params['per_page'] && !isInt(params['per_page'])) {
175
+ throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
176
+ }
177
+
178
+ const response = await Api.sendRequest(`/as2_stations`, 'GET', params, options)
179
+
180
+ return response?.data?.map(obj => new As2Station(obj, options)) || []
181
+ }
182
+
183
+ static all = (params = {}, options = {}) =>
184
+ As2Station.list(params, options)
185
+
186
+ // Parameters:
187
+ // id (required) - int64 - As2 Station ID.
188
+ static find = async (id, params = {}, options = {}) => {
189
+ if (!isObject(params)) {
190
+ throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
191
+ }
192
+
193
+ params['id'] = id
194
+
195
+ if (!params['id']) {
196
+ throw new Error('Parameter missing: id')
197
+ }
198
+
199
+ if (params['id'] && !isInt(params['id'])) {
200
+ throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
201
+ }
202
+
203
+ const response = await Api.sendRequest(`/as2_stations/${params['id']}`, 'GET', params, options)
204
+
205
+ return new As2Station(response?.data, options)
206
+ }
207
+
208
+ static get = (id, params = {}, options = {}) =>
209
+ As2Station.find(id, params, options)
210
+
211
+ // Parameters:
212
+ // name (required) - string - AS2 Name
213
+ // domain (required) - string - AS2 Domain
214
+ // uri (required) - string - URL base for AS2 responses
215
+ // public_certificate (required) - string
216
+ // private_key (required) - string
217
+ static create = async (params = {}, options = {}) => {
218
+ if (!params['name']) {
219
+ throw new Error('Parameter missing: name')
220
+ }
221
+
222
+ if (!params['domain']) {
223
+ throw new Error('Parameter missing: domain')
224
+ }
225
+
226
+ if (!params['uri']) {
227
+ throw new Error('Parameter missing: uri')
228
+ }
229
+
230
+ if (!params['public_certificate']) {
231
+ throw new Error('Parameter missing: public_certificate')
232
+ }
233
+
234
+ if (!params['private_key']) {
235
+ throw new Error('Parameter missing: private_key')
236
+ }
237
+
238
+ if (params['name'] && !isString(params['name'])) {
239
+ throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
240
+ }
241
+
242
+ if (params['domain'] && !isString(params['domain'])) {
243
+ throw new Error(`Bad parameter: domain must be of type String, received ${getType(domain)}`)
244
+ }
245
+
246
+ if (params['uri'] && !isString(params['uri'])) {
247
+ throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
248
+ }
249
+
250
+ if (params['public_certificate'] && !isString(params['public_certificate'])) {
251
+ throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
252
+ }
253
+
254
+ if (params['private_key'] && !isString(params['private_key'])) {
255
+ throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
256
+ }
257
+
258
+ const response = await Api.sendRequest(`/as2_stations`, 'POST', params, options)
259
+
260
+ return new As2Station(response?.data, options)
261
+ }
262
+ }
263
+
264
+ export default As2Station
@@ -64,7 +64,7 @@ class HistoryExport {
64
64
  this.attributes.query_action = value
65
65
  }
66
66
 
67
- // string # Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`
67
+ // string # Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`, `as2`
68
68
  getQueryInterface = () => this.attributes.query_interface
69
69
 
70
70
  setQueryInterface = value => {
@@ -245,7 +245,7 @@ class HistoryExport {
245
245
  // start_at - string - Start date/time of export range.
246
246
  // end_at - string - End date/time of export range.
247
247
  // query_action - string - Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
248
- // query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`
248
+ // query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`, `as2`
249
249
  // query_user_id - string - Return results that are actions performed by the user indiciated by this User ID
250
250
  // query_file_id - string - Return results that are file actions related to the file indicated by this File ID
251
251
  // query_parent_id - string - Return results that are file actions inside the parent folder specified by this folder ID
@@ -61,7 +61,7 @@ class HistoryExportResult {
61
61
  // string # The type of login failure, if applicable. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`, `country_mismatch`
62
62
  getFailureType = () => this.attributes.failure_type
63
63
 
64
- // string # Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`
64
+ // string # Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`, `office`, `mobile`, `as2`
65
65
  getInterface = () => this.attributes.interface
66
66
 
67
67
  // int64 # ID of the object (such as Users, or API Keys) on which the action was taken