=begin #HubDB endpoints #HubDB is a relational data store that presents data as rows, columns, and cells in a table, much like a spreadsheet. HubDB tables can be added or modified [in the HubSpot CMS](https://knowledge.hubspot.com/cos-general/how-to-edit-hubdb-tables), but you can also use the API endpoints documented here. For more information on HubDB tables and using their data on a HubSpot site, see the [CMS developers site](https://designers.hubspot.com/docs/tools/hubdb). You can also see the [documentation for dynamic pages](https://designers.hubspot.com/docs/tutorials/how-to-build-dynamic-pages-with-hubdb) for more details about the `useForPages` field. HubDB tables now support `DRAFT` and `PUBLISHED` versions. This allows you to update data in the table, either for testing or to allow for a manual approval process, without affecting any live pages using the existing data. Draft data can be reviewed and published by a user working in HubSpot or published via the API. Draft data can also be discarded, allowing users to go back to the live version of the data without disrupting it. The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module Hubspot module Cms module Hubdb class DefaultApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Archive a table # Archive an existing HubDB table. # @param table_id [String] The ID or name of the table to archive. # @param [Hash] opts the optional parameters # @return [nil] def archive_table(table_id, opts = {}) archive_table_with_http_info(table_id, opts) nil end # Archive a table # Archive an existing HubDB table. # @param table_id [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 def archive_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.archive_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.archive_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = {} 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, :return_types_map => return_types_map ) 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: DefaultApi#archive_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Clone rows in batch # Clones rows in the `DRAFT` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] The JSON array of row ids # @param [Hash] opts the optional parameters # @return [Object] def batch_clone_draft_table_rows(table_id, batch_input_string, opts = {}) data, _status_code, _headers = batch_clone_draft_table_rows_with_http_info(table_id, batch_input_string, opts) data end # Clone rows in batch # Clones rows in the `DRAFT` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] The JSON array of row ids # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_clone_draft_table_rows_with_http_info(table_id, batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_clone_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_clone_draft_table_rows" end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling DefaultApi.batch_clone_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/clone'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_string) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'Object', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_clone_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create rows in batch # Creates rows in the `DRAFT` version of the specified table, given an array of row objects. See the endpoint `/tables/{tableId}/rows` for more details. # @param table_id [String] The ID or name of the table # @param batch_input_hub_db_table_row_v3 [BatchInputHubDbTableRowV3] JSON array of row objects # @param [Hash] opts the optional parameters # @return [Object] def batch_create_draft_table_rows(table_id, batch_input_hub_db_table_row_v3, opts = {}) data, _status_code, _headers = batch_create_draft_table_rows_with_http_info(table_id, batch_input_hub_db_table_row_v3, opts) data end # Create rows in batch # Creates rows in the `DRAFT` version of the specified table, given an array of row objects. See the endpoint `/tables/{tableId}/rows` for more details. # @param table_id [String] The ID or name of the table # @param batch_input_hub_db_table_row_v3 [BatchInputHubDbTableRowV3] JSON array of row objects # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_create_draft_table_rows_with_http_info(table_id, batch_input_hub_db_table_row_v3, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_create_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_create_draft_table_rows" end # verify the required parameter 'batch_input_hub_db_table_row_v3' is set if @api_client.config.client_side_validation && batch_input_hub_db_table_row_v3.nil? fail ArgumentError, "Missing the required parameter 'batch_input_hub_db_table_row_v3' when calling DefaultApi.batch_create_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/create'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_hub_db_table_row_v3) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 201 => 'Object', 207 => 'BatchResponseHubDbTableRowV3WithErrors', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_create_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Permanently deletes rows # Permanently deletes rows from the `DRAFT` version of the table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] JSON array of row ids. # @param [Hash] opts the optional parameters # @return [nil] def batch_purge_draft_table_rows(table_id, batch_input_string, opts = {}) batch_purge_draft_table_rows_with_http_info(table_id, batch_input_string, opts) nil end # Permanently deletes rows # Permanently deletes rows from the `DRAFT` version of the table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] JSON array of row ids. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def batch_purge_draft_table_rows_with_http_info(table_id, batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_purge_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_purge_draft_table_rows" end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling DefaultApi.batch_purge_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/purge'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # 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(batch_input_string) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = {} 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_purge_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a set of rows from DRAFT table # Returns rows in the `DRAFT` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] JSON array of row ids. # @param [Hash] opts the optional parameters # @return [Object] def batch_read_draft_table_rows(table_id, batch_input_string, opts = {}) data, _status_code, _headers = batch_read_draft_table_rows_with_http_info(table_id, batch_input_string, opts) data end # Get a set of rows from DRAFT table # Returns rows in the `DRAFT` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table # @param batch_input_string [BatchInputString] JSON array of row ids. # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_read_draft_table_rows_with_http_info(table_id, batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_read_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_read_draft_table_rows" end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling DefaultApi.batch_read_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/read'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_string) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'Object', 207 => 'BatchResponseHubDbTableRowV3WithErrors', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_read_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a set of rows # Returns rows in the `PUBLISHED` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table to query. # @param batch_input_string [BatchInputString] The JSON array of row ids # @param [Hash] opts the optional parameters # @return [Object] def batch_read_table_rows(table_id, batch_input_string, opts = {}) data, _status_code, _headers = batch_read_table_rows_with_http_info(table_id, batch_input_string, opts) data end # Get a set of rows # Returns rows in the `PUBLISHED` version of the specified table, given a set of row ids. # @param table_id [String] The ID or name of the table to query. # @param batch_input_string [BatchInputString] The JSON array of row ids # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_read_table_rows_with_http_info(table_id, batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_read_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_read_table_rows" end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling DefaultApi.batch_read_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/batch/read'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_string) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'Object', 207 => 'BatchResponseHubDbTableRowV3WithErrors', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_read_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Replace rows in batch in DRAFT table # Updates multiple rows as a batch in the `DRAFT` version of the table. See the endpoint `/tables/{tableId}/rows/{rowId}/draft PUT` for details on updating a single row. # @param table_id [String] The ID or name of the table # @param batch_input_hub_db_table_row_v3 [BatchInputHubDbTableRowV3] JSON array of row objects. # @param [Hash] opts the optional parameters # @return [Object] def batch_replace_draft_table_rows(table_id, batch_input_hub_db_table_row_v3, opts = {}) data, _status_code, _headers = batch_replace_draft_table_rows_with_http_info(table_id, batch_input_hub_db_table_row_v3, opts) data end # Replace rows in batch in DRAFT table # Updates multiple rows as a batch in the `DRAFT` version of the table. See the endpoint `/tables/{tableId}/rows/{rowId}/draft PUT` for details on updating a single row. # @param table_id [String] The ID or name of the table # @param batch_input_hub_db_table_row_v3 [BatchInputHubDbTableRowV3] JSON array of row objects. # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_replace_draft_table_rows_with_http_info(table_id, batch_input_hub_db_table_row_v3, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_replace_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_replace_draft_table_rows" end # verify the required parameter 'batch_input_hub_db_table_row_v3' is set if @api_client.config.client_side_validation && batch_input_hub_db_table_row_v3.nil? fail ArgumentError, "Missing the required parameter 'batch_input_hub_db_table_row_v3' when calling DefaultApi.batch_replace_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/replace'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_hub_db_table_row_v3) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'Object', 207 => 'BatchResponseHubDbTableRowV3WithErrors', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_replace_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update rows in batch in DRAFT table # Updates multiple rows as a batch in the `DRAFT` version of the table. See the endpoint `/tables/{tableId}/rows/{rowId}/draft PATCH` for details on updating a single row. # @param table_id [String] The ID or name of the table # @param batch_input_json_node [BatchInputJsonNode] JSON array of row objects. # @param [Hash] opts the optional parameters # @return [Object] def batch_update_draft_table_rows(table_id, batch_input_json_node, opts = {}) data, _status_code, _headers = batch_update_draft_table_rows_with_http_info(table_id, batch_input_json_node, opts) data end # Update rows in batch in DRAFT table # Updates multiple rows as a batch in the `DRAFT` version of the table. See the endpoint `/tables/{tableId}/rows/{rowId}/draft PATCH` for details on updating a single row. # @param table_id [String] The ID or name of the table # @param batch_input_json_node [BatchInputJsonNode] JSON array of row objects. # @param [Hash] opts the optional parameters # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def batch_update_draft_table_rows_with_http_info(table_id, batch_input_json_node, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.batch_update_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.batch_update_draft_table_rows" end # verify the required parameter 'batch_input_json_node' is set if @api_client.config.client_side_validation && batch_input_json_node.nil? fail ArgumentError, "Missing the required parameter 'batch_input_json_node' when calling DefaultApi.batch_update_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft/batch/update'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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(batch_input_json_node) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'Object', 207 => 'BatchResponseHubDbTableRowV3WithErrors', } 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, :return_types_map => return_types_map ) 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: DefaultApi#batch_update_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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 [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] def clone_draft_table(table_id, hub_db_table_clone_request, opts = {}) data, _status_code, _headers = clone_draft_table_with_http_info(table_id, hub_db_table_clone_request, opts) data end # 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 [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 def clone_draft_table_with_http_info(table_id, hub_db_table_clone_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.clone_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.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 DefaultApi.clone_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft/clone'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#clone_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Clone a row # Clones a single row in the `DRAFT` version of the table. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [HubDbTableRowV3] def clone_draft_table_row(row_id, table_id, opts = {}) data, _status_code, _headers = clone_draft_table_row_with_http_info(row_id, table_id, opts) data end # Clone a row # Clones a single row in the `DRAFT` version of the table. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [Array<(HubDbTableRowV3, Integer, Hash)>] HubDbTableRowV3 data, response status code and response headers def clone_draft_table_row_with_http_info(row_id, table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.clone_draft_table_row ...' end # verify the required parameter 'row_id' is set if @api_client.config.client_side_validation && row_id.nil? fail ArgumentError, "Missing the required parameter 'row_id' when calling DefaultApi.clone_draft_table_row" end pattern = Regexp.new(/\d+/) if @api_client.config.client_side_validation && row_id !~ pattern fail ArgumentError, "invalid value for 'row_id' when calling DefaultApi.clone_draft_table_row, must conform to the pattern #{pattern}." end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.clone_draft_table_row" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/{rowId}/draft/clone'.sub('{' + 'rowId' + '}', CGI.escape(row_id.to_s)).sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableRowV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#clone_draft_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new table # Creates a new 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] 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 a new table # Creates a new 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 def create_table_with_http_info(hub_db_table_v3_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.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 DefaultApi.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) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 201 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#create_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add a new row to a table # Add a new row to a HubDB table. New rows will be added to the `DRAFT` version of the table. Use the `/publish` endpoint to push these changes live. # @param table_id [String] The ID or name of the target table. # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The row definition JSON, formatted as described above. # @param [Hash] opts the optional parameters # @return [HubDbTableRowV3] def create_table_row(table_id, hub_db_table_row_v3_input, opts = {}) data, _status_code, _headers = create_table_row_with_http_info(table_id, hub_db_table_row_v3_input, opts) data end # Add a new row to a table # Add a new row to a HubDB table. New rows will be added to the `DRAFT` version of the table. Use the `/publish` endpoint to push these changes live. # @param table_id [String] The ID or name of the target table. # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The row definition JSON, formatted as described above. # @param [Hash] opts the optional parameters # @return [Array<(HubDbTableRowV3, Integer, Hash)>] HubDbTableRowV3 data, response status code and response headers def create_table_row_with_http_info(table_id, hub_db_table_row_v3_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.create_table_row ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.create_table_row" end # verify the required parameter 'hub_db_table_row_v3_input' is set if @api_client.config.client_side_validation && hub_db_table_row_v3_input.nil? fail ArgumentError, "Missing the required parameter 'hub_db_table_row_v3_input' when calling DefaultApi.create_table_row" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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_row_v3_input) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 201 => 'HubDbTableRowV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#create_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Export a DRAFT table # Exports the `DRAFT` version of a table to CSV / EXCEL format. # @param table_id [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 `CSV`, `XLSX`, and `XLS`. # @return [File] def export_draft_table(table_id, opts = {}) data, _status_code, _headers = export_draft_table_with_http_info(table_id, opts) data end # Export a DRAFT table # Exports the `DRAFT` version of a table to CSV / EXCEL format. # @param table_id [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 `CSV`, `XLSX`, and `XLS`. # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers def export_draft_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.export_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.export_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft/export'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'File', } 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, :return_types_map => return_types_map ) 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: DefaultApi#export_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Export a PUBLISHED version of a table # Exports the `PUBLISHED` version of a table to CSV / EXCEL format. # @param table_id [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 `CSV`, `XLSX`, and `XLS`. # @return [File] def export_table(table_id, opts = {}) data, _status_code, _headers = export_table_with_http_info(table_id, opts) data end # Export a PUBLISHED version of a table # Exports the `PUBLISHED` version of a table to CSV / EXCEL format. # @param table_id [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 `CSV`, `XLSX`, and `XLS`. # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers def export_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.export_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.export_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/export'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'File', } 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, :return_types_map => return_types_map ) 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: DefaultApi#export_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Return all DRAFT tables # Returns the details for each DRAFT table defined in the specified account, including column definitions. `Note:` Unlike other HubDB GET endpoints, getting all tables will require authentication.\" # @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] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` 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 `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @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 [CollectionResponseWithTotalHubDbTableV3] def get_all_draft_tables(opts = {}) data, _status_code, _headers = get_all_draft_tables_with_http_info(opts) data end # Return all DRAFT tables # Returns the details for each DRAFT table defined in the specified account, including column definitions. `Note:` Unlike other HubDB GET endpoints, getting all tables will require authentication.\" # @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] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` 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 `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @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<(CollectionResponseWithTotalHubDbTableV3, Integer, Hash)>] CollectionResponseWithTotalHubDbTableV3 data, response status code and response headers def get_all_draft_tables_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'CollectionResponseWithTotalHubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#get_all_draft_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all tables # Returns the details for each table defined in an account, including column definitions. `Note:` Unlike other HubDB GET endpoints, getting all tables will require authentication.\" # @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] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` 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 `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @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 [CollectionResponseWithTotalHubDbTableV3] def get_all_tables(opts = {}) data, _status_code, _headers = get_all_tables_with_http_info(opts) data end # Get all tables # Returns the details for each table defined in an account, including column definitions. `Note:` Unlike other HubDB GET endpoints, getting all tables will require authentication.\" # @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] :sort Specifies which fields to use for sorting results. Valid fields are `name`, `createdAt`, `updatedAt`, `createdBy`, `updatedBy`. `createdAt` 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 `paging.next.after` JSON property of a paged response containing more results. # @option opts [Boolean] :archived Specifies whether to return archived tables. Defaults to `false`. # @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<(CollectionResponseWithTotalHubDbTableV3, Integer, Hash)>] CollectionResponseWithTotalHubDbTableV3 data, response status code and response headers def get_all_tables_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'CollectionResponseWithTotalHubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#get_all_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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 [String] The ID or name of the table to return. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Set this to `true` to return an archived table. Defaults to `false`. # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [HubDbTableV3] def get_draft_table_details_by_id(table_id, opts = {}) data, _status_code, _headers = get_draft_table_details_by_id_with_http_info(table_id, opts) data end # 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 [String] The ID or name of the table to return. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Set this to `true` to return an archived table. Defaults to `false`. # @option opts [Boolean] :include_foreign_ids Set this to `true` to populate foreign ID values in the result. # @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers def get_draft_table_details_by_id_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.get_draft_table_details_by_id ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.get_draft_table_details_by_id" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#get_draft_table_details_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a table row # Get a single row by ID from a table's `DRAFT` version. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [HubDbTableRowV3] def get_draft_table_row_by_id(row_id, table_id, opts = {}) data, _status_code, _headers = get_draft_table_row_by_id_with_http_info(row_id, table_id, opts) data end # Get a table row # Get a single row by ID from a table's `DRAFT` version. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [Array<(HubDbTableRowV3, Integer, Hash)>] HubDbTableRowV3 data, response status code and response headers def get_draft_table_row_by_id_with_http_info(row_id, table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.get_draft_table_row_by_id ...' end # verify the required parameter 'row_id' is set if @api_client.config.client_side_validation && row_id.nil? fail ArgumentError, "Missing the required parameter 'row_id' when calling DefaultApi.get_draft_table_row_by_id" end pattern = Regexp.new(/\d+/) if @api_client.config.client_side_validation && row_id !~ pattern fail ArgumentError, "invalid value for 'row_id' when calling DefaultApi.get_draft_table_row_by_id, must conform to the pattern #{pattern}." end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.get_draft_table_row_by_id" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/{rowId}/draft'.sub('{' + 'rowId' + '}', CGI.escape(row_id.to_s)).sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableRowV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#get_draft_table_row_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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 the `/push-live` endpoint to push these changes to `PUBLISHED`. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import. The second part will be the CSV file you want to import. Refer the overview section to check the details and format of the JSON-formatted options for the import. # @param table_id [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] def import_draft_table(table_id, opts = {}) data, _status_code, _headers = import_draft_table_with_http_info(table_id, opts) data end # 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 the `/push-live` endpoint to push these changes to `PUBLISHED`. This endpoint takes a multi-part POST request. The first part will be a set of JSON-formatted options for the import. The second part will be the CSV file you want to import. Refer the overview section to check the details and format of the JSON-formatted options for the import. # @param table_id [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 def import_draft_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.import_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.import_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft/import'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'ImportResult', } 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, :return_types_map => return_types_map ) 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: DefaultApi#import_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Publish a table from draft # Publishes the current `DRAFT` version of the table by copying the data to the PUBLISHED version of the table. This will immediately push the data for any stored `DRAFT` version to the `PUBLISHED` version of the table, meaning any website pages using data from the table will be updated. # @param table_id [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 `true` to populate foreign ID values in the response. # @return [HubDbTableV3] def publish_draft_table(table_id, opts = {}) data, _status_code, _headers = publish_draft_table_with_http_info(table_id, opts) data end # Publish a table from draft # Publishes the current `DRAFT` version of the table by copying the data to the PUBLISHED version of the table. This will immediately push the data for any stored `DRAFT` version to the `PUBLISHED` version of the table, meaning any website pages using data from the table will be updated. # @param table_id [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 `true` to populate foreign ID values in the response. # @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers def publish_draft_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.publish_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.publish_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft/push-live'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#publish_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Permanently deletes a row # Permanently deletes a row from a table's `DRAFT` version. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [nil] def purge_draft_table_row(row_id, table_id, opts = {}) purge_draft_table_row_with_http_info(row_id, table_id, opts) nil end # Permanently deletes a row # Permanently deletes a row from a table's `DRAFT` version. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def purge_draft_table_row_with_http_info(row_id, table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.purge_draft_table_row ...' end # verify the required parameter 'row_id' is set if @api_client.config.client_side_validation && row_id.nil? fail ArgumentError, "Missing the required parameter 'row_id' when calling DefaultApi.purge_draft_table_row" end pattern = Regexp.new(/\d+/) if @api_client.config.client_side_validation && row_id !~ pattern fail ArgumentError, "invalid value for 'row_id' when calling DefaultApi.purge_draft_table_row, must conform to the pattern #{pattern}." end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.purge_draft_table_row" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/{rowId}/draft'.sub('{' + 'rowId' + '}', CGI.escape(row_id.to_s)).sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = {} 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, :return_types_map => return_types_map ) 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: DefaultApi#purge_draft_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get rows from DRAFT table # Returns rows in the `DRAFT` version of the specified table. Row results can be filtered and sorted using the options mentioned in the `/tables/{tableId}/rows` endpoint. # @param table_id [String] The ID or name of the table to query. # @param [Hash] opts the optional parameters # @option opts [Array] :properties Specify the column names to get results containing only the required columns instead of all column details. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is `1000`. # @option opts [Array] :sort Specifies the column names to sort the results by. # @return [CollectionResponseWithTotalHubDbTableRowV3] def read_draft_table_rows(table_id, opts = {}) data, _status_code, _headers = read_draft_table_rows_with_http_info(table_id, opts) data end # Get rows from DRAFT table # Returns rows in the `DRAFT` version of the specified table. Row results can be filtered and sorted using the options mentioned in the `/tables/{tableId}/rows` endpoint. # @param table_id [String] The ID or name of the table to query. # @param [Hash] opts the optional parameters # @option opts [Array] :properties Specify the column names to get results containing only the required columns instead of all column details. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the `paging.next.after` JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is `1000`. # @option opts [Array] :sort Specifies the column names to sort the results by. # @return [Array<(CollectionResponseWithTotalHubDbTableRowV3, Integer, Hash)>] CollectionResponseWithTotalHubDbTableRowV3 data, response status code and response headers def read_draft_table_rows_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.read_draft_table_rows ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.read_draft_table_rows" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/draft'.sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'properties'] = @api_client.build_collection_param(opts[:'properties'], :multi) if !opts[:'properties'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'CollectionResponseWithTotalHubDbTableRowV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#read_draft_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Replaces an existing row # Replace a single row in the table's `DRAFT` version. All the column values must be specified. If a column has a value in the target table and this request doesn't define that value, it will be deleted. See the `Create a row` endpoint for instructions on how to format the JSON row definitions. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The JSON object of the row # @param [Hash] opts the optional parameters # @return [HubDbTableRowV3] def replace_draft_table_row(row_id, table_id, hub_db_table_row_v3_input, opts = {}) data, _status_code, _headers = replace_draft_table_row_with_http_info(row_id, table_id, hub_db_table_row_v3_input, opts) data end # Replaces an existing row # Replace a single row in the table's `DRAFT` version. All the column values must be specified. If a column has a value in the target table and this request doesn't define that value, it will be deleted. See the `Create a row` endpoint for instructions on how to format the JSON row definitions. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The JSON object of the row # @param [Hash] opts the optional parameters # @return [Array<(HubDbTableRowV3, Integer, Hash)>] HubDbTableRowV3 data, response status code and response headers def replace_draft_table_row_with_http_info(row_id, table_id, hub_db_table_row_v3_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.replace_draft_table_row ...' end # verify the required parameter 'row_id' is set if @api_client.config.client_side_validation && row_id.nil? fail ArgumentError, "Missing the required parameter 'row_id' when calling DefaultApi.replace_draft_table_row" end pattern = Regexp.new(/\d+/) if @api_client.config.client_side_validation && row_id !~ pattern fail ArgumentError, "invalid value for 'row_id' when calling DefaultApi.replace_draft_table_row, must conform to the pattern #{pattern}." end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.replace_draft_table_row" end # verify the required parameter 'hub_db_table_row_v3_input' is set if @api_client.config.client_side_validation && hub_db_table_row_v3_input.nil? fail ArgumentError, "Missing the required parameter 'hub_db_table_row_v3_input' when calling DefaultApi.replace_draft_table_row" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/{rowId}/draft'.sub('{' + 'rowId' + '}', CGI.escape(row_id.to_s)).sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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_row_v3_input) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableRowV3', } 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, :return_types_map => return_types_map ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DefaultApi#replace_draft_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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. # @param table_id [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 `true` to populate foreign ID values in the response. # @return [HubDbTableV3] def reset_draft_table(table_id, opts = {}) data, _status_code, _headers = reset_draft_table_with_http_info(table_id, opts) data end # 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. # @param table_id [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 `true` to populate foreign ID values in the response. # @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers def reset_draft_table_with_http_info(table_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.reset_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.reset_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft/reset'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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] # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#reset_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an existing table # Update an existing HubDB table. You can use this endpoint to add or remove a column. Tables updated using the endpoint will only modify the `DRAFT` table. Use the publish endpoint to push all changes to the `PUBLISHED` version. You can only include the columns that need to be modified without including the remaining columns. # @param table_id [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 `true` to populate foreign ID values in the result. # @return [HubDbTableV3] def update_draft_table(table_id, hub_db_table_v3_input, opts = {}) data, _status_code, _headers = update_draft_table_with_http_info(table_id, hub_db_table_v3_input, opts) data end # Update an existing table # Update an existing HubDB table. You can use this endpoint to add or remove a column. Tables updated using the endpoint will only modify the `DRAFT` table. Use the publish endpoint to push all changes to the `PUBLISHED` version. You can only include the columns that need to be modified without including the remaining columns. # @param table_id [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 `true` to populate foreign ID values in the result. # @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers def update_draft_table_with_http_info(table_id, hub_db_table_v3_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.update_draft_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.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 DefaultApi.update_draft_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/draft'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#update_draft_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates an existing row # Sparse updates a single row in the table's `DRAFT` version. All the column values need not be specified. Only the columns or fields that needs to be modified can be specified. See the `Create a row` endpoint for instructions on how to format the JSON row definitions. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The JSON object of the row with necessary fields that needs to be updated. # @param [Hash] opts the optional parameters # @return [HubDbTableRowV3] def update_draft_table_row(row_id, table_id, hub_db_table_row_v3_input, opts = {}) data, _status_code, _headers = update_draft_table_row_with_http_info(row_id, table_id, hub_db_table_row_v3_input, opts) data end # Updates an existing row # Sparse updates a single row in the table's `DRAFT` version. All the column values need not be specified. Only the columns or fields that needs to be modified can be specified. See the `Create a row` endpoint for instructions on how to format the JSON row definitions. # @param row_id [String] The ID of the row # @param table_id [String] The ID or name of the table # @param hub_db_table_row_v3_input [HubDbTableRowV3Input] The JSON object of the row with necessary fields that needs to be updated. # @param [Hash] opts the optional parameters # @return [Array<(HubDbTableRowV3, Integer, Hash)>] HubDbTableRowV3 data, response status code and response headers def update_draft_table_row_with_http_info(row_id, table_id, hub_db_table_row_v3_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.update_draft_table_row ...' end # verify the required parameter 'row_id' is set if @api_client.config.client_side_validation && row_id.nil? fail ArgumentError, "Missing the required parameter 'row_id' when calling DefaultApi.update_draft_table_row" end pattern = Regexp.new(/\d+/) if @api_client.config.client_side_validation && row_id !~ pattern fail ArgumentError, "invalid value for 'row_id' when calling DefaultApi.update_draft_table_row, must conform to the pattern #{pattern}." end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.update_draft_table_row" end # verify the required parameter 'hub_db_table_row_v3_input' is set if @api_client.config.client_side_validation && hub_db_table_row_v3_input.nil? fail ArgumentError, "Missing the required parameter 'hub_db_table_row_v3_input' when calling DefaultApi.update_draft_table_row" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}/rows/{rowId}/draft'.sub('{' + 'rowId' + '}', CGI.escape(row_id.to_s)).sub('{' + 'tableId' + '}', CGI.escape(table_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' 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_row_v3_input) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableRowV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#update_draft_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Publish or unpublish a live version of a table or restore an archived table # Use this endpoint to perform one of the following
  • Publish a live version of a table (without copying table data from DRAFT)
  • Un-publish a live version of a table (Leaving the data in the live version)
  • Restore an archived table
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. Examples: Publish a table: ``` { \"published\": true } ``` Unpublish 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 [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 `true` to populate foreign ID values in the result. # @return [HubDbTableV3] def update_table(table_id, hub_db_table_v3_live_input, opts = {}) data, _status_code, _headers = update_table_with_http_info(table_id, hub_db_table_v3_live_input, opts) data end # 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. Examples: Publish a table: ``` { \"published\": true } ``` Unpublish 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 [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 `true` to populate foreign ID values in the result. # @return [Array<(HubDbTableV3, Integer, Hash)>] HubDbTableV3 data, response status code and response headers def update_table_with_http_info(table_id, hub_db_table_v3_live_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DefaultApi.update_table ...' end # verify the required parameter 'table_id' is set if @api_client.config.client_side_validation && table_id.nil? fail ArgumentError, "Missing the required parameter 'table_id' when calling DefaultApi.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 DefaultApi.update_table" end # resource path local_var_path = '/cms/v3/hubdb/tables/{tableId}'.sub('{' + 'tableId' + '}', CGI.escape(table_id.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) # auth_names auth_names = opts[:auth_names] || ['oauth2'] # return_type return_type = opts[:return_type] return_types_map = { 200 => 'HubDbTableV3', } 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, :return_types_map => return_types_map ) 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: DefaultApi#update_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end end end