Class: DevDraftAI::ProductsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/devdraft/api/products_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProductsApi

Returns a new instance of ProductsApi.



16
17
18
# File 'lib/devdraft/api/products_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/devdraft/api/products_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#product_controller_create(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, opts = {}) ⇒ nil

Create a new product Creates a new product with optional image uploads. This endpoint allows you to create products with detailed information and multiple images. ## Use Cases - Add new products to your catalog - Create products with multiple images - Set up product pricing and descriptions ## Supported Image Formats - JPEG/JPG - PNG - WebP - Maximum 10 images per product - Maximum file size: 5MB per image ## Example Request (multipart/form-data) “‘ name: "Premium Widget" description: "High-quality widget for all your needs" price: "99.99" images: [file1.jpg, file2.jpg] // Optional, up to 10 images “` ## Required Fields - `name`: Product name - `price`: Product price (decimal number) ## Optional Fields - `description`: Detailed product description - `images`: Product images (up to 10 files)

Parameters:

  • name
  • description
  • price
  • currency
  • type
  • weight
  • unit
  • quantity
  • stock_count
  • status
  • product_type
  • images
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


35
36
37
38
# File 'lib/devdraft/api/products_api.rb', line 35

def product_controller_create(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, opts = {})
  product_controller_create_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, opts)
  nil
end

#product_controller_create_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create a new product Creates a new product with optional image uploads. This endpoint allows you to create products with detailed information and multiple images. ## Use Cases - Add new products to your catalog - Create products with multiple images - Set up product pricing and descriptions ## Supported Image Formats - JPEG/JPG - PNG - WebP - Maximum 10 images per product - Maximum file size: 5MB per image ## Example Request (multipart/form-data) &#x60;&#x60;&#x60; name: &quot;Premium Widget&quot; description: &quot;High-quality widget for all your needs&quot; price: &quot;99.99&quot; images: [file1.jpg, file2.jpg] // Optional, up to 10 images &#x60;&#x60;&#x60; ## Required Fields - &#x60;name&#x60;: Product name - &#x60;price&#x60;: Product price (decimal number) ## Optional Fields - &#x60;description&#x60;: Detailed product description - &#x60;images&#x60;: Product images (up to 10 files)

Parameters:

  • name
  • description
  • price
  • currency
  • type
  • weight
  • unit
  • quantity
  • stock_count
  • status
  • product_type
  • images
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/devdraft/api/products_api.rb', line 56

def product_controller_create_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_create ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'description' is set
  if @api_client.config.client_side_validation && description.nil?
    fail ArgumentError, "Missing the required parameter 'description' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'price' is set
  if @api_client.config.client_side_validation && price.nil?
    fail ArgumentError, "Missing the required parameter 'price' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'currency' is set
  if @api_client.config.client_side_validation && currency.nil?
    fail ArgumentError, "Missing the required parameter 'currency' when calling ProductsApi.product_controller_create"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY'].include?(currency)
    fail ArgumentError, "invalid value for 'currency', must be one of USD, EUR, GBP, CAD, AUD, JPY"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'weight' is set
  if @api_client.config.client_side_validation && weight.nil?
    fail ArgumentError, "Missing the required parameter 'weight' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'unit' is set
  if @api_client.config.client_side_validation && unit.nil?
    fail ArgumentError, "Missing the required parameter 'unit' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'quantity' is set
  if @api_client.config.client_side_validation && quantity.nil?
    fail ArgumentError, "Missing the required parameter 'quantity' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'stock_count' is set
  if @api_client.config.client_side_validation && stock_count.nil?
    fail ArgumentError, "Missing the required parameter 'stock_count' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'product_type' is set
  if @api_client.config.client_side_validation && product_type.nil?
    fail ArgumentError, "Missing the required parameter 'product_type' when calling ProductsApi.product_controller_create"
  end
  # verify the required parameter 'images' is set
  if @api_client.config.client_side_validation && images.nil?
    fail ArgumentError, "Missing the required parameter 'images' when calling ProductsApi.product_controller_create"
  end
  # resource path
  local_var_path = '/api/v0/products'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # 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['name'] = name
  form_params['description'] = description
  form_params['price'] = price
  form_params['currency'] = currency
  form_params['type'] = type
  form_params['weight'] = weight
  form_params['unit'] = unit
  form_params['quantity'] = quantity
  form_params['stockCount'] = stock_count
  form_params['status'] = status
  form_params['productType'] = product_type
  form_params['images'] = @api_client.build_collection_param(images, :multi)

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_controller_find_all(opts = {}) ⇒ nil

Get all products Retrieves a list of products with pagination. This endpoint allows you to fetch products with optional pagination. ## Use Cases - List all products - Browse product catalog - Implement product search ## Query Parameters - ‘skip`: Number of records to skip (default: 0) - `take`: Number of records to take (default: 10) ## Example Response “`json { "data": [ { "id": "prod_123456", "name": "Premium Widget", "description": "High-quality widget for all your needs", "price": "99.99", "images": [ "", "" ], "createdAt": "2024-03-20T10:00:00Z" } ], "total": 100, "skip": 0, "take": 10 } “`

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :skip (BigDecimal)

    Number of records to skip

  • :take (BigDecimal)

    Number of records to take

