|
| 1 | +=begin |
| 2 | +#Communications |
| 3 | +
|
| 4 | +#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) |
| 5 | +
|
| 6 | +The version of the OpenAPI document: v3 |
| 7 | +
|
| 8 | +Generated by: https://openapi-generator.tech |
| 9 | +OpenAPI Generator version: 6.2.1 |
| 10 | +
|
| 11 | +=end |
| 12 | + |
| 13 | +require 'cgi' |
| 14 | + |
| 15 | +module Hubspot |
| 16 | + module Crm |
| 17 | + module Objects |
| 18 | + module Communications |
| 19 | + class BatchApi |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = ApiClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + # Archive a batch of Communications by ID |
| 26 | + # @param batch_input_simple_public_object_id [BatchInputSimplePublicObjectId] |
| 27 | + # @param [Hash] opts the optional parameters |
| 28 | + # @return [nil] |
| 29 | + def archive(batch_input_simple_public_object_id, opts = {}) |
| 30 | + archive_with_http_info(batch_input_simple_public_object_id, opts) |
| 31 | + nil |
| 32 | + end |
| 33 | + |
| 34 | + # Archive a batch of Communications by ID |
| 35 | + # @param batch_input_simple_public_object_id [BatchInputSimplePublicObjectId] |
| 36 | + # @param [Hash] opts the optional parameters |
| 37 | + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers |
| 38 | + def archive_with_http_info(batch_input_simple_public_object_id, opts = {}) |
| 39 | + if @api_client.config.debugging |
| 40 | + @api_client.config.logger.debug 'Calling API: BatchApi.archive ...' |
| 41 | + end |
| 42 | + # verify the required parameter 'batch_input_simple_public_object_id' is set |
| 43 | + if @api_client.config.client_side_validation && batch_input_simple_public_object_id.nil? |
| 44 | + fail ArgumentError, "Missing the required parameter 'batch_input_simple_public_object_id' when calling BatchApi.archive" |
| 45 | + end |
| 46 | + # resource path |
| 47 | + local_var_path = '/crm/v3/objects/Communications/batch/archive' |
| 48 | + |
| 49 | + # query parameters |
| 50 | + query_params = opts[:query_params] || {} |
| 51 | + |
| 52 | + # header parameters |
| 53 | + header_params = opts[:header_params] || {} |
| 54 | + # HTTP header 'Accept' (if needed) |
| 55 | + header_params['Accept'] = @api_client.select_header_accept(['*/*']) |
| 56 | + # HTTP header 'Content-Type' |
| 57 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 58 | + if !content_type.nil? |
| 59 | + header_params['Content-Type'] = content_type |
| 60 | + end |
| 61 | + |
| 62 | + # form parameters |
| 63 | + form_params = opts[:form_params] || {} |
| 64 | + |
| 65 | + # http body (model) |
| 66 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_simple_public_object_id) |
| 67 | + |
| 68 | + # return_type |
| 69 | + return_type = opts[:debug_return_type] |
| 70 | + |
| 71 | + # auth_names |
| 72 | + auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2'] |
| 73 | + |
| 74 | + new_options = opts.merge( |
| 75 | + :operation => :"BatchApi.archive", |
| 76 | + :header_params => header_params, |
| 77 | + :query_params => query_params, |
| 78 | + :form_params => form_params, |
| 79 | + :body => post_body, |
| 80 | + :auth_names => auth_names, |
| 81 | + :return_type => return_type |
| 82 | + ) |
| 83 | + |
| 84 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 85 | + if @api_client.config.debugging |
| 86 | + @api_client.config.logger.debug "API called: BatchApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 87 | + end |
| 88 | + return data, status_code, headers |
| 89 | + end |
| 90 | + |
| 91 | + # Create a batch of Communications |
| 92 | + # @param batch_input_simple_public_object_input_for_create [BatchInputSimplePublicObjectInputForCreate] |
| 93 | + # @param [Hash] opts the optional parameters |
| 94 | + # @return [BatchResponseSimplePublicObject] |
| 95 | + def create(batch_input_simple_public_object_input_for_create, opts = {}) |
| 96 | + data, _status_code, _headers = create_with_http_info(batch_input_simple_public_object_input_for_create, opts) |
| 97 | + data |
| 98 | + end |
| 99 | + |
| 100 | + # Create a batch of Communications |
| 101 | + # @param batch_input_simple_public_object_input_for_create [BatchInputSimplePublicObjectInputForCreate] |
| 102 | + # @param [Hash] opts the optional parameters |
| 103 | + # @return [Array<(BatchResponseSimplePublicObject, Integer, Hash)>] BatchResponseSimplePublicObject data, response status code and response headers |
| 104 | + def create_with_http_info(batch_input_simple_public_object_input_for_create, opts = {}) |
| 105 | + if @api_client.config.debugging |
| 106 | + @api_client.config.logger.debug 'Calling API: BatchApi.create ...' |
| 107 | + end |
| 108 | + # verify the required parameter 'batch_input_simple_public_object_input_for_create' is set |
| 109 | + if @api_client.config.client_side_validation && batch_input_simple_public_object_input_for_create.nil? |
| 110 | + fail ArgumentError, "Missing the required parameter 'batch_input_simple_public_object_input_for_create' when calling BatchApi.create" |
| 111 | + end |
| 112 | + # resource path |
| 113 | + local_var_path = '/crm/v3/objects/Communications/batch/create' |
| 114 | + |
| 115 | + # query parameters |
| 116 | + query_params = opts[:query_params] || {} |
| 117 | + |
| 118 | + # header parameters |
| 119 | + header_params = opts[:header_params] || {} |
| 120 | + # HTTP header 'Accept' (if needed) |
| 121 | + header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) |
| 122 | + # HTTP header 'Content-Type' |
| 123 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 124 | + if !content_type.nil? |
| 125 | + header_params['Content-Type'] = content_type |
| 126 | + end |
| 127 | + |
| 128 | + # form parameters |
| 129 | + form_params = opts[:form_params] || {} |
| 130 | + |
| 131 | + # http body (model) |
| 132 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_simple_public_object_input_for_create) |
| 133 | + |
| 134 | + # return_type |
| 135 | + return_type = opts[:debug_return_type] || 'BatchResponseSimplePublicObject' |
| 136 | + |
| 137 | + # auth_names |
| 138 | + auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2'] |
| 139 | + |
| 140 | + new_options = opts.merge( |
| 141 | + :operation => :"BatchApi.create", |
| 142 | + :header_params => header_params, |
| 143 | + :query_params => query_params, |
| 144 | + :form_params => form_params, |
| 145 | + :body => post_body, |
| 146 | + :auth_names => auth_names, |
| 147 | + :return_type => return_type |
| 148 | + ) |
| 149 | + |
| 150 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 151 | + if @api_client.config.debugging |
| 152 | + @api_client.config.logger.debug "API called: BatchApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 153 | + end |
| 154 | + return data, status_code, headers |
| 155 | + end |
| 156 | + |
| 157 | + # Read a batch of Communications by internal ID, or unique property values |
| 158 | + # @param batch_read_input_simple_public_object_id [BatchReadInputSimplePublicObjectId] |
| 159 | + # @param [Hash] opts the optional parameters |
| 160 | + # @option opts [Boolean] :archived Whether to return only results that have been archived. (default to false) |
| 161 | + # @return [BatchResponseSimplePublicObject] |
| 162 | + def read(batch_read_input_simple_public_object_id, opts = {}) |
| 163 | + data, _status_code, _headers = read_with_http_info(batch_read_input_simple_public_object_id, opts) |
| 164 | + data |
| 165 | + end |
| 166 | + |
| 167 | + # Read a batch of Communications by internal ID, or unique property values |
| 168 | + # @param batch_read_input_simple_public_object_id [BatchReadInputSimplePublicObjectId] |
| 169 | + # @param [Hash] opts the optional parameters |
| 170 | + # @option opts [Boolean] :archived Whether to return only results that have been archived. (default to false) |
| 171 | + # @return [Array<(BatchResponseSimplePublicObject, Integer, Hash)>] BatchResponseSimplePublicObject data, response status code and response headers |
| 172 | + def read_with_http_info(batch_read_input_simple_public_object_id, opts = {}) |
| 173 | + if @api_client.config.debugging |
| 174 | + @api_client.config.logger.debug 'Calling API: BatchApi.read ...' |
| 175 | + end |
| 176 | + # verify the required parameter 'batch_read_input_simple_public_object_id' is set |
| 177 | + if @api_client.config.client_side_validation && batch_read_input_simple_public_object_id.nil? |
| 178 | + fail ArgumentError, "Missing the required parameter 'batch_read_input_simple_public_object_id' when calling BatchApi.read" |
| 179 | + end |
| 180 | + # resource path |
| 181 | + local_var_path = '/crm/v3/objects/Communications/batch/read' |
| 182 | + |
| 183 | + # query parameters |
| 184 | + query_params = opts[:query_params] || {} |
| 185 | + query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? |
| 186 | + |
| 187 | + # header parameters |
| 188 | + header_params = opts[:header_params] || {} |
| 189 | + # HTTP header 'Accept' (if needed) |
| 190 | + header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) |
| 191 | + # HTTP header 'Content-Type' |
| 192 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 193 | + if !content_type.nil? |
| 194 | + header_params['Content-Type'] = content_type |
| 195 | + end |
| 196 | + |
| 197 | + # form parameters |
| 198 | + form_params = opts[:form_params] || {} |
| 199 | + |
| 200 | + # http body (model) |
| 201 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_read_input_simple_public_object_id) |
| 202 | + |
| 203 | + # return_type |
| 204 | + return_type = opts[:debug_return_type] || 'BatchResponseSimplePublicObject' |
| 205 | + |
| 206 | + # auth_names |
| 207 | + auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2'] |
| 208 | + |
| 209 | + new_options = opts.merge( |
| 210 | + :operation => :"BatchApi.read", |
| 211 | + :header_params => header_params, |
| 212 | + :query_params => query_params, |
| 213 | + :form_params => form_params, |
| 214 | + :body => post_body, |
| 215 | + :auth_names => auth_names, |
| 216 | + :return_type => return_type |
| 217 | + ) |
| 218 | + |
| 219 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 220 | + if @api_client.config.debugging |
| 221 | + @api_client.config.logger.debug "API called: BatchApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 222 | + end |
| 223 | + return data, status_code, headers |
| 224 | + end |
| 225 | + |
| 226 | + # Update a batch of Communications |
| 227 | + # @param batch_input_simple_public_object_batch_input [BatchInputSimplePublicObjectBatchInput] |
| 228 | + # @param [Hash] opts the optional parameters |
| 229 | + # @return [BatchResponseSimplePublicObject] |
| 230 | + def update(batch_input_simple_public_object_batch_input, opts = {}) |
| 231 | + data, _status_code, _headers = update_with_http_info(batch_input_simple_public_object_batch_input, opts) |
| 232 | + data |
| 233 | + end |
| 234 | + |
| 235 | + # Update a batch of Communications |
| 236 | + # @param batch_input_simple_public_object_batch_input [BatchInputSimplePublicObjectBatchInput] |
| 237 | + # @param [Hash] opts the optional parameters |
| 238 | + # @return [Array<(BatchResponseSimplePublicObject, Integer, Hash)>] BatchResponseSimplePublicObject data, response status code and response headers |
| 239 | + def update_with_http_info(batch_input_simple_public_object_batch_input, opts = {}) |
| 240 | + if @api_client.config.debugging |
| 241 | + @api_client.config.logger.debug 'Calling API: BatchApi.update ...' |
| 242 | + end |
| 243 | + # verify the required parameter 'batch_input_simple_public_object_batch_input' is set |
| 244 | + if @api_client.config.client_side_validation && batch_input_simple_public_object_batch_input.nil? |
| 245 | + fail ArgumentError, "Missing the required parameter 'batch_input_simple_public_object_batch_input' when calling BatchApi.update" |
| 246 | + end |
| 247 | + # resource path |
| 248 | + local_var_path = '/crm/v3/objects/Communications/batch/update' |
| 249 | + |
| 250 | + # query parameters |
| 251 | + query_params = opts[:query_params] || {} |
| 252 | + |
| 253 | + # header parameters |
| 254 | + header_params = opts[:header_params] || {} |
| 255 | + # HTTP header 'Accept' (if needed) |
| 256 | + header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) |
| 257 | + # HTTP header 'Content-Type' |
| 258 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 259 | + if !content_type.nil? |
| 260 | + header_params['Content-Type'] = content_type |
| 261 | + end |
| 262 | + |
| 263 | + # form parameters |
| 264 | + form_params = opts[:form_params] || {} |
| 265 | + |
| 266 | + # http body (model) |
| 267 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_simple_public_object_batch_input) |
| 268 | + |
| 269 | + # return_type |
| 270 | + return_type = opts[:debug_return_type] || 'BatchResponseSimplePublicObject' |
| 271 | + |
| 272 | + # auth_names |
| 273 | + auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2'] |
| 274 | + |
| 275 | + new_options = opts.merge( |
| 276 | + :operation => :"BatchApi.update", |
| 277 | + :header_params => header_params, |
| 278 | + :query_params => query_params, |
| 279 | + :form_params => form_params, |
| 280 | + :body => post_body, |
| 281 | + :auth_names => auth_names, |
| 282 | + :return_type => return_type |
| 283 | + ) |
| 284 | + |
| 285 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 286 | + if @api_client.config.debugging |
| 287 | + @api_client.config.logger.debug "API called: BatchApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 288 | + end |
| 289 | + return data, status_code, headers |
| 290 | + end |
| 291 | + end |
| 292 | + end |
| 293 | + end |
| 294 | + end |
| 295 | +end |
0 commit comments