Class: Buildium::FilesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/buildium-ruby/api/files_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FilesApi

Returns a new instance of FilesApi.



19
20
21
# File 'lib/buildium-ruby/api/files_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/buildium-ruby/api/files_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_file_category(file_category_post_message, opts = {}) ⇒ FileCategoryMessage

Create a category Creates a file category. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View` `Edit`

Parameters:

Returns:



27
28
29
30
# File 'lib/buildium-ruby/api/files_api.rb', line 27

def create_file_category(file_category_post_message, opts = {})
  data, _status_code, _headers = create_file_category_with_http_info(file_category_post_message, opts)
  data
end

#create_file_category_with_http_info(file_category_post_message, opts = {}) ⇒ Array<(FileCategoryMessage, Integer, Hash)>

Create a category Creates a file category. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60; &#x60;Edit&#x60;

Parameters:

Returns:

  • (Array<(FileCategoryMessage, Integer, Hash)>)

    FileCategoryMessage data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/buildium-ruby/api/files_api.rb', line 37

def create_file_category_with_http_info(file_category_post_message, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.create_file_category ...'
  end
  # verify the required parameter 'file_category_post_message' is set
  if @api_client.config.client_side_validation && file_category_post_message.nil?
    fail ArgumentError, "Missing the required parameter 'file_category_post_message' when calling FilesApi.create_file_category"
  end
  # resource path
  local_var_path = '/v1/files/categories'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(file_category_post_message)

  # return_type
  return_type = opts[:debug_return_type] || 'FileCategoryMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.create_file_category",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#create_file_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_upload_file_request_async(file_upload_post_message, opts = {}) ⇒ FileUploadTicketMessage

Upload a file Uploading a file requires making two API requests. Each step is outlined below. <br /><br /><strong>Step 1 - Save file metadata</strong><br /> The first step in the file upload process is to submit the file metadata to ‘/v1/files/uploadrequests`. The response of this call will contain a URL and a collection of form data that will be used in step 2 to generate the request for the file binary upload. <br /><br /><strong>NOTE:</strong> The response data will expire after 5 minutes. The file metadata will not be saved in the Buildium system if step 2 of this process is not completed successfully. <br /><br /><strong>Step 2 - Upload the file binary</strong><br /> Uploading the file binary will require using the response from step 1 to form a POST request to the Buildium file provider. Follow these steps to create the request: <br /> 1. Form a POST request using the value of the `BucketUrl` property as the URL. <br /><br /> 2. Set the `Content-Type` header to `multipart/form-data`. <br /><br /> 3. Copy the fields from the `FormData` property to this request as form-data key/value pairs. <br /><strong>NOTE:</strong> These values must added to the request form-data in the order they were received in the response. <br /><br /> 4. Lastly create a form-data key named `file` and set the value to the file binary. <br /><strong>NOTE:</strong> This must be the last field in the form-data list. <br /><br />This image shows what the POST request should look like if you’re using Postman: <img src="file-upload-example.png" /><br /><br /> 5. Send the POST request! A successful request will return with a ‘204 - NO CONTENT` HTTP response code. For any failure responses, please refer to <a target="_blank" href="docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses">AWS documentation</a> on REST error responses. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - `View` `Edit`

Parameters:

  • file_upload_post_message (FileUploadPostMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# File 'lib/buildium-ruby/api/files_api.rb', line 95

def create_upload_file_request_async(file_upload_post_message, opts = {})
  data, _status_code, _headers = create_upload_file_request_async_with_http_info(file_upload_post_message, opts)
  data
end

#create_upload_file_request_async_with_http_info(file_upload_post_message, opts = {}) ⇒ Array<(FileUploadTicketMessage, Integer, Hash)>

Upload a file Uploading a file requires making two API requests. Each step is outlined below. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1 - Save file metadata&lt;/strong&gt;&lt;br /&gt; The first step in the file upload process is to submit the file metadata to &#x60;/v1/files/uploadrequests&#x60;. The response of this call will contain a URL and a collection of form data that will be used in step 2 to generate the request for the file binary upload. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The response data will expire after 5 minutes. The file metadata will not be saved in the Buildium system if step 2 of this process is not completed successfully. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2 - Upload the file binary&lt;/strong&gt;&lt;br /&gt; Uploading the file binary will require using the response from step 1 to form a POST request to the Buildium file provider. Follow these steps to create the request: &lt;br /&gt; 1. Form a POST request using the value of the &#x60;BucketUrl&#x60; property as the URL. &lt;br /&gt;&lt;br /&gt; 2. Set the &#x60;Content-Type&#x60; header to &#x60;multipart/form-data&#x60;. &lt;br /&gt;&lt;br /&gt; 3. Copy the fields from the &#x60;FormData&#x60; property to this request as form-data key/value pairs. &lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; These values must added to the request form-data in the order they were received in the response. &lt;br /&gt;&lt;br /&gt; 4. Lastly create a form-data key named &#x60;file&#x60; and set the value to the file binary. &lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; This must be the last field in the form-data list. &lt;br /&gt;&lt;br /&gt;This image shows what the POST request should look like if you&#39;re using Postman: &lt;img src&#x3D;&quot;file-upload-example.png&quot; /&gt;&lt;br /&gt;&lt;br /&gt; 5. Send the POST request! A successful request will return with a &#x60;204 - NO CONTENT&#x60; HTTP response code. For any failure responses, please refer to &lt;a target&#x3D;&quot;_blank&quot; href&#x3D;&quot;docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses&quot;&gt;AWS documentation&lt;/a&gt; on REST error responses. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60; &#x60;Edit&#x60;

Parameters:

  • file_upload_post_message (FileUploadPostMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileUploadTicketMessage, Integer, Hash)>)

    FileUploadTicketMessage data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/buildium-ruby/api/files_api.rb', line 105

def create_upload_file_request_async_with_http_info(file_upload_post_message, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.create_upload_file_request_async ...'
  end
  # verify the required parameter 'file_upload_post_message' is set
  if @api_client.config.client_side_validation && file_upload_post_message.nil?
    fail ArgumentError, "Missing the required parameter 'file_upload_post_message' when calling FilesApi.create_upload_file_request_async"
  end
  # resource path
  local_var_path = '/v1/files/uploadrequests'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(file_upload_post_message)

  # return_type
  return_type = opts[:debug_return_type] || 'FileUploadTicketMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.create_upload_file_request_async",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#create_upload_file_request_async\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_file_by_id(file_id, opts = {}) ⇒ FileMessage

Retrieve a file GetFileDownloadUrlAsync">Download File endpoint.</a><br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View`

