files.com 1.2.205 → 1.2.206

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.205
1
+ 1.2.206
@@ -11,7 +11,8 @@
11
11
  "group_id": 1,
12
12
  "group_name": "example",
13
13
  "permission": "full",
14
- "recursive": true
14
+ "recursive": true,
15
+ "site_id": 1
15
16
  }
16
17
  ```
17
18
 
@@ -23,6 +24,7 @@
23
24
  * `group_name` (string): Group name (if applicable)
24
25
  * `permission` (string): Permission type. See the table referenced in the documentation for an explanation of each permission.
25
26
  * `recursive` (boolean): Recursive: does this permission apply to subfolders?
27
+ * `site_id` (int64): Site ID
26
28
 
27
29
  ---
28
30
 
@@ -42,7 +44,7 @@ await Permission.list({
42
44
 
43
45
  * `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
44
46
  * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
45
- * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `group_id`, `path` or `user_id`.
47
+ * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path` or `user_id`.
46
48
  * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id ]`.
47
49
  * `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
48
50
  * `path` (string): Permission path. If provided, will scope all permissions(including upward) to this path.
@@ -63,6 +65,7 @@ await Permission.create({
63
65
  'user_id': 1,
64
66
  'username': "user",
65
67
  'group_name': "example",
68
+ 'site_id': 1,
66
69
  })
67
70
  ```
68
71
 
@@ -76,6 +79,7 @@ await Permission.create({
76
79
  * `user_id` (int64): User ID. Provide `username` or `user_id`
77
80
  * `username` (string): User username. Provide `username` or `user_id`
78
81
  * `group_name` (string): Group name. Provide `group_name` or `group_id`
82
+ * `site_id` (int64): Site ID. If not provided, will default to current site. Used when creating a permission for a child site.
79
83
 
80
84
  ---
81
85
 
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.205';
14
+ var version = '1.2.206';
15
15
  var userAgent = "Files.com JavaScript SDK v".concat(version);
16
16
  var logLevel = _Logger.LogLevel.INFO;
17
17
  var debugRequest = false;
@@ -89,6 +89,13 @@ var Permission = /*#__PURE__*/(0, _createClass2.default)(function Permission() {
89
89
  (0, _defineProperty2.default)(this, "setRecursive", function (value) {
90
90
  _this.attributes.recursive = value;
91
91
  });
92
+ // int64 # Site ID
93
+ (0, _defineProperty2.default)(this, "getSiteId", function () {
94
+ return _this.attributes.site_id;
95
+ });
96
+ (0, _defineProperty2.default)(this, "setSiteId", function (value) {
97
+ _this.attributes.site_id = value;
98
+ });
92
99
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
93
100
  var params,
94
101
  _args = arguments;
@@ -181,7 +188,7 @@ _Permission = Permission;
181
188
  // Parameters:
182
189
  // cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
183
190
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
184
- // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `group_id`, `path` or `user_id`.
191
+ // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path` or `user_id`.
185
192
  // filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id ]`.
186
193
  // filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
187
194
  // path - string - Permission path. If provided, will scope all permissions(including upward) to this path.
@@ -255,6 +262,7 @@ _Permission = Permission;
255
262
  // user_id - int64 - User ID. Provide `username` or `user_id`
256
263
  // username - string - User username. Provide `username` or `user_id`
257
264
  // group_name - string - Group name. Provide `group_name` or `group_id`
265
+ // site_id - int64 - Site ID. If not provided, will default to current site. Used when creating a permission for a child site.
258
266
  (0, _defineProperty2.default)(Permission, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
259
267
  var params,
260
268
  options,
@@ -307,12 +315,18 @@ _Permission = Permission;
307
315
  }
308
316
  throw new errors.InvalidParameterError("Bad parameter: group_name must be of type String, received ".concat((0, _utils.getType)(params.group_name)));
309
317
  case 16:
310
- _context4.next = 18;
311
- return _Api.default.sendRequest('/permissions', 'POST', params, options);
318
+ if (!(params.site_id && !(0, _utils.isInt)(params.site_id))) {
319
+ _context4.next = 18;
320
+ break;
321
+ }
322
+ throw new errors.InvalidParameterError("Bad parameter: site_id must be of type Int, received ".concat((0, _utils.getType)(params.site_id)));
312
323
  case 18:
324
+ _context4.next = 20;
325
+ return _Api.default.sendRequest('/permissions', 'POST', params, options);
326
+ case 20:
313
327
  response = _context4.sent;
314
328
  return _context4.abrupt("return", new _Permission(response === null || response === void 0 ? void 0 : response.data, options));
315
- case 20:
329
+ case 22:
316
330
  case "end":
317
331
  return _context4.stop();
318
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.205",
3
+ "version": "1.2.206",
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.205'
8
+ const version = '1.2.206'
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO
@@ -84,6 +84,13 @@ class Permission {
84
84
  this.attributes.recursive = value
85
85
  }
86
86
 
87
+ // int64 # Site ID
88
+ getSiteId = () => this.attributes.site_id
89
+
90
+ setSiteId = value => {
91
+ this.attributes.site_id = value
92
+ }
93
+
87
94
  delete = async (params = {}) => {
88
95
  if (!this.attributes.id) {
89
96
  throw new errors.EmptyPropertyError('Current object has no id')
@@ -125,7 +132,7 @@ class Permission {
125
132
  // Parameters:
126
133
  // cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
127
134
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
128
- // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `group_id`, `path` or `user_id`.
135
+ // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path` or `user_id`.
129
136
  // filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ user_id, path ]` or `[ user_id, group_id ]`.
130
137
  // filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
131
138
  // path - string - Permission path. If provided, will scope all permissions(including upward) to this path.
@@ -169,6 +176,7 @@ class Permission {
169
176
  // user_id - int64 - User ID. Provide `username` or `user_id`
170
177
  // username - string - User username. Provide `username` or `user_id`
171
178
  // group_name - string - Group name. Provide `group_name` or `group_id`
179
+ // site_id - int64 - Site ID. If not provided, will default to current site. Used when creating a permission for a child site.
172
180
  static create = async (params = {}, options = {}) => {
173
181
  if (!params.path) {
174
182
  throw new errors.MissingParameterError('Parameter missing: path')
@@ -198,6 +206,10 @@ class Permission {
198
206
  throw new errors.InvalidParameterError(`Bad parameter: group_name must be of type String, received ${getType(params.group_name)}`)
199
207
  }
200
208
 
209
+ if (params.site_id && !isInt(params.site_id)) {
210
+ throw new errors.InvalidParameterError(`Bad parameter: site_id must be of type Int, received ${getType(params.site_id)}`)
211
+ }
212
+
201
213
  const response = await Api.sendRequest('/permissions', 'POST', params, options)
202
214
 
203
215
  return new Permission(response?.data, options)