files.com 1.2.317 → 1.2.319

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.317
1
+ 1.2.319
@@ -0,0 +1,132 @@
1
+ # Partner
2
+
3
+ ## Example Partner Object
4
+
5
+ ```
6
+ {
7
+ "allow_bypassing_2fa_policies": true,
8
+ "allow_credential_changes": true,
9
+ "allow_user_creation": true,
10
+ "id": 1,
11
+ "name": "Acme Corp",
12
+ "notes": "This is a note about the partner.",
13
+ "root_folder": "/AcmeCorp"
14
+ }
15
+ ```
16
+
17
+ * `allow_bypassing_2fa_policies` (boolean): Allow users created under this Partner to bypass Two-Factor Authentication policies.
18
+ * `allow_credential_changes` (boolean): Allow Partner Admins to change or reset credentials for users belonging to this Partner.
19
+ * `allow_user_creation` (boolean): Allow Partner Admins to create users.
20
+ * `id` (int64): The unique ID of the Partner.
21
+ * `name` (string): The name of the Partner.
22
+ * `notes` (string): Notes about this Partner.
23
+ * `root_folder` (string): The root folder path for this Partner.
24
+
25
+ ---
26
+
27
+ ## List Partners
28
+
29
+ ```
30
+ await Partner.list
31
+ ```
32
+
33
+
34
+ ### Parameters
35
+
36
+ * `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.
37
+ * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
38
+ * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`.
39
+
40
+ ---
41
+
42
+ ## Show Partner
43
+
44
+ ```
45
+ await Partner.find(id)
46
+ ```
47
+
48
+
49
+ ### Parameters
50
+
51
+ * `id` (int64): Required - Partner ID.
52
+
53
+ ---
54
+
55
+ ## Create Partner
56
+
57
+ ```
58
+ await Partner.create({
59
+ 'allow_bypassing_2fa_policies': false,
60
+ 'allow_credential_changes': false,
61
+ 'allow_user_creation': false,
62
+ 'name': "Acme Corp",
63
+ 'notes': "This is a note about the partner.",
64
+ 'root_folder': "/AcmeCorp",
65
+ })
66
+ ```
67
+
68
+
69
+ ### Parameters
70
+
71
+ * `allow_bypassing_2fa_policies` (boolean): Allow users created under this Partner to bypass Two-Factor Authentication policies.
72
+ * `allow_credential_changes` (boolean): Allow Partner Admins to change or reset credentials for users belonging to this Partner.
73
+ * `allow_user_creation` (boolean): Allow Partner Admins to create users.
74
+ * `name` (string): The name of the Partner.
75
+ * `notes` (string): Notes about this Partner.
76
+ * `root_folder` (string): The root folder path for this Partner.
77
+
78
+ ---
79
+
80
+ ## Update Partner
81
+
82
+ ```
83
+ const partner = await Partner.find(id)
84
+
85
+ await partner.update({
86
+ 'allow_bypassing_2fa_policies': false,
87
+ 'allow_credential_changes': false,
88
+ 'allow_user_creation': false,
89
+ 'name': "Acme Corp",
90
+ 'notes': "This is a note about the partner.",
91
+ 'root_folder': "/AcmeCorp",
92
+ })
93
+ ```
94
+
95
+ ### Parameters
96
+
97
+ * `id` (int64): Required - Partner ID.
98
+ * `allow_bypassing_2fa_policies` (boolean): Allow users created under this Partner to bypass Two-Factor Authentication policies.
99
+ * `allow_credential_changes` (boolean): Allow Partner Admins to change or reset credentials for users belonging to this Partner.
100
+ * `allow_user_creation` (boolean): Allow Partner Admins to create users.
101
+ * `name` (string): The name of the Partner.
102
+ * `notes` (string): Notes about this Partner.
103
+ * `root_folder` (string): The root folder path for this Partner.
104
+
105
+ ### Example Response
106
+
107
+ ```json
108
+ {
109
+ "allow_bypassing_2fa_policies": true,
110
+ "allow_credential_changes": true,
111
+ "allow_user_creation": true,
112
+ "id": 1,
113
+ "name": "Acme Corp",
114
+ "notes": "This is a note about the partner.",
115
+ "root_folder": "/AcmeCorp"
116
+ }
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Delete Partner
122
+
123
+ ```
124
+ const partner = await Partner.find(id)
125
+
126
+ await partner.delete()
127
+ ```
128
+
129
+ ### Parameters
130
+
131
+ * `id` (int64): Required - Partner ID.
132
+
@@ -10,6 +10,7 @@
10
10
  "username": "user",
11
11
  "group_id": 1,
12
12
  "group_name": "example",
13
+ "partner_id": 1,
13
14
  "permission": "full",
14
15
  "recursive": true,
15
16
  "site_id": 1
@@ -22,6 +23,7 @@
22
23
  * `username` (string): Username (if applicable)
23
24
  * `group_id` (int64): Group ID
24
25
  * `group_name` (string): Group name (if applicable)
26
+ * `partner_id` (int64): Partner ID (if applicable)
25
27
  * `permission` (string): Permission type. See the table referenced in the documentation for an explanation of each permission.
26
28
  * `recursive` (boolean): Recursive: does this permission apply to subfolders?
27
29
  * `site_id` (int64): Site ID
@@ -35,6 +37,7 @@ await Permission.list({
35
37
  'path': "example",
36
38
  'include_groups': false,
37
39
  'group_id': 1,
40
+ 'partner_id': 1,
38
41
  'user_id': 1,
39
42
  })
40
43
  ```