Parameters:

  • file_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



163
164
165
166
# File 'lib/buildium-ruby/api/files_api.rb', line 163

def get_file_by_id(file_id, opts = {})
  data, _status_code, _headers = get_file_by_id_with_http_info(file_id, opts)
  data
end

#get_file_by_id_with_http_info(file_id, opts = {}) ⇒ Array<(FileMessage, Integer, Hash)>

Retrieve a file GetFileDownloadUrlAsync&quot;&gt;Download File endpoint.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60;

Parameters:

  • file_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileMessage, Integer, Hash)>)

    FileMessage data, response status code and response headers



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/buildium-ruby/api/files_api.rb', line 173

def get_file_by_id_with_http_info(file_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.get_file_by_id ...'
  end
  # verify the required parameter 'file_id' is set
  if @api_client.config.client_side_validation && file_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_file_by_id"
  end
  # resource path
  local_var_path = '/v1/files/{fileId}'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FileMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.get_file_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#get_file_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_file_categories(opts = {}) ⇒ Array<FileCategoryMessage>

Retrieve all categories Retrieves a list of file categories. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :orderby (String)

    &#x60;orderby&#x60; indicates the field(s) and direction to sort the results in the response. See &lt;a href&#x3D;&quot;#section/API-Overview/Bulk-Request-Options&quot;&gt;Bulk Request Options&lt;/a&gt; for more information.

  • :offset (Integer)

    &#x60;offset&#x60; indicates the position of the first record to return. The &#x60;offset&#x60; is zero-based and the default is 0.

  • :limit (Integer)

    &#x60;limit&#x60; indicates the maximum number of results to be returned in the response. &#x60;limit&#x60; can range between 1 and 1000 and the default is 50.

Returns:



228
229
230
231
# File 'lib/buildium-ruby/api/files_api.rb', line 228

def get_file_categories(opts = {})
  data, _status_code, _headers = get_file_categories_with_http_info(opts)
  data
end

#get_file_categories_with_http_info(opts = {}) ⇒ Array<(Array<FileCategoryMessage>, Integer, Hash)>

Retrieve all categories Retrieves a list of file categories. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :orderby (String)

    &#x60;orderby&#x60; indicates the field(s) and direction to sort the results in the response. See &lt;a href&#x3D;&quot;#section/API-Overview/Bulk-Request-Options&quot;&gt;Bulk Request Options&lt;/a&gt; for more information.

  • :offset (Integer)

    &#x60;offset&#x60; indicates the position of the first record to return. The &#x60;offset&#x60; is zero-based and the default is 0.

  • :limit (Integer)

    &#x60;limit&#x60; indicates the maximum number of results to be returned in the response. &#x60;limit&#x60; can range between 1 and 1000 and the default is 50.

Returns:

  • (Array<(Array<FileCategoryMessage>, Integer, Hash)>)

    Array<FileCategoryMessage> data, response status code and response headers



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/buildium-ruby/api/files_api.rb', line 240

def get_file_categories_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.get_file_categories ...'
  end
  # resource path
  local_var_path = '/v1/files/categories'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<FileCategoryMessage>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.get_file_categories",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#get_file_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_file_category_by_id(file_category_id, opts = {}) ⇒ FileCategoryMessage

Retrieve a category Retrieves a specific file category. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View`

Parameters:

  • file_category_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



292
293
294
295
# File 'lib/buildium-ruby/api/files_api.rb', line 292

def get_file_category_by_id(file_category_id, opts = {})
  data, _status_code, _headers = get_file_category_by_id_with_http_info(file_category_id, opts)
  data
end

#get_file_category_by_id_with_http_info(file_category_id, opts = {}) ⇒ Array<(FileCategoryMessage, Integer, Hash)>

Retrieve a category Retrieves a specific file category. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60;

Parameters:

  • file_category_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileCategoryMessage, Integer, Hash)>)

    FileCategoryMessage data, response status code and response headers



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/buildium-ruby/api/files_api.rb', line 302

def get_file_category_by_id_with_http_info(file_category_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.get_file_category_by_id ...'
  end
  # verify the required parameter 'file_category_id' is set
  if @api_client.config.client_side_validation && file_category_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_category_id' when calling FilesApi.get_file_category_by_id"
  end
  # resource path
  local_var_path = '/v1/files/categories/{fileCategoryId}'.sub('{' + 'fileCategoryId' + '}', CGI.escape(file_category_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FileCategoryMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.get_file_category_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#get_file_category_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_file_download_url_async(file_id, opts = {}) ⇒ FileDownloadMessage

Download a file Downloading a file requires making two API requests. The first request to ‘/v1/files/fileId/downloadrequest` will return a secure URL that can be used to download the file contents. Note the download URL is transient and will expire after 5 minutes. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - `View`

Parameters:

  • file_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



355
356
357
358
# File 'lib/buildium-ruby/api/files_api.rb', line 355

def get_file_download_url_async(file_id, opts = {})
  data, _status_code, _headers = get_file_download_url_async_with_http_info(file_id, opts)
  data
end

#get_file_download_url_async_with_http_info(file_id, opts = {}) ⇒ Array<(FileDownloadMessage, Integer, Hash)>

Download a file Downloading a file requires making two API requests. The first request to &#x60;/v1/files/fileId/downloadrequest&#x60; will return a secure URL that can be used to download the file contents. Note the download URL is transient and will expire after 5 minutes. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60;

Parameters:

  • file_id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileDownloadMessage, Integer, Hash)>)

    FileDownloadMessage data, response status code and response headers



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/buildium-ruby/api/files_api.rb', line 365