Returns:

  • (nil)


163
164
165
166
# File 'lib/devdraft/api/products_api.rb', line 163

def product_controller_find_all(opts = {})
  product_controller_find_all_with_http_info(opts)
  nil
end

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

Get all products Retrieves a list of products with pagination. This endpoint allows you to fetch products with optional pagination. ## Use Cases - List all products - Browse product catalog - Implement product search ## Query Parameters - &#x60;skip&#x60;: Number of records to skip (default: 0) - &#x60;take&#x60;: Number of records to take (default: 10) ## Example Response &#x60;&#x60;&#x60;json { &quot;data&quot;: [ { &quot;id&quot;: &quot;prod_123456&quot;, &quot;name&quot;: &quot;Premium Widget&quot;, &quot;description&quot;: &quot;High-quality widget for all your needs&quot;, &quot;price&quot;: &quot;99.99&quot;, &quot;images&quot;: [ &quot;&quot;, &quot;&quot; ], &quot;createdAt&quot;: &quot;2024-03-20T10:00:00Z&quot; } ], &quot;total&quot;: 100, &quot;skip&quot;: 0, &quot;take&quot;: 10 } &#x60;&#x60;&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :skip (BigDecimal)

    Number of records to skip

  • :take (BigDecimal)

    Number of records to take

Returns:

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

    nil, response status code and response headers



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/devdraft/api/products_api.rb', line 174

def product_controller_find_all_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_find_all ...'
  end
  # resource path
  local_var_path = '/api/v0/products'

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_find_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_controller_find_one(id, opts = {}) ⇒ nil

Get a product by ID Retrieves detailed information about a specific product. This endpoint allows you to fetch complete product details including all images. ## Use Cases - View product details - Display product information - Check product availability ## Example Response “‘json { "id": "prod_123456", "name": "Premium Widget", "description": "High-quality widget for all your needs", "price": "99.99", "images": [ "", "" ], "createdAt": "2024-03-20T10:00:00Z", "updatedAt": "2024-03-20T10:00:00Z" } “`

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

  • (nil)


216
217
218
219
# File 'lib/devdraft/api/products_api.rb', line 216

def product_controller_find_one(id, opts = {})
  product_controller_find_one_with_http_info(id, opts)
  nil
end

#product_controller_find_one_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get a product by ID Retrieves detailed information about a specific product. This endpoint allows you to fetch complete product details including all images. ## Use Cases - View product details - Display product information - Check product availability ## Example Response &#x60;&#x60;&#x60;json { &quot;id&quot;: &quot;prod_123456&quot;, &quot;name&quot;: &quot;Premium Widget&quot;, &quot;description&quot;: &quot;High-quality widget for all your needs&quot;, &quot;price&quot;: &quot;99.99&quot;, &quot;images&quot;: [ &quot;&quot;, &quot;&quot; ], &quot;createdAt&quot;: &quot;2024-03-20T10:00:00Z&quot;, &quot;updatedAt&quot;: &quot;2024-03-20T10:00:00Z&quot; } &#x60;&#x60;&#x60;

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
259
260
261
262
263
264
# File 'lib/devdraft/api/products_api.rb', line 226

def product_controller_find_one_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_find_one ...'
  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 ProductsApi.product_controller_find_one"
  end
  # resource path
  local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_find_one\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_controller_remove(id, opts = {}) ⇒ nil

Delete a product Deletes a product and its associated images. This endpoint allows you to remove a product and all its associated data. ## Use Cases - Remove discontinued products - Clean up product catalog - Delete test products ## Notes - This action cannot be undone - All product images will be deleted - Associated data will be removed

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

  • (nil)


270
271
272
273
# File 'lib/devdraft/api/products_api.rb', line 270

def product_controller_remove(id, opts = {})
  product_controller_remove_with_http_info(id, opts)
  nil
end

#product_controller_remove_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a product Deletes a product and its associated images. This endpoint allows you to remove a product and all its associated data. ## Use Cases - Remove discontinued products - Clean up product catalog - Delete test products ## Notes - This action cannot be undone - All product images will be deleted - Associated data will be removed

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



280
281
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
# File 'lib/devdraft/api/products_api.rb', line 280

def product_controller_remove_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_remove ...'
  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 ProductsApi.product_controller_remove"
  end
  # resource path
  local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_controller_update(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, id, opts = {}) ⇒ nil

Update a product Updates an existing product’s information and optionally adds new images. This endpoint allows you to modify product details and manage product images. ## Use Cases - Update product information - Change product pricing - Modify product images - Update product description ## Example Request (multipart/form-data) “‘ name: "Updated Premium Widget" description: "Updated description" price: "129.99" images: [file1.jpg, file2.jpg] // Optional, up to 10 images “` ## Notes - Only include fields that need to be updated - New images will replace existing images - Maximum 10 images per product - Images are automatically optimized

Parameters:

  • name
  • description
  • price
  • currency
  • type
  • weight
  • unit
  • quantity
  • stock_count
  • status
  • product_type
  • images
  • id

    Product ID

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

    the optional parameters

