files.com 1.1.19 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. package/.eslintrc.js +0 -3
  2. package/_VERSION +1 -1
  3. package/lib/Api.js +1 -1
  4. package/lib/Errors.js +345 -334
  5. package/lib/Files.js +1 -1
  6. package/lib/models/ActionNotificationExport.js +25 -25
  7. package/lib/models/ActionNotificationExportResult.js +10 -10
  8. package/lib/models/ActionWebhookFailure.js +5 -9
  9. package/lib/models/ApiKey.js +62 -70
  10. package/lib/models/App.js +5 -5
  11. package/lib/models/As2IncomingMessage.js +7 -7
  12. package/lib/models/As2OutgoingMessage.js +7 -7
  13. package/lib/models/As2Partner.js +54 -58
  14. package/lib/models/As2Station.js +51 -55
  15. package/lib/models/Automation.js +102 -110
  16. package/lib/models/AutomationRun.js +13 -13
  17. package/lib/models/BandwidthSnapshot.js +5 -5
  18. package/lib/models/Behavior.js +77 -85
  19. package/lib/models/Bundle.js +102 -110
  20. package/lib/models/BundleDownload.js +9 -9
  21. package/lib/models/BundleNotification.js +37 -41
  22. package/lib/models/BundleRecipient.js +22 -22
  23. package/lib/models/BundleRegistration.js +7 -7
  24. package/lib/models/Clickwrap.js +52 -56
  25. package/lib/models/DnsRecord.js +5 -5
  26. package/lib/models/EmailIncomingMessage.js +5 -5
  27. package/lib/models/ExternalEvent.js +18 -18
  28. package/lib/models/File.js +89 -93
  29. package/lib/models/FileComment.js +41 -45
  30. package/lib/models/FileCommentReaction.js +15 -19
  31. package/lib/models/FileMigration.js +5 -5
  32. package/lib/models/Folder.js +24 -24
  33. package/lib/models/FormFieldSet.js +44 -48
  34. package/lib/models/GpgKey.js +53 -57
  35. package/lib/models/Group.js +51 -55
  36. package/lib/models/GroupUser.js +53 -57
  37. package/lib/models/History.js +72 -72
  38. package/lib/models/HistoryExport.js +51 -51
  39. package/lib/models/HistoryExportResult.js +10 -10
  40. package/lib/models/InboxRecipient.js +22 -22
  41. package/lib/models/InboxRegistration.js +7 -7
  42. package/lib/models/InboxUpload.js +9 -9
  43. package/lib/models/Invoice.js +12 -12
  44. package/lib/models/IpAddress.js +17 -17
  45. package/lib/models/Lock.js +27 -31
  46. package/lib/models/Message.js +60 -64
  47. package/lib/models/MessageComment.js +46 -50
  48. package/lib/models/MessageCommentReaction.js +27 -31
  49. package/lib/models/MessageReaction.js +27 -31
  50. package/lib/models/Notification.js +66 -70
  51. package/lib/models/Payment.js +12 -12
  52. package/lib/models/Permission.js +28 -32
  53. package/lib/models/Priority.js +9 -9
  54. package/lib/models/Project.js +39 -43
  55. package/lib/models/PublicKey.js +46 -50
  56. package/lib/models/RemoteBandwidthSnapshot.js +5 -5
  57. package/lib/models/RemoteServer.js +306 -310
  58. package/lib/models/Request.js +33 -37
  59. package/lib/models/Session.js +11 -15
  60. package/lib/models/SettingsChange.js +5 -5
  61. package/lib/models/SftpHostKey.js +40 -44
  62. package/lib/models/ShareGroup.js +50 -54
  63. package/lib/models/Site.js +138 -138
  64. package/lib/models/Snapshot.js +44 -48
  65. package/lib/models/SsoStrategy.js +15 -19
  66. package/lib/models/Style.js +17 -21
  67. package/lib/models/UsageDailySnapshot.js +5 -5
  68. package/lib/models/UsageSnapshot.js +5 -5
  69. package/lib/models/User.js +156 -172
  70. package/lib/models/UserCipherUse.js +7 -7
  71. package/lib/models/UserRequest.js +26 -30
  72. package/lib/models/WebhookTest.js +15 -15
  73. package/package.json +6 -2
  74. package/src/Api.js +2 -1
  75. package/src/Errors.js +189 -178
  76. package/src/Files.js +1 -1
  77. package/src/models/AccountLineItem.js +5 -2
  78. package/src/models/Action.js +5 -2
  79. package/src/models/ActionNotificationExport.js +36 -35
  80. package/src/models/ActionNotificationExportResult.js +15 -13
  81. package/src/models/ActionWebhookFailure.js +9 -8
  82. package/src/models/ApiKey.js +69 -72
  83. package/src/models/App.js +10 -8
  84. package/src/models/As2IncomingMessage.js +12 -10
  85. package/src/models/As2OutgoingMessage.js +12 -10
  86. package/src/models/As2Partner.js +61 -60
  87. package/src/models/As2Station.js +58 -57
  88. package/src/models/Auto.js +5 -2
  89. package/src/models/Automation.js +121 -110
  90. package/src/models/AutomationRun.js +18 -17
  91. package/src/models/BandwidthSnapshot.js +10 -8
  92. package/src/models/Behavior.js +85 -86
  93. package/src/models/Bundle.js +121 -110
  94. package/src/models/BundleDownload.js +14 -12
  95. package/src/models/BundleNotification.js +40 -43
  96. package/src/models/BundleRecipient.js +33 -32
  97. package/src/models/BundleRegistration.js +12 -10
  98. package/src/models/Clickwrap.js +60 -58
  99. package/src/models/DnsRecord.js +10 -8
  100. package/src/models/EmailIncomingMessage.js +10 -8
  101. package/src/models/Errors.js +5 -2
  102. package/src/models/ExternalEvent.js +29 -29
  103. package/src/models/File.js +116 -108
  104. package/src/models/FileAction.js +5 -2
  105. package/src/models/FileComment.js +45 -46
  106. package/src/models/FileCommentReaction.js +26 -26
  107. package/src/models/FileMigration.js +10 -8
  108. package/src/models/FileUploadPart.js +5 -2
  109. package/src/models/Folder.js +32 -29
  110. package/src/models/FormField.js +5 -2
  111. package/src/models/FormFieldSet.js +49 -50
  112. package/src/models/GpgKey.js +60 -59
  113. package/src/models/Group.js +58 -57
  114. package/src/models/GroupUser.js +60 -58
  115. package/src/models/History.js +77 -74
  116. package/src/models/HistoryExport.js +62 -61
  117. package/src/models/HistoryExportResult.js +15 -13
  118. package/src/models/Image.js +5 -2
  119. package/src/models/InboxRecipient.js +33 -32
  120. package/src/models/InboxRegistration.js +12 -10
  121. package/src/models/InboxUpload.js +14 -12
  122. package/src/models/Invoice.js +17 -14
  123. package/src/models/InvoiceLineItem.js +5 -2
  124. package/src/models/IpAddress.js +22 -20
  125. package/src/models/Lock.js +36 -36
  126. package/src/models/Message.js +66 -66
  127. package/src/models/MessageComment.js +50 -52
  128. package/src/models/MessageCommentReaction.js +38 -40
  129. package/src/models/MessageReaction.js +38 -40
  130. package/src/models/Notification.js +74 -72
  131. package/src/models/Payment.js +17 -14
  132. package/src/models/PaymentLineItem.js +5 -2
  133. package/src/models/Permission.js +39 -40
  134. package/src/models/Preview.js +5 -2
  135. package/src/models/Priority.js +14 -12
  136. package/src/models/Project.js +43 -45
  137. package/src/models/PublicIpAddress.js +5 -2
  138. package/src/models/PublicKey.js +50 -52
  139. package/src/models/RemoteBandwidthSnapshot.js +10 -8
  140. package/src/models/RemoteServer.js +380 -312
  141. package/src/models/RemoteServerConfigurationFile.js +5 -2
  142. package/src/models/Request.js +44 -46
  143. package/src/models/Session.js +22 -22
  144. package/src/models/SettingsChange.js +10 -8
  145. package/src/models/SftpHostKey.js +45 -46
  146. package/src/models/ShareGroup.js +56 -56
  147. package/src/models/ShareGroupMember.js +5 -2
  148. package/src/models/Site.js +143 -142
  149. package/src/models/Snapshot.js +50 -50
  150. package/src/models/SsoStrategy.js +20 -21
  151. package/src/models/Status.js +5 -2
  152. package/src/models/Style.js +22 -23
  153. package/src/models/UsageDailySnapshot.js +10 -8
  154. package/src/models/UsageSnapshot.js +10 -8
  155. package/src/models/User.js +185 -168
  156. package/src/models/UserCipherUse.js +12 -10
  157. package/src/models/UserRequest.js +37 -39
  158. package/src/models/WebhookTest.js +26 -24
  159. package/test/Api.test.js +163 -0
  160. package/test/{package.json → integration/package.json} +1 -1
  161. package/test/{src → integration/src}/index.js +1 -1
  162. package/test.sh +2 -1
  163. /package/test/{.babelrc → integration/.babelrc} +0 -0
  164. /package/test/{index.js → integration/index.js} +0 -0
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class InboxRecipient {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class InboxRecipient {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // string # The recipient's company.
28
32
  getCompany = () => this.attributes.company
29
33
 
@@ -73,15 +77,14 @@ class InboxRecipient {
73
77
  this.attributes.share_after_create = value
74
78
  }
75
79
 
76
-
77
80
  save = async () => {
78
- if (this.attributes['id']) {
79
- throw new errors.NotImplementedError('The InboxRecipient object doesn\'t support updates.')
80
- } else {
81
- const newObject = await InboxRecipient.create(this.attributes, this.options)
82
- this.attributes = { ...newObject.attributes }
83
- return true
84
- }
81
+ if (this.attributes.id) {
82
+ throw new errors.NotImplementedError('The InboxRecipient object doesn\'t support updates.')
83
+ } else {
84
+ const newObject = await InboxRecipient.create(this.attributes, this.options)
85
+ this.attributes = { ...newObject.attributes }
86
+ return true
87
+ }
85
88
  }
86
89
 
87
90
  // Parameters:
@@ -91,25 +94,24 @@ class InboxRecipient {
91
94
  // filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`.
92
95
  // inbox_id (required) - int64 - List recipients for the inbox with this ID.
93
96
  static list = async (params = {}, options = {}) => {
94
- if (!params['inbox_id']) {
97
+ if (!params.inbox_id) {
95
98
  throw new errors.MissingParameterError('Parameter missing: inbox_id')
96
99
  }
97
100
 
98
- if (params['cursor'] && !isString(params['cursor'])) {
99
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
101
+ if (params.cursor && !isString(params.cursor)) {
102
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
100
103
  }
101
104
 
102
- if (params['per_page'] && !isInt(params['per_page'])) {
103
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
105
+ if (params.per_page && !isInt(params.per_page)) {
106
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
104
107
  }
105
108
 
106
- if (params['inbox_id'] && !isInt(params['inbox_id'])) {
107
- throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
109
+ if (params.inbox_id && !isInt(params.inbox_id)) {
110
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
108
111
  }
109
112
 
110
- const response = await Api.sendRequest(`/inbox_recipients`, 'GET', params, options)
113
+ const response = await Api.sendRequest('/inbox_recipients', 'GET', params, options)
111
114
 
112
-
113
115
  return response?.data?.map(obj => new InboxRecipient(obj, options)) || []
114
116
  }
115
117
 
@@ -124,37 +126,36 @@ class InboxRecipient {
124
126
  // note - string - Note to include in email.
125
127
  // share_after_create - boolean - Set to true to share the link with the recipient upon creation.
126
128
  static create = async (params = {}, options = {}) => {
127
- if (!params['inbox_id']) {
129
+ if (!params.inbox_id) {
128
130
  throw new errors.MissingParameterError('Parameter missing: inbox_id')
129
131
  }
130
132
 
131
- if (!params['recipient']) {
133
+ if (!params.recipient) {
132
134
  throw new errors.MissingParameterError('Parameter missing: recipient')
133
135
  }
134
136
 
135
- if (params['inbox_id'] && !isInt(params['inbox_id'])) {
136
- throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
137
+ if (params.inbox_id && !isInt(params.inbox_id)) {
138
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
137
139
  }
138
140
 
139
- if (params['recipient'] && !isString(params['recipient'])) {
140
- throw new errors.InvalidParameterError(`Bad parameter: recipient must be of type String, received ${getType(params['recipient'])}`)
141
+ if (params.recipient && !isString(params.recipient)) {
142
+ throw new errors.InvalidParameterError(`Bad parameter: recipient must be of type String, received ${getType(params.recipient)}`)
141
143
  }
142
144
 
143
- if (params['name'] && !isString(params['name'])) {
144
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
145
+ if (params.name && !isString(params.name)) {
146
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
145
147
  }
146
148
 
147
- if (params['company'] && !isString(params['company'])) {
148
- throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(params['company'])}`)
149
+ if (params.company && !isString(params.company)) {
150
+ throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(params.company)}`)
149
151
  }
150
152
 
151
- if (params['note'] && !isString(params['note'])) {
152
- throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params['note'])}`)
153
+ if (params.note && !isString(params.note)) {
154
+ throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
153
155
  }
154
156
 
155
- const response = await Api.sendRequest(`/inbox_recipients`, 'POST', params, options)
157
+ const response = await Api.sendRequest('/inbox_recipients', 'POST', params, options)
156
158
 
157
-
158
159
  return new InboxRecipient(response?.data, options)
159
160
  }
160
161
  }
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class InboxRegistration {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class InboxRegistration {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // string # Registration cookie code
28
32
  getCode = () => this.attributes.code
29
33
 
@@ -60,27 +64,25 @@ class InboxRegistration {
60
64
  // date-time # Registration creation date/time
61
65
  getCreatedAt = () => this.attributes.created_at
62
66
 
63
-
64
67
  // Parameters:
65
68
  // 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.
66
69
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
67
70
  // folder_behavior_id - int64 - ID of the associated Inbox.
68
71
  static list = async (params = {}, options = {}) => {
69
- if (params['cursor'] && !isString(params['cursor'])) {
70
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
72
+ if (params.cursor && !isString(params.cursor)) {
73
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
71
74
  }
72
75
 
73
- if (params['per_page'] && !isInt(params['per_page'])) {
74
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
76
+ if (params.per_page && !isInt(params.per_page)) {
77
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
75
78
  }
76
79
 
77
- if (params['folder_behavior_id'] && !isInt(params['folder_behavior_id'])) {
78
- throw new errors.InvalidParameterError(`Bad parameter: folder_behavior_id must be of type Int, received ${getType(params['folder_behavior_id'])}`)
80
+ if (params.folder_behavior_id && !isInt(params.folder_behavior_id)) {
81
+ throw new errors.InvalidParameterError(`Bad parameter: folder_behavior_id must be of type Int, received ${getType(params.folder_behavior_id)}`)
79
82
  }
80
83
 
81
- const response = await Api.sendRequest(`/inbox_registrations`, 'GET', params, options)
84
+ const response = await Api.sendRequest('/inbox_registrations', 'GET', params, options)
82
85
 
83
-
84
86
  return response?.data?.map(obj => new InboxRegistration(obj, options)) || []
85
87
  }
86
88
 
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class InboxUpload {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class InboxUpload {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // InboxRegistration
28
32
  getInboxRegistration = () => this.attributes.inbox_registration
29
33
 
@@ -33,7 +37,6 @@ class InboxUpload {
33
37
  // date-time # Upload date/time
34
38
  getCreatedAt = () => this.attributes.created_at
35
39
 
36
-
37
40
  // Parameters:
38
41
  // 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.
39
42
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
@@ -46,25 +49,24 @@ class InboxUpload {
46
49
  // inbox_registration_id - int64 - InboxRegistration ID
47
50
  // inbox_id - int64 - Inbox ID
48
51
  static list = async (params = {}, options = {}) => {
49
- if (params['cursor'] && !isString(params['cursor'])) {
50
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
52
+ if (params.cursor && !isString(params.cursor)) {
53
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
51
54
  }
52
55
 
53
- if (params['per_page'] && !isInt(params['per_page'])) {
54
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
56
+ if (params.per_page && !isInt(params.per_page)) {
57
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
55
58
  }
56
59
 
57
- if (params['inbox_registration_id'] && !isInt(params['inbox_registration_id'])) {
58
- throw new errors.InvalidParameterError(`Bad parameter: inbox_registration_id must be of type Int, received ${getType(params['inbox_registration_id'])}`)
60
+ if (params.inbox_registration_id && !isInt(params.inbox_registration_id)) {
61
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_registration_id must be of type Int, received ${getType(params.inbox_registration_id)}`)
59
62
  }
60
63
 
61
- if (params['inbox_id'] && !isInt(params['inbox_id'])) {
62
- throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
64
+ if (params.inbox_id && !isInt(params.inbox_id)) {
65
+ throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
63
66
  }
64
67
 
65
- const response = await Api.sendRequest(`/inbox_uploads`, 'GET', params, options)
68
+ const response = await Api.sendRequest('/inbox_uploads', 'GET', params, options)
66
69
 
67
-
68
70
  return response?.data?.map(obj => new InboxUpload(obj, options)) || []
69
71
  }
70
72
 
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class Invoice {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Invoice {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # Line item Id
28
32
  getId = () => this.attributes.id
29
33
 
@@ -66,22 +70,21 @@ class Invoice {
66
70
  // date-time # Line item updated at
67
71
  getUpdatedAt = () => this.attributes.updated_at
68
72
 
69
-
70
73
  // Parameters:
71
74
  // 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.
72
75
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
73
76
  static list = async (params = {}, options = {}) => {
74
- if (params['cursor'] && !isString(params['cursor'])) {
75
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
77
+ if (params.cursor && !isString(params.cursor)) {
78
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
76
79
  }
77
80
 
78
- if (params['per_page'] && !isInt(params['per_page'])) {
79
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
81
+ if (params.per_page && !isInt(params.per_page)) {
82
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
80
83
  }
81
84
 
82
- const response = await Api.sendRequest(`/invoices`, 'GET', params, options)
85
+ const response = await Api.sendRequest('/invoices', 'GET', params, options)
83
86
 
84
- const AccountLineItem = require("./AccountLineItem.js").default
87
+ const AccountLineItem = require('./AccountLineItem.js').default
85
88
  return response?.data?.map(obj => new AccountLineItem(obj, options)) || []
86
89
  }
87
90
 
@@ -95,19 +98,19 @@ class Invoice {
95
98
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
96
99
  }
97
100
 
98
- params['id'] = id
101
+ params.id = id
99
102
 
100
- if (!params['id']) {
103
+ if (!params.id) {
101
104
  throw new errors.MissingParameterError('Parameter missing: id')
102
105
  }
103
106
 
104
- if (params['id'] && !isInt(params['id'])) {
105
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
107
+ if (params.id && !isInt(params.id)) {
108
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
106
109
  }
107
110
 
108
- const response = await Api.sendRequest(`/invoices/${encodeURIComponent(params['id'])}`, 'GET', params, options)
111
+ const response = await Api.sendRequest(`/invoices/${encodeURIComponent(params.id)}`, 'GET', params, options)
109
112
 
110
- const AccountLineItem = require("./AccountLineItem.js").default
113
+ const AccountLineItem = require('./AccountLineItem.js').default
111
114
  return new AccountLineItem(response?.data, options)
112
115
  }
113
116
 
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class InvoiceLineItem {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class InvoiceLineItem {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // double # Invoice line item amount
28
32
  getAmount = () => this.attributes.amount
29
33
 
@@ -50,7 +54,6 @@ class InvoiceLineItem {
50
54
 
51
55
  // string # Site name
52
56
  getSite = () => this.attributes.site
53
-
54
57
  }
55
58
 
56
59
  export default InvoiceLineItem
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class IpAddress {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class IpAddress {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // string # Unique label for list; used by Zapier and other integrations.
28
32
  getId = () => this.attributes.id
29
33
 
@@ -36,22 +40,20 @@ class IpAddress {
36
40
  // array # A list of IP addresses.
37
41
  getIpAddresses = () => this.attributes.ip_addresses
38
42
 
39
-
40
43
  // Parameters:
41
44
  // 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.
42
45
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
43
46
  static list = async (params = {}, options = {}) => {
44
- if (params['cursor'] && !isString(params['cursor'])) {
45
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
47
+ if (params.cursor && !isString(params.cursor)) {
48
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
46
49
  }
47
50
 
48
- if (params['per_page'] && !isInt(params['per_page'])) {
49
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
51
+ if (params.per_page && !isInt(params.per_page)) {
52
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
50
53
  }
51
54
 
52
- const response = await Api.sendRequest(`/ip_addresses`, 'GET', params, options)
55
+ const response = await Api.sendRequest('/ip_addresses', 'GET', params, options)
53
56
 
54
-
55
57
  return response?.data?.map(obj => new IpAddress(obj, options)) || []
56
58
  }
57
59
 
@@ -62,17 +64,17 @@ class IpAddress {
62
64
  // 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.
63
65
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
64
66
  static getExavaultReserved = async (params = {}, options = {}) => {
65
- if (params['cursor'] && !isString(params['cursor'])) {
66
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
67
+ if (params.cursor && !isString(params.cursor)) {
68
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
67
69
  }
68
70
 
69
- if (params['per_page'] && !isInt(params['per_page'])) {
70
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
71
+ if (params.per_page && !isInt(params.per_page)) {
72
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
71
73
  }
72
74
 
73
- const response = await Api.sendRequest(`/ip_addresses/exavault-reserved`, 'GET', params, options)
75
+ const response = await Api.sendRequest('/ip_addresses/exavault-reserved', 'GET', params, options)
74
76
 
75
- const PublicIpAddress = require("./PublicIpAddress.js").default
77
+ const PublicIpAddress = require('./PublicIpAddress.js').default
76
78
  return response?.data?.map(obj => new PublicIpAddress(obj, options)) || []
77
79
  }
78
80
 
@@ -80,17 +82,17 @@ class IpAddress {
80
82
  // 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.
81
83
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
82
84
  static getReserved = async (params = {}, options = {}) => {
83
- if (params['cursor'] && !isString(params['cursor'])) {
84
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
85
+ if (params.cursor && !isString(params.cursor)) {
86
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
85
87
  }
86
88
 
87
- if (params['per_page'] && !isInt(params['per_page'])) {
88
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
89
+ if (params.per_page && !isInt(params.per_page)) {
90
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
89
91
  }
90
92
 
91
- const response = await Api.sendRequest(`/ip_addresses/reserved`, 'GET', params, options)
93
+ const response = await Api.sendRequest('/ip_addresses/reserved', 'GET', params, options)
92
94
 
93
- const PublicIpAddress = require("./PublicIpAddress.js").default
95
+ const PublicIpAddress = require('./PublicIpAddress.js').default
94
96
  return response?.data?.map(obj => new PublicIpAddress(obj, options)) || []
95
97
  }
96
98
  }
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import Api from '../Api'
3
3
  import * as errors from '../Errors'
4
- import { getType, isArray, isInt, isObject, isString } from '../utils'
4
+ import {
5
+ getType, isArray, isInt, isObject, isString,
6
+ } from '../utils'
5
7
  /* eslint-enable no-unused-vars */
6
8
 
7
9
  /**
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
9
11
  */
10
12
  class Lock {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Lock {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.path
30
+
27
31
  // string # Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
28
32
  getPath = () => this.attributes.path
29
33
 
@@ -108,7 +112,6 @@ class Lock {
108
112
  this.attributes.username = value
109
113
  }
110
114
 
111
-
112
115
  // Parameters:
113
116
  // token (required) - string - Lock token
114
117
  delete = async (params = {}) => {
@@ -121,41 +124,40 @@ class Lock {
121
124
  }
122
125
 
123
126
  params.path = this.attributes.path
124
- if (params['path'] && !isString(params['path'])) {
125
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
127
+ if (params.path && !isString(params.path)) {
128
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
126
129
  }
127
- if (params['token'] && !isString(params['token'])) {
128
- throw new errors.InvalidParameterError(`Bad parameter: token must be of type String, received ${getType(params['token'])}`)
130
+
131
+ if (params.token && !isString(params.token)) {
132
+ throw new errors.InvalidParameterError(`Bad parameter: token must be of type String, received ${getType(params.token)}`)
129
133
  }
130
134
 
131
- if (!params['path']) {
135
+ if (!params.path) {
132
136
  if (this.attributes.path) {
133
- params['path'] = this.path
137
+ params.path = this.path
134
138
  } else {
135
139
  throw new errors.MissingParameterError('Parameter missing: path')
136
140
  }
137
141
  }
138
142
 
139
- if (!params['token']) {
143
+ if (!params.token) {
140
144
  if (this.attributes.token) {
141
- params['token'] = this.token
145
+ params.token = this.token
142
146
  } else {
143
147
  throw new errors.MissingParameterError('Parameter missing: token')
144
148
  }
145
149
  }
146
150
 
147
- const response = await Api.sendRequest(`/locks/${encodeURIComponent(params['path'])}`, 'DELETE', params, this.options)
148
-
149
- return
151
+ await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'DELETE', params, this.options)
150
152
  }
151
153
 
152
154
  destroy = (params = {}) =>
153
155
  this.delete(params)
154
156
 
155
157
  save = async () => {
156
- const newObject = await Lock.create(this.attributes.path, this.attributes, this.options)
157
- this.attributes = { ...newObject.attributes }
158
- return true
158
+ const newObject = await Lock.create(this.attributes.path, this.attributes, this.options)
159
+ this.attributes = { ...newObject.attributes }
160
+ return true
159
161
  }
160
162
 
161
163
  // Parameters:
@@ -168,27 +170,26 @@ class Lock {
168
170
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
169
171
  }
170
172
 
171
- params['path'] = path
173
+ params.path = path
172
174
 
173
- if (!params['path']) {
175
+ if (!params.path) {
174
176
  throw new errors.MissingParameterError('Parameter missing: path')
175
177
  }
176
178
 
177
- if (params['cursor'] && !isString(params['cursor'])) {
178
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
179
+ if (params.cursor && !isString(params.cursor)) {
180
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
179
181
  }
180
182
 
181
- if (params['per_page'] && !isInt(params['per_page'])) {
182
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
183
+ if (params.per_page && !isInt(params.per_page)) {
184
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
183
185
  }
184
186
 
185
- if (params['path'] && !isString(params['path'])) {
186
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
187
+ if (params.path && !isString(params.path)) {
188
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
187
189
  }
188
190
 
189
- const response = await Api.sendRequest(`/locks/${encodeURIComponent(params['path'])}`, 'GET', params, options)
191
+ const response = await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'GET', params, options)
190
192
 
191
-
192
193
  return response?.data?.map(obj => new Lock(obj, options)) || []
193
194
  }
194
195
 
@@ -203,27 +204,26 @@ class Lock {
203
204
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
204
205
  }
205
206
 
206
- params['path'] = path
207
+ params.path = path
207
208
 
208
- if (!params['path']) {
209
+ if (!params.path) {
209
210
  throw new errors.MissingParameterError('Parameter missing: path')
210
211
  }
211
212
 
212
- if (params['path'] && !isString(params['path'])) {
213
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
213
+ if (params.path && !isString(params.path)) {
214
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
214
215
  }
215
216
 
216
- if (params['recursive'] && !isString(params['recursive'])) {
217
- throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params['recursive'])}`)
217
+ if (params.recursive && !isString(params.recursive)) {
218
+ throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params.recursive)}`)
218
219
  }
219
220
 
220
- if (params['timeout'] && !isInt(params['timeout'])) {
221
- throw new errors.InvalidParameterError(`Bad parameter: timeout must be of type Int, received ${getType(params['timeout'])}`)
221
+ if (params.timeout && !isInt(params.timeout)) {
222
+ throw new errors.InvalidParameterError(`Bad parameter: timeout must be of type Int, received ${getType(params.timeout)}`)
222
223
  }
223
224
 
224
- const response = await Api.sendRequest(`/locks/${encodeURIComponent(params['path'])}`, 'POST', params, options)
225
+ const response = await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'POST', params, options)
225
226
 
226
-
227
227
  return new Lock(response?.data, options)
228
228
  }
229
229
  }