license_manager 0.1.0
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 +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +9 -0
- data/LICENSE +201 -0
- data/README.md +96 -0
- data/Rakefile +10 -0
- data/docs/ConnectStripe.md +18 -0
- data/docs/CreateCustomer.md +20 -0
- data/docs/CreateIntegrationMapping.md +20 -0
- data/docs/CreateLicense.md +36 -0
- data/docs/CreatePolicy.md +30 -0
- data/docs/CreatePortalLink.md +18 -0
- data/docs/CreateProduct.md +20 -0
- data/docs/CreateProductWithPolicy.md +24 -0
- data/docs/CreateRelease.md +20 -0
- data/docs/CreateToken.md +20 -0
- data/docs/Customer.md +30 -0
- data/docs/CustomerList.md +20 -0
- data/docs/CustomersApi.md +385 -0
- data/docs/Error.md +18 -0
- data/docs/ErrorError.md +22 -0
- data/docs/ErrorErrorIssuesInner.md +20 -0
- data/docs/ErrorErrorIssuesInnerPathInner.md +15 -0
- data/docs/Event.md +34 -0
- data/docs/EventActor.md +55 -0
- data/docs/EventActorOneOf.md +26 -0
- data/docs/EventActorOneOf1.md +24 -0
- data/docs/EventActorOneOf2.md +22 -0
- data/docs/EventActorOneOf3.md +18 -0
- data/docs/EventActorOneOf4.md +22 -0
- data/docs/EventList.md +20 -0
- data/docs/EventMachine.md +22 -0
- data/docs/EventType.md +15 -0
- data/docs/EventsApi.md +173 -0
- data/docs/FixedMaxVersion.md +20 -0
- data/docs/Integration.md +38 -0
- data/docs/IntegrationMapping.md +38 -0
- data/docs/IntegrationStatus.md +15 -0
- data/docs/IntegrationsApi.md +587 -0
- data/docs/License.md +50 -0
- data/docs/LicenseList.md +20 -0
- data/docs/LicenseMaxVersion.md +22 -0
- data/docs/LicenseMaxVersionInput.md +22 -0
- data/docs/LicenseStats.md +26 -0
- data/docs/LicenseStatsActivationsByMachineInner.md +24 -0
- data/docs/LicenseStatsActivationsByVersionInner.md +20 -0
- data/docs/LicenseStatus.md +15 -0
- data/docs/LicenseToken.md +18 -0
- data/docs/LicensesApi.md +817 -0
- data/docs/ListPolicyEventsTypeParameter.md +15 -0
- data/docs/ListStripePrices200Response.md +18 -0
- data/docs/LockMaxVersion.md +22 -0
- data/docs/LockMaxVersionMajorAfter.md +49 -0
- data/docs/LockMaxVersionMajorAfterOneOf.md +20 -0
- data/docs/LockMaxVersionMajorAfterOneOf1.md +20 -0
- data/docs/LockMaxVersionMinorAfter.md +20 -0
- data/docs/Machine.md +36 -0
- data/docs/MachineList.md +20 -0
- data/docs/MachinesApi.md +246 -0
- data/docs/Pagination.md +24 -0
- data/docs/PoliciesApi.md +388 -0
- data/docs/Policy.md +40 -0
- data/docs/PolicyDuration.md +20 -0
- data/docs/PolicyList.md +20 -0
- data/docs/PolicyMaxVersion.md +24 -0
- data/docs/PolicySettings.md +24 -0
- data/docs/PolicySettingsDuration.md +20 -0
- data/docs/PolicySettingsDurationAnyOf.md +20 -0
- data/docs/PolicySettingsDurationAnyOf1.md +20 -0
- data/docs/PolicySettingsMaxVersion.md +24 -0
- data/docs/Portal.md +30 -0
- data/docs/PortalApi.md +289 -0
- data/docs/PortalLink.md +22 -0
- data/docs/PortalNotFound.md +22 -0
- data/docs/PortalSettings.md +26 -0
- data/docs/Price.md +20 -0
- data/docs/PriceInput.md +20 -0
- data/docs/Product.md +32 -0
- data/docs/ProductList.md +20 -0
- data/docs/ProductStats.md +54 -0
- data/docs/ProductStatsActivationsByVersionInner.md +20 -0
- data/docs/ProductStatsActiveMachinesByPlatformInner.md +20 -0
- data/docs/ProductStatsActiveMachinesByVersionInner.md +20 -0
- data/docs/ProductStatsNewLicensesByPolicyInner.md +22 -0
- data/docs/ProductsApi.md +666 -0
- data/docs/Release.md +28 -0
- data/docs/ReleaseList.md +20 -0
- data/docs/ReleasesApi.md +388 -0
- data/docs/RequestPortalLink.md +20 -0
- data/docs/Revenue.md +34 -0
- data/docs/SendLicenseKeys.md +18 -0
- data/docs/SendPortalLink.md +18 -0
- data/docs/SigningKey.md +27 -0
- data/docs/StripeIntegration.md +26 -0
- data/docs/StripePermission.md +22 -0
- data/docs/StripePrice.md +28 -0
- data/docs/Token.md +24 -0
- data/docs/TokensApi.md +235 -0
- data/docs/UpdateCustomer.md +20 -0
- data/docs/UpdateIntegrationMapping.md +18 -0
- data/docs/UpdateLicense.md +28 -0
- data/docs/UpdatePolicy.md +30 -0
- data/docs/UpdateProduct.md +22 -0
- data/docs/UpdateProductPortal.md +26 -0
- data/docs/UpdateRelease.md +20 -0
- data/docs/ValidateKey.md +26 -0
- data/docs/ValidateKeyError.md +18 -0
- data/docs/ValidateKeyErrorError.md +24 -0
- data/git_push.sh +54 -0
- data/lib/license_manager/api/customers_api.rb +398 -0
- data/lib/license_manager/api/events_api.rb +207 -0
- data/lib/license_manager/api/integrations_api.rb +559 -0
- data/lib/license_manager/api/licenses_api.rb +885 -0
- data/lib/license_manager/api/machines_api.rb +257 -0
- data/lib/license_manager/api/policies_api.rb +412 -0
- data/lib/license_manager/api/portal_api.rb +310 -0
- data/lib/license_manager/api/products_api.rb +653 -0
- data/lib/license_manager/api/releases_api.rb +408 -0
- data/lib/license_manager/api/tokens_api.rb +244 -0
- data/lib/license_manager/api_client.rb +441 -0
- data/lib/license_manager/api_error.rb +58 -0
- data/lib/license_manager/api_model_base.rb +88 -0
- data/lib/license_manager/configuration.rb +400 -0
- data/lib/license_manager/models/connect_stripe.rb +187 -0
- data/lib/license_manager/models/create_customer.rb +222 -0
- data/lib/license_manager/models/create_integration_mapping.rb +222 -0
- data/lib/license_manager/models/create_license.rb +361 -0
- data/lib/license_manager/models/create_policy.rb +347 -0
- data/lib/license_manager/models/create_portal_link.rb +196 -0
- data/lib/license_manager/models/create_product.rb +244 -0
- data/lib/license_manager/models/create_product_with_policy.rb +270 -0
- data/lib/license_manager/models/create_release.rb +208 -0
- data/lib/license_manager/models/create_token.rb +237 -0
- data/lib/license_manager/models/customer.rb +308 -0
- data/lib/license_manager/models/customer_list.rb +206 -0
- data/lib/license_manager/models/error.rb +177 -0
- data/lib/license_manager/models/error_error.rb +215 -0
- data/lib/license_manager/models/error_error_issues_inner.rb +205 -0
- data/lib/license_manager/models/error_error_issues_inner_path_inner.rb +103 -0
- data/lib/license_manager/models/event.rb +340 -0
- data/lib/license_manager/models/event_actor.rb +108 -0
- data/lib/license_manager/models/event_actor_one_of.rb +251 -0
- data/lib/license_manager/models/event_actor_one_of1.rb +239 -0
- data/lib/license_manager/models/event_actor_one_of2.rb +257 -0
- data/lib/license_manager/models/event_actor_one_of3.rb +201 -0
- data/lib/license_manager/models/event_actor_one_of4.rb +243 -0
- data/lib/license_manager/models/event_list.rb +206 -0
- data/lib/license_manager/models/event_machine.rb +216 -0
- data/lib/license_manager/models/event_type.rb +46 -0
- data/lib/license_manager/models/fixed_max_version.rb +240 -0
- data/lib/license_manager/models/integration.rb +412 -0
- data/lib/license_manager/models/integration_mapping.rb +435 -0
- data/lib/license_manager/models/integration_status.rb +42 -0
- data/lib/license_manager/models/license.rb +542 -0
- data/lib/license_manager/models/license_list.rb +206 -0
- data/lib/license_manager/models/license_max_version.rb +208 -0
- data/lib/license_manager/models/license_max_version_input.rb +202 -0
- data/lib/license_manager/models/license_stats.rb +292 -0
- data/lib/license_manager/models/license_stats_activations_by_machine_inner.rb +244 -0
- data/lib/license_manager/models/license_stats_activations_by_version_inner.rb +206 -0
- data/lib/license_manager/models/license_status.rb +42 -0
- data/lib/license_manager/models/license_token.rb +178 -0
- data/lib/license_manager/models/list_policy_events_type_parameter.rb +104 -0
- data/lib/license_manager/models/list_stripe_prices200_response.rb +179 -0
- data/lib/license_manager/models/lock_max_version.rb +240 -0
- data/lib/license_manager/models/lock_max_version_major_after.rb +105 -0
- data/lib/license_manager/models/lock_max_version_major_after_one_of.rb +245 -0
- data/lib/license_manager/models/lock_max_version_major_after_one_of1.rb +246 -0
- data/lib/license_manager/models/lock_max_version_minor_after.rb +104 -0
- data/lib/license_manager/models/machine.rb +383 -0
- data/lib/license_manager/models/machine_list.rb +206 -0
- data/lib/license_manager/models/pagination.rb +260 -0
- data/lib/license_manager/models/policy.rb +425 -0
- data/lib/license_manager/models/policy_duration.rb +104 -0
- data/lib/license_manager/models/policy_list.rb +206 -0
- data/lib/license_manager/models/policy_max_version.rb +104 -0
- data/lib/license_manager/models/policy_settings.rb +244 -0
- data/lib/license_manager/models/policy_settings_duration.rb +104 -0
- data/lib/license_manager/models/policy_settings_duration_any_of.rb +245 -0
- data/lib/license_manager/models/policy_settings_duration_any_of1.rb +246 -0
- data/lib/license_manager/models/policy_settings_max_version.rb +104 -0
- data/lib/license_manager/models/portal.rb +281 -0
- data/lib/license_manager/models/portal_link.rb +232 -0
- data/lib/license_manager/models/portal_not_found.rb +204 -0
- data/lib/license_manager/models/portal_settings.rb +304 -0
- data/lib/license_manager/models/price.rb +206 -0
- data/lib/license_manager/models/price_input.rb +224 -0
- data/lib/license_manager/models/product.rb +333 -0
- data/lib/license_manager/models/product_list.rb +206 -0
- data/lib/license_manager/models/product_stats.rb +682 -0
- data/lib/license_manager/models/product_stats_activations_by_version_inner.rb +193 -0
- data/lib/license_manager/models/product_stats_active_machines_by_platform_inner.rb +190 -0
- data/lib/license_manager/models/product_stats_active_machines_by_version_inner.rb +190 -0
- data/lib/license_manager/models/product_stats_new_licenses_by_policy_inner.rb +235 -0
- data/lib/license_manager/models/release.rb +308 -0
- data/lib/license_manager/models/release_list.rb +206 -0
- data/lib/license_manager/models/request_portal_link.rb +216 -0
- data/lib/license_manager/models/revenue.rb +401 -0
- data/lib/license_manager/models/send_license_keys.rb +198 -0
- data/lib/license_manager/models/send_portal_link.rb +187 -0
- data/lib/license_manager/models/signing_key.rb +282 -0
- data/lib/license_manager/models/stripe_integration.rb +276 -0
- data/lib/license_manager/models/stripe_permission.rb +253 -0
- data/lib/license_manager/models/stripe_price.rb +280 -0
- data/lib/license_manager/models/token.rb +274 -0
- data/lib/license_manager/models/update_customer.rb +215 -0
- data/lib/license_manager/models/update_integration_mapping.rb +186 -0
- data/lib/license_manager/models/update_license.rb +268 -0
- data/lib/license_manager/models/update_policy.rb +340 -0
- data/lib/license_manager/models/update_product.rb +246 -0
- data/lib/license_manager/models/update_product_portal.rb +274 -0
- data/lib/license_manager/models/update_release.rb +201 -0
- data/lib/license_manager/models/validate_key.rb +362 -0
- data/lib/license_manager/models/validate_key_error.rb +177 -0
- data/lib/license_manager/models/validate_key_error_error.rb +226 -0
- data/lib/license_manager/version.rb +15 -0
- data/lib/license_manager.rb +142 -0
- data/license_manager.gemspec +41 -0
- data/openapi.json +9825 -0
- data/spec/api/customers_api_spec.rb +102 -0
- data/spec/api/events_api_spec.rb +68 -0
- data/spec/api/integrations_api_spec.rb +134 -0
- data/spec/api/licenses_api_spec.rb +200 -0
- data/spec/api/machines_api_spec.rb +77 -0
- data/spec/api/policies_api_spec.rb +105 -0
- data/spec/api/portal_api_spec.rb +87 -0
- data/spec/api/products_api_spec.rb +148 -0
- data/spec/api/releases_api_spec.rb +105 -0
- data/spec/api/tokens_api_spec.rb +74 -0
- data/spec/models/connect_stripe_spec.rb +36 -0
- data/spec/models/create_customer_spec.rb +42 -0
- data/spec/models/create_integration_mapping_spec.rb +42 -0
- data/spec/models/create_license_spec.rb +90 -0
- data/spec/models/create_policy_spec.rb +72 -0
- data/spec/models/create_portal_link_spec.rb +36 -0
- data/spec/models/create_product_spec.rb +42 -0
- data/spec/models/create_product_with_policy_spec.rb +54 -0
- data/spec/models/create_release_spec.rb +42 -0
- data/spec/models/create_token_spec.rb +46 -0
- data/spec/models/customer_list_spec.rb +42 -0
- data/spec/models/customer_spec.rb +72 -0
- data/spec/models/error_error_issues_inner_path_inner_spec.rb +21 -0
- data/spec/models/error_error_issues_inner_spec.rb +42 -0
- data/spec/models/error_error_spec.rb +48 -0
- data/spec/models/error_spec.rb +36 -0
- data/spec/models/event_actor_one_of1_spec.rb +58 -0
- data/spec/models/event_actor_one_of2_spec.rb +56 -0
- data/spec/models/event_actor_one_of3_spec.rb +40 -0
- data/spec/models/event_actor_one_of4_spec.rb +56 -0
- data/spec/models/event_actor_one_of_spec.rb +64 -0
- data/spec/models/event_actor_spec.rb +32 -0
- data/spec/models/event_list_spec.rb +42 -0
- data/spec/models/event_machine_spec.rb +48 -0
- data/spec/models/event_spec.rb +84 -0
- data/spec/models/event_type_spec.rb +30 -0
- data/spec/models/fixed_max_version_spec.rb +46 -0
- data/spec/models/integration_mapping_spec.rb +100 -0
- data/spec/models/integration_spec.rb +100 -0
- data/spec/models/integration_status_spec.rb +30 -0
- data/spec/models/license_list_spec.rb +42 -0
- data/spec/models/license_max_version_input_spec.rb +48 -0
- data/spec/models/license_max_version_spec.rb +48 -0
- data/spec/models/license_spec.rb +132 -0
- data/spec/models/license_stats_activations_by_machine_inner_spec.rb +54 -0
- data/spec/models/license_stats_activations_by_version_inner_spec.rb +42 -0
- data/spec/models/license_stats_spec.rb +60 -0
- data/spec/models/license_status_spec.rb +30 -0
- data/spec/models/license_token_spec.rb +36 -0
- data/spec/models/list_policy_events_type_parameter_spec.rb +21 -0
- data/spec/models/list_stripe_prices200_response_spec.rb +36 -0
- data/spec/models/lock_max_version_major_after_one_of1_spec.rb +46 -0
- data/spec/models/lock_max_version_major_after_one_of_spec.rb +46 -0
- data/spec/models/lock_max_version_major_after_spec.rb +32 -0
- data/spec/models/lock_max_version_minor_after_spec.rb +21 -0
- data/spec/models/lock_max_version_spec.rb +52 -0
- data/spec/models/machine_list_spec.rb +42 -0
- data/spec/models/machine_spec.rb +94 -0
- data/spec/models/pagination_spec.rb +54 -0
- data/spec/models/policy_duration_spec.rb +21 -0
- data/spec/models/policy_list_spec.rb +42 -0
- data/spec/models/policy_max_version_spec.rb +21 -0
- data/spec/models/policy_settings_duration_any_of1_spec.rb +46 -0
- data/spec/models/policy_settings_duration_any_of_spec.rb +46 -0
- data/spec/models/policy_settings_duration_spec.rb +21 -0
- data/spec/models/policy_settings_max_version_spec.rb +21 -0
- data/spec/models/policy_settings_spec.rb +54 -0
- data/spec/models/policy_spec.rb +102 -0
- data/spec/models/portal_link_spec.rb +48 -0
- data/spec/models/portal_not_found_spec.rb +48 -0
- data/spec/models/portal_settings_spec.rb +60 -0
- data/spec/models/portal_spec.rb +72 -0
- data/spec/models/price_input_spec.rb +42 -0
- data/spec/models/price_spec.rb +42 -0
- data/spec/models/product_list_spec.rb +42 -0
- data/spec/models/product_spec.rb +78 -0
- data/spec/models/product_stats_activations_by_version_inner_spec.rb +42 -0
- data/spec/models/product_stats_active_machines_by_platform_inner_spec.rb +42 -0
- data/spec/models/product_stats_active_machines_by_version_inner_spec.rb +42 -0
- data/spec/models/product_stats_new_licenses_by_policy_inner_spec.rb +48 -0
- data/spec/models/product_stats_spec.rb +144 -0
- data/spec/models/release_list_spec.rb +42 -0
- data/spec/models/release_spec.rb +66 -0
- data/spec/models/request_portal_link_spec.rb +42 -0
- data/spec/models/revenue_spec.rb +84 -0
- data/spec/models/send_license_keys_spec.rb +36 -0
- data/spec/models/send_portal_link_spec.rb +36 -0
- data/spec/models/signing_key_spec.rb +58 -0
- data/spec/models/stripe_integration_spec.rb +60 -0
- data/spec/models/stripe_permission_spec.rb +52 -0
- data/spec/models/stripe_price_spec.rb +66 -0
- data/spec/models/token_spec.rb +62 -0
- data/spec/models/update_customer_spec.rb +42 -0
- data/spec/models/update_integration_mapping_spec.rb +36 -0
- data/spec/models/update_license_spec.rb +66 -0
- data/spec/models/update_policy_spec.rb +72 -0
- data/spec/models/update_product_portal_spec.rb +60 -0
- data/spec/models/update_product_spec.rb +48 -0
- data/spec/models/update_release_spec.rb +42 -0
- data/spec/models/validate_key_error_error_spec.rb +54 -0
- data/spec/models/validate_key_error_spec.rb +36 -0
- data/spec/models/validate_key_spec.rb +60 -0
- data/spec/spec_helper.rb +111 -0
- metadata +532 -0
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#LicenseManager API
|
|
3
|
+
|
|
4
|
+
#Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module LicenseManager
|
|
16
|
+
class ProductsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Create a product
|
|
23
|
+
# Without a `slug`, the product gets one derived from its name: lower cased, without accents and special characters (`Élan Pro 2!` becomes `elan-pro-2`). When another product of the organization already uses it, a dash and 3 random lowercase letters or digits are appended (`elan-pro-2-k3f`), until the slug is free. An explicit `slug` is used as is: the request fails with a `409` when it's taken, it's never changed. Slug uniqueness is enforced by the database, so when concurrent requests end up with the same slug, only one succeeds and the others get a `409`, even without an explicit `slug`. Retrying such a request without a `slug` derives a new one. The product is created with its default policy, named `Default policy` with the `default` slug, whose settings are given by `defaultPolicy`. Omitted settings default to licenses that never expire, on a single machine, offline for one week, for every version of the product. Unlike `createPolicy`, where `maxMachines` defaults to no limit. With `isTestFromProductId`, the product is a test product: its id, its slug, and the ids, slugs and license keys of its resources start with `test_` (`TEST-` for license keys), and only test API keys reach it. It starts with copies of the policies, releases and portal settings of the live product, `defaultPolicy` is ignored. Later changes to the live product aren't copied: reset the test product to copy them again. Test API keys can only create test products, live API keys only live ones. **Required role permission**: `product:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
24
|
+
# @param create_product_with_policy [CreateProductWithPolicy]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @return [Product]
|
|
27
|
+
def create_product(create_product_with_policy, opts = {})
|
|
28
|
+
data, _status_code, _headers = create_product_with_http_info(create_product_with_policy, opts)
|
|
29
|
+
data
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Create a product
|
|
33
|
+
# Without a `slug`, the product gets one derived from its name: lower cased, without accents and special characters (`Élan Pro 2!` becomes `elan-pro-2`). When another product of the organization already uses it, a dash and 3 random lowercase letters or digits are appended (`elan-pro-2-k3f`), until the slug is free. An explicit `slug` is used as is: the request fails with a `409` when it's taken, it's never changed. Slug uniqueness is enforced by the database, so when concurrent requests end up with the same slug, only one succeeds and the others get a `409`, even without an explicit `slug`. Retrying such a request without a `slug` derives a new one. The product is created with its default policy, named `Default policy` with the `default` slug, whose settings are given by `defaultPolicy`. Omitted settings default to licenses that never expire, on a single machine, offline for one week, for every version of the product. Unlike `createPolicy`, where `maxMachines` defaults to no limit. With `isTestFromProductId`, the product is a test product: its id, its slug, and the ids, slugs and license keys of its resources start with `test_` (`TEST-` for license keys), and only test API keys reach it. It starts with copies of the policies, releases and portal settings of the live product, `defaultPolicy` is ignored. Later changes to the live product aren't copied: reset the test product to copy them again. Test API keys can only create test products, live API keys only live ones. **Required role permission**: `product:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
34
|
+
# @param create_product_with_policy [CreateProductWithPolicy]
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
37
|
+
def create_product_with_http_info(create_product_with_policy, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.create_product ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'create_product_with_policy' is set
|
|
42
|
+
if @api_client.config.client_side_validation && create_product_with_policy.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'create_product_with_policy' when calling ProductsApi.create_product"
|
|
44
|
+
end
|
|
45
|
+
# resource path
|
|
46
|
+
local_var_path = '/v1/products'
|
|
47
|
+
|
|
48
|
+
# query parameters
|
|
49
|
+
query_params = opts[:query_params] || {}
|
|
50
|
+
|
|
51
|
+
# header parameters
|
|
52
|
+
header_params = opts[:header_params] || {}
|
|
53
|
+
# HTTP header 'Accept' (if needed)
|
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
55
|
+
# HTTP header 'Content-Type'
|
|
56
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
57
|
+
if !content_type.nil?
|
|
58
|
+
header_params['Content-Type'] = content_type
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# form parameters
|
|
62
|
+
form_params = opts[:form_params] || {}
|
|
63
|
+
|
|
64
|
+
# http body (model)
|
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_product_with_policy)
|
|
66
|
+
|
|
67
|
+
# return_type
|
|
68
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
69
|
+
|
|
70
|
+
# auth_names
|
|
71
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
72
|
+
|
|
73
|
+
new_options = opts.merge(
|
|
74
|
+
:operation => :"ProductsApi.create_product",
|
|
75
|
+
:header_params => header_params,
|
|
76
|
+
:query_params => query_params,
|
|
77
|
+
:form_params => form_params,
|
|
78
|
+
:body => post_body,
|
|
79
|
+
:auth_names => auth_names,
|
|
80
|
+
:return_type => return_type
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
84
|
+
if @api_client.config.debugging
|
|
85
|
+
@api_client.config.logger.debug "API called: ProductsApi#create_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
86
|
+
end
|
|
87
|
+
return data, status_code, headers
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Delete a product
|
|
91
|
+
# Deletes the product along with its policies, customers and releases, and its test products with everything they hold. A live product that licenses belong to can't be deleted: delete them first. A test product can always be deleted, along with its licenses and machines. The events of the deleted policies and licenses can no longer be listed. **Required role permission**: `product:delete` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
92
|
+
# @param id [String]
|
|
93
|
+
# @param [Hash] opts the optional parameters
|
|
94
|
+
# @return [nil]
|
|
95
|
+
def delete_product(id, opts = {})
|
|
96
|
+
delete_product_with_http_info(id, opts)
|
|
97
|
+
nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Delete a product
|
|
101
|
+
# Deletes the product along with its policies, customers and releases, and its test products with everything they hold. A live product that licenses belong to can't be deleted: delete them first. A test product can always be deleted, along with its licenses and machines. The events of the deleted policies and licenses can no longer be listed. **Required role permission**: `product:delete` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
102
|
+
# @param id [String]
|
|
103
|
+
# @param [Hash] opts the optional parameters
|
|
104
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
105
|
+
def delete_product_with_http_info(id, opts = {})
|
|
106
|
+
if @api_client.config.debugging
|
|
107
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.delete_product ...'
|
|
108
|
+
end
|
|
109
|
+
# verify the required parameter 'id' is set
|
|
110
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
111
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.delete_product"
|
|
112
|
+
end
|
|
113
|
+
# resource path
|
|
114
|
+
local_var_path = '/v1/products/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
115
|
+
|
|
116
|
+
# query parameters
|
|
117
|
+
query_params = opts[:query_params] || {}
|
|
118
|
+
|
|
119
|
+
# header parameters
|
|
120
|
+
header_params = opts[:header_params] || {}
|
|
121
|
+
# HTTP header 'Accept' (if needed)
|
|
122
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
123
|
+
|
|
124
|
+
# form parameters
|
|
125
|
+
form_params = opts[:form_params] || {}
|
|
126
|
+
|
|
127
|
+
# http body (model)
|
|
128
|
+
post_body = opts[:debug_body]
|
|
129
|
+
|
|
130
|
+
# return_type
|
|
131
|
+
return_type = opts[:debug_return_type]
|
|
132
|
+
|
|
133
|
+
# auth_names
|
|
134
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
135
|
+
|
|
136
|
+
new_options = opts.merge(
|
|
137
|
+
:operation => :"ProductsApi.delete_product",
|
|
138
|
+
:header_params => header_params,
|
|
139
|
+
:query_params => query_params,
|
|
140
|
+
:form_params => form_params,
|
|
141
|
+
:body => post_body,
|
|
142
|
+
:auth_names => auth_names,
|
|
143
|
+
:return_type => return_type
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
147
|
+
if @api_client.config.debugging
|
|
148
|
+
@api_client.config.logger.debug "API called: ProductsApi#delete_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
149
|
+
end
|
|
150
|
+
return data, status_code, headers
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Delete a product logo
|
|
154
|
+
# Removes the logo of the product, and deletes its image. Succeeds when the product has no logo. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
155
|
+
# @param id [String]
|
|
156
|
+
# @param [Hash] opts the optional parameters
|
|
157
|
+
# @return [Product]
|
|
158
|
+
def delete_product_logo(id, opts = {})
|
|
159
|
+
data, _status_code, _headers = delete_product_logo_with_http_info(id, opts)
|
|
160
|
+
data
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Delete a product logo
|
|
164
|
+
# Removes the logo of the product, and deletes its image. Succeeds when the product has no logo. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
165
|
+
# @param id [String]
|
|
166
|
+
# @param [Hash] opts the optional parameters
|
|
167
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
168
|
+
def delete_product_logo_with_http_info(id, opts = {})
|
|
169
|
+
if @api_client.config.debugging
|
|
170
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.delete_product_logo ...'
|
|
171
|
+
end
|
|
172
|
+
# verify the required parameter 'id' is set
|
|
173
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
174
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.delete_product_logo"
|
|
175
|
+
end
|
|
176
|
+
# resource path
|
|
177
|
+
local_var_path = '/v1/products/{id}/logo'.sub('{id}', CGI.escape(id.to_s))
|
|
178
|
+
|
|
179
|
+
# query parameters
|
|
180
|
+
query_params = opts[:query_params] || {}
|
|
181
|
+
|
|
182
|
+
# header parameters
|
|
183
|
+
header_params = opts[:header_params] || {}
|
|
184
|
+
# HTTP header 'Accept' (if needed)
|
|
185
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
186
|
+
|
|
187
|
+
# form parameters
|
|
188
|
+
form_params = opts[:form_params] || {}
|
|
189
|
+
|
|
190
|
+
# http body (model)
|
|
191
|
+
post_body = opts[:debug_body]
|
|
192
|
+
|
|
193
|
+
# return_type
|
|
194
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
195
|
+
|
|
196
|
+
# auth_names
|
|
197
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
198
|
+
|
|
199
|
+
new_options = opts.merge(
|
|
200
|
+
:operation => :"ProductsApi.delete_product_logo",
|
|
201
|
+
:header_params => header_params,
|
|
202
|
+
:query_params => query_params,
|
|
203
|
+
:form_params => form_params,
|
|
204
|
+
:body => post_body,
|
|
205
|
+
:auth_names => auth_names,
|
|
206
|
+
:return_type => return_type
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
210
|
+
if @api_client.config.debugging
|
|
211
|
+
@api_client.config.logger.debug "API called: ProductsApi#delete_product_logo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
212
|
+
end
|
|
213
|
+
return data, status_code, headers
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Get a product
|
|
217
|
+
# @param id [String]
|
|
218
|
+
# @param [Hash] opts the optional parameters
|
|
219
|
+
# @return [Product]
|
|
220
|
+
def get_product(id, opts = {})
|
|
221
|
+
data, _status_code, _headers = get_product_with_http_info(id, opts)
|
|
222
|
+
data
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Get a product
|
|
226
|
+
# @param id [String]
|
|
227
|
+
# @param [Hash] opts the optional parameters
|
|
228
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
229
|
+
def get_product_with_http_info(id, opts = {})
|
|
230
|
+
if @api_client.config.debugging
|
|
231
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.get_product ...'
|
|
232
|
+
end
|
|
233
|
+
# verify the required parameter 'id' is set
|
|
234
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
235
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.get_product"
|
|
236
|
+
end
|
|
237
|
+
# resource path
|
|
238
|
+
local_var_path = '/v1/products/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
239
|
+
|
|
240
|
+
# query parameters
|
|
241
|
+
query_params = opts[:query_params] || {}
|
|
242
|
+
|
|
243
|
+
# header parameters
|
|
244
|
+
header_params = opts[:header_params] || {}
|
|
245
|
+
# HTTP header 'Accept' (if needed)
|
|
246
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
247
|
+
|
|
248
|
+
# form parameters
|
|
249
|
+
form_params = opts[:form_params] || {}
|
|
250
|
+
|
|
251
|
+
# http body (model)
|
|
252
|
+
post_body = opts[:debug_body]
|
|
253
|
+
|
|
254
|
+
# return_type
|
|
255
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
256
|
+
|
|
257
|
+
# auth_names
|
|
258
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
259
|
+
|
|
260
|
+
new_options = opts.merge(
|
|
261
|
+
:operation => :"ProductsApi.get_product",
|
|
262
|
+
:header_params => header_params,
|
|
263
|
+
:query_params => query_params,
|
|
264
|
+
:form_params => form_params,
|
|
265
|
+
:body => post_body,
|
|
266
|
+
:auth_names => auth_names,
|
|
267
|
+
:return_type => return_type
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
271
|
+
if @api_client.config.debugging
|
|
272
|
+
@api_client.config.logger.debug "API called: ProductsApi#get_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
273
|
+
end
|
|
274
|
+
return data, status_code, headers
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Get the stats of a product
|
|
278
|
+
# Counts of the licenses and machines of the product, number of licenses created each day over the last 30 days and each month over the last 12 months, overall and per policy, revenue per currency over the same periods, and successful activations each day over the last 30 days. Days and months are in UTC.
|
|
279
|
+
# @param id [String]
|
|
280
|
+
# @param [Hash] opts the optional parameters
|
|
281
|
+
# @return [ProductStats]
|
|
282
|
+
def get_product_stats(id, opts = {})
|
|
283
|
+
data, _status_code, _headers = get_product_stats_with_http_info(id, opts)
|
|
284
|
+
data
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Get the stats of a product
|
|
288
|
+
# Counts of the licenses and machines of the product, number of licenses created each day over the last 30 days and each month over the last 12 months, overall and per policy, revenue per currency over the same periods, and successful activations each day over the last 30 days. Days and months are in UTC.
|
|
289
|
+
# @param id [String]
|
|
290
|
+
# @param [Hash] opts the optional parameters
|
|
291
|
+
# @return [Array<(ProductStats, Integer, Hash)>] ProductStats data, response status code and response headers
|
|
292
|
+
def get_product_stats_with_http_info(id, opts = {})
|
|
293
|
+
if @api_client.config.debugging
|
|
294
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.get_product_stats ...'
|
|
295
|
+
end
|
|
296
|
+
# verify the required parameter 'id' is set
|
|
297
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
298
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.get_product_stats"
|
|
299
|
+
end
|
|
300
|
+
# resource path
|
|
301
|
+
local_var_path = '/v1/products/{id}/stats'.sub('{id}', CGI.escape(id.to_s))
|
|
302
|
+
|
|
303
|
+
# query parameters
|
|
304
|
+
query_params = opts[:query_params] || {}
|
|
305
|
+
|
|
306
|
+
# header parameters
|
|
307
|
+
header_params = opts[:header_params] || {}
|
|
308
|
+
# HTTP header 'Accept' (if needed)
|
|
309
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
310
|
+
|
|
311
|
+
# form parameters
|
|
312
|
+
form_params = opts[:form_params] || {}
|
|
313
|
+
|
|
314
|
+
# http body (model)
|
|
315
|
+
post_body = opts[:debug_body]
|
|
316
|
+
|
|
317
|
+
# return_type
|
|
318
|
+
return_type = opts[:debug_return_type] || 'ProductStats'
|
|
319
|
+
|
|
320
|
+
# auth_names
|
|
321
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
322
|
+
|
|
323
|
+
new_options = opts.merge(
|
|
324
|
+
:operation => :"ProductsApi.get_product_stats",
|
|
325
|
+
:header_params => header_params,
|
|
326
|
+
:query_params => query_params,
|
|
327
|
+
:form_params => form_params,
|
|
328
|
+
:body => post_body,
|
|
329
|
+
:auth_names => auth_names,
|
|
330
|
+
:return_type => return_type
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
334
|
+
if @api_client.config.debugging
|
|
335
|
+
@api_client.config.logger.debug "API called: ProductsApi#get_product_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
336
|
+
end
|
|
337
|
+
return data, status_code, headers
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
# List products
|
|
341
|
+
# @param [Hash] opts the optional parameters
|
|
342
|
+
# @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
|
|
343
|
+
# @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
|
|
344
|
+
# @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
|
|
345
|
+
# @option opts [String] :search Case-insensitive text the name or slug contains.
|
|
346
|
+
# @option opts [String] :slug Only returns the product with this exact slug.
|
|
347
|
+
# @option opts [String] :is_test Only returns the test products with `true`, the live ones with `false`. API keys only list the products of their own mode.
|
|
348
|
+
# @return [ProductList]
|
|
349
|
+
def list_products(opts = {})
|
|
350
|
+
data, _status_code, _headers = list_products_with_http_info(opts)
|
|
351
|
+
data
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# List products
|
|
355
|
+
# @param [Hash] opts the optional parameters
|
|
356
|
+
# @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
|
|
357
|
+
# @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
|
|
358
|
+
# @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
|
|
359
|
+
# @option opts [String] :search Case-insensitive text the name or slug contains.
|
|
360
|
+
# @option opts [String] :slug Only returns the product with this exact slug.
|
|
361
|
+
# @option opts [String] :is_test Only returns the test products with `true`, the live ones with `false`. API keys only list the products of their own mode.
|
|
362
|
+
# @return [Array<(ProductList, Integer, Hash)>] ProductList data, response status code and response headers
|
|
363
|
+
def list_products_with_http_info(opts = {})
|
|
364
|
+
if @api_client.config.debugging
|
|
365
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.list_products ...'
|
|
366
|
+
end
|
|
367
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
368
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ProductsApi.list_products, must be greater than or equal to 1.'
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
|
|
372
|
+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProductsApi.list_products, must be smaller than or equal to 100.'
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
|
|
376
|
+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ProductsApi.list_products, must be greater than or equal to 1.'
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
allowable_values = ["name", "-name", "slug", "-slug", "createdAt", "-createdAt", "updatedAt", "-updatedAt", "unknown_default_open_api"]
|
|
380
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
|
|
381
|
+
fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
|
|
382
|
+
end
|
|
383
|
+
if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length > 200
|
|
384
|
+
fail ArgumentError, 'invalid value for "opts[:"search"]" when calling ProductsApi.list_products, the character length must be smaller than or equal to 200.'
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length < 1
|
|
388
|
+
fail ArgumentError, 'invalid value for "opts[:"search"]" when calling ProductsApi.list_products, the character length must be greater than or equal to 1.'
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
allowable_values = ["true", "false", "unknown_default_open_api"]
|
|
392
|
+
if @api_client.config.client_side_validation && opts[:'is_test'] && !allowable_values.include?(opts[:'is_test'])
|
|
393
|
+
fail ArgumentError, "invalid value for \"is_test\", must be one of #{allowable_values}"
|
|
394
|
+
end
|
|
395
|
+
# resource path
|
|
396
|
+
local_var_path = '/v1/products'
|
|
397
|
+
|
|
398
|
+
# query parameters
|
|
399
|
+
query_params = opts[:query_params] || {}
|
|
400
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
401
|
+
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
|
|
402
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
|
403
|
+
query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
|
|
404
|
+
query_params[:'slug'] = opts[:'slug'] if !opts[:'slug'].nil?
|
|
405
|
+
query_params[:'isTest'] = opts[:'is_test'] if !opts[:'is_test'].nil?
|
|
406
|
+
|
|
407
|
+
# header parameters
|
|
408
|
+
header_params = opts[:header_params] || {}
|
|
409
|
+
# HTTP header 'Accept' (if needed)
|
|
410
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
411
|
+
|
|
412
|
+
# form parameters
|
|
413
|
+
form_params = opts[:form_params] || {}
|
|
414
|
+
|
|
415
|
+
# http body (model)
|
|
416
|
+
post_body = opts[:debug_body]
|
|
417
|
+
|
|
418
|
+
# return_type
|
|
419
|
+
return_type = opts[:debug_return_type] || 'ProductList'
|
|
420
|
+
|
|
421
|
+
# auth_names
|
|
422
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
423
|
+
|
|
424
|
+
new_options = opts.merge(
|
|
425
|
+
:operation => :"ProductsApi.list_products",
|
|
426
|
+
:header_params => header_params,
|
|
427
|
+
:query_params => query_params,
|
|
428
|
+
:form_params => form_params,
|
|
429
|
+
:body => post_body,
|
|
430
|
+
:auth_names => auth_names,
|
|
431
|
+
:return_type => return_type
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
435
|
+
if @api_client.config.debugging
|
|
436
|
+
@api_client.config.logger.debug "API called: ProductsApi#list_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
437
|
+
end
|
|
438
|
+
return data, status_code, headers
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
# Reset a test product
|
|
442
|
+
# Deletes the customers, licenses, machines, policies and releases of the test product, with their events, then copies the policies, releases and portal settings of its live product again. Its id, name and slug are kept, but the copied policies get new ids. The tokens of its customers, licenses and machines stop working. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
443
|
+
# @param id [String]
|
|
444
|
+
# @param [Hash] opts the optional parameters
|
|
445
|
+
# @return [Product]
|
|
446
|
+
def reset_product(id, opts = {})
|
|
447
|
+
data, _status_code, _headers = reset_product_with_http_info(id, opts)
|
|
448
|
+
data
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Reset a test product
|
|
452
|
+
# Deletes the customers, licenses, machines, policies and releases of the test product, with their events, then copies the policies, releases and portal settings of its live product again. Its id, name and slug are kept, but the copied policies get new ids. The tokens of its customers, licenses and machines stop working. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
453
|
+
# @param id [String]
|
|
454
|
+
# @param [Hash] opts the optional parameters
|
|
455
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
456
|
+
def reset_product_with_http_info(id, opts = {})
|
|
457
|
+
if @api_client.config.debugging
|
|
458
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.reset_product ...'
|
|
459
|
+
end
|
|
460
|
+
# verify the required parameter 'id' is set
|
|
461
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
462
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.reset_product"
|
|
463
|
+
end
|
|
464
|
+
# resource path
|
|
465
|
+
local_var_path = '/v1/products/{id}/reset'.sub('{id}', CGI.escape(id.to_s))
|
|
466
|
+
|
|
467
|
+
# query parameters
|
|
468
|
+
query_params = opts[:query_params] || {}
|
|
469
|
+
|
|
470
|
+
# header parameters
|
|
471
|
+
header_params = opts[:header_params] || {}
|
|
472
|
+
# HTTP header 'Accept' (if needed)
|
|
473
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
474
|
+
|
|
475
|
+
# form parameters
|
|
476
|
+
form_params = opts[:form_params] || {}
|
|
477
|
+
|
|
478
|
+
# http body (model)
|
|
479
|
+
post_body = opts[:debug_body]
|
|
480
|
+
|
|
481
|
+
# return_type
|
|
482
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
483
|
+
|
|
484
|
+
# auth_names
|
|
485
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
486
|
+
|
|
487
|
+
new_options = opts.merge(
|
|
488
|
+
:operation => :"ProductsApi.reset_product",
|
|
489
|
+
:header_params => header_params,
|
|
490
|
+
:query_params => query_params,
|
|
491
|
+
:form_params => form_params,
|
|
492
|
+
:body => post_body,
|
|
493
|
+
:auth_names => auth_names,
|
|
494
|
+
:return_type => return_type
|
|
495
|
+
)
|
|
496
|
+
|
|
497
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
498
|
+
if @api_client.config.debugging
|
|
499
|
+
@api_client.config.logger.debug "API called: ProductsApi#reset_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
500
|
+
end
|
|
501
|
+
return data, status_code, headers
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
# Update a product
|
|
505
|
+
# A product can't be turned into a test product, or back: `isTestFromProductId` can't be changed. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
506
|
+
# @param id [String]
|
|
507
|
+
# @param update_product [UpdateProduct]
|
|
508
|
+
# @param [Hash] opts the optional parameters
|
|
509
|
+
# @return [Product]
|
|
510
|
+
def update_product(id, update_product, opts = {})
|
|
511
|
+
data, _status_code, _headers = update_product_with_http_info(id, update_product, opts)
|
|
512
|
+
data
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
# Update a product
|
|
516
|
+
# A product can't be turned into a test product, or back: `isTestFromProductId` can't be changed. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
517
|
+
# @param id [String]
|
|
518
|
+
# @param update_product [UpdateProduct]
|
|
519
|
+
# @param [Hash] opts the optional parameters
|
|
520
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
521
|
+
def update_product_with_http_info(id, update_product, opts = {})
|
|
522
|
+
if @api_client.config.debugging
|
|
523
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.update_product ...'
|
|
524
|
+
end
|
|
525
|
+
# verify the required parameter 'id' is set
|
|
526
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
527
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.update_product"
|
|
528
|
+
end
|
|
529
|
+
# verify the required parameter 'update_product' is set
|
|
530
|
+
if @api_client.config.client_side_validation && update_product.nil?
|
|
531
|
+
fail ArgumentError, "Missing the required parameter 'update_product' when calling ProductsApi.update_product"
|
|
532
|
+
end
|
|
533
|
+
# resource path
|
|
534
|
+
local_var_path = '/v1/products/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
535
|
+
|
|
536
|
+
# query parameters
|
|
537
|
+
query_params = opts[:query_params] || {}
|
|
538
|
+
|
|
539
|
+
# header parameters
|
|
540
|
+
header_params = opts[:header_params] || {}
|
|
541
|
+
# HTTP header 'Accept' (if needed)
|
|
542
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
543
|
+
# HTTP header 'Content-Type'
|
|
544
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
545
|
+
if !content_type.nil?
|
|
546
|
+
header_params['Content-Type'] = content_type
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
# form parameters
|
|
550
|
+
form_params = opts[:form_params] || {}
|
|
551
|
+
|
|
552
|
+
# http body (model)
|
|
553
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_product)
|
|
554
|
+
|
|
555
|
+
# return_type
|
|
556
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
557
|
+
|
|
558
|
+
# auth_names
|
|
559
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
560
|
+
|
|
561
|
+
new_options = opts.merge(
|
|
562
|
+
:operation => :"ProductsApi.update_product",
|
|
563
|
+
:header_params => header_params,
|
|
564
|
+
:query_params => query_params,
|
|
565
|
+
:form_params => form_params,
|
|
566
|
+
:body => post_body,
|
|
567
|
+
:auth_names => auth_names,
|
|
568
|
+
:return_type => return_type
|
|
569
|
+
)
|
|
570
|
+
|
|
571
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
|
572
|
+
if @api_client.config.debugging
|
|
573
|
+
@api_client.config.logger.debug "API called: ProductsApi#update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
574
|
+
end
|
|
575
|
+
return data, status_code, headers
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
# Upload a product logo
|
|
579
|
+
# Replaces the logo of the product, shown in the web app and the customer portal. The previous logo is deleted. Accepts WebP, PNG, JPEG and SVG images up to 1 MB, recognized by their content. Logos are shown in squares: use square images, 256×256 pixels for bitmaps. The web app crops and resizes images to this size, and converts them to WebP, before uploading them. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
580
|
+
# @param id [String]
|
|
581
|
+
# @param file [File] WebP, PNG, JPEG or SVG image, up to 1 MB.
|
|
582
|
+
# @param [Hash] opts the optional parameters
|
|
583
|
+
# @return [Product]
|
|
584
|
+
def upload_product_logo(id, file, opts = {})
|
|
585
|
+
data, _status_code, _headers = upload_product_logo_with_http_info(id, file, opts)
|
|
586
|
+
data
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
# Upload a product logo
|
|
590
|
+
# Replaces the logo of the product, shown in the web app and the customer portal. The previous logo is deleted. Accepts WebP, PNG, JPEG and SVG images up to 1 MB, recognized by their content. Logos are shown in squares: use square images, 256×256 pixels for bitmaps. The web app crops and resizes images to this size, and converts them to WebP, before uploading them. **Required role permission**: `product:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
|
|
591
|
+
# @param id [String]
|
|
592
|
+
# @param file [File] WebP, PNG, JPEG or SVG image, up to 1 MB.
|
|
593
|
+
# @param [Hash] opts the optional parameters
|
|
594
|
+
# @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers
|
|
595
|
+
def upload_product_logo_with_http_info(id, file, opts = {})
|
|
596
|
+
if @api_client.config.debugging
|
|
597
|
+
@api_client.config.logger.debug 'Calling API: ProductsApi.upload_product_logo ...'
|
|
598
|
+
end
|
|
599
|
+
# verify the required parameter 'id' is set
|
|
600
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
601
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.upload_product_logo"
|
|
602
|
+
end
|
|
603
|
+
# verify the required parameter 'file' is set
|
|
604
|
+
if @api_client.config.client_side_validation && file.nil?
|
|
605
|
+
fail ArgumentError, "Missing the required parameter 'file' when calling ProductsApi.upload_product_logo"
|
|
606
|
+
end
|
|
607
|
+
# resource path
|
|
608
|
+
local_var_path = '/v1/products/{id}/logo'.sub('{id}', CGI.escape(id.to_s))
|
|
609
|
+
|
|
610
|
+
# query parameters
|
|
611
|
+
query_params = opts[:query_params] || {}
|
|
612
|
+
|
|
613
|
+
# header parameters
|
|
614
|
+
header_params = opts[:header_params] || {}
|
|
615
|
+
# HTTP header 'Accept' (if needed)
|
|
616
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
617
|
+
# HTTP header 'Content-Type'
|
|
618
|
+
content_type = @api_client.select_header_content_type(['multipart/form-data'])
|
|
619
|
+
if !content_type.nil?
|
|
620
|
+
header_params['Content-Type'] = content_type
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
# form parameters
|
|
624
|
+
form_params = opts[:form_params] || {}
|
|
625
|
+
form_params['file'] = file
|
|
626
|
+
|
|
627
|
+
# http body (model)
|
|
628
|
+
post_body = opts[:debug_body]
|
|
629
|
+
|
|
630
|
+
# return_type
|
|
631
|
+
return_type = opts[:debug_return_type] || 'Product'
|
|
632
|
+
|
|
633
|
+
# auth_names
|
|
634
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
635
|
+
|
|
636
|
+
new_options = opts.merge(
|
|
637
|
+
:operation => :"ProductsApi.upload_product_logo",
|
|
638
|
+
:header_params => header_params,
|
|
639
|
+
:query_params => query_params,
|
|
640
|
+
:form_params => form_params,
|
|
641
|
+
:body => post_body,
|
|
642
|
+
:auth_names => auth_names,
|
|
643
|
+
:return_type => return_type
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
647
|
+
if @api_client.config.debugging
|
|
648
|
+
@api_client.config.logger.debug "API called: ProductsApi#upload_product_logo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
649
|
+
end
|
|
650
|
+
return data, status_code, headers
|
|
651
|
+
end
|
|
652
|
+
end
|
|
653
|
+
end
|