files.com 1.2.136 → 1.2.137

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/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.136
1
+ 1.2.137
@@ -56,8 +56,8 @@ await Permission.list({
56
56
 
57
57
  ```
58
58
  await Permission.create({
59
+ 'path': "path",
59
60
  'group_id': 1,
60
- 'path': "example",
61
61
  'permission': "full",
62
62
  'recursive': true,
63
63
  'user_id': 1,
@@ -68,9 +68,9 @@ await Permission.create({
68
68
 
69
69
  ### Parameters
70
70
 
71
+ * `path` (string): Required - Folder path
71
72
  * `group_id` (int64): Group ID
72
- * `path` (string): Folder path
73
- * `permission` (string): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
73
+ * `permission` (string): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
74
74
  * `recursive` (boolean): Apply to subfolders recursively?
75
75
  * `user_id` (int64): User ID. Provide `username` or `user_id`
76
76
  * `username` (string): User username. Provide `username` or `user_id`
package/lib/Files.js CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
11
11
  var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
- var version = '1.2.136';
14
+ var version = '1.2.137';
15
15
  var userAgent = "Files.com JavaScript SDK v".concat(version);
16
16
  var logLevel = _Logger.LogLevel.INFO;
17
17
  var debugRequest = false;
@@ -248,9 +248,9 @@ _Permission = Permission;
248
248
  return _Permission.list(params, options);
249
249
  });
250
250
  // Parameters:
251
+ // path (required) - string - Folder path
251
252
  // group_id - int64 - Group ID
252
- // path - string - Folder path
253
- // permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
253
+ // permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
254
254
  // recursive - boolean - Apply to subfolders recursively?
255
255
  // user_id - int64 - User ID. Provide `username` or `user_id`
256
256
  // username - string - User username. Provide `username` or `user_id`
@@ -264,11 +264,11 @@ _Permission = Permission;
264
264
  case 0:
265
265
  params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
266
266
  options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
267
- if (!(params.group_id && !(0, _utils.isInt)(params.group_id))) {
267
+ if (params.path) {
268
268
  _context4.next = 4;
269
269
  break;
270
270
  }
271
- throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(params.group_id)));
271
+ throw new errors.MissingParameterError('Parameter missing: path');
272
272
  case 4:
273
273
  if (!(params.path && !(0, _utils.isString)(params.path))) {
274
274
  _context4.next = 6;
@@ -276,30 +276,36 @@ _Permission = Permission;
276
276
  }
277
277
  throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
278
278
  case 6:
279
- if (!(params.permission && !(0, _utils.isString)(params.permission))) {
279
+ if (!(params.group_id && !(0, _utils.isInt)(params.group_id))) {
280
280
  _context4.next = 8;
281
281
  break;
282
282
  }
283
- throw new errors.InvalidParameterError("Bad parameter: permission must be of type String, received ".concat((0, _utils.getType)(params.permission)));
283
+ throw new errors.InvalidParameterError("Bad parameter: group_id must be of type Int, received ".concat((0, _utils.getType)(params.group_id)));
284
284
  case 8:
285
- if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
285
+ if (!(params.permission && !(0, _utils.isString)(params.permission))) {
286
286
  _context4.next = 10;
287
287
  break;
288
288
  }
289
- throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
289
+ throw new errors.InvalidParameterError("Bad parameter: permission must be of type String, received ".concat((0, _utils.getType)(params.permission)));
290
290
  case 10:
291
- if (!(params.username && !(0, _utils.isString)(params.username))) {
291
+ if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
292
292
  _context4.next = 12;
293
293
  break;
294
294
  }
295
- throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(params.username)));
295
+ throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
296
296
  case 12:
297
- _context4.next = 14;
298
- return _Api.default.sendRequest('/permissions', 'POST', params, options);
297
+ if (!(params.username && !(0, _utils.isString)(params.username))) {
298
+ _context4.next = 14;
299
+ break;
300
+ }
301
+ throw new errors.InvalidParameterError("Bad parameter: username must be of type String, received ".concat((0, _utils.getType)(params.username)));
299
302
  case 14:
303
+ _context4.next = 16;
304
+ return _Api.default.sendRequest('/permissions', 'POST', params, options);
305
+ case 16:
300
306
  response = _context4.sent;
301
307
  return _context4.abrupt("return", new _Permission(response === null || response === void 0 ? void 0 : response.data, options));
302
- case 16:
308
+ case 18:
303
309
  case "end":
304
310
  return _context4.stop();
305
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.136",
3
+ "version": "1.2.137",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- const version = '1.2.136'
8
+ const version = '1.2.137'
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO
@@ -162,21 +162,25 @@ class Permission {
162
162
  Permission.list(params, options)
163
163
 
164
164
  // Parameters:
165
+ // path (required) - string - Folder path
165
166
  // group_id - int64 - Group ID
166
- // path - string - Folder path
167
- // permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
167
+ // permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
168
168
  // recursive - boolean - Apply to subfolders recursively?
169
169
  // user_id - int64 - User ID. Provide `username` or `user_id`
170
170
  // username - string - User username. Provide `username` or `user_id`
171
171
  static create = async (params = {}, options = {}) => {
172
- if (params.group_id && !isInt(params.group_id)) {
173
- throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(params.group_id)}`)
172
+ if (!params.path) {
173
+ throw new errors.MissingParameterError('Parameter missing: path')
174
174
  }
175
175
 
176
176
  if (params.path && !isString(params.path)) {
177
177
  throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
178
178
  }
179
179
 
180
+ if (params.group_id && !isInt(params.group_id)) {
181
+ throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(params.group_id)}`)
182
+ }
183
+
180
184
  if (params.permission && !isString(params.permission)) {
181
185
  throw new errors.InvalidParameterError(`Bad parameter: permission must be of type String, received ${getType(params.permission)}`)
182
186
  }