class Hubspot::Cms::Hubdb::TablesApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 21
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

archive_table(table_id_or_name, opts = {}) click to toggle source

Archive a table Archive (soft delete) an existing HubDB table. This archives both the live and draft versions. @param table_id_or_name [String] The ID or name of the table to archive. @param [Hash] opts the optional parameters @return [nil]

# 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 = {}) click to toggle source

Archive a table Archive (soft delete) an existing HubDB table. This archives both the live and draft versions. @param table_id_or_name [String] The ID or name of the table to archive. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# 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[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

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`. @param table_id_or_name [String] The ID or name of the table to clone. @param 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. @param [Hash] opts the optional parameters @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 92
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 = {}) click to toggle source

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;. @param table_id_or_name [String] The ID or name of the table to clone. @param 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. @param [Hash] opts the optional parameters @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 103
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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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_input, opts = {}) click to toggle source

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. @param hub_db_table_v3_input [HubDbTableV3Input] The JSON schema for the table being created. @param [Hash] opts the optional parameters @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 161
def create_table(hub_db_table_v3_input, opts = {})
  data, _status_code, _headers = create_table_with_http_info(hub_db_table_v3_input, opts)
  data
end
create_table_with_http_info(hub_db_table_v3_input, opts = {}) click to toggle source

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. @param hub_db_table_v3_input [HubDbTableV3Input] The JSON schema for the table being created. @param [Hash] opts the optional parameters @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 171
def create_table_with_http_info(hub_db_table_v3_input, 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_input' is set
  if @api_client.config.client_side_validation && hub_db_table_v3_input.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_v3_input' 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Export a draft table Exports the `draft` version of a table to CSV / EXCEL format. @param table_id_or_name [String] The ID or name of the table to export. @param [Hash] opts the optional parameters @option opts [String] :format The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;. @return [File]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 226
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 = {}) click to toggle source

Export a draft table Exports the &#x60;draft&#x60; version of a table to CSV / EXCEL format. @param table_id_or_name [String] The ID or name of the table to export. @param [Hash] opts the optional parameters @option opts [String] :format The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;. @return [Array<(File, Integer, Hash)>] File data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 237
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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Export a published version of a table Exports the `live` version of a table to CSV / EXCEL format. @param table_id_or_name [String] The ID or name of the table to export. @param [Hash] opts the optional parameters @option opts [String] :format The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;. @return [File]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 291
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 = {}) click to toggle source

Export a published version of a table Exports the &#x60;live&#x60; version of a table to CSV / EXCEL format. @param table_id_or_name [String] The ID or name of the table to export. @param [Hash] opts the optional parameters @option opts [String] :format The file format to export. Possible values include &#x60;CSV&#x60;, &#x60;XLSX&#x60;, and &#x60;XLS&#x60;. @return [Array<(File, Integer, Hash)>] File data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 302
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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Return all draft tables Returns the details for each draft table defined in the specified account, including column definitions. @param [Hash] opts the optional parameters @option opts [DateTime] :updated_after Only return tables last updated after the specified time. @option opts [DateTime] :updated_before Only return tables last updated before the specified time. @option opts [Array<String>] :sort 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. @option opts [DateTime] :created_at Only return tables created at exactly the specified time. @option opts [DateTime] :created_after Only return tables created after the specified time. @option opts [String] :after 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. @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to &#x60;false&#x60;. @option opts [DateTime] :created_before Only return tables created before the specified time. @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. @option opts [Integer] :limit The maximum number of results to return. Default is 1000. @return [CollectionResponseWithTotalHubDbTableV3ForwardPaging]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 364
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 = {}) click to toggle source

Return all draft tables Returns the details for each draft table defined in the specified account, including column definitions. @param [Hash] opts the optional parameters @option opts [DateTime] :updated_after Only return tables last updated after the specified time. @option opts [DateTime] :updated_before Only return tables last updated before the specified time. @option opts [Array<String>] :sort 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. @option opts [DateTime] :created_at Only return tables created at exactly the specified time. @option opts [DateTime] :created_after Only return tables created after the specified time. @option opts [String] :after 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. @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to &#x60;false&#x60;. @option opts [DateTime] :created_before Only return tables created before the specified time. @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. @option opts [Integer] :limit The maximum number of results to return. Default is 1000. @return [Array<(CollectionResponseWithTotalHubDbTableV3ForwardPaging, Integer, Hash)>] CollectionResponseWithTotalHubDbTableV3ForwardPaging data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 383
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[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil?
  query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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[:'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[:body] 

  # return_type
  return_type = opts[:return_type] || 'CollectionResponseWithTotalHubDbTableV3ForwardPaging' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Get all live tables Returns the details for the `live` version of each table defined in an account, including column definitions. @param [Hash] opts the optional parameters @option opts [DateTime] :updated_after Only return tables last updated after the specified time. @option opts [DateTime] :updated_before Only return tables last updated before the specified time. @option opts [Array<String>] :sort 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. @option opts [DateTime] :created_at Only return tables created at exactly the specified time. @option opts [DateTime] :created_after Only return tables created after the specified time. @option opts [String] :after 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. @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to &#x60;false&#x60;. @option opts [DateTime] :created_before Only return tables created before the specified time. @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. @option opts [Integer] :limit The maximum number of results to return. Default is 1000. @return [CollectionResponseWithTotalHubDbTableV3ForwardPaging]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 450
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 = {}) click to toggle source

Get all live tables Returns the details for the &#x60;live&#x60; version of each table defined in an account, including column definitions. @param [Hash] opts the optional parameters @option opts [DateTime] :updated_after Only return tables last updated after the specified time. @option opts [DateTime] :updated_before Only return tables last updated before the specified time. @option opts [Array<String>] :sort 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. @option opts [DateTime] :created_at Only return tables created at exactly the specified time. @option opts [DateTime] :created_after Only return tables created after the specified time. @option opts [String] :after 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. @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to &#x60;false&#x60;. @option opts [DateTime] :created_before Only return tables created before the specified time. @option opts [DateTime] :updated_at Only return tables last updated at exactly the specified time. @option opts [Integer] :limit The maximum number of results to return. Default is 1000. @return [Array<(CollectionResponseWithTotalHubDbTableV3ForwardPaging, Integer, Hash)>] CollectionResponseWithTotalHubDbTableV3ForwardPaging data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 469
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[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil?
  query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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[:'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[:body] 

  # return_type
  return_type = opts[:return_type] || 'CollectionResponseWithTotalHubDbTableV3ForwardPaging' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

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. @param table_id_or_name [String] The ID or name of the table to return. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Set this to &#x60;true&#x60; to return an archived table. Defaults to &#x60;false&#x60;. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 529
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 = {}) click to toggle source

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. @param table_id_or_name [String] The ID or name of the table to return. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Set this to &#x60;true&#x60; to return an archived table. Defaults to &#x60;false&#x60;. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 541
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[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Get details for a live table Returns the details for the `live` 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. @param table_id_or_name [String] The ID or name of the table to return. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Set this to &#x60;true&#x60; to return details for an archived table. Defaults to &#x60;false&#x60;. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 597
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 = {}) click to toggle source

Get details for a live table Returns the details for the &#x60;live&#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. @param table_id_or_name [String] The ID or name of the table to return. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Set this to &#x60;true&#x60; to return details for an archived table. Defaults to &#x60;false&#x60;. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 609
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[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

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 `/push-live` endpoint to push these changes to `live` 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 to check the details and format of the JSON-formatted options for the import. @param table_id_or_name [String] The ID of the destination table where data will be imported. @param [Hash] opts the optional parameters @option opts [File] :file The source CSV file to be imported. @option opts [String] :config Configuration for the import in JSON format as described above. @return [ImportResult]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 665
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 = {}) click to toggle source

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;/push-live&#x60; endpoint to push these changes to &#x60;live&#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 to check the details and format of the JSON-formatted options for the import. @param table_id_or_name [String] The ID of the destination table where data will be imported. @param [Hash] opts the optional parameters @option opts [File] :file The source CSV file to be imported. @option opts [String] :config Configuration for the import in JSON format as described above. @return [Array<(ImportResult, Integer, Hash)>] ImportResult data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 677
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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Publish a table from draft Copies the data from draft to live version of the table and also publishes the live version. This will immediately push the data to the `live` version of the table and publishes the live version, meaning any website pages using data from the table will be updated. @param table_id_or_name [String] The ID or name of the table to publish. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the response. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 734
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 = {}) click to toggle source

Publish a table from draft Copies the data from draft to live version of the table and also publishes the live version. This will immediately push the data to the &#x60;live&#x60; version of the table and publishes the live version, meaning any website pages using data from the table will be updated. @param table_id_or_name [String] The ID or name of the table to publish. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the response. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 745
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/push-live'.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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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 = {}) click to toggle source

Reset a draft table Replaces the data in the `draft` version of the table with values from the `live` version. Any unpublished changes in the `draft` will be lost after this call is made. @param table_id_or_name [String] The ID or name of the table to reset. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the response. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 799
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 = {}) click to toggle source

Reset a draft table Replaces the data in the &#x60;draft&#x60; version of the table with values from the &#x60;live&#x60; version. Any unpublished changes in the &#x60;draft&#x60; will be lost after this call is made. @param table_id_or_name [String] The ID or name of the table to reset. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the response. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 810
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[:body] 

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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
update_draft_table(table_id_or_name, hub_db_table_v3_input, opts = {}) click to toggle source

Update an existing table Update an existing HubDB table. You can use this endpoint to add or remove columns to the table. Tables updated using the endpoint will only modify the `draft` verion of the table. Use `push-live` endpoint to push all the changes to the `live` version. 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. @param table_id_or_name [String] The ID or name of the table to update. @param hub_db_table_v3_input [HubDbTableV3Input] The JSON schema for the table being updated. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 865
def update_draft_table(table_id_or_name, hub_db_table_v3_input, opts = {})
  data, _status_code, _headers = update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_input, opts)
  data
end
update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_input, opts = {}) click to toggle source

Update an existing table Update an existing HubDB table. You can use this endpoint to add or remove columns to the table. Tables updated using the endpoint will only modify the &#x60;draft&#x60; verion of the table. Use &#x60;push-live&#x60; endpoint to push all the changes to the &#x60;live&#x60; version. 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. @param table_id_or_name [String] The ID or name of the table to update. @param hub_db_table_v3_input [HubDbTableV3Input] The JSON schema for the table being updated. @param [Hash] opts the optional parameters @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 877
def update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_input, 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_input' is set
  if @api_client.config.client_side_validation && hub_db_table_v3_input.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_v3_input' 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?

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :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
update_table(table_id_or_name, hub_db_table_v3_live_input, opts = {}) click to toggle source

Publish or unpublish a live version of a table or restore an archived table Use this endpoint to perform one of the following <ul><li> Publish a live version of a table (without copying table data from draft) </li><li>Un-publish a live version of a table (Leaving the data in the live version)</li><li>Restore an archived table</li></ul> To publish a table, send `published` property in the JSON object with the value `true`. To unpublish a table, send `published` property in the JSON object with the value `false`. To restore an archived table, send `archived` property in the JSON object with the value `false` along with the query parameter `archived=true`. When restoring an archived table, if an active table already exists with the same `name` or `label`, you will need to change the name of the archived table when restoring it using the `name` and `label` parameters with a new name and new label. When you restore a table, the table will be restored only in the `draft` version. Examples: Publish live version of a table: “` { "published": true } “` Unpublish live version of a table: “` { "published": false } “` Restore a table: (send `archived=true` in query parameters) “` { "archived": false } “` Restore a table with a new name: (send `archived=true` in query parameters) “` { "label": "New Table Name", "name": "new_table_name", "archived": false } “` @param table_id_or_name [String] The ID or name of the table to return. @param hub_db_table_v3_live_input [HubDbTableV3LiveInput] The JSON object as described. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Whether to return only results that have been archived. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [HubDbTableV3]

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 939
def update_table(table_id_or_name, hub_db_table_v3_live_input, opts = {})
  data, _status_code, _headers = update_table_with_http_info(table_id_or_name, hub_db_table_v3_live_input, opts)
  data
end
update_table_with_http_info(table_id_or_name, hub_db_table_v3_live_input, opts = {}) click to toggle source

Publish or unpublish a live version of a table or restore an archived table Use this endpoint to perform one of the following &lt;ul&gt;&lt;li&gt; Publish a live version of a table (without copying table data from draft) &lt;/li&gt;&lt;li&gt;Un-publish a live version of a table (Leaving the data in the live version)&lt;/li&gt;&lt;li&gt;Restore an archived table&lt;/li&gt;&lt;/ul&gt; To publish a table, send &#x60;published&#x60; property in the JSON object with the value &#x60;true&#x60;. To unpublish a table, send &#x60;published&#x60; property in the JSON object with the value &#x60;false&#x60;. To restore an archived table, send &#x60;archived&#x60; property in the JSON object with the value &#x60;false&#x60; along with the query parameter &#x60;archived&#x3D;true&#x60;. When restoring an archived table, if an active table already exists with the same &#x60;name&#x60; or &#x60;label&#x60;, you will need to change the name of the archived table when restoring it using the &#x60;name&#x60; and &#x60;label&#x60; parameters with a new name and new label. When you restore a table, the table will be restored only in the &#x60;draft&#x60; version. Examples: Publish live version of a table: &#x60;&#x60;&#x60; { "published&quot;: true } &#x60;&#x60;&#x60; Unpublish live version of a table: &#x60;&#x60;&#x60; { "published&quot;: false } &#x60;&#x60;&#x60; Restore a table: (send &#x60;archived&#x3D;true&#x60; in query parameters) &#x60;&#x60;&#x60; { "archived&quot;: false } &#x60;&#x60;&#x60; Restore a table with a new name: (send &#x60;archived&#x3D;true&#x60; in query parameters) &#x60;&#x60;&#x60; { "label&quot;: "New Table Name&quot;, "name&quot;: "new_table_name&quot;, "archived&quot;: false } &#x60;&#x60;&#x60; @param table_id_or_name [String] The ID or name of the table to return. @param hub_db_table_v3_live_input [HubDbTableV3LiveInput] The JSON object as described. @param [Hash] opts the optional parameters @option opts [Boolean] :archived Whether to return only results that have been archived. @option opts [Boolean] :include_foreign_ids Set this to &#x60;true&#x60; to populate foreign ID values in the result. @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers

# File lib/hubspot/codegen/cms/hubdb/api/tables_api.rb, line 952
def update_table_with_http_info(table_id_or_name, hub_db_table_v3_live_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TablesApi.update_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_table"
  end
  # verify the required parameter 'hub_db_table_v3_live_input' is set
  if @api_client.config.client_side_validation && hub_db_table_v3_live_input.nil?
    fail ArgumentError, "Missing the required parameter 'hub_db_table_v3_live_input' when calling TablesApi.update_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] || {}
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  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', '*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

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