Class: Hubspot::Cms::Hubdb::TablesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/cms/hubdb/api/tables_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TablesApi

Returns a new instance of TablesApi.



21
22
23
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 21

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



19
20
21
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 19

def api_client
  @api_client
end

Instance Method Details

#archive_table(table_id_or_name, opts = {}) ⇒ nil

Archive a table Archive (soft delete) an existing HubDB table. This archives both the published and draft versions.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to archive.

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

    the optional parameters

Returns:

  • (nil)


29
30
31
32
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 29

def archive_table(table_id_or_name, opts = {})
  archive_table_with_http_info(table_id_or_name, opts)
  nil
end

#archive_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Archive a table Archive (soft delete) an existing HubDB table. This archives both the published and draft versions.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to archive.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 39

def archive_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.archive_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.archive_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.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(['*/*'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#clone_draft_table(table_id_or_name, hub_db_table_clone_request, opts = {}) ⇒ HubDbTableV3

Clone a table Clone an existing HubDB table. The ‘newName` and `newLabel` of the new table can be sent as JSON in the `body` parameter. This will create the cloned table as a `draft`.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to clone.

  • hub_db_table_clone_request (HubDbTableCloneRequest)

    JSON object with the properties newName and newLabel. You can set copyRows to false to clone the table with copying rows and default is true.

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

    the optional parameters

Returns:



93
94
95
96
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 93

def clone_draft_table(table_id_or_name, hub_db_table_clone_request, opts = {})
  data, _status_code, _headers = clone_draft_table_with_http_info(table_id_or_name, hub_db_table_clone_request, opts)
  data
end

#clone_draft_table_with_http_info(table_id_or_name, hub_db_table_clone_request, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Clone a table Clone an existing HubDB table. The &#x60;newName&#x60; and &#x60;newLabel&#x60; of the new table can be sent as JSON in the &#x60;body&#x60; parameter. This will create the cloned table as a &#x60;draft&#x60;.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to clone.

  • hub_db_table_clone_request (HubDbTableCloneRequest)

    JSON object with the properties newName and newLabel. You can set copyRows to false to clone the table with copying rows and default is true.

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

    the optional parameters

Returns:

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

    HubDbTableV3 data, response status code and response headers



104
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
157
158
159
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 104

def clone_draft_table_with_http_info(table_id_or_name, hub_db_table_clone_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.clone_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.clone_draft_table"
  end
  # verify the required parameter 'hub_db_table_clone_request' is set
  if @api_client.config.client_side_validation && hub_db_table_clone_request.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_clone_request' when calling TablesApi.clone_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/clone'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.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(hub_db_table_clone_request)

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

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

  new_options = opts.merge(
    :operation => :"TablesApi.clone_draft_table",
    :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: TablesApi#clone_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_table(hub_db_table_v3_request, opts = {}) ⇒ HubDbTableV3

Create a new table Creates a new draft HubDB table given a JSON schema. The table name and label should be unique for each account.

Parameters:

  • hub_db_table_v3_request (HubDbTableV3Request)

    The JSON schema for the table being created.

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

    the optional parameters

Returns:



166
167
168
169
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 166

def create_table(hub_db_table_v3_request, opts = {})
  data, _status_code, _headers = create_table_with_http_info(hub_db_table_v3_request, opts)
  data
end

#create_table_with_http_info(hub_db_table_v3_request, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Create a new table Creates a new draft HubDB table given a JSON schema. The table name and label should be unique for each account.

Parameters:

  • hub_db_table_v3_request (HubDbTableV3Request)

    The JSON schema for the table being created.

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

    the optional parameters

Returns:

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

    HubDbTableV3 data, response status code and response headers



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
220
221
222
223
224
225
226
227
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 176

def create_table_with_http_info(hub_db_table_v3_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.create_table ...'
  end
  # verify the required parameter 'hub_db_table_v3_request' is set
  if @api_client.config.client_side_validation && hub_db_table_v3_request.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_v3_request' when calling TablesApi.create_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables'

  # 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(hub_db_table_v3_request)

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

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

  new_options = opts.merge(
    :operation => :"TablesApi.create_table",
    :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: TablesApi#create_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#export_draft_table(table_id_or_name, opts = {}) ⇒ File

Export a draft table Exports the ‘draft` version of a table to CSV / EXCEL format.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to export.

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

    the optional parameters

Options Hash (opts):

  • :format (String)

    The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;.

Returns:

  • (File)


235
236
237
238
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 235

def export_draft_table(table_id_or_name, opts = {})
  data, _status_code, _headers = export_draft_table_with_http_info(table_id_or_name, opts)
  data
end

#export_draft_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(File, Integer, Hash)>

Export a draft table Exports the &#x60;draft&#x60; version of a table to CSV / EXCEL format.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to export.

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

    the optional parameters

Options Hash (opts):

  • :format (String)

    The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;.

Returns:

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

    File data, response status code and response headers



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
286
287
288
289
290
291
292
293
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 246

def export_draft_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.export_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.export_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/export'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.ms-excel', 'text/csv', '*/*'])

  # 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 => :"TablesApi.export_draft_table",
    :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: TablesApi#export_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#export_table(table_id_or_name, opts = {}) ⇒ File

