Class: XbimAim::ModelFilesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/xbim_aim/api/model_files_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ModelFilesApi

Returns a new instance of ModelFilesApi.



19
20
21
# File 'lib/xbim_aim/api/model_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/xbim_aim/api/model_files_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#model_files_get_file(asset_id, model_id, tenant_id, region, opts = {}) ⇒ File

Downloads the model as originally uploaded <span style=‘font-size: 17px;’>Summary:</span>Downloads the model as originally uploaded.<br/>Return Type: string<br/><br/>

Parameters:

  • asset_id (Integer)

    Asset ID

  • model_id (Integer)

    Model ID

  • tenant_id (String)

    The unique Tenant ID (UUID or Identifier string)

  • region (String)

    The data center region the data resides in

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

    the optional parameters

Returns:

  • (File)


30
31
32
33
# File 'lib/xbim_aim/api/model_files_api.rb', line 30

def model_files_get_file(asset_id, model_id, tenant_id, region, opts = {})
  data, _status_code, _headers = model_files_get_file_with_http_info(asset_id, model_id, tenant_id, region, opts)
  data
end

#model_files_get_file_with_http_info(asset_id, model_id, tenant_id, region, opts = {}) ⇒ Array<(File, Integer, Hash)>

Downloads the model as originally uploaded &lt;span style&#x3D;&#39;font-size: 17px;&#39;&gt;Summary:&lt;/span&gt;Downloads the model as originally uploaded.&lt;br/&gt;Return Type: &lt;b&gt;string&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;

Parameters:

  • asset_id (Integer)

    Asset ID

  • model_id (Integer)

    Model ID

  • tenant_id (String)

    The unique Tenant ID (UUID or Identifier string)

  • region (String)

    The data center region the data resides in

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/xbim_aim/api/model_files_api.rb', line 43

def model_files_get_file_with_http_info(asset_id, model_id, tenant_id, region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ModelFilesApi.model_files_get_file ...'
  end
  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling ModelFilesApi.model_files_get_file"
  end
  # verify the required parameter 'model_id' is set
  if @api_client.config.client_side_validation && model_id.nil?
    fail ArgumentError, "Missing the required parameter 'model_id' when calling ModelFilesApi.model_files_get_file"
  end
  # verify the required parameter 'tenant_id' is set
  if @api_client.config.client_side_validation && tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'tenant_id' when calling ModelFilesApi.model_files_get_file"
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling ModelFilesApi.model_files_get_file"
  end
  # verify enum value
  allowable_values = ["UK", "WestEurope", "Sandbox"]
  if @api_client.config.client_side_validation && !allowable_values.include?(region)
    fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/{region}/aim/2.0/{tenantId}/modelfiles/download/{assetId}/{modelId}'.sub('{' + 'assetId' + '}', CGI.escape(asset_id.to_s)).sub('{' + 'modelId' + '}', CGI.escape(model_id.to_s)).sub('{' + 'tenantId' + '}', CGI.escape(tenant_id.to_s)).sub('{' + 'region' + '}', CGI.escape(region.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/octet-stream'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"ModelFilesApi.model_files_get_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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ModelFilesApi#model_files_get_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#model_files_upload_single_file(tenant_id, region, file, asset_name, opts = {}) ⇒ FileUploadResult

A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing <span style=‘font-size: 17px;’>Summary:</span>A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing.<br/>Uploads a model File, creating a new Asset and Model as required. The model is associated with the named asset. The Asset will be created if it does not exist. <br /> On successful upload the model will be queued for processing..<br/>Return Type: FileUploadResult<br/><br/>

Parameters:

  • tenant_id (String)

    The unique Tenant ID (UUID or Identifier string)

  • region (String)

    The data center region the data resides in

  • file (File)

    A model file in the correct format (IFC / IFCZip / Zip)

  • asset_name (String)

    The name of the asset to associate the model upload with.

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

    the optional parameters

Options Hash (opts):

  • :segment_name (String)

    The name of the asset segment to associate the model with. The segment will be created if not present. Defaults to the Model Name if undefined

  • :revision (String)

    A version identifier for the model.

  • :status (String)

    A status identifier for the model

  • :asset_id (Integer)

    The ID of the asset to associate the model upload with. If not defined, a new asset will be created.

  • :model_id (Integer)

    The ID of the model to be populated with the data. If not defined, a new model will be created.

  • :original_filename (String)

    The original filename of the model, for zipped models

Returns:



122
123
124
125
# File 'lib/xbim_aim/api/model_files_api.rb', line 122

def model_files_upload_single_file(tenant_id, region, file, asset_name, opts = {})
  data, _status_code, _headers = model_files_upload_single_file_with_http_info(tenant_id, region, file, asset_name, opts)
  data
end

#model_files_upload_single_file_with_http_info(tenant_id, region, file, asset_name, opts = {}) ⇒ Array<(FileUploadResult, Integer, Hash)>

A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing &lt;span style&#x3D;&#39;font-size: 17px;&#39;&gt;Summary:&lt;/span&gt;A one-stop service for Uploading an IFC model file, creating an asset and Model as required, and initiating processing.&lt;br/&gt;Uploads a model File, creating a new Asset and Model as required. The model is associated with the named asset. The Asset will be created if it does not exist. &lt;br /&gt; On successful upload the model will be queued for processing..&lt;br/&gt;Return Type: &lt;b&gt;FileUploadResult&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;

Parameters:

  • tenant_id (String)

    The unique Tenant ID (UUID or Identifier string)

  • region (String)

    The data center region the data resides in

  • file (File)

    A model file in the correct format (IFC / IFCZip / Zip)

  • asset_name (String)

    The name of the asset to associate the model upload with.

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

    the optional parameters

Options Hash (opts):

  • :segment_name (String)

    The name of the asset segment to associate the model with. The segment will be created if not present. Defaults to the Model Name if undefined

  • :revision (String)

    A version identifier for the model.

  • :status (String)

    A status identifier for the model

  • :asset_id (Integer)

    The ID of the asset to associate the model upload with. If not defined, a new asset will be created.

  • :model_id (Integer)

    The ID of the model to be populated with the data. If not defined, a new model will be created.

  • :original_filename (String)

    The original filename of the model, for zipped models

Returns:

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

    FileUploadResult data, response status code and response headers



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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
# File 'lib/xbim_aim/api/model_files_api.rb', line 141

def model_files_upload_single_file_with_http_info(tenant_id, region, file, asset_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ModelFilesApi.model_files_upload_single_file ...'
  end
  # verify the required parameter 'tenant_id' is set
  if @api_client.config.client_side_validation && tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'tenant_id' when calling ModelFilesApi.model_files_upload_single_file"
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling ModelFilesApi.model_files_upload_single_file"
  end
  # verify enum value
  allowable_values = ["UK", "WestEurope", "Sandbox"]
  if @api_client.config.client_side_validation && !allowable_values.include?(region)
    fail ArgumentError, "invalid value for \"region\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling ModelFilesApi.model_files_upload_single_file"
  end
  # verify the required parameter 'asset_name' is set
  if @api_client.config.client_side_validation && asset_name.nil?
    fail ArgumentError, "Missing the required parameter 'asset_name' when calling ModelFilesApi.model_files_upload_single_file"
  end
  # resource path
  local_var_path = '/{region}/aim/2.0/{tenantId}/modelfiles/upload'.sub('{' + 'tenantId' + '}', CGI.escape(tenant_id.to_s)).sub('{' + 'region' + '}', CGI.escape(region.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', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['assetName'] = asset_name
  form_params['segmentName'] = opts[:'segment_name'] if !opts[:'segment_name'].nil?
  form_params['revision'] = opts[:'revision'] if !opts[:'revision'].nil?
  form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
  form_params['assetId'] = opts[:'asset_id'] if !opts[:'asset_id'].nil?
  form_params['modelId'] = opts[:'model_id'] if !opts[:'model_id'].nil?
  form_params['originalFilename'] = opts[:'original_filename'] if !opts[:'original_filename'].nil?

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"ModelFilesApi.model_files_upload_single_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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ModelFilesApi#model_files_upload_single_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end