Class: KlaviyoAPI::ImagesApi
- Inherits:
-
Object
- Object
- KlaviyoAPI::ImagesApi
- Defined in:
- lib/klaviyo-api-sdk/api/images_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_image(id, opts = {}) ⇒ Hash<String, Object>
Get Image Get the image with the given image ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:read`. -
#get_image_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Image Get the image with the given image ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:read`.
-
#get_images(opts = {}) ⇒ Hash<String, Object>
Get Images Get all images in an account.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:read`. -
#get_images_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Images Get all images in an account.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:read`.
-
#initialize(api_client = ApiClient.default) ⇒ ImagesApi
constructor
A new instance of ImagesApi.
-
#update_image(id, image_partial_update_query, opts = {}) ⇒ Hash<String, Object>
Update Image Update the image with the given image ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:write`. -
#update_image_with_http_info(id, image_partial_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Update Image Update the image with the given image ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:write`.
-
#upload_image_from_file(file, opts = {}) ⇒ Hash<String, Object>
(also: #create_image_upload)
Upload Image From File Upload an image from a file.
-
#upload_image_from_file_with_http_info(file, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
(also: #create_image_upload_with_http_info)
Upload Image From File Upload an image from a file.
-
#upload_image_from_url(image_create_query, opts = {}) ⇒ Hash<String, Object>
(also: #create_image)
Upload Image From URL Import an image from a url or data uri.
-
#upload_image_from_url_with_http_info(image_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
(also: #create_image_with_http_info)
Upload Image From URL Import an image from a url or data uri.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_image(id, opts = {}) ⇒ Hash<String, Object>
Get Image Get the image with the given image ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:read`
28 29 30 31 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 28 def get_image(id, opts = {}) data, _status_code, _headers = get_image_with_http_info(id, opts) data end |
#get_image_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Image Get the image with the given image ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:read`
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 39 def get_image_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.get_image ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ImagesApi.get_image" end allowable_values = ["name", "image_url", "format", "size", "hidden", "updated_at"] if @api_client.config.client_side_validation && opts[:'fields_image'] && !opts[:'fields_image'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_image\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/images/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[image]'] = @api_client.build_collection_param(opts[:'fields_image'], :csv) if !opts[:'fields_image'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth'] = opts.merge( :operation => :"ImagesApi.get_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#get_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_images(opts = {}) ⇒ Hash<String, Object>
Get Images Get all images in an account.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:read`
103 104 105 106 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 103 def get_images(opts = {}) data, _status_code, _headers = get_images_with_http_info(opts) data end |
#get_images_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Images Get all images in an account.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:read`
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 117 def get_images_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.get_images ...' end allowable_values = ["name", "image_url", "format", "size", "hidden", "updated_at"] if @api_client.config.client_side_validation && opts[:'fields_image'] && !opts[:'fields_image'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_image\", must include one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ImagesApi.get_images, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ImagesApi.get_images, must be greater than or equal to 1.' end allowable_values = ["format", "-format", "id", "-id", "name", "-name", "size", "-size", "updated_at", "-updated_at"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/images' # query parameters query_params = opts[:query_params] || {} query_params[:'fields[image]'] = @api_client.build_collection_param(opts[:'fields_image'], :csv) if !opts[:'fields_image'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth'] = opts.merge( :operation => :"ImagesApi.get_images", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#get_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_image(id, image_partial_update_query, opts = {}) ⇒ Hash<String, Object>
Update Image Update the image with the given image ID.
*Rate limits*:
Burst: ‘10/s`
Steady: `150/m` Scopes: `images:write`
190 191 192 193 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 190 def update_image(id, image_partial_update_query, opts = {}) data, _status_code, _headers = update_image_with_http_info(id, image_partial_update_query, opts) data end |
#update_image_with_http_info(id, image_partial_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Update Image Update the image with the given image ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` Scopes: `images:write`
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 201 def update_image_with_http_info(id, image_partial_update_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.update_image ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ImagesApi.update_image" end # verify the required parameter 'image_partial_update_query' is set if @api_client.config.client_side_validation && image_partial_update_query.nil? fail ArgumentError, "Missing the required parameter 'image_partial_update_query' when calling ImagesApi.update_image" end # resource path local_var_path = '/api/images/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/vnd.api+json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(image_partial_update_query) # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth'] = opts.merge( :operation => :"ImagesApi.update_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#update_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#upload_image_from_file(file, opts = {}) ⇒ Hash<String, Object> Also known as: create_image_upload
Upload Image From File Upload an image from a file. If you want to import an image from an existing url or a data uri, use the Upload Image From URL endpoint instead.
*Rate limits*:
Burst: ‘3/s`
Steady: `100/m`
Daily: `100/d` Scopes: `images:write`
267 268 269 270 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 267 def upload_image_from_file(file, opts = {}) data, _status_code, _headers = upload_image_from_file_with_http_info(file, opts) data end |
#upload_image_from_file_with_http_info(file, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_image_upload_with_http_info
Upload Image From File Upload an image from a file. If you want to import an image from an existing url or a data uri, use the Upload Image From URL endpoint instead.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `100/m`<br>Daily: `100/d` Scopes: `images:write`
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 282 def upload_image_from_file_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.upload_image_from_file ...' end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling ImagesApi.upload_image_from_file" end # resource path local_var_path = '/api/image-upload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = file form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['hidden'] = opts[:'hidden'] if !opts[:'hidden'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth'] = opts.merge( :operation => :"ImagesApi.upload_image_from_file", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#upload_image_from_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#upload_image_from_url(image_create_query, opts = {}) ⇒ Hash<String, Object> Also known as: create_image
Upload Image From URL Import an image from a url or data uri. If you want to upload an image from a file, use the Upload Image From File endpoint instead.
*Rate limits*:
Burst: ‘3/s`
Steady: `100/m`
Daily: `100/d` Scopes: `images:write`
348 349 350 351 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 348 def upload_image_from_url(image_create_query, opts = {}) data, _status_code, _headers = upload_image_from_url_with_http_info(image_create_query, opts) data end |
#upload_image_from_url_with_http_info(image_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)> Also known as: create_image_with_http_info
Upload Image From URL Import an image from a url or data uri. If you want to upload an image from a file, use the Upload Image From File endpoint instead.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `100/m`<br>Daily: `100/d` Scopes: `images:write`
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/klaviyo-api-sdk/api/images_api.rb', line 361 def upload_image_from_url_with_http_info(image_create_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.upload_image_from_url ...' end # verify the required parameter 'image_create_query' is set if @api_client.config.client_side_validation && image_create_query.nil? fail ArgumentError, "Missing the required parameter 'image_create_query' when calling ImagesApi.upload_image_from_url" end # resource path local_var_path = '/api/images' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['KLAVIYO_API_REVISION'] || ENV['API_REVISION'] || "2025-01-15" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/vnd.api+json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(image_create_query) # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key', 'OAuth'] = opts.merge( :operation => :"ImagesApi.upload_image_from_url", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#upload_image_from_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |