devdraft 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +155 -253
- data/Rakefile +2 -0
- data/devdraft-1.0.0.gem +0 -0
- data/{devdraft_ai_sdk.gemspec → devdraft.gemspec} +15 -11
- data/docs/APIHealthApi.md +82 -30
- data/docs/AggregatedBalanceResponse.md +19 -6
- data/docs/AllBalancesResponse.md +19 -6
- data/docs/AppBalancesApi.md +125 -65
- data/docs/BridgeFiatPaymentRail.md +15 -0
- data/docs/BridgePaymentRail.md +12 -3
- data/docs/CreateBankPaymentIntentDto.md +49 -21
- data/docs/CreateCustomerDto.md +25 -9
- data/docs/CreateDirectBankTransferDto.md +29 -11
- data/docs/CreateDirectWalletTransferDto.md +21 -7
- data/docs/CreateExternalBankTransferDto.md +40 -0
- data/docs/CreateExternalStablecoinTransferDto.md +28 -0
- data/docs/CreateInvoiceDto.md +45 -19
- data/docs/CreateLiquidationAddressDto.md +43 -18
- data/docs/CreatePaymentLinkDto.md +53 -28
- data/docs/CreateStablePaymentIntentDto.md +43 -18
- data/docs/CreateStablecoinConversionDto.md +23 -8
- data/docs/CreateTaxDto.md +26 -0
- data/docs/CreateWebhookDto.md +23 -8
- data/docs/CustomerStatus.md +12 -3
- data/docs/CustomerType.md +15 -0
- data/docs/CustomersApi.md +187 -114
- data/docs/DestinationCurrency.md +12 -3
- data/docs/ExchangeRateResponseDto.md +25 -9
- data/docs/ExchangeRatesApi.md +130 -72
- data/docs/FiatCurrency.md +12 -3
- data/docs/HealthResponseDto.md +25 -9
- data/docs/InvoiceProductDto.md +17 -5
- data/docs/InvoicesApi.md +177 -104
- data/docs/LiquidationAddressResponseDto.md +41 -17
- data/docs/LiquidationAddressesApi.md +115 -61
- data/docs/PaymentIntentsApi.md +93 -57
- data/docs/PaymentLinkProductDto.md +17 -5
- data/docs/PaymentLinksApi.md +175 -102
- data/docs/PaymentRequestDto.md +21 -7
- data/docs/PaymentResponseDto.md +23 -8
- data/docs/ProductsApi.md +307 -194
- data/docs/PublicHealthResponseDto.md +19 -6
- data/docs/RefundResponseDto.md +23 -8
- data/docs/StableCoinCurrency.md +12 -3
- data/docs/TaxControllerCreate201Response.md +30 -0
- data/docs/TaxControllerDeleteWithoutId400Response.md +22 -0
- data/docs/TaxControllerUpdateWithoutId400Response.md +22 -0
- data/docs/TaxesApi.md +374 -122
- data/docs/TestPaymentsApi.md +150 -60
- data/docs/TransfersApi.md +274 -72
- data/docs/UpdateCustomerDto.md +25 -9
- data/docs/UpdateTaxDto.md +26 -0
- data/docs/UpdateWebhookDto.md +23 -8
- data/docs/WalletsApi.md +44 -24
- data/docs/WebhookResponseDto.md +29 -11
- data/docs/WebhooksApi.md +225 -134
- data/git_push.sh +41 -28
- data/lib/devdraft/api/api_health_api.rb +32 -16
- data/lib/devdraft/api/app_balances_api.rb +45 -22
- data/lib/devdraft/api/customers_api.rb +124 -71
- data/lib/devdraft/api/exchange_rates_api.rb +49 -26
- data/lib/devdraft/api/invoices_api.rb +89 -53
- data/lib/devdraft/api/liquidation_addresses_api.rb +70 -44
- data/lib/devdraft/api/payment_intents_api.rb +62 -40
- data/lib/devdraft/api/payment_links_api.rb +85 -49
- data/lib/devdraft/api/products_api.rb +214 -216
- data/lib/devdraft/api/taxes_api.rb +257 -66
- data/lib/devdraft/api/test_payments_api.rb +70 -44
- data/lib/devdraft/api/transfers_api.rb +206 -46
- data/lib/devdraft/api/wallets_api.rb +18 -9
- data/lib/devdraft/api/webhooks_api.rb +109 -66
- data/lib/devdraft/api_client.rb +76 -71
- data/lib/devdraft/api_error.rb +5 -4
- data/lib/devdraft/api_model_base.rb +88 -0
- data/lib/devdraft/configuration.rb +121 -18
- data/lib/devdraft/models/aggregated_balance_response.rb +68 -101
- data/lib/devdraft/models/all_balances_response.rb +76 -99
- data/lib/devdraft/models/bridge_fiat_payment_rail.rb +45 -0
- data/lib/devdraft/models/bridge_payment_rail.rb +36 -24
- data/lib/devdraft/models/create_bank_payment_intent_dto.rb +191 -114
- data/lib/devdraft/models/create_customer_dto.rb +123 -113
- data/lib/devdraft/models/create_direct_bank_transfer_dto.rb +105 -104
- data/lib/devdraft/models/create_direct_wallet_transfer_dto.rb +89 -100
- data/lib/devdraft/models/create_external_bank_transfer_dto.rb +505 -0
- data/lib/devdraft/models/create_external_stablecoin_transfer_dto.rb +266 -0
- data/lib/devdraft/models/create_invoice_dto.rb +151 -121
- data/lib/devdraft/models/create_liquidation_address_dto.rb +195 -115
- data/lib/devdraft/models/create_payment_link_dto.rb +192 -214
- data/lib/devdraft/models/create_stable_payment_intent_dto.rb +324 -111
- data/lib/devdraft/models/create_stablecoin_conversion_dto.rb +102 -101
- data/lib/devdraft/models/create_tax_dto.rb +281 -0
- data/lib/devdraft/models/create_webhook_dto.rb +104 -101
- data/lib/devdraft/models/customer_status.rb +23 -10
- data/lib/devdraft/models/customer_type.rb +45 -0
- data/lib/devdraft/models/destination_currency.rb +27 -15
- data/lib/devdraft/models/exchange_rate_response_dto.rb +103 -102
- data/lib/devdraft/models/fiat_currency.rb +22 -10
- data/lib/devdraft/models/health_response_dto.rb +99 -106
- data/lib/devdraft/models/invoice_product_dto.rb +63 -98
- data/lib/devdraft/models/liquidation_address_response_dto.rb +147 -110
- data/lib/devdraft/models/payment_link_product_dto.rb +70 -98
- data/lib/devdraft/models/payment_request_dto.rb +77 -100
- data/lib/devdraft/models/payment_response_dto.rb +102 -101
- data/lib/devdraft/models/public_health_response_dto.rb +68 -101
- data/lib/devdraft/models/refund_response_dto.rb +102 -101
- data/lib/devdraft/models/stable_coin_currency.rb +21 -9
- data/lib/devdraft/models/tax_controller_create201_response.rb +201 -0
- data/lib/devdraft/models/tax_controller_delete_without_id400_response.rb +165 -0
- data/lib/devdraft/models/tax_controller_update_without_id400_response.rb +165 -0
- data/lib/devdraft/models/update_customer_dto.rb +117 -113
- data/lib/devdraft/models/update_tax_dto.rb +256 -0
- data/lib/devdraft/models/update_webhook_dto.rb +70 -101
- data/lib/devdraft/models/webhook_response_dto.rb +140 -103
- data/lib/devdraft/version.rb +6 -5
- data/lib/devdraft.rb +18 -27
- data/spec/api/api_health_api_spec.rb +10 -9
- data/spec/api/app_balances_api_spec.rb +11 -10
- data/spec/api/customers_api_spec.rb +25 -24
- data/spec/api/exchange_rates_api_spec.rb +11 -10
- data/spec/api/invoices_api_spec.rb +16 -15
- data/spec/api/liquidation_addresses_api_spec.rb +13 -12
- data/spec/api/payment_intents_api_spec.rb +12 -11
- data/spec/api/payment_links_api_spec.rb +14 -13
- data/spec/api/products_api_spec.rb +41 -40
- data/spec/api/taxes_api_spec.rb +51 -21
- data/spec/api/test_payments_api_spec.rb +14 -13
- data/spec/api/transfers_api_spec.rb +36 -13
- data/spec/api/wallets_api_spec.rb +9 -8
- data/spec/api/webhooks_api_spec.rb +20 -19
- data/spec/models/aggregated_balance_response_spec.rb +15 -19
- data/spec/models/all_balances_response_spec.rb +14 -18
- data/spec/models/bridge_fiat_payment_rail_spec.rb +30 -0
- data/spec/models/bridge_payment_rail_spec.rb +11 -15
- data/spec/models/create_bank_payment_intent_dto_spec.rb +29 -33
- data/spec/models/create_customer_dto_spec.rb +17 -25
- data/spec/models/create_direct_bank_transfer_dto_spec.rb +19 -23
- data/spec/models/create_direct_wallet_transfer_dto_spec.rb +15 -19
- data/spec/models/create_external_bank_transfer_dto_spec.rb +102 -0
- data/spec/models/create_external_stablecoin_transfer_dto_spec.rb +66 -0
- data/spec/models/create_invoice_dto_spec.rb +31 -35
- data/spec/models/create_liquidation_address_dto_spec.rb +28 -32
- data/spec/models/create_payment_link_dto_spec.rb +34 -76
- data/spec/models/create_stable_payment_intent_dto_spec.rb +26 -30
- data/spec/models/create_stablecoin_conversion_dto_spec.rb +16 -20
- data/spec/models/create_tax_dto_spec.rb +60 -0
- data/spec/models/create_webhook_dto_spec.rb +16 -20
- data/spec/models/customer_status_spec.rb +11 -15
- data/spec/models/customer_type_spec.rb +30 -0
- data/spec/models/destination_currency_spec.rb +11 -15
- data/spec/models/exchange_rate_response_dto_spec.rb +17 -21
- data/spec/models/fiat_currency_spec.rb +11 -15
- data/spec/models/health_response_dto_spec.rb +19 -23
- data/spec/models/invoice_product_dto_spec.rb +13 -17
- data/spec/models/liquidation_address_response_dto_spec.rb +25 -29
- data/spec/models/payment_link_product_dto_spec.rb +13 -17
- data/spec/models/payment_request_dto_spec.rb +15 -19
- data/spec/models/payment_response_dto_spec.rb +16 -20
- data/spec/models/public_health_response_dto_spec.rb +15 -19
- data/spec/models/refund_response_dto_spec.rb +16 -20
- data/spec/models/stable_coin_currency_spec.rb +11 -15
- data/spec/models/tax_controller_create201_response_spec.rb +72 -0
- data/spec/models/tax_controller_delete_without_id400_response_spec.rb +48 -0
- data/spec/models/tax_controller_update_without_id400_response_spec.rb +48 -0
- data/spec/models/update_customer_dto_spec.rb +17 -25
- data/spec/models/update_tax_dto_spec.rb +60 -0
- data/spec/models/update_webhook_dto_spec.rb +16 -20
- data/spec/models/webhook_response_dto_spec.rb +19 -23
- data/spec/spec_helper.rb +5 -4
- metadata +49 -116
- data/docs/AllOfAllBalancesResponseEurc.md +0 -9
- data/docs/AllOfAllBalancesResponseUsdc.md +0 -9
- data/docs/AllOfCreateBankPaymentIntentDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoDestinationNetwork.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoSourceCurrency.md +0 -6
- data/docs/AllOfCreateBankPaymentIntentDtoSourcePaymentRail.md +0 -6
- data/docs/AllOfCreateCustomerDtoStatus.md +0 -6
- data/docs/AllOfCreateLiquidationAddressDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateLiquidationAddressDtoDestinationPaymentRail.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoDestinationCurrency.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoDestinationNetwork.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoSourceCurrency.md +0 -6
- data/docs/AllOfCreateStablePaymentIntentDtoSourceNetwork.md +0 -6
- data/docs/AllOfUpdateCustomerDtoStatus.md +0 -6
- data/docs/CreateProductDto.md +0 -18
- data/docs/CreateTaxInput.md +0 -6
- data/docs/UpdatePaymentLinkDto.md +0 -6
- data/docs/UpdatePreferenceInput.md +0 -6
- data/docs/UpdateProductDto.md +0 -18
- data/docs/UpdateTaxInput.md +0 -6
- data/example.rb +0 -129
- data/lib/devdraft/models/all_of_all_balances_response_eurc.rb +0 -283
- data/lib/devdraft/models/all_of_all_balances_response_usdc.rb +0 -283
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_destination_network.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_bank_payment_intent_dto_source_payment_rail.rb +0 -202
- data/lib/devdraft/models/all_of_create_customer_dto_status.rb +0 -202
- data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_liquidation_address_dto_destination_payment_rail.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_destination_network.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_currency.rb +0 -202
- data/lib/devdraft/models/all_of_create_stable_payment_intent_dto_source_network.rb +0 -202
- data/lib/devdraft/models/all_of_update_customer_dto_status.rb +0 -202
- data/lib/devdraft/models/create_product_dto.rb +0 -370
- data/lib/devdraft/models/create_tax_input.rb +0 -197
- data/lib/devdraft/models/update_payment_link_dto.rb +0 -197
- data/lib/devdraft/models/update_preference_input.rb +0 -197
- data/lib/devdraft/models/update_product_dto.rb +0 -355
- data/lib/devdraft/models/update_tax_input.rb +0 -197
- data/spec/api_client_spec.rb +0 -225
- data/spec/base_object_spec.rb +0 -109
- data/spec/configuration_spec.rb +0 -41
- data/spec/models/all_of_all_balances_response_eurc_spec.rb +0 -56
- data/spec/models/all_of_all_balances_response_usdc_spec.rb +0 -56
- data/spec/models/all_of_create_bank_payment_intent_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_destination_network_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_source_currency_spec.rb +0 -34
- data/spec/models/all_of_create_bank_payment_intent_dto_source_payment_rail_spec.rb +0 -34
- data/spec/models/all_of_create_customer_dto_status_spec.rb +0 -34
- data/spec/models/all_of_create_liquidation_address_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_liquidation_address_dto_destination_payment_rail_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_destination_currency_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_destination_network_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_source_currency_spec.rb +0 -34
- data/spec/models/all_of_create_stable_payment_intent_dto_source_network_spec.rb +0 -34
- data/spec/models/all_of_update_customer_dto_status_spec.rb +0 -34
- data/spec/models/create_product_dto_spec.rb +0 -110
- data/spec/models/create_tax_input_spec.rb +0 -34
- data/spec/models/update_payment_link_dto_spec.rb +0 -34
- data/spec/models/update_preference_input_spec.rb +0 -34
- data/spec/models/update_product_dto_spec.rb +0 -110
- data/spec/models/update_tax_input_spec.rb +0 -34
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
# A comprehensive payment processing and business management API that enables seamless integration of cryptocurrency and traditional payment methods.
|
|
5
5
|
|
|
6
|
-
OpenAPI
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.17.0
|
|
7
10
|
|
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
-
Swagger Codegen version: 3.0.65
|
|
10
11
|
=end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Devdraft
|
|
13
16
|
class ProductsApi
|
|
14
17
|
attr_accessor :api_client
|
|
15
18
|
|
|
@@ -18,42 +21,42 @@ module DevDraftAI
|
|
|
18
21
|
end
|
|
19
22
|
# Create a new product
|
|
20
23
|
# 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)
|
|
21
|
-
# @param name
|
|
22
|
-
# @param description
|
|
23
|
-
# @param price
|
|
24
|
-
# @param currency
|
|
25
|
-
# @param type
|
|
26
|
-
# @param weight
|
|
27
|
-
# @param unit
|
|
28
|
-
# @param quantity
|
|
29
|
-
# @param stock_count
|
|
30
|
-
# @param status
|
|
31
|
-
# @param product_type
|
|
32
|
-
# @param images
|
|
24
|
+
# @param name [String] Product name as it will appear to customers. Should be clear and descriptive.
|
|
25
|
+
# @param description [String] Detailed description of the product. Supports markdown formatting for rich text display.
|
|
26
|
+
# @param price [Float] Product price in the specified currency. Must be greater than 0.
|
|
33
27
|
# @param [Hash] opts the optional parameters
|
|
28
|
+
# @option opts [String] :currency Currency code for the price. Defaults to USD if not specified. (default to 'USD')
|
|
29
|
+
# @option opts [String] :type Product type
|
|
30
|
+
# @option opts [Float] :weight Weight of the product
|
|
31
|
+
# @option opts [String] :unit Unit of measurement
|
|
32
|
+
# @option opts [Float] :quantity Quantity available
|
|
33
|
+
# @option opts [Float] :stock_count Stock count
|
|
34
|
+
# @option opts [String] :status Product status
|
|
35
|
+
# @option opts [String] :product_type Product type
|
|
36
|
+
# @option opts [Array<String>] :images Array of image URLs
|
|
34
37
|
# @return [nil]
|
|
35
|
-
def product_controller_create(name, description, price,
|
|
36
|
-
product_controller_create_with_http_info(name, description, price,
|
|
38
|
+
def product_controller_create(name, description, price, opts = {})
|
|
39
|
+
product_controller_create_with_http_info(name, description, price, opts)
|
|
37
40
|
nil
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
# Create a new product
|
|
41
44
|
# 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)
|
|
42
|
-
# @param name
|
|
43
|
-
# @param description
|
|
44
|
-
# @param price
|
|
45
|
-
# @param currency
|
|
46
|
-
# @param type
|
|
47
|
-
# @param weight
|
|
48
|
-
# @param unit
|
|
49
|
-
# @param quantity
|
|
50
|
-
# @param stock_count
|
|
51
|
-
# @param status
|
|
52
|
-
# @param product_type
|
|
53
|
-
# @param images
|
|
45
|
+
# @param name [String] Product name as it will appear to customers. Should be clear and descriptive.
|
|
46
|
+
# @param description [String] Detailed description of the product. Supports markdown formatting for rich text display.
|
|
47
|
+
# @param price [Float] Product price in the specified currency. Must be greater than 0.
|
|
54
48
|
# @param [Hash] opts the optional parameters
|
|
49
|
+
# @option opts [String] :currency Currency code for the price. Defaults to USD if not specified. (default to 'USD')
|
|
50
|
+
# @option opts [String] :type Product type
|
|
51
|
+
# @option opts [Float] :weight Weight of the product
|
|
52
|
+
# @option opts [String] :unit Unit of measurement
|
|
53
|
+
# @option opts [Float] :quantity Quantity available
|
|
54
|
+
# @option opts [Float] :stock_count Stock count
|
|
55
|
+
# @option opts [String] :status Product status
|
|
56
|
+
# @option opts [String] :product_type Product type
|
|
57
|
+
# @option opts [Array<String>] :images Array of image URLs
|
|
55
58
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
56
|
-
def product_controller_create_with_http_info(name, description, price,
|
|
59
|
+
def product_controller_create_with_http_info(name, description, price, opts = {})
|
|
57
60
|
if @api_client.config.debugging
|
|
58
61
|
@api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_create ...'
|
|
59
62
|
end
|
|
@@ -61,53 +64,33 @@ module DevDraftAI
|
|
|
61
64
|
if @api_client.config.client_side_validation && name.nil?
|
|
62
65
|
fail ArgumentError, "Missing the required parameter 'name' when calling ProductsApi.product_controller_create"
|
|
63
66
|
end
|
|
67
|
+
if @api_client.config.client_side_validation && name.to_s.length > 200
|
|
68
|
+
fail ArgumentError, 'invalid value for "name" when calling ProductsApi.product_controller_create, the character length must be smaller than or equal to 200.'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if @api_client.config.client_side_validation && name.to_s.length < 1
|
|
72
|
+
fail ArgumentError, 'invalid value for "name" when calling ProductsApi.product_controller_create, the character length must be greater than or equal to 1.'
|
|
73
|
+
end
|
|
74
|
+
|
|
64
75
|
# verify the required parameter 'description' is set
|
|
65
76
|
if @api_client.config.client_side_validation && description.nil?
|
|
66
77
|
fail ArgumentError, "Missing the required parameter 'description' when calling ProductsApi.product_controller_create"
|
|
67
78
|
end
|
|
79
|
+
if @api_client.config.client_side_validation && description.to_s.length > 2000
|
|
80
|
+
fail ArgumentError, 'invalid value for "description" when calling ProductsApi.product_controller_create, the character length must be smaller than or equal to 2000.'
|
|
81
|
+
end
|
|
82
|
+
|
|
68
83
|
# verify the required parameter 'price' is set
|
|
69
84
|
if @api_client.config.client_side_validation && price.nil?
|
|
70
85
|
fail ArgumentError, "Missing the required parameter 'price' when calling ProductsApi.product_controller_create"
|
|
71
86
|
end
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
fail ArgumentError, "Missing the required parameter 'currency' when calling ProductsApi.product_controller_create"
|
|
75
|
-
end
|
|
76
|
-
# verify enum value
|
|
77
|
-
if @api_client.config.client_side_validation && !['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY'].include?(currency)
|
|
78
|
-
fail ArgumentError, "invalid value for 'currency', must be one of USD, EUR, GBP, CAD, AUD, JPY"
|
|
79
|
-
end
|
|
80
|
-
# verify the required parameter 'type' is set
|
|
81
|
-
if @api_client.config.client_side_validation && type.nil?
|
|
82
|
-
fail ArgumentError, "Missing the required parameter 'type' when calling ProductsApi.product_controller_create"
|
|
83
|
-
end
|
|
84
|
-
# verify the required parameter 'weight' is set
|
|
85
|
-
if @api_client.config.client_side_validation && weight.nil?
|
|
86
|
-
fail ArgumentError, "Missing the required parameter 'weight' when calling ProductsApi.product_controller_create"
|
|
87
|
-
end
|
|
88
|
-
# verify the required parameter 'unit' is set
|
|
89
|
-
if @api_client.config.client_side_validation && unit.nil?
|
|
90
|
-
fail ArgumentError, "Missing the required parameter 'unit' when calling ProductsApi.product_controller_create"
|
|
91
|
-
end
|
|
92
|
-
# verify the required parameter 'quantity' is set
|
|
93
|
-
if @api_client.config.client_side_validation && quantity.nil?
|
|
94
|
-
fail ArgumentError, "Missing the required parameter 'quantity' when calling ProductsApi.product_controller_create"
|
|
95
|
-
end
|
|
96
|
-
# verify the required parameter 'stock_count' is set
|
|
97
|
-
if @api_client.config.client_side_validation && stock_count.nil?
|
|
98
|
-
fail ArgumentError, "Missing the required parameter 'stock_count' when calling ProductsApi.product_controller_create"
|
|
99
|
-
end
|
|
100
|
-
# verify the required parameter 'status' is set
|
|
101
|
-
if @api_client.config.client_side_validation && status.nil?
|
|
102
|
-
fail ArgumentError, "Missing the required parameter 'status' when calling ProductsApi.product_controller_create"
|
|
87
|
+
if @api_client.config.client_side_validation && price < 0.01
|
|
88
|
+
fail ArgumentError, 'invalid value for "price" when calling ProductsApi.product_controller_create, must be greater than or equal to 0.01.'
|
|
103
89
|
end
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# verify the required parameter 'images' is set
|
|
109
|
-
if @api_client.config.client_side_validation && images.nil?
|
|
110
|
-
fail ArgumentError, "Missing the required parameter 'images' when calling ProductsApi.product_controller_create"
|
|
90
|
+
|
|
91
|
+
allowable_values = ["USD", "EUR", "GBP", "CAD", "AUD", "JPY"]
|
|
92
|
+
if @api_client.config.client_side_validation && opts[:'currency'] && !allowable_values.include?(opts[:'currency'])
|
|
93
|
+
fail ArgumentError, "invalid value for \"currency\", must be one of #{allowable_values}"
|
|
111
94
|
end
|
|
112
95
|
# resource path
|
|
113
96
|
local_var_path = '/api/v0/products'
|
|
@@ -118,47 +101,57 @@ module DevDraftAI
|
|
|
118
101
|
# header parameters
|
|
119
102
|
header_params = opts[:header_params] || {}
|
|
120
103
|
# HTTP header 'Content-Type'
|
|
121
|
-
|
|
104
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
105
|
+
if !content_type.nil?
|
|
106
|
+
header_params['Content-Type'] = content_type
|
|
107
|
+
end
|
|
122
108
|
|
|
123
109
|
# form parameters
|
|
124
110
|
form_params = opts[:form_params] || {}
|
|
125
111
|
form_params['name'] = name
|
|
126
112
|
form_params['description'] = description
|
|
127
113
|
form_params['price'] = price
|
|
128
|
-
form_params['currency'] = currency
|
|
129
|
-
form_params['type'] = type
|
|
130
|
-
form_params['weight'] = weight
|
|
131
|
-
form_params['unit'] = unit
|
|
132
|
-
form_params['quantity'] = quantity
|
|
133
|
-
form_params['stockCount'] = stock_count
|
|
134
|
-
form_params['status'] = status
|
|
135
|
-
form_params['productType'] = product_type
|
|
136
|
-
form_params['images'] = @api_client.build_collection_param(images, :
|
|
114
|
+
form_params['currency'] = opts[:'currency'] if !opts[:'currency'].nil?
|
|
115
|
+
form_params['type'] = opts[:'type'] if !opts[:'type'].nil?
|
|
116
|
+
form_params['weight'] = opts[:'weight'] if !opts[:'weight'].nil?
|
|
117
|
+
form_params['unit'] = opts[:'unit'] if !opts[:'unit'].nil?
|
|
118
|
+
form_params['quantity'] = opts[:'quantity'] if !opts[:'quantity'].nil?
|
|
119
|
+
form_params['stockCount'] = opts[:'stock_count'] if !opts[:'stock_count'].nil?
|
|
120
|
+
form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
121
|
+
form_params['productType'] = opts[:'product_type'] if !opts[:'product_type'].nil?
|
|
122
|
+
form_params['images'] = @api_client.build_collection_param(opts[:'images'], :csv) if !opts[:'images'].nil?
|
|
137
123
|
|
|
138
124
|
# http body (model)
|
|
139
|
-
post_body = opts[:
|
|
125
|
+
post_body = opts[:debug_body]
|
|
126
|
+
|
|
127
|
+
# return_type
|
|
128
|
+
return_type = opts[:debug_return_type]
|
|
140
129
|
|
|
141
|
-
|
|
130
|
+
# auth_names
|
|
131
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
142
132
|
|
|
143
|
-
|
|
144
|
-
|
|
133
|
+
new_options = opts.merge(
|
|
134
|
+
:operation => :"ProductsApi.product_controller_create",
|
|
145
135
|
:header_params => header_params,
|
|
146
136
|
:query_params => query_params,
|
|
147
137
|
:form_params => form_params,
|
|
148
138
|
:body => post_body,
|
|
149
139
|
:auth_names => auth_names,
|
|
150
|
-
:return_type => return_type
|
|
140
|
+
:return_type => return_type
|
|
141
|
+
)
|
|
151
142
|
|
|
143
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
152
144
|
if @api_client.config.debugging
|
|
153
145
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
154
146
|
end
|
|
155
147
|
return data, status_code, headers
|
|
156
148
|
end
|
|
149
|
+
|
|
157
150
|
# Get all products
|
|
158
151
|
# 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\": [ \"https://storage.example.com/images/file1.jpg\", \"https://storage.example.com/images/file2.jpg\" ], \"createdAt\": \"2024-03-20T10:00:00Z\" } ], \"total\": 100, \"skip\": 0, \"take\": 10 } ```
|
|
159
152
|
# @param [Hash] opts the optional parameters
|
|
160
|
-
# @option opts [
|
|
161
|
-
# @option opts [
|
|
153
|
+
# @option opts [Float] :skip Number of records to skip
|
|
154
|
+
# @option opts [Float] :take Number of records to take
|
|
162
155
|
# @return [nil]
|
|
163
156
|
def product_controller_find_all(opts = {})
|
|
164
157
|
product_controller_find_all_with_http_info(opts)
|
|
@@ -168,8 +161,8 @@ module DevDraftAI
|
|
|
168
161
|
# Get all products
|
|
169
162
|
# 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\": [ \"https://storage.example.com/images/file1.jpg\", \"https://storage.example.com/images/file2.jpg\" ], \"createdAt\": \"2024-03-20T10:00:00Z\" } ], \"total\": 100, \"skip\": 0, \"take\": 10 } ```
|
|
170
163
|
# @param [Hash] opts the optional parameters
|
|
171
|
-
# @option opts [
|
|
172
|
-
# @option opts [
|
|
164
|
+
# @option opts [Float] :skip Number of records to skip
|
|
165
|
+
# @option opts [Float] :take Number of records to take
|
|
173
166
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
174
167
|
def product_controller_find_all_with_http_info(opts = {})
|
|
175
168
|
if @api_client.config.debugging
|
|
@@ -190,27 +183,34 @@ module DevDraftAI
|
|
|
190
183
|
form_params = opts[:form_params] || {}
|
|
191
184
|
|
|
192
185
|
# http body (model)
|
|
193
|
-
post_body = opts[:
|
|
186
|
+
post_body = opts[:debug_body]
|
|
187
|
+
|
|
188
|
+
# return_type
|
|
189
|
+
return_type = opts[:debug_return_type]
|
|
194
190
|
|
|
195
|
-
|
|
191
|
+
# auth_names
|
|
192
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
196
193
|
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
new_options = opts.merge(
|
|
195
|
+
:operation => :"ProductsApi.product_controller_find_all",
|
|
199
196
|
:header_params => header_params,
|
|
200
197
|
:query_params => query_params,
|
|
201
198
|
:form_params => form_params,
|
|
202
199
|
:body => post_body,
|
|
203
200
|
:auth_names => auth_names,
|
|
204
|
-
:return_type => return_type
|
|
201
|
+
:return_type => return_type
|
|
202
|
+
)
|
|
205
203
|
|
|
204
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
206
205
|
if @api_client.config.debugging
|
|
207
206
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_find_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
208
207
|
end
|
|
209
208
|
return data, status_code, headers
|
|
210
209
|
end
|
|
210
|
+
|
|
211
211
|
# Get a product by ID
|
|
212
212
|
# 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\": [ \"https://storage.example.com/images/file1.jpg\", \"https://storage.example.com/images/file2.jpg\" ], \"createdAt\": \"2024-03-20T10:00:00Z\", \"updatedAt\": \"2024-03-20T10:00:00Z\" } ```
|
|
213
|
-
# @param id Product ID
|
|
213
|
+
# @param id [String] Product ID
|
|
214
214
|
# @param [Hash] opts the optional parameters
|
|
215
215
|
# @return [nil]
|
|
216
216
|
def product_controller_find_one(id, opts = {})
|
|
@@ -220,7 +220,7 @@ module DevDraftAI
|
|
|
220
220
|
|
|
221
221
|
# Get a product by ID
|
|
222
222
|
# 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\": [ \"https://storage.example.com/images/file1.jpg\", \"https://storage.example.com/images/file2.jpg\" ], \"createdAt\": \"2024-03-20T10:00:00Z\", \"updatedAt\": \"2024-03-20T10:00:00Z\" } ```
|
|
223
|
-
# @param id Product ID
|
|
223
|
+
# @param id [String] Product ID
|
|
224
224
|
# @param [Hash] opts the optional parameters
|
|
225
225
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
226
226
|
def product_controller_find_one_with_http_info(id, opts = {})
|
|
@@ -232,7 +232,7 @@ module DevDraftAI
|
|
|
232
232
|
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.product_controller_find_one"
|
|
233
233
|
end
|
|
234
234
|
# resource path
|
|
235
|
-
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)
|
|
235
|
+
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
236
236
|
|
|
237
237
|
# query parameters
|
|
238
238
|
query_params = opts[:query_params] || {}
|
|
@@ -244,27 +244,34 @@ module DevDraftAI
|
|
|
244
244
|
form_params = opts[:form_params] || {}
|
|
245
245
|
|
|
246
246
|
# http body (model)
|
|
247
|
-
post_body = opts[:
|
|
247
|
+
post_body = opts[:debug_body]
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
# return_type
|
|
250
|
+
return_type = opts[:debug_return_type]
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
# auth_names
|
|
253
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
254
|
+
|
|
255
|
+
new_options = opts.merge(
|
|
256
|
+
:operation => :"ProductsApi.product_controller_find_one",
|
|
253
257
|
:header_params => header_params,
|
|
254
258
|
:query_params => query_params,
|
|
255
259
|
:form_params => form_params,
|
|
256
260
|
:body => post_body,
|
|
257
261
|
:auth_names => auth_names,
|
|
258
|
-
:return_type => return_type
|
|
262
|
+
:return_type => return_type
|
|
263
|
+
)
|
|
259
264
|
|
|
265
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
260
266
|
if @api_client.config.debugging
|
|
261
267
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_find_one\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
262
268
|
end
|
|
263
269
|
return data, status_code, headers
|
|
264
270
|
end
|
|
271
|
+
|
|
265
272
|
# Delete a product
|
|
266
273
|
# 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
|
|
267
|
-
# @param id Product ID
|
|
274
|
+
# @param id [String] Product ID
|
|
268
275
|
# @param [Hash] opts the optional parameters
|
|
269
276
|
# @return [nil]
|
|
270
277
|
def product_controller_remove(id, opts = {})
|
|
@@ -274,7 +281,7 @@ module DevDraftAI
|
|
|
274
281
|
|
|
275
282
|
# Delete a product
|
|
276
283
|
# 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
|
|
277
|
-
# @param id Product ID
|
|
284
|
+
# @param id [String] Product ID
|
|
278
285
|
# @param [Hash] opts the optional parameters
|
|
279
286
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
280
287
|
def product_controller_remove_with_http_info(id, opts = {})
|
|
@@ -286,7 +293,7 @@ module DevDraftAI
|
|
|
286
293
|
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.product_controller_remove"
|
|
287
294
|
end
|
|
288
295
|
# resource path
|
|
289
|
-
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)
|
|
296
|
+
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
290
297
|
|
|
291
298
|
# query parameters
|
|
292
299
|
query_params = opts[:query_params] || {}
|
|
@@ -298,125 +305,100 @@ module DevDraftAI
|
|
|
298
305
|
form_params = opts[:form_params] || {}
|
|
299
306
|
|
|
300
307
|
# http body (model)
|
|
301
|
-
post_body = opts[:
|
|
308
|
+
post_body = opts[:debug_body]
|
|
302
309
|
|
|
303
|
-
|
|
310
|
+
# return_type
|
|
311
|
+
return_type = opts[:debug_return_type]
|
|
304
312
|
|
|
305
|
-
|
|
306
|
-
|
|
313
|
+
# auth_names
|
|
314
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
315
|
+
|
|
316
|
+
new_options = opts.merge(
|
|
317
|
+
:operation => :"ProductsApi.product_controller_remove",
|
|
307
318
|
:header_params => header_params,
|
|
308
319
|
:query_params => query_params,
|
|
309
320
|
:form_params => form_params,
|
|
310
321
|
:body => post_body,
|
|
311
322
|
:auth_names => auth_names,
|
|
312
|
-
:return_type => return_type
|
|
323
|
+
:return_type => return_type
|
|
324
|
+
)
|
|
313
325
|
|
|
326
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
314
327
|
if @api_client.config.debugging
|
|
315
328
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
316
329
|
end
|
|
317
330
|
return data, status_code, headers
|
|
318
331
|
end
|
|
332
|
+
|
|
319
333
|
# Update a product
|
|
320
334
|
# 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
|
|
321
|
-
# @param
|
|
322
|
-
# @param description
|
|
323
|
-
# @param price
|
|
324
|
-
# @param currency
|
|
325
|
-
# @param type
|
|
326
|
-
# @param weight
|
|
327
|
-
# @param unit
|
|
328
|
-
# @param quantity
|
|
329
|
-
# @param stock_count
|
|
330
|
-
# @param status
|
|
331
|
-
# @param product_type
|
|
332
|
-
# @param images
|
|
333
|
-
# @param id Product ID
|
|
335
|
+
# @param id [String] Product ID
|
|
334
336
|
# @param [Hash] opts the optional parameters
|
|
337
|
+
# @option opts [String] :name Product name as it will appear to customers. Should be clear and descriptive.
|
|
338
|
+
# @option opts [String] :description Detailed description of the product. Supports markdown formatting for rich text display.
|
|
339
|
+
# @option opts [Float] :price Product price in the specified currency. Must be greater than 0.
|
|
340
|
+
# @option opts [String] :currency Currency code for the price. Defaults to USD if not specified. (default to 'USD')
|
|
341
|
+
# @option opts [String] :type Product type
|
|
342
|
+
# @option opts [Float] :weight Weight of the product
|
|
343
|
+
# @option opts [String] :unit Unit of measurement
|
|
344
|
+
# @option opts [Float] :quantity Quantity available
|
|
345
|
+
# @option opts [Float] :stock_count Stock count
|
|
346
|
+
# @option opts [String] :status Product status
|
|
347
|
+
# @option opts [String] :product_type Product type
|
|
348
|
+
# @option opts [Array<String>] :images Array of image URLs
|
|
335
349
|
# @return [nil]
|
|
336
|
-
def product_controller_update(
|
|
337
|
-
product_controller_update_with_http_info(
|
|
350
|
+
def product_controller_update(id, opts = {})
|
|
351
|
+
product_controller_update_with_http_info(id, opts)
|
|
338
352
|
nil
|
|
339
353
|
end
|
|
340
354
|
|
|
341
355
|
# Update a product
|
|
342
|
-
# Updates an existing product&#
|
|
343
|
-
# @param
|
|
344
|
-
# @param description
|
|
345
|
-
# @param price
|
|
346
|
-
# @param currency
|
|
347
|
-
# @param type
|
|
348
|
-
# @param weight
|
|
349
|
-
# @param unit
|
|
350
|
-
# @param quantity
|
|
351
|
-
# @param stock_count
|
|
352
|
-
# @param status
|
|
353
|
-
# @param product_type
|
|
354
|
-
# @param images
|
|
355
|
-
# @param id Product ID
|
|
356
|
+
# 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
|
|
357
|
+
# @param id [String] Product ID
|
|
356
358
|
# @param [Hash] opts the optional parameters
|
|
359
|
+
# @option opts [String] :name Product name as it will appear to customers. Should be clear and descriptive.
|
|
360
|
+
# @option opts [String] :description Detailed description of the product. Supports markdown formatting for rich text display.
|
|
361
|
+
# @option opts [Float] :price Product price in the specified currency. Must be greater than 0.
|
|
362
|
+
# @option opts [String] :currency Currency code for the price. Defaults to USD if not specified. (default to 'USD')
|
|
363
|
+
# @option opts [String] :type Product type
|
|
364
|
+
# @option opts [Float] :weight Weight of the product
|
|
365
|
+
# @option opts [String] :unit Unit of measurement
|
|
366
|
+
# @option opts [Float] :quantity Quantity available
|
|
367
|
+
# @option opts [Float] :stock_count Stock count
|
|
368
|
+
# @option opts [String] :status Product status
|
|
369
|
+
# @option opts [String] :product_type Product type
|
|
370
|
+
# @option opts [Array<String>] :images Array of image URLs
|
|
357
371
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
358
|
-
def product_controller_update_with_http_info(
|
|
372
|
+
def product_controller_update_with_http_info(id, opts = {})
|
|
359
373
|
if @api_client.config.debugging
|
|
360
374
|
@api_client.config.logger.debug 'Calling API: ProductsApi.product_controller_update ...'
|
|
361
375
|
end
|
|
362
|
-
# verify the required parameter '
|
|
363
|
-
if @api_client.config.client_side_validation &&
|
|
364
|
-
fail ArgumentError, "Missing the required parameter '
|
|
365
|
-
end
|
|
366
|
-
# verify the required parameter 'description' is set
|
|
367
|
-
if @api_client.config.client_side_validation && description.nil?
|
|
368
|
-
fail ArgumentError, "Missing the required parameter 'description' when calling ProductsApi.product_controller_update"
|
|
369
|
-
end
|
|
370
|
-
# verify the required parameter 'price' is set
|
|
371
|
-
if @api_client.config.client_side_validation && price.nil?
|
|
372
|
-
fail ArgumentError, "Missing the required parameter 'price' when calling ProductsApi.product_controller_update"
|
|
373
|
-
end
|
|
374
|
-
# verify the required parameter 'currency' is set
|
|
375
|
-
if @api_client.config.client_side_validation && currency.nil?
|
|
376
|
-
fail ArgumentError, "Missing the required parameter 'currency' when calling ProductsApi.product_controller_update"
|
|
377
|
-
end
|
|
378
|
-
# verify enum value
|
|
379
|
-
if @api_client.config.client_side_validation && !['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY'].include?(currency)
|
|
380
|
-
fail ArgumentError, "invalid value for 'currency', must be one of USD, EUR, GBP, CAD, AUD, JPY"
|
|
381
|
-
end
|
|
382
|
-
# verify the required parameter 'type' is set
|
|
383
|
-
if @api_client.config.client_side_validation && type.nil?
|
|
384
|
-
fail ArgumentError, "Missing the required parameter 'type' when calling ProductsApi.product_controller_update"
|
|
385
|
-
end
|
|
386
|
-
# verify the required parameter 'weight' is set
|
|
387
|
-
if @api_client.config.client_side_validation && weight.nil?
|
|
388
|
-
fail ArgumentError, "Missing the required parameter 'weight' when calling ProductsApi.product_controller_update"
|
|
389
|
-
end
|
|
390
|
-
# verify the required parameter 'unit' is set
|
|
391
|
-
if @api_client.config.client_side_validation && unit.nil?
|
|
392
|
-
fail ArgumentError, "Missing the required parameter 'unit' when calling ProductsApi.product_controller_update"
|
|
393
|
-
end
|
|
394
|
-
# verify the required parameter 'quantity' is set
|
|
395
|
-
if @api_client.config.client_side_validation && quantity.nil?
|
|
396
|
-
fail ArgumentError, "Missing the required parameter 'quantity' when calling ProductsApi.product_controller_update"
|
|
376
|
+
# verify the required parameter 'id' is set
|
|
377
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
378
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.product_controller_update"
|
|
397
379
|
end
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
fail ArgumentError, "Missing the required parameter 'stock_count' when calling ProductsApi.product_controller_update"
|
|
380
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length > 200
|
|
381
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling ProductsApi.product_controller_update, the character length must be smaller than or equal to 200.'
|
|
401
382
|
end
|
|
402
|
-
|
|
403
|
-
if @api_client.config.client_side_validation &&
|
|
404
|
-
fail ArgumentError,
|
|
383
|
+
|
|
384
|
+
if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length < 1
|
|
385
|
+
fail ArgumentError, 'invalid value for "opts[:"name"]" when calling ProductsApi.product_controller_update, the character length must be greater than or equal to 1.'
|
|
405
386
|
end
|
|
406
|
-
|
|
407
|
-
if @api_client.config.client_side_validation &&
|
|
408
|
-
fail ArgumentError,
|
|
387
|
+
|
|
388
|
+
if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length > 2000
|
|
389
|
+
fail ArgumentError, 'invalid value for "opts[:"description"]" when calling ProductsApi.product_controller_update, the character length must be smaller than or equal to 2000.'
|
|
409
390
|
end
|
|
410
|
-
|
|
411
|
-
if @api_client.config.client_side_validation &&
|
|
412
|
-
fail ArgumentError,
|
|
391
|
+
|
|
392
|
+
if @api_client.config.client_side_validation && !opts[:'price'].nil? && opts[:'price'] < 0.01
|
|
393
|
+
fail ArgumentError, 'invalid value for "opts[:"price"]" when calling ProductsApi.product_controller_update, must be greater than or equal to 0.01.'
|
|
413
394
|
end
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
395
|
+
|
|
396
|
+
allowable_values = ["USD", "EUR", "GBP", "CAD", "AUD", "JPY"]
|
|
397
|
+
if @api_client.config.client_side_validation && opts[:'currency'] && !allowable_values.include?(opts[:'currency'])
|
|
398
|
+
fail ArgumentError, "invalid value for \"currency\", must be one of #{allowable_values}"
|
|
417
399
|
end
|
|
418
400
|
# resource path
|
|
419
|
-
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', id.to_s)
|
|
401
|
+
local_var_path = '/api/v0/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
420
402
|
|
|
421
403
|
# query parameters
|
|
422
404
|
query_params = opts[:query_params] || {}
|
|
@@ -424,45 +406,55 @@ module DevDraftAI
|
|
|
424
406
|
# header parameters
|
|
425
407
|
header_params = opts[:header_params] || {}
|
|
426
408
|
# HTTP header 'Content-Type'
|
|
427
|
-
|
|
409
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
410
|
+
if !content_type.nil?
|
|
411
|
+
header_params['Content-Type'] = content_type
|
|
412
|
+
end
|
|
428
413
|
|
|
429
414
|
# form parameters
|
|
430
415
|
form_params = opts[:form_params] || {}
|
|
431
|
-
form_params['name'] = name
|
|
432
|
-
form_params['description'] = description
|
|
433
|
-
form_params['price'] = price
|
|
434
|
-
form_params['currency'] = currency
|
|
435
|
-
form_params['type'] = type
|
|
436
|
-
form_params['weight'] = weight
|
|
437
|
-
form_params['unit'] = unit
|
|
438
|
-
form_params['quantity'] = quantity
|
|
439
|
-
form_params['stockCount'] = stock_count
|
|
440
|
-
form_params['status'] = status
|
|
441
|
-
form_params['productType'] = product_type
|
|
442
|
-
form_params['images'] = @api_client.build_collection_param(images, :
|
|
416
|
+
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
|
417
|
+
form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
|
|
418
|
+
form_params['price'] = opts[:'price'] if !opts[:'price'].nil?
|
|
419
|
+
form_params['currency'] = opts[:'currency'] if !opts[:'currency'].nil?
|
|
420
|
+
form_params['type'] = opts[:'type'] if !opts[:'type'].nil?
|
|
421
|
+
form_params['weight'] = opts[:'weight'] if !opts[:'weight'].nil?
|
|
422
|
+
form_params['unit'] = opts[:'unit'] if !opts[:'unit'].nil?
|
|
423
|
+
form_params['quantity'] = opts[:'quantity'] if !opts[:'quantity'].nil?
|
|
424
|
+
form_params['stockCount'] = opts[:'stock_count'] if !opts[:'stock_count'].nil?
|
|
425
|
+
form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
426
|
+
form_params['productType'] = opts[:'product_type'] if !opts[:'product_type'].nil?
|
|
427
|
+
form_params['images'] = @api_client.build_collection_param(opts[:'images'], :csv) if !opts[:'images'].nil?
|
|
443
428
|
|
|
444
429
|
# http body (model)
|
|
445
|
-
post_body = opts[:
|
|
430
|
+
post_body = opts[:debug_body]
|
|
446
431
|
|
|
447
|
-
|
|
432
|
+
# return_type
|
|
433
|
+
return_type = opts[:debug_return_type]
|
|
448
434
|
|
|
449
|
-
|
|
450
|
-
|
|
435
|
+
# auth_names
|
|
436
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
437
|
+
|
|
438
|
+
new_options = opts.merge(
|
|
439
|
+
:operation => :"ProductsApi.product_controller_update",
|
|
451
440
|
:header_params => header_params,
|
|
452
441
|
:query_params => query_params,
|
|
453
442
|
:form_params => form_params,
|
|
454
443
|
:body => post_body,
|
|
455
444
|
:auth_names => auth_names,
|
|
456
|
-
:return_type => return_type
|
|
445
|
+
:return_type => return_type
|
|
446
|
+
)
|
|
457
447
|
|
|
448
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
458
449
|
if @api_client.config.debugging
|
|
459
450
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
460
451
|
end
|
|
461
452
|
return data, status_code, headers
|
|
462
453
|
end
|
|
454
|
+
|
|
463
455
|
# Upload images for a product
|
|
464
456
|
# 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
|
|
465
|
-
# @param id Product ID
|
|
457
|
+
# @param id [String] Product ID
|
|
466
458
|
# @param [Hash] opts the optional parameters
|
|
467
459
|
# @return [nil]
|
|
468
460
|
def product_controller_upload_image(id, opts = {})
|
|
@@ -472,7 +464,7 @@ module DevDraftAI
|
|
|
472
464
|
|
|
473
465
|
# Upload images for a product
|
|
474
466
|
# 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
|
|
475
|
-
# @param id Product ID
|
|
467
|
+
# @param id [String] Product ID
|
|
476
468
|
# @param [Hash] opts the optional parameters
|
|
477
469
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
478
470
|
def product_controller_upload_image_with_http_info(id, opts = {})
|
|
@@ -484,7 +476,7 @@ module DevDraftAI
|
|
|
484
476
|
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.product_controller_upload_image"
|
|
485
477
|
end
|
|
486
478
|
# resource path
|
|
487
|
-
local_var_path = '/api/v0/products/{id}/images'.sub('{' + 'id' + '}', id.to_s)
|
|
479
|
+
local_var_path = '/api/v0/products/{id}/images'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
488
480
|
|
|
489
481
|
# query parameters
|
|
490
482
|
query_params = opts[:query_params] || {}
|
|
@@ -496,19 +488,25 @@ module DevDraftAI
|
|
|
496
488
|
form_params = opts[:form_params] || {}
|
|
497
489
|
|
|
498
490
|
# http body (model)
|
|
499
|
-
post_body = opts[:
|
|
491
|
+
post_body = opts[:debug_body]
|
|
492
|
+
|
|
493
|
+
# return_type
|
|
494
|
+
return_type = opts[:debug_return_type]
|
|
500
495
|
|
|
501
|
-
|
|
496
|
+
# auth_names
|
|
497
|
+
auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']
|
|
502
498
|
|
|
503
|
-
|
|
504
|
-
|
|
499
|
+
new_options = opts.merge(
|
|
500
|
+
:operation => :"ProductsApi.product_controller_upload_image",
|
|
505
501
|
:header_params => header_params,
|
|
506
502
|
:query_params => query_params,
|
|
507
503
|
:form_params => form_params,
|
|
508
504
|
:body => post_body,
|
|
509
505
|
:auth_names => auth_names,
|
|
510
|
-
:return_type => return_type
|
|
506
|
+
:return_type => return_type
|
|
507
|
+
)
|
|
511
508
|
|
|
509
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
512
510
|
if @api_client.config.debugging
|
|
513
511
|
@api_client.config.logger.debug "API called: ProductsApi#product_controller_upload_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
514
512
|
end
|