@@ -44,12 +47,13 @@ await Permission.list({
44
47
 
45
48
  * `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.
46
49
  * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
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`, `user_id` or `id`.
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 ]`, `[ user_id, group_id ]` or `[ user_id, group_id, path ]`.
50
+ * `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`, `user_id`, `partner_id` or `id`.
51
+ * `filter` (object): If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id`, `partner_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ partner_id, path ]`, `[ user_id, path ]`, `[ user_id, group_id ]`, `[ user_id, group_id, path ]`, `[ user_id, group_id, partner_id ]` or `[ user_id, group_id, partner_id, path ]`.
49
52
  * `filter_prefix` (object): If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
50
53
  * `path` (string): Permission path. If provided, will scope all permissions(including upward) to this path.
51
54
  * `include_groups` (boolean): If searching by user or group, also include user's permissions that are inherited from its groups?
52
55
  * `group_id` (string):
56
+ * `partner_id` (string):
53
57
  * `user_id` (string):
54
58
 
55
59
  ---
@@ -62,6 +66,7 @@ await Permission.create({
62
66
  'group_id': 1,
63
67
  'permission': "full",
64
68
  'recursive': false,
69
+ 'partner_id': 1,
65
70
  'user_id': 1,
66
71
  'username': "user",
67
72
  'group_name': "example",
@@ -76,6 +81,7 @@ await Permission.create({
76
81
  * `group_id` (int64): Group ID. Provide `group_name` or `group_id`
77
82
  * `permission` (string): Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
78
83
  * `recursive` (boolean): Apply to subfolders recursively?
84
+ * `partner_id` (int64): Partner ID if this Permission belongs to a partner.
79
85
  * `user_id` (int64): User ID. Provide `username` or `user_id`
80
86
  * `username` (string): User username. Provide `username` or `user_id`
81
87
  * `group_name` (string): Group name. Provide `group_name` or `group_id`
@@ -259,6 +259,8 @@
259
259
  "notes": "Internal notes on this user.",
260
260
  "notification_daily_send_time": 18,
261
261
  "office_integration_enabled": true,
262
+ "partner_admin": true,
263
+ "partner_id": 1,
262
264
  "password_set_at": "2000-01-01T01:00:00Z",
263
265
  "password_validity_days": 1,
264
266
  "public_keys_count": 1,
@@ -46,6 +46,8 @@
46
46
  "notes": "Internal notes on this user.",
47
47
  "notification_daily_send_time": 18,
48
48
  "office_integration_enabled": true,
49
+ "partner_admin": true,
50
+ "partner_id": 1,
49
51
  "password_set_at": "2000-01-01T01:00:00Z",
50
52
  "password_validity_days": 1,
51
53
  "public_keys_count": 1,
@@ -116,6 +118,8 @@
116
118
  * `notes` (string): Any internal notes on the user
117
119
  * `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
118
120
  * `office_integration_enabled` (boolean): Enable integration with Office for the web?
121
+ * `partner_admin` (boolean): Is this user a Partner administrator?
122
+ * `partner_id` (int64): Partner ID if this user belongs to a Partner
119
123
  * `password_set_at` (date-time): Last time the user's password was set
120
124
  * `password_validity_days` (int64): Number of days to allow user to use the same password
121
125
  * `public_keys_count` (int64): Number of public keys associated with this user
@@ -223,6 +227,7 @@ await User.create({
223
227
  'company': "ACME Corp.",
224
228
  'notes': "Internal notes on this user.",
225
229
  'office_integration_enabled': true,
230
+ 'partner_id': 1,
226
231
  'password_validity_days': 1,
227
232
  'readonly_site_admin': true,
228
233
  'receive_admin_alerts': true,
@@ -277,6 +282,7 @@ await User.create({
277
282
  * `company` (string): User's company
278
283
  * `notes` (string): Any internal notes on the user
279
284
  * `office_integration_enabled` (boolean): Enable integration with Office for the web?
285
+ * `partner_id` (int64): Partner ID if this user belongs to a Partner
280
286
  * `password_validity_days` (int64): Number of days to allow user to use the same password
281
287
  * `readonly_site_admin` (boolean): Is the user an allowed to view all (non-billing) site configuration for this site?
282
288
  * `receive_admin_alerts` (boolean): Should the user receive admin alerts such a certificate expiration notifications and overages?
@@ -372,6 +378,7 @@ await user.update({
372
378
  'company': "ACME Corp.",
373
379
  'notes': "Internal notes on this user.",
374
380
  'office_integration_enabled': true,
381
+ 'partner_id': 1,
375
382
  'password_validity_days': 1,
376
383
  'readonly_site_admin': true,
377
384
  'receive_admin_alerts': true,
@@ -427,6 +434,7 @@ await user.update({
427
434
  * `company` (string): User's company
428
435
  * `notes` (string): Any internal notes on the user
429
436
  * `office_integration_enabled` (boolean): Enable integration with Office for the web?
437
+ * `partner_id` (int64): Partner ID if this user belongs to a Partner
430
438
  * `password_validity_days` (int64): Number of days to allow user to use the same password
431
439
  * `readonly_site_admin` (boolean): Is the user an allowed to view all (non-billing) site configuration for this site?
432
440
  * `receive_admin_alerts` (boolean): Should the user receive admin alerts such a certificate expiration notifications and overages?
@@ -493,6 +501,8 @@ await user.update({
493
501
  "notes": "Internal notes on this user.",
494
502
  "notification_daily_send_time": 18,
495
503
  "office_integration_enabled": true,
504
+ "partner_admin": true,
505
+ "partner_id": 1,
496
506
  "password_set_at": "2000-01-01T01:00:00Z",
497
507
  "password_validity_days": 1,
498
508
  "public_keys_count": 1,
package/lib/Files.js CHANGED
@@ -12,7 +12,7 @@ var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
14
  var language = null;
15
- var version = '1.2.317';
15
+ var version = '1.2.319';
16
16
  var userAgent = "Files.com JavaScript SDK v".concat(version);
17
17
  var logLevel = _Logger.LogLevel.INFO;
18
18
  var debugRequest = false;
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+ var _Api = _interopRequireDefault(require("../Api"));
14
+ var errors = _interopRequireWildcard(require("../Errors"));
15
+ var _utils = require("../utils");
16
+ var _Partner;
17
+ /* eslint-disable no-unused-vars */
18
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ /* eslint-enable no-unused-vars */
22
+ /**
23
+ * Class Partner
24
+ */
25
+ var Partner = /*#__PURE__*/(0, _createClass2.default)(function Partner() {
26
+ var _this = this;
27
+ var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
+ (0, _classCallCheck2.default)(this, Partner);
30
+ (0, _defineProperty2.default)(this, "attributes", {});
31
+ (0, _defineProperty2.default)(this, "options", {});
32
+ (0, _defineProperty2.default)(this, "isLoaded", function () {
33
+ return !!_this.attributes.id;
34
+ });
35
+ // boolean # Allow users created under this Partner to bypass Two-Factor Authentication policies.
36
+ (0, _defineProperty2.default)(this, "getAllowBypassing2faPolicies", function () {
37
+ return _this.attributes.allow_bypassing_2fa_policies;
38
+ });
39
+ (0, _defineProperty2.default)(this, "setAllowBypassing2faPolicies", function (value) {
40
+ _this.attributes.allow_bypassing_2fa_policies = value;
41
+ });
42
+ // boolean # Allow Partner Admins to change or reset credentials for users belonging to this Partner.
43
+ (0, _defineProperty2.default)(this, "getAllowCredentialChanges", function () {
44
+ return _this.attributes.allow_credential_changes;
45
+ });
46
+ (0, _defineProperty2.default)(this, "setAllowCredentialChanges", function (value) {
47
+ _this.attributes.allow_credential_changes = value;
48
+ });
49
+ // boolean # Allow Partner Admins to create users.
50
+ (0, _defineProperty2.default)(this, "getAllowUserCreation", function () {
51
+ return _this.attributes.allow_user_creation;
52
+ });
53
+ (0, _defineProperty2.default)(this, "setAllowUserCreation", function (value) {
54
+ _this.attributes.allow_user_creation = value;
55
+ });
56
+ // int64 # The unique ID of the Partner.
57
+ (0, _defineProperty2.default)(this, "getId", function () {
58
+ return _this.attributes.id;
59
+ });
60
+ (0, _defineProperty2.default)(this, "setId", function (value) {
61
+ _this.attributes.id = value;
62
+ });
63
+ // string # The name of the Partner.
64
+ (0, _defineProperty2.default)(this, "getName", function () {
65
+ return _this.attributes.name;
66
+ });
67
+ (0, _defineProperty2.default)(this, "setName", function (value) {
68
+ _this.attributes.name = value;
69
+ });
70
+ // string # Notes about this Partner.
71
+ (0, _defineProperty2.default)(this, "getNotes", function () {
72
+ return _this.attributes.notes;
73
+ });
74
+ (0, _defineProperty2.default)(this, "setNotes", function (value) {
75
+ _this.attributes.notes = value;
76
+ });
77
+ // string # The root folder path for this Partner.
78
+ (0, _defineProperty2.default)(this, "getRootFolder", function () {
79
+ return _this.attributes.root_folder;
80
+ });
81
+ (0, _defineProperty2.default)(this, "setRootFolder", function (value) {
82
+ _this.attributes.root_folder = value;
83
+ });
84
+ // Parameters:
85
+ // allow_bypassing_2fa_policies - boolean - Allow users created under this Partner to bypass Two-Factor Authentication policies.
86
+ // allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
87
+ // allow_user_creation - boolean - Allow Partner Admins to create users.
88
+ // name - string - The name of the Partner.
89
+ // notes - string - Notes about this Partner.
90
+ // root_folder - string - The root folder path for this Partner.
91
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
92
+ var params,
93
+ response,
94
+ _args = arguments;
95
+ return _regenerator.default.wrap(function (_context) {
96
+ while (1) switch (_context.prev = _context.next) {
97
+ case 0:
98
+ params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
99
+ if (_this.attributes.id) {
100
+ _context.next = 1;
101
+ break;
102
+ }
103
+ throw new errors.EmptyPropertyError('Current object has no id');
104
+ case 1:
105
+ if ((0, _utils.isObject)(params)) {
106
+ _context.next = 2;
107
+ break;
108
+ }
109
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
110
+ case 2:
111
+ params.id = _this.attributes.id;
112
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
113
+ _context.next = 3;
114
+ break;
115
+ }
116
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
117
+ case 3:
118
+ if (!(params.name && !(0, _utils.isString)(params.name))) {
119
+ _context.next = 4;
120
+ break;
121
+ }
122
+ throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
123
+ case 4:
124
+ if (!(params.notes && !(0, _utils.isString)(params.notes))) {
125
+ _context.next = 5;
126
+ break;
127
+ }
128
+ throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(params.notes)));
129
+ case 5:
130
+ if (!(params.root_folder && !(0, _utils.isString)(params.root_folder))) {
131
+ _context.next = 6;
132
+ break;
133
+ }
134
+ throw new errors.InvalidParameterError("Bad parameter: root_folder must be of type String, received ".concat((0, _utils.getType)(params.root_folder)));
135
+ case 6:
136
+ if (params.id) {
137
+ _context.next = 8;
138
+ break;
139
+ }
140
+ if (!_this.attributes.id) {
141
+ _context.next = 7;
142
+ break;
143
+ }
144
+ params.id = _this.id;
145
+ _context.next = 8;
146
+ break;
147
+ case 7:
148
+ throw new errors.MissingParameterError('Parameter missing: id');
149
+ case 8:
150
+ _context.next = 9;
151
+ return _Api.default.sendRequest("/partners/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
152
+ case 9:
153
+ response = _context.sent;
154
+ return _context.abrupt("return", new Partner(response === null || response === void 0 ? void 0 : response.data, _this.options));
155
+ case 10:
156
+ case "end":
157
+ return _context.stop();
158
+ }
159
+ }, _callee);
160
+ })));
161
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
162
+ var params,
163
+ _args2 = arguments;
164
+ return _regenerator.default.wrap(function (_context2) {
165
+ while (1) switch (_context2.prev = _context2.next) {
166
+ case 0:
167
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
168
+ if (_this.attributes.id) {
169
+ _context2.next = 1;
170
+ break;
171
+ }
172
+ throw new errors.EmptyPropertyError('Current object has no id');
173
+ case 1:
174
+ if ((0, _utils.isObject)(params)) {
175
+ _context2.next = 2;
176
+ break;
177
+ }
178
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
179
+ case 2:
180
+ params.id = _this.attributes.id;
181
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
182
+ _context2.next = 3;
183
+ break;
184
+ }
185
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
186
+ case 3:
187
+ if (params.id) {
188
+ _context2.next = 5;
189
+ break;
190
+ }
191
+ if (!_this.attributes.id) {
192
+ _context2.next = 4;
193
+ break;
194
+ }
195
+ params.id = _this.id;
196
+ _context2.next = 5;
197
+ break;
198
+ case 4:
199
+ throw new errors.MissingParameterError('Parameter missing: id');
200
+ case 5:
201
+ _context2.next = 6;
202
+ return _Api.default.sendRequest("/partners/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
203
+ case 6:
204
+ case "end":
205
+ return _context2.stop();
206
+ }
207
+ }, _callee2);
208
+ })));
209
+ (0, _defineProperty2.default)(this, "destroy", function () {
210
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
211
+ return _this.delete(params);
212
+ });
213
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
214
+ var _newObject, newObject;
215
+ return _regenerator.default.wrap(function (_context3) {
216
+ while (1) switch (_context3.prev = _context3.next) {
217
+ case 0:
218
+ if (!_this.attributes.id) {
219
+ _context3.next = 2;
220
+ break;
221
+ }
222
+ _context3.next = 1;
223
+ return _this.update(_this.attributes);
224
+ case 1:
225
+ _newObject = _context3.sent;
226
+ _this.attributes = _objectSpread({}, _newObject.attributes);
227
+ return _context3.abrupt("return", true);
228
+ case 2:
229
+ _context3.next = 3;
230
+ return Partner.create(_this.attributes, _this.options);
231
+ case 3:
232
+ newObject = _context3.sent;
233
+ _this.attributes = _objectSpread({}, newObject.attributes);
234
+ return _context3.abrupt("return", true);
235
+ case 4:
236
+ case "end":
237
+ return _context3.stop();
238
+ }
239
+ }, _callee3);
240
+ })));
241
+ Object.entries(attributes).forEach(function (_ref4) {
242
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
243
+ key = _ref5[0],
244
+ value = _ref5[1];
245
+ var normalizedKey = key.replace('?', '');
246
+ _this.attributes[normalizedKey] = value;
247
+ Object.defineProperty(_this, normalizedKey, {
248
+ value: value,
249
+ writable: false
250
+ });
251
+ });
252
+ this.options = _objectSpread({}, options);
253
+ });
254
+ _Partner = Partner;
255
+ // Parameters:
256
+ // 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.
257
+ // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
258
+ // sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`.
259
+ (0, _defineProperty2.default)(Partner, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
260
+ var _response$data;
261
+ var params,
262
+ options,
263
+ response,
264
+ _args4 = arguments;
265
+ return _regenerator.default.wrap(function (_context4) {
266
+ while (1) switch (_context4.prev = _context4.next) {
267
+ case 0:
268
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
269
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
270
+ if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
271
+ _context4.next = 1;
272
+ break;
273
+ }
274
+ throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
275
+ case 1:
276
+ if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
277
+ _context4.next = 2;
278
+ break;
279
+ }
280
+ throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
281
+ case 2:
282
+ _context4.next = 3;
283
+ return _Api.default.sendRequest('/partners', 'GET', params, options);
284
+ case 3:
285
+ response = _context4.sent;
286
+ return _context4.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
287
+ return new _Partner(obj, options);
288
+ })) || []);
289
+ case 4:
290
+ case "end":
291
+ return _context4.stop();
292
+ }
293
+ }, _callee4);
294
+ })));
295
+ (0, _defineProperty2.default)(Partner, "all", function () {
296
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
297
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
298
+ return _Partner.list(params, options);
299
+ });
300
+ // Parameters:
301
+ // id (required) - int64 - Partner ID.
302
+ (0, _defineProperty2.default)(Partner, "find", /*#__PURE__*/function () {
303
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
304
+ var params,
305
+ options,
306
+ response,
307
+ _args5 = arguments;
308
+ return _regenerator.default.wrap(function (_context5) {
309
+ while (1) switch (_context5.prev = _context5.next) {
310
+ case 0:
311
+ params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
312
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
313
+ if ((0, _utils.isObject)(params)) {
314
+ _context5.next = 1;
315
+ break;
316
+ }
317
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
318
+ case 1:
319
+ params.id = id;
320
+ if (params.id) {
321
+ _context5.next = 2;
322
+ break;
323
+ }
324
+ throw new errors.MissingParameterError('Parameter missing: id');
325
+ case 2:
326
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
327
+ _context5.next = 3;
328
+ break;
329
+ }
330
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
331
+ case 3:
332
+ _context5.next = 4;
333
+ return _Api.default.sendRequest("/partners/".concat(encodeURIComponent(params.id)), 'GET', params, options);
334
+ case 4:
335
+ response = _context5.sent;
336
+ return _context5.abrupt("return", new _Partner(response === null || response === void 0 ? void 0 : response.data, options));
337
+ case 5:
338
+ case "end":
339
+ return _context5.stop();
340
+ }
341
+ }, _callee5);
342
+ }));
343
+ return function (_x) {
344
+ return _ref7.apply(this, arguments);
345
+ };
346
+ }());
347
+ (0, _defineProperty2.default)(Partner, "get", function (id) {
348
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
349
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
350
+ return _Partner.find(id, params, options);
351
+ });
352
+ // Parameters:
353
+ // allow_bypassing_2fa_policies - boolean - Allow users created under this Partner to bypass Two-Factor Authentication policies.
354
+ // allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
355
+ // allow_user_creation - boolean - Allow Partner Admins to create users.
356
+ // name - string - The name of the Partner.
357
+ // notes - string - Notes about this Partner.
358
+ // root_folder - string - The root folder path for this Partner.
359
+ (0, _defineProperty2.default)(Partner, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
360
+ var params,
361
+ options,
362
+ response,
363
+ _args6 = arguments;
364
+ return _regenerator.default.wrap(function (_context6) {
365
+ while (1) switch (_context6.prev = _context6.next) {
366
+ case 0:
367
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
368
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
369
+ if (!(params.name && !(0, _utils.isString)(params.name))) {
370
+ _context6.next = 1;
371
+ break;
372
+ }
373
+ throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
374
+ case 1:
375
+ if (!(params.notes && !(0, _utils.isString)(params.notes))) {
376
+ _context6.next = 2;
377
+ break;
378
+ }
379
+ throw new errors.InvalidParameterError("Bad parameter: notes must be of type String, received ".concat((0, _utils.getType)(params.notes)));
380
+ case 2:
381
+ if (!(params.root_folder && !(0, _utils.isString)(params.root_folder))) {
382
+ _context6.next = 3;
383
+ break;
384
+ }
385
+ throw new errors.InvalidParameterError("Bad parameter: root_folder must be of type String, received ".concat((0, _utils.getType)(params.root_folder)));
386
+ case 3:
387
+ _context6.next = 4;
388
+ return _Api.default.sendRequest('/partners', 'POST', params, options);
389
+ case 4:
390
+ response = _context6.sent;
391
+ return _context6.abrupt("return", new _Partner(response === null || response === void 0 ? void 0 : response.data, options));
392
+ case 5:
393
+ case "end":
394
+ return _context6.stop();
395
+ }
396
+ }, _callee6);
397
+ })));
398
+ var _default = exports.default = Partner;
399
+ module.exports = Partner;
400
+ module.exports.default = Partner;