Returns:

  • (nil)


336
337
338
339
# File 'lib/devdraft/api/products_api.rb', line 336

def product_controller_update(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, id, opts = {})
  product_controller_update_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, id, opts)
  nil
end

#product_controller_update_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update a product Updates an existing product&#x27;s information and optionally adds new images. This endpoint allows you to modify product details and manage product images. ## Use Cases - Update product information - Change product pricing - Modify product images - Update product description ## Example Request (multipart/form-data) &#x60;&#x60;&#x60; name: &quot;Updated Premium Widget&quot; description: &quot;Updated description&quot; price: &quot;129.99&quot; images: [file1.jpg, file2.jpg] // Optional, up to 10 images &#x60;&#x60;&#x60; ## Notes - Only include fields that need to be updated - New images will replace existing images - Maximum 10 images per product - Images are automatically optimized

Parameters:

  • name
  • description
  • price
  • currency
  • type
  • weight
  • unit
  • quantity
  • stock_count
  • status
  • product_type
  • images
  • id

    Product ID

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



358
359
360
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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/devdraft/api/products_api.rb', line 358

def product_controller_update_with_http_info(name, description, price, currency, type, weight, unit, quantity, stock_count, status, product_type, images, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_update ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'description' is set
  if @api_client.config.client_side_validation && description.nil?
    fail ArgumentError, "Missing the required parameter 'description' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'price' is set
  if @api_client.config.client_side_validation && price.nil?
    fail ArgumentError, "Missing the required parameter 'price' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'currency' is set
  if @api_client.config.client_side_validation && currency.nil?
    fail ArgumentError, "Missing the required parameter 'currency' when calling ProductsApi.product_controller_update"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY'].include?(currency)
    fail ArgumentError, "invalid value for 'currency', must be one of USD, EUR, GBP, CAD, AUD, JPY"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'weight' is set
  if @api_client.config.client_side_validation && weight.nil?
    fail ArgumentError, "Missing the required parameter 'weight' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'unit' is set
  if @api_client.config.client_side_validation && unit.nil?
    fail ArgumentError, "Missing the required parameter 'unit' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'quantity' is set
  if @api_client.config.client_side_validation && quantity.nil?
    fail ArgumentError, "Missing the required parameter 'quantity' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'stock_count' is set
  if @api_client.config.client_side_validation && stock_count.nil?
    fail ArgumentError, "Missing the required parameter 'stock_count' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'product_type' is set
  if @api_client.config.client_side_validation && product_type.nil?
    fail ArgumentError, "Missing the required parameter 'product_type' when calling ProductsApi.product_controller_update"
  end
  # verify the required parameter 'images' is set
  if @api_client.config.client_side_validation && images.nil?
    fail ArgumentError, "Missing the required parameter 'images' when calling ProductsApi.product_controller_update"
  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 ProductsApi.product_controller_update"
  end
  # resource path
  local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # 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['name'] = name
  form_params['description'] = description
  form_params['price'] = price
  form_params['currency'] = currency
  form_params['type'] = type
  form_params['weight'] = weight
  form_params['unit'] = unit
  form_params['quantity'] = quantity
  form_params['stockCount'] = stock_count
  form_params['status'] = status
  form_params['productType'] = product_type
  form_params['images'] = @api_client.build_collection_param(images, :multi)

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_controller_upload_image(id, opts = {}) ⇒ nil

Upload images for a product Adds new images to an existing product. This endpoint allows you to upload additional images for a product that already exists. ## Use Cases - Add more product images - Update product gallery - Enhance product presentation ## Supported Image Formats - JPEG/JPG - PNG - WebP - Maximum 10 images per upload - Maximum file size: 5MB per image ## Example Request (multipart/form-data) “‘ images: [file1.jpg, file2.jpg] // Up to 10 images “` ## Notes - Images are appended to existing product images - Total images per product cannot exceed 10 - Images are automatically optimized and resized

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

  • (nil)


468
469
470
471
# File 'lib/devdraft/api/products_api.rb', line 468

def product_controller_upload_image(id, opts = {})
  product_controller_upload_image_with_http_info(id, opts)
  nil
end

#product_controller_upload_image_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upload images for a product Adds new images to an existing product. This endpoint allows you to upload additional images for a product that already exists. ## Use Cases - Add more product images - Update product gallery - Enhance product presentation ## Supported Image Formats - JPEG/JPG - PNG - WebP - Maximum 10 images per upload - Maximum file size: 5MB per image ## Example Request (multipart/form-data) &#x60;&#x60;&#x60; images: [file1.jpg, file2.jpg] // Up to 10 images &#x60;&#x60;&#x60; ## Notes - Images are appended to existing product images - Total images per product cannot exceed 10 - Images are automatically optimized and resized

Parameters:

  • id

    Product ID

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/devdraft/api/products_api.rb', line 478

def product_controller_upload_image_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_upload_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 ProductsApi.product_controller_upload_image"
  end
  # resource path
  local_var_path = '/api/v0/products/{id}/images'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#product_controller_upload_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end