def get_file_download_url_async_with_http_info(file_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.get_file_download_url_async ...'
  end
  # verify the required parameter 'file_id' is set
  if @api_client.config.client_side_validation && file_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_file_download_url_async"
  end
  # resource path
  local_var_path = '/v1/files/{fileId}/downloadrequest'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FileDownloadMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.get_file_download_url_async",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#get_file_download_url_async\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_files(opts = {}) ⇒ Array<FileMessage>

Retrieve all files GetFileDownloadUrlAsync">Download File</a> endpoint. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :entityid (Integer)

    Filters results to any file associated with the specified entity identifier. This filter is used in conjunction with the &#x60;EntityType&#x60; field which must be set to the type of entity this identifier references.

  • :entitytype (String)

    Specifies the type of entity that &#x60;EntityId&#x60; refers to. This field is required if &#x60;EntityId&#x60; is specified.

  • :categoryid (Integer)

    Filters results to any file associated with the specified category identifier.

  • :titleordescription (String)

    Filters results to files whose title or description contains the specified value.

  • :uploadedfrom (Date)

    Filters results to any files that were updated on or after the specified date. The value must be formatted as YYYY-MM-DD.

  • :uploadedto (Date)

    Filters results to any files that were updated on or before the specified date. The value must be formatted as YYYY-MM-DD.

  • :physicalfilenames (Array<String>)

    Filters results to any files with a &#x60;PhysicalFileName&#x60;exactly matching one of the provided values.

  • :orderby (String)

    &#x60;orderby&#x60; indicates the field(s) and direction to sort the results in the response. See &lt;a href&#x3D;&quot;#section/API-Overview/Bulk-Request-Options&quot;&gt;Bulk Request Options&lt;/a&gt; for more information.

  • :offset (Integer)

    &#x60;offset&#x60; indicates the position of the first record to return. The &#x60;offset&#x60; is zero-based and the default is 0.

  • :limit (Integer)

    &#x60;limit&#x60; indicates the maximum number of results to be returned in the response. &#x60;limit&#x60; can range between 1 and 1000 and the default is 50.

Returns:



427
428
429
430
# File 'lib/buildium-ruby/api/files_api.rb', line 427

def get_files(opts = {})
  data, _status_code, _headers = get_files_with_http_info(opts)
  data
end

#get_files_with_http_info(opts = {}) ⇒ Array<(Array<FileMessage>, Integer, Hash)>

Retrieve all files GetFileDownloadUrlAsync&quot;&gt;Download File&lt;/a&gt; endpoint. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :entityid (Integer)

    Filters results to any file associated with the specified entity identifier. This filter is used in conjunction with the &#x60;EntityType&#x60; field which must be set to the type of entity this identifier references.

  • :entitytype (String)

    Specifies the type of entity that &#x60;EntityId&#x60; refers to. This field is required if &#x60;EntityId&#x60; is specified.

  • :categoryid (Integer)

    Filters results to any file associated with the specified category identifier.

  • :titleordescription (String)

    Filters results to files whose title or description contains the specified value.

  • :uploadedfrom (Date)

    Filters results to any files that were updated on or after the specified date. The value must be formatted as YYYY-MM-DD.

  • :uploadedto (Date)

    Filters results to any files that were updated on or before the specified date. The value must be formatted as YYYY-MM-DD.

  • :physicalfilenames (Array<String>)

    Filters results to any files with a &#x60;PhysicalFileName&#x60;exactly matching one of the provided values.

  • :orderby (String)

    &#x60;orderby&#x60; indicates the field(s) and direction to sort the results in the response. See &lt;a href&#x3D;&quot;#section/API-Overview/Bulk-Request-Options&quot;&gt;Bulk Request Options&lt;/a&gt; for more information.

  • :offset (Integer)

    &#x60;offset&#x60; indicates the position of the first record to return. The &#x60;offset&#x60; is zero-based and the default is 0.

  • :limit (Integer)

    &#x60;limit&#x60; indicates the maximum number of results to be returned in the response. &#x60;limit&#x60; can range between 1 and 1000 and the default is 50.

Returns:

  • (Array<(Array<FileMessage>, Integer, Hash)>)

    Array<FileMessage> data, response status code and response headers



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/buildium-ruby/api/files_api.rb', line 446

def get_files_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.get_files ...'
  end
  allowable_values = ["Account", "Association", "AssociationOwner", "AssociationUnit", "Lease", "OwnershipAccount", "PublicAsset", "Rental", "RentalOwner", "RentalUnit", "Tenant", "Vendor"]
  if @api_client.config.client_side_validation && opts[:'entitytype'] && !allowable_values.include?(opts[:'entitytype'])
    fail ArgumentError, "invalid value for \"entitytype\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/files'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'entityid'] = opts[:'entityid'] if !opts[:'entityid'].nil?
  query_params[:'entitytype'] = opts[:'entitytype'] if !opts[:'entitytype'].nil?
  query_params[:'categoryid'] = opts[:'categoryid'] if !opts[:'categoryid'].nil?
  query_params[:'titleordescription'] = opts[:'titleordescription'] if !opts[:'titleordescription'].nil?
  query_params[:'uploadedfrom'] = opts[:'uploadedfrom'] if !opts[:'uploadedfrom'].nil?
  query_params[:'uploadedto'] = opts[:'uploadedto'] if !opts[:'uploadedto'].nil?
  query_params[:'physicalfilenames'] = @api_client.build_collection_param(opts[:'physicalfilenames'], :multi) if !opts[:'physicalfilenames'].nil?
  query_params[:'orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<FileMessage>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.get_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#get_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_file(file_id, file_put_message, opts = {}) ⇒ FileMessage

Update a file Updates a metadata of the file. <br /><br /><strong>NOTE:</strong> Any field not included in the update request will be set to either an empty string or ‘null` in the database depending on the field definition. <br />The recommended workflow to ensure no data is inadvertently overwritten is to execute a `GET` request for the resource you’re about to update and then use this response to fill any of the fields that are not being updated. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View` `Edit`

Parameters:

  • file_id (Integer)
  • file_put_message (FilePutMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



510
511
512
513
# File 'lib/buildium-ruby/api/files_api.rb', line 510

def update_file(file_id, file_put_message, opts = {})
  data, _status_code, _headers = update_file_with_http_info(file_id, file_put_message, opts)
  data
end

#update_file_category(file_category_id, file_category_put_message, opts = {}) ⇒ FileCategoryMessage

Update a category Updates a file category. Note that file categories where ‘IsEditable` is `false` can not be updated. <br /><br /><strong>NOTE:</strong> Any field not included in the update request will be set to either an empty string or `null` in the database depending on the field definition. <br />The recommended workflow to ensure no data is inadvertently overwritten is to execute a `GET` request for the resource you’re about to update and then use this response to fill any of the fields that are not being updated. <br /><br /><h4>Required permission(s):</h4><span class="permissionBlock">Documents &gt; Files</span> - ‘View` `Edit`

Parameters:

  • file_category_id (Integer)
  • file_category_put_message (FileCategoryPutMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



584
585
586
587
# File 'lib/buildium-ruby/api/files_api.rb', line 584

def update_file_category(file_category_id, file_category_put_message, opts = {})
  data, _status_code, _headers = update_file_category_with_http_info(file_category_id, file_category_put_message, opts)
  data
end

#update_file_category_with_http_info(file_category_id, file_category_put_message, opts = {}) ⇒ Array<(FileCategoryMessage, Integer, Hash)>

Update a category Updates a file category. Note that file categories where &#x60;IsEditable&#x60; is &#x60;false&#x60; can not be updated. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Any field not included in the update request will be set to either an empty string or &#x60;null&#x60; in the database depending on the field definition. &lt;br /&gt;The recommended workflow to ensure no data is inadvertently overwritten is to execute a &#x60;GET&#x60; request for the resource you&#39;re about to update and then use this response to fill any of the fields that are not being updated. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60; &#x60;Edit&#x60;

Parameters:

  • file_category_id (Integer)
  • file_category_put_message (FileCategoryPutMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileCategoryMessage, Integer, Hash)>)

    FileCategoryMessage data, response status code and response headers



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/buildium-ruby/api/files_api.rb', line 595

def update_file_category_with_http_info(file_category_id, file_category_put_message, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.update_file_category ...'
  end
  # verify the required parameter 'file_category_id' is set
  if @api_client.config.client_side_validation && file_category_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_category_id' when calling FilesApi.update_file_category"
  end
  # verify the required parameter 'file_category_put_message' is set
  if @api_client.config.client_side_validation && file_category_put_message.nil?
    fail ArgumentError, "Missing the required parameter 'file_category_put_message' when calling FilesApi.update_file_category"
  end
  # resource path
  local_var_path = '/v1/files/categories/{fileCategoryId}'.sub('{' + 'fileCategoryId' + '}', CGI.escape(file_category_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(file_category_put_message)

  # return_type
  return_type = opts[:debug_return_type] || 'FileCategoryMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.update_file_category",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#update_file_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_file_with_http_info(file_id, file_put_message, opts = {}) ⇒ Array<(FileMessage, Integer, Hash)>

Update a file Updates a metadata of the file. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Any field not included in the update request will be set to either an empty string or &#x60;null&#x60; in the database depending on the field definition. &lt;br /&gt;The recommended workflow to ensure no data is inadvertently overwritten is to execute a &#x60;GET&#x60; request for the resource you&#39;re about to update and then use this response to fill any of the fields that are not being updated. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Required permission(s):&lt;/h4&gt;&lt;span class&#x3D;&quot;permissionBlock&quot;&gt;Documents &amp;gt; Files&lt;/span&gt; - &#x60;View&#x60; &#x60;Edit&#x60;

Parameters:

  • file_id (Integer)
  • file_put_message (FilePutMessage)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileMessage, Integer, Hash)>)

    FileMessage data, response status code and response headers



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/buildium-ruby/api/files_api.rb', line 521

def update_file_with_http_info(file_id, file_put_message, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.update_file ...'
  end
  # verify the required parameter 'file_id' is set
  if @api_client.config.client_side_validation && file_id.nil?
    fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.update_file"
  end
  # verify the required parameter 'file_put_message' is set
  if @api_client.config.client_side_validation && file_put_message.nil?
    fail ArgumentError, "Missing the required parameter 'file_put_message' when calling FilesApi.update_file"
  end
  # resource path
  local_var_path = '/v1/files/{fileId}'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(file_put_message)

  # return_type
  return_type = opts[:debug_return_type] || 'FileMessage'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['clientId', 'clientSecret']

  new_options = opts.merge(
    :operation => :"FilesApi.update_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FilesApi#update_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end