Export a published version of a table Exports the ‘published` version of a table to CSV / EXCEL format.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to export.

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

    the optional parameters

Options Hash (opts):

  • :format (String)

    The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;.

Returns:

  • (File)


301
302
303
304
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 301

def export_table(table_id_or_name, opts = {})
  data, _status_code, _headers = export_table_with_http_info(table_id_or_name, opts)
  data
end

#export_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(File, Integer, Hash)>

Export a published version of a table Exports the &#x60;published&#x60; version of a table to CSV / EXCEL format.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to export.

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

    the optional parameters

Options Hash (opts):

  • :format (String)

    The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;.

Returns:

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

    File data, response status code and response headers



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
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 312

def export_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.export_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.export_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/export'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.ms-excel', 'text/csv', '*/*'])

  # 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 => :"TablesApi.export_table",
    :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: TablesApi#export_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_draft_tables(opts = {}) ⇒ CollectionResponseWithTotalHubDbTableV3ForwardPaging

Return all draft tables Returns the details for each draft table defined in the specified account, including column definitions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 1000.

  • :created_at (Time)

    Only return tables created at exactly the specified time.

  • :created_after (Time)

    Only return tables created after the specified time.

  • :created_before (Time)

    Only return tables created before the specified time.

  • :updated_at (Time)

    Only return tables last updated at exactly the specified time.

  • :updated_after (Time)

    Only return tables last updated after the specified time.

  • :updated_before (Time)

    Only return tables last updated before the specified time.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:



375
376
377
378
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 375

def get_all_draft_tables(opts = {})
  data, _status_code, _headers = get_all_draft_tables_with_http_info(opts)
  data
end

#get_all_draft_tables_with_http_info(opts = {}) ⇒ Array<(CollectionResponseWithTotalHubDbTableV3ForwardPaging, Integer, Hash)>

Return all draft tables Returns the details for each draft table defined in the specified account, including column definitions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 1000.

  • :created_at (Time)

    Only return tables created at exactly the specified time.

  • :created_after (Time)

    Only return tables created after the specified time.

  • :created_before (Time)

    Only return tables created before the specified time.

  • :updated_at (Time)

    Only return tables last updated at exactly the specified time.

  • :updated_after (Time)

    Only return tables last updated after the specified time.

  • :updated_before (Time)

    Only return tables last updated before the specified time.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 394

def get_all_draft_tables_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.get_all_draft_tables ...'
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/draft'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil?
  query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
  query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
  query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?
  query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil?
  query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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] || 'CollectionResponseWithTotalHubDbTableV3ForwardPaging'

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

  new_options = opts.merge(
    :operation => :"TablesApi.get_all_draft_tables",
    :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: TablesApi#get_all_draft_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_tables(opts = {}) ⇒ CollectionResponseWithTotalHubDbTableV3ForwardPaging

Get all published tables Returns the details for the ‘published` version of each table defined in an account, including column definitions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 1000.

  • :created_at (Time)

    Only return tables created at exactly the specified time.

  • :created_after (Time)

    Only return tables created after the specified time.

  • :created_before (Time)

    Only return tables created before the specified time.

  • :updated_at (Time)

    Only return tables last updated at exactly the specified time.

  • :updated_after (Time)

    Only return tables last updated after the specified time.

  • :updated_before (Time)

    Only return tables last updated before the specified time.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:



462
463
464
465
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 462

def get_all_tables(opts = {})
  data, _status_code, _headers = get_all_tables_with_http_info(opts)
  data
end

#get_all_tables_with_http_info(opts = {}) ⇒ Array<(CollectionResponseWithTotalHubDbTableV3ForwardPaging, Integer, Hash)>

Get all published tables Returns the details for the &#x60;published&#x60; version of each table defined in an account, including column definitions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :sort (Array<String>)

    Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default.

  • :after (String)

    The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to return. Default is 1000.

  • :created_at (Time)

    Only return tables created at exactly the specified time.

  • :created_after (Time)

    Only return tables created after the specified time.

  • :created_before (Time)

    Only return tables created before the specified time.

  • :updated_at (Time)

    Only return tables last updated at exactly the specified time.

  • :updated_after (Time)

    Only return tables last updated after the specified time.

  • :updated_before (Time)

    Only return tables last updated before the specified time.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 481

def get_all_tables_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.get_all_tables ...'
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil?
  query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?
  query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?
  query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil?
  query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil?
  query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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] || 'CollectionResponseWithTotalHubDbTableV3ForwardPaging'

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

  new_options = opts.merge(
    :operation => :"TablesApi.get_all_tables",
    :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: TablesApi#get_all_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_draft_table_details_by_id(table_id_or_name, opts = {}) ⇒ HubDbTableV3

Get details for a draft table Get the details for the ‘draft` version of a specific HubDB table. This will include the definitions for the columns in the table and the number of rows in the table.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to return.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Set this to &#x60;true&#x60; to return an archived table. Defaults to &#x60;false&#x60;.

Returns:



542
543
544
545
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 542

def get_draft_table_details_by_id(table_id_or_name, opts = {})
  data, _status_code, _headers = get_draft_table_details_by_id_with_http_info(table_id_or_name, opts)
  data
end

#get_draft_table_details_by_id_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Get details for a draft table Get the details for the &#x60;draft&#x60; version of a specific HubDB table. This will include the definitions for the columns in the table and the number of rows in the table.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to return.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Set this to &#x60;true&#x60; to return an archived table. Defaults to &#x60;false&#x60;.

Returns:

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

    HubDbTableV3 data, response status code and response headers



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 554

def get_draft_table_details_by_id_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.get_draft_table_details_by_id ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.get_draft_table_details_by_id"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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] || 'HubDbTableV3'

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

  new_options = opts.merge(
    :operation => :"TablesApi.get_draft_table_details_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: TablesApi#get_draft_table_details_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table_details(table_id_or_name, opts = {}) ⇒ HubDbTableV3

Get details for a published table Returns the details for the ‘published` version of the specified table. This will include the definitions for the columns in the table and the number of rows in the table. Note: This endpoint can be accessed without any authentication if the table is set to be allowed for public access.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to return.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Set this to &#x60;true&#x60; to return details for an archived table. Defaults to &#x60;false&#x60;.

Returns:



611
612
613
614
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 611

def get_table_details(table_id_or_name, opts = {})
  data, _status_code, _headers = get_table_details_with_http_info(table_id_or_name, opts)
  data
end

#get_table_details_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Get details for a published table Returns the details for the &#x60;published&#x60; version of the specified table. This will include the definitions for the columns in the table and the number of rows in the table. Note: This endpoint can be accessed without any authentication if the table is set to be allowed for public access.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to return.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Set this to &#x60;true&#x60; to return details for an archived table. Defaults to &#x60;false&#x60;.

Returns:

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

    HubDbTableV3 data, response status code and response headers



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
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 623

def get_table_details_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.get_table_details ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.get_table_details"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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] || 'HubDbTableV3'

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

  new_options = opts.merge(
    :operation => :"TablesApi.get_table_details",
    :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: TablesApi#get_table_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#import_draft_table(table_id_or_name, opts = {}) ⇒ ImportResult

Import data into draft table Import the contents of a CSV file into an existing HubDB table. The data will always be imported into the ‘draft` version of the table. Use `/publish` endpoint to push these changes to `published` version. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import and you can specify this with the name as `config`. The second part will be the CSV file you want to import and you can specify this with the name as `file`. Refer the [overview section](developers.hubspot.com/docs/api/cms/hubdb#importing-tables) to check the details and format of the JSON-formatted options for the import.

Parameters:

  • table_id_or_name (String)

    The ID of the destination table where data will be imported.

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

    the optional parameters

Options Hash (opts):

  • :config (String)

    Configuration for the import in JSON format as described above.

  • :file (File)

    The source CSV file to be imported.

Returns:



680
681
682
683
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 680

def import_draft_table(table_id_or_name, opts = {})
  data, _status_code, _headers = import_draft_table_with_http_info(table_id_or_name, opts)
  data
end

#import_draft_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(ImportResult, Integer, Hash)>

Import data into draft table Import the contents of a CSV file into an existing HubDB table. The data will always be imported into the &#x60;draft&#x60; version of the table. Use &#x60;/publish&#x60; endpoint to push these changes to &#x60;published&#x60; version. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import and you can specify this with the name as &#x60;config&#x60;. The second part will be the CSV file you want to import and you can specify this with the name as &#x60;file&#x60;. Refer the [overview section](developers.hubspot.com/docs/api/cms/hubdb#importing-tables) to check the details and format of the JSON-formatted options for the import.

Parameters:

  • table_id_or_name (String)

    The ID of the destination table where data will be imported.

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

    the optional parameters

Options Hash (opts):

  • :config (String)

    Configuration for the import in JSON format as described above.

  • :file (File)

    The source CSV file to be imported.

Returns:

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

    ImportResult data, response status code and response headers



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 692

def import_draft_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.import_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.import_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/import'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.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(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['config'] = opts[:'config'] if !opts[:'config'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"TablesApi.import_draft_table",
    :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: TablesApi#import_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_draft_table(table_id_or_name, opts = {}) ⇒ HubDbTableV3

Publish a table from draft Publishes the table by copying the data and table schema changes from draft version to the published version, meaning any website pages using data from the table will be updated.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to publish.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:



753
754
755
756
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 753

def publish_draft_table(table_id_or_name, opts = {})
  data, _status_code, _headers = publish_draft_table_with_http_info(table_id_or_name, opts)
  data
end

#publish_draft_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Publish a table from draft Publishes the table by copying the data and table schema changes from draft version to the published version, meaning any website pages using data from the table will be updated.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to publish.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:

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

    HubDbTableV3 data, response status code and response headers



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 764

def publish_draft_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.publish_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.publish_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/publish'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].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] || 'HubDbTableV3'

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

  new_options = opts.merge(
    :operation => :"TablesApi.publish_draft_table",
    :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: TablesApi#publish_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#reset_draft_table(table_id_or_name, opts = {}) ⇒ HubDbTableV3

Reset a draft table Replaces the data in the ‘draft` version of the table with values from the `published` version. Any unpublished changes in the `draft` will be lost after this call is made.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to reset.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:



819
820
821
822
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 819

def reset_draft_table(table_id_or_name, opts = {})
  data, _status_code, _headers = reset_draft_table_with_http_info(table_id_or_name, opts)
  data
end

#reset_draft_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Reset a draft table Replaces the data in the &#x60;draft&#x60; version of the table with values from the &#x60;published&#x60; version. Any unpublished changes in the &#x60;draft&#x60; will be lost after this call is made.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to reset.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:

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

    HubDbTableV3 data, response status code and response headers



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 830

def reset_draft_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.reset_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.reset_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/reset'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].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] || 'HubDbTableV3'

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

  new_options = opts.merge(
    :operation => :"TablesApi.reset_draft_table",
    :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: TablesApi#reset_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unpublish_table(table_id_or_name, opts = {}) ⇒ HubDbTableV3

Unpublish a table Unpublishes the table, meaning any website pages using data from the table will not render any data.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to publish.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:



885
886
887
888
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 885

def unpublish_table(table_id_or_name, opts = {})
  data, _status_code, _headers = unpublish_table_with_http_info(table_id_or_name, opts)
  data
end

#unpublish_table_with_http_info(table_id_or_name, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Unpublish a table Unpublishes the table, meaning any website pages using data from the table will not render any data.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to publish.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the response.

Returns:

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

    HubDbTableV3 data, response status code and response headers



896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 896

def unpublish_table_with_http_info(table_id_or_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.unpublish_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.unpublish_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/unpublish'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].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] || 'HubDbTableV3'

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

  new_options = opts.merge(
    :operation => :"TablesApi.unpublish_table",
    :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: TablesApi#unpublish_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_draft_table(table_id_or_name, hub_db_table_v3_request, opts = {}) ⇒ HubDbTableV3

Update an existing table Update an existing HubDB table. You can use this endpoint to add or remove columns to the table as well as restore an archived table. Tables updated using the endpoint will only modify the ‘draft` verion of the table. Use `publish` endpoint to push all the changes to the `published` version. To restore a table, include the query parameter `archived=true` and `"archived": false` in the json body. Note: You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to update.

  • hub_db_table_v3_request (HubDbTableV3Request)

    The JSON schema for the table being updated.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:



953
954
955
956
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 953

def update_draft_table(table_id_or_name, hub_db_table_v3_request, opts = {})
  data, _status_code, _headers = update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_request, opts)
  data
end

#update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_request, opts = {}) ⇒ Array<(HubDbTableV3, Integer, Hash)>

Update an existing table Update an existing HubDB table. You can use this endpoint to add or remove columns to the table as well as restore an archived table. Tables updated using the endpoint will only modify the &#x60;draft&#x60; verion of the table. Use &#x60;publish&#x60; endpoint to push all the changes to the &#x60;published&#x60; version. To restore a table, include the query parameter &#x60;archived&#x3D;true&#x60; and &#x60;&quot;archived&quot;: false&#x60; in the json body. Note: You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted.

Parameters:

  • table_id_or_name (String)

    The ID or name of the table to update.

  • hub_db_table_v3_request (HubDbTableV3Request)

    The JSON schema for the table being updated.

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

    the optional parameters

Options Hash (opts):

  • :include_foreign_ids (Boolean)

    Set this to &#x60;true&#x60; to populate foreign ID values in the result.

  • :archived (Boolean)

    Specifies whether to return archived tables. Defaults to &#x60;false&#x60;.

Returns:

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

    HubDbTableV3 data, response status code and response headers



966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/hubspot/codegen/cms/hubdb/api/tables_api.rb', line 966

def update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.update_draft_table ...'
  end
  # verify the required parameter 'table_id_or_name' is set
  if @api_client.config.client_side_validation && table_id_or_name.nil?
    fail ArgumentError, "Missing the required parameter 'table_id_or_name' when calling TablesApi.update_draft_table"
  end
  # verify the required parameter 'hub_db_table_v3_request' is set
  if @api_client.config.client_side_validation && hub_db_table_v3_request.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_v3_request' when calling TablesApi.update_draft_table"
  end
  # resource path
  local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?

  # 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(hub_db_table_v3_request)

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

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

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