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.
Files changed (323) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +201 -0
  5. data/README.md +96 -0
  6. data/Rakefile +10 -0
  7. data/docs/ConnectStripe.md +18 -0
  8. data/docs/CreateCustomer.md +20 -0
  9. data/docs/CreateIntegrationMapping.md +20 -0
  10. data/docs/CreateLicense.md +36 -0
  11. data/docs/CreatePolicy.md +30 -0
  12. data/docs/CreatePortalLink.md +18 -0
  13. data/docs/CreateProduct.md +20 -0
  14. data/docs/CreateProductWithPolicy.md +24 -0
  15. data/docs/CreateRelease.md +20 -0
  16. data/docs/CreateToken.md +20 -0
  17. data/docs/Customer.md +30 -0
  18. data/docs/CustomerList.md +20 -0
  19. data/docs/CustomersApi.md +385 -0
  20. data/docs/Error.md +18 -0
  21. data/docs/ErrorError.md +22 -0
  22. data/docs/ErrorErrorIssuesInner.md +20 -0
  23. data/docs/ErrorErrorIssuesInnerPathInner.md +15 -0
  24. data/docs/Event.md +34 -0
  25. data/docs/EventActor.md +55 -0
  26. data/docs/EventActorOneOf.md +26 -0
  27. data/docs/EventActorOneOf1.md +24 -0
  28. data/docs/EventActorOneOf2.md +22 -0
  29. data/docs/EventActorOneOf3.md +18 -0
  30. data/docs/EventActorOneOf4.md +22 -0
  31. data/docs/EventList.md +20 -0
  32. data/docs/EventMachine.md +22 -0
  33. data/docs/EventType.md +15 -0
  34. data/docs/EventsApi.md +173 -0
  35. data/docs/FixedMaxVersion.md +20 -0
  36. data/docs/Integration.md +38 -0
  37. data/docs/IntegrationMapping.md +38 -0
  38. data/docs/IntegrationStatus.md +15 -0
  39. data/docs/IntegrationsApi.md +587 -0
  40. data/docs/License.md +50 -0
  41. data/docs/LicenseList.md +20 -0
  42. data/docs/LicenseMaxVersion.md +22 -0
  43. data/docs/LicenseMaxVersionInput.md +22 -0
  44. data/docs/LicenseStats.md +26 -0
  45. data/docs/LicenseStatsActivationsByMachineInner.md +24 -0
  46. data/docs/LicenseStatsActivationsByVersionInner.md +20 -0
  47. data/docs/LicenseStatus.md +15 -0
  48. data/docs/LicenseToken.md +18 -0
  49. data/docs/LicensesApi.md +817 -0
  50. data/docs/ListPolicyEventsTypeParameter.md +15 -0
  51. data/docs/ListStripePrices200Response.md +18 -0
  52. data/docs/LockMaxVersion.md +22 -0
  53. data/docs/LockMaxVersionMajorAfter.md +49 -0
  54. data/docs/LockMaxVersionMajorAfterOneOf.md +20 -0
  55. data/docs/LockMaxVersionMajorAfterOneOf1.md +20 -0
  56. data/docs/LockMaxVersionMinorAfter.md +20 -0
  57. data/docs/Machine.md +36 -0
  58. data/docs/MachineList.md +20 -0
  59. data/docs/MachinesApi.md +246 -0
  60. data/docs/Pagination.md +24 -0
  61. data/docs/PoliciesApi.md +388 -0
  62. data/docs/Policy.md +40 -0
  63. data/docs/PolicyDuration.md +20 -0
  64. data/docs/PolicyList.md +20 -0
  65. data/docs/PolicyMaxVersion.md +24 -0
  66. data/docs/PolicySettings.md +24 -0
  67. data/docs/PolicySettingsDuration.md +20 -0
  68. data/docs/PolicySettingsDurationAnyOf.md +20 -0
  69. data/docs/PolicySettingsDurationAnyOf1.md +20 -0
  70. data/docs/PolicySettingsMaxVersion.md +24 -0
  71. data/docs/Portal.md +30 -0
  72. data/docs/PortalApi.md +289 -0
  73. data/docs/PortalLink.md +22 -0
  74. data/docs/PortalNotFound.md +22 -0
  75. data/docs/PortalSettings.md +26 -0
  76. data/docs/Price.md +20 -0
  77. data/docs/PriceInput.md +20 -0
  78. data/docs/Product.md +32 -0
  79. data/docs/ProductList.md +20 -0
  80. data/docs/ProductStats.md +54 -0
  81. data/docs/ProductStatsActivationsByVersionInner.md +20 -0
  82. data/docs/ProductStatsActiveMachinesByPlatformInner.md +20 -0
  83. data/docs/ProductStatsActiveMachinesByVersionInner.md +20 -0
  84. data/docs/ProductStatsNewLicensesByPolicyInner.md +22 -0
  85. data/docs/ProductsApi.md +666 -0
  86. data/docs/Release.md +28 -0
  87. data/docs/ReleaseList.md +20 -0
  88. data/docs/ReleasesApi.md +388 -0
  89. data/docs/RequestPortalLink.md +20 -0
  90. data/docs/Revenue.md +34 -0
  91. data/docs/SendLicenseKeys.md +18 -0
  92. data/docs/SendPortalLink.md +18 -0
  93. data/docs/SigningKey.md +27 -0
  94. data/docs/StripeIntegration.md +26 -0
  95. data/docs/StripePermission.md +22 -0
  96. data/docs/StripePrice.md +28 -0
  97. data/docs/Token.md +24 -0
  98. data/docs/TokensApi.md +235 -0
  99. data/docs/UpdateCustomer.md +20 -0
  100. data/docs/UpdateIntegrationMapping.md +18 -0
  101. data/docs/UpdateLicense.md +28 -0
  102. data/docs/UpdatePolicy.md +30 -0
  103. data/docs/UpdateProduct.md +22 -0
  104. data/docs/UpdateProductPortal.md +26 -0
  105. data/docs/UpdateRelease.md +20 -0
  106. data/docs/ValidateKey.md +26 -0
  107. data/docs/ValidateKeyError.md +18 -0
  108. data/docs/ValidateKeyErrorError.md +24 -0
  109. data/git_push.sh +54 -0
  110. data/lib/license_manager/api/customers_api.rb +398 -0
  111. data/lib/license_manager/api/events_api.rb +207 -0
  112. data/lib/license_manager/api/integrations_api.rb +559 -0
  113. data/lib/license_manager/api/licenses_api.rb +885 -0
  114. data/lib/license_manager/api/machines_api.rb +257 -0
  115. data/lib/license_manager/api/policies_api.rb +412 -0
  116. data/lib/license_manager/api/portal_api.rb +310 -0
  117. data/lib/license_manager/api/products_api.rb +653 -0
  118. data/lib/license_manager/api/releases_api.rb +408 -0
  119. data/lib/license_manager/api/tokens_api.rb +244 -0
  120. data/lib/license_manager/api_client.rb +441 -0
  121. data/lib/license_manager/api_error.rb +58 -0
  122. data/lib/license_manager/api_model_base.rb +88 -0
  123. data/lib/license_manager/configuration.rb +400 -0
  124. data/lib/license_manager/models/connect_stripe.rb +187 -0
  125. data/lib/license_manager/models/create_customer.rb +222 -0
  126. data/lib/license_manager/models/create_integration_mapping.rb +222 -0
  127. data/lib/license_manager/models/create_license.rb +361 -0
  128. data/lib/license_manager/models/create_policy.rb +347 -0
  129. data/lib/license_manager/models/create_portal_link.rb +196 -0
  130. data/lib/license_manager/models/create_product.rb +244 -0
  131. data/lib/license_manager/models/create_product_with_policy.rb +270 -0
  132. data/lib/license_manager/models/create_release.rb +208 -0
  133. data/lib/license_manager/models/create_token.rb +237 -0
  134. data/lib/license_manager/models/customer.rb +308 -0
  135. data/lib/license_manager/models/customer_list.rb +206 -0
  136. data/lib/license_manager/models/error.rb +177 -0
  137. data/lib/license_manager/models/error_error.rb +215 -0
  138. data/lib/license_manager/models/error_error_issues_inner.rb +205 -0
  139. data/lib/license_manager/models/error_error_issues_inner_path_inner.rb +103 -0
  140. data/lib/license_manager/models/event.rb +340 -0
  141. data/lib/license_manager/models/event_actor.rb +108 -0
  142. data/lib/license_manager/models/event_actor_one_of.rb +251 -0
  143. data/lib/license_manager/models/event_actor_one_of1.rb +239 -0
  144. data/lib/license_manager/models/event_actor_one_of2.rb +257 -0
  145. data/lib/license_manager/models/event_actor_one_of3.rb +201 -0
  146. data/lib/license_manager/models/event_actor_one_of4.rb +243 -0
  147. data/lib/license_manager/models/event_list.rb +206 -0
  148. data/lib/license_manager/models/event_machine.rb +216 -0
  149. data/lib/license_manager/models/event_type.rb +46 -0
  150. data/lib/license_manager/models/fixed_max_version.rb +240 -0
  151. data/lib/license_manager/models/integration.rb +412 -0
  152. data/lib/license_manager/models/integration_mapping.rb +435 -0
  153. data/lib/license_manager/models/integration_status.rb +42 -0
  154. data/lib/license_manager/models/license.rb +542 -0
  155. data/lib/license_manager/models/license_list.rb +206 -0
  156. data/lib/license_manager/models/license_max_version.rb +208 -0
  157. data/lib/license_manager/models/license_max_version_input.rb +202 -0
  158. data/lib/license_manager/models/license_stats.rb +292 -0
  159. data/lib/license_manager/models/license_stats_activations_by_machine_inner.rb +244 -0
  160. data/lib/license_manager/models/license_stats_activations_by_version_inner.rb +206 -0
  161. data/lib/license_manager/models/license_status.rb +42 -0
  162. data/lib/license_manager/models/license_token.rb +178 -0
  163. data/lib/license_manager/models/list_policy_events_type_parameter.rb +104 -0
  164. data/lib/license_manager/models/list_stripe_prices200_response.rb +179 -0
  165. data/lib/license_manager/models/lock_max_version.rb +240 -0
  166. data/lib/license_manager/models/lock_max_version_major_after.rb +105 -0
  167. data/lib/license_manager/models/lock_max_version_major_after_one_of.rb +245 -0
  168. data/lib/license_manager/models/lock_max_version_major_after_one_of1.rb +246 -0
  169. data/lib/license_manager/models/lock_max_version_minor_after.rb +104 -0
  170. data/lib/license_manager/models/machine.rb +383 -0
  171. data/lib/license_manager/models/machine_list.rb +206 -0
  172. data/lib/license_manager/models/pagination.rb +260 -0
  173. data/lib/license_manager/models/policy.rb +425 -0
  174. data/lib/license_manager/models/policy_duration.rb +104 -0
  175. data/lib/license_manager/models/policy_list.rb +206 -0
  176. data/lib/license_manager/models/policy_max_version.rb +104 -0
  177. data/lib/license_manager/models/policy_settings.rb +244 -0
  178. data/lib/license_manager/models/policy_settings_duration.rb +104 -0
  179. data/lib/license_manager/models/policy_settings_duration_any_of.rb +245 -0
  180. data/lib/license_manager/models/policy_settings_duration_any_of1.rb +246 -0
  181. data/lib/license_manager/models/policy_settings_max_version.rb +104 -0
  182. data/lib/license_manager/models/portal.rb +281 -0
  183. data/lib/license_manager/models/portal_link.rb +232 -0
  184. data/lib/license_manager/models/portal_not_found.rb +204 -0
  185. data/lib/license_manager/models/portal_settings.rb +304 -0
  186. data/lib/license_manager/models/price.rb +206 -0
  187. data/lib/license_manager/models/price_input.rb +224 -0
  188. data/lib/license_manager/models/product.rb +333 -0
  189. data/lib/license_manager/models/product_list.rb +206 -0
  190. data/lib/license_manager/models/product_stats.rb +682 -0
  191. data/lib/license_manager/models/product_stats_activations_by_version_inner.rb +193 -0
  192. data/lib/license_manager/models/product_stats_active_machines_by_platform_inner.rb +190 -0
  193. data/lib/license_manager/models/product_stats_active_machines_by_version_inner.rb +190 -0
  194. data/lib/license_manager/models/product_stats_new_licenses_by_policy_inner.rb +235 -0
  195. data/lib/license_manager/models/release.rb +308 -0
  196. data/lib/license_manager/models/release_list.rb +206 -0
  197. data/lib/license_manager/models/request_portal_link.rb +216 -0
  198. data/lib/license_manager/models/revenue.rb +401 -0
  199. data/lib/license_manager/models/send_license_keys.rb +198 -0
  200. data/lib/license_manager/models/send_portal_link.rb +187 -0
  201. data/lib/license_manager/models/signing_key.rb +282 -0
  202. data/lib/license_manager/models/stripe_integration.rb +276 -0
  203. data/lib/license_manager/models/stripe_permission.rb +253 -0
  204. data/lib/license_manager/models/stripe_price.rb +280 -0
  205. data/lib/license_manager/models/token.rb +274 -0
  206. data/lib/license_manager/models/update_customer.rb +215 -0
  207. data/lib/license_manager/models/update_integration_mapping.rb +186 -0
  208. data/lib/license_manager/models/update_license.rb +268 -0
  209. data/lib/license_manager/models/update_policy.rb +340 -0
  210. data/lib/license_manager/models/update_product.rb +246 -0
  211. data/lib/license_manager/models/update_product_portal.rb +274 -0
  212. data/lib/license_manager/models/update_release.rb +201 -0
  213. data/lib/license_manager/models/validate_key.rb +362 -0
  214. data/lib/license_manager/models/validate_key_error.rb +177 -0
  215. data/lib/license_manager/models/validate_key_error_error.rb +226 -0
  216. data/lib/license_manager/version.rb +15 -0
  217. data/lib/license_manager.rb +142 -0
  218. data/license_manager.gemspec +41 -0
  219. data/openapi.json +9825 -0
  220. data/spec/api/customers_api_spec.rb +102 -0
  221. data/spec/api/events_api_spec.rb +68 -0
  222. data/spec/api/integrations_api_spec.rb +134 -0
  223. data/spec/api/licenses_api_spec.rb +200 -0
  224. data/spec/api/machines_api_spec.rb +77 -0
  225. data/spec/api/policies_api_spec.rb +105 -0
  226. data/spec/api/portal_api_spec.rb +87 -0
  227. data/spec/api/products_api_spec.rb +148 -0
  228. data/spec/api/releases_api_spec.rb +105 -0
  229. data/spec/api/tokens_api_spec.rb +74 -0
  230. data/spec/models/connect_stripe_spec.rb +36 -0
  231. data/spec/models/create_customer_spec.rb +42 -0
  232. data/spec/models/create_integration_mapping_spec.rb +42 -0
  233. data/spec/models/create_license_spec.rb +90 -0
  234. data/spec/models/create_policy_spec.rb +72 -0
  235. data/spec/models/create_portal_link_spec.rb +36 -0
  236. data/spec/models/create_product_spec.rb +42 -0
  237. data/spec/models/create_product_with_policy_spec.rb +54 -0
  238. data/spec/models/create_release_spec.rb +42 -0
  239. data/spec/models/create_token_spec.rb +46 -0
  240. data/spec/models/customer_list_spec.rb +42 -0
  241. data/spec/models/customer_spec.rb +72 -0
  242. data/spec/models/error_error_issues_inner_path_inner_spec.rb +21 -0
  243. data/spec/models/error_error_issues_inner_spec.rb +42 -0
  244. data/spec/models/error_error_spec.rb +48 -0
  245. data/spec/models/error_spec.rb +36 -0
  246. data/spec/models/event_actor_one_of1_spec.rb +58 -0
  247. data/spec/models/event_actor_one_of2_spec.rb +56 -0
  248. data/spec/models/event_actor_one_of3_spec.rb +40 -0
  249. data/spec/models/event_actor_one_of4_spec.rb +56 -0
  250. data/spec/models/event_actor_one_of_spec.rb +64 -0
  251. data/spec/models/event_actor_spec.rb +32 -0
  252. data/spec/models/event_list_spec.rb +42 -0
  253. data/spec/models/event_machine_spec.rb +48 -0
  254. data/spec/models/event_spec.rb +84 -0
  255. data/spec/models/event_type_spec.rb +30 -0
  256. data/spec/models/fixed_max_version_spec.rb +46 -0
  257. data/spec/models/integration_mapping_spec.rb +100 -0
  258. data/spec/models/integration_spec.rb +100 -0
  259. data/spec/models/integration_status_spec.rb +30 -0
  260. data/spec/models/license_list_spec.rb +42 -0
  261. data/spec/models/license_max_version_input_spec.rb +48 -0
  262. data/spec/models/license_max_version_spec.rb +48 -0
  263. data/spec/models/license_spec.rb +132 -0
  264. data/spec/models/license_stats_activations_by_machine_inner_spec.rb +54 -0
  265. data/spec/models/license_stats_activations_by_version_inner_spec.rb +42 -0
  266. data/spec/models/license_stats_spec.rb +60 -0
  267. data/spec/models/license_status_spec.rb +30 -0
  268. data/spec/models/license_token_spec.rb +36 -0
  269. data/spec/models/list_policy_events_type_parameter_spec.rb +21 -0
  270. data/spec/models/list_stripe_prices200_response_spec.rb +36 -0
  271. data/spec/models/lock_max_version_major_after_one_of1_spec.rb +46 -0
  272. data/spec/models/lock_max_version_major_after_one_of_spec.rb +46 -0
  273. data/spec/models/lock_max_version_major_after_spec.rb +32 -0
  274. data/spec/models/lock_max_version_minor_after_spec.rb +21 -0
  275. data/spec/models/lock_max_version_spec.rb +52 -0
  276. data/spec/models/machine_list_spec.rb +42 -0
  277. data/spec/models/machine_spec.rb +94 -0
  278. data/spec/models/pagination_spec.rb +54 -0
  279. data/spec/models/policy_duration_spec.rb +21 -0
  280. data/spec/models/policy_list_spec.rb +42 -0
  281. data/spec/models/policy_max_version_spec.rb +21 -0
  282. data/spec/models/policy_settings_duration_any_of1_spec.rb +46 -0
  283. data/spec/models/policy_settings_duration_any_of_spec.rb +46 -0
  284. data/spec/models/policy_settings_duration_spec.rb +21 -0
  285. data/spec/models/policy_settings_max_version_spec.rb +21 -0
  286. data/spec/models/policy_settings_spec.rb +54 -0
  287. data/spec/models/policy_spec.rb +102 -0
  288. data/spec/models/portal_link_spec.rb +48 -0
  289. data/spec/models/portal_not_found_spec.rb +48 -0
  290. data/spec/models/portal_settings_spec.rb +60 -0
  291. data/spec/models/portal_spec.rb +72 -0
  292. data/spec/models/price_input_spec.rb +42 -0
  293. data/spec/models/price_spec.rb +42 -0
  294. data/spec/models/product_list_spec.rb +42 -0
  295. data/spec/models/product_spec.rb +78 -0
  296. data/spec/models/product_stats_activations_by_version_inner_spec.rb +42 -0
  297. data/spec/models/product_stats_active_machines_by_platform_inner_spec.rb +42 -0
  298. data/spec/models/product_stats_active_machines_by_version_inner_spec.rb +42 -0
  299. data/spec/models/product_stats_new_licenses_by_policy_inner_spec.rb +48 -0
  300. data/spec/models/product_stats_spec.rb +144 -0
  301. data/spec/models/release_list_spec.rb +42 -0
  302. data/spec/models/release_spec.rb +66 -0
  303. data/spec/models/request_portal_link_spec.rb +42 -0
  304. data/spec/models/revenue_spec.rb +84 -0
  305. data/spec/models/send_license_keys_spec.rb +36 -0
  306. data/spec/models/send_portal_link_spec.rb +36 -0
  307. data/spec/models/signing_key_spec.rb +58 -0
  308. data/spec/models/stripe_integration_spec.rb +60 -0
  309. data/spec/models/stripe_permission_spec.rb +52 -0
  310. data/spec/models/stripe_price_spec.rb +66 -0
  311. data/spec/models/token_spec.rb +62 -0
  312. data/spec/models/update_customer_spec.rb +42 -0
  313. data/spec/models/update_integration_mapping_spec.rb +36 -0
  314. data/spec/models/update_license_spec.rb +66 -0
  315. data/spec/models/update_policy_spec.rb +72 -0
  316. data/spec/models/update_product_portal_spec.rb +60 -0
  317. data/spec/models/update_product_spec.rb +48 -0
  318. data/spec/models/update_release_spec.rb +42 -0
  319. data/spec/models/validate_key_error_error_spec.rb +54 -0
  320. data/spec/models/validate_key_error_spec.rb +36 -0
  321. data/spec/models/validate_key_spec.rb +60 -0
  322. data/spec/spec_helper.rb +111 -0
  323. metadata +532 -0
@@ -0,0 +1,885 @@
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 LicensesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a license
23
+ # Without a `key`, the license gets a random one, like `7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF`: 5 groups of 5 characters separated by dashes, each character an upper case letter or a digit other than `O`, `0`, `I` and `1`. That's 32 possible characters encoding 5 bits each, for 125 random bits. Without a `policyId`, the license follows the product's default policy. Without an `expiresAt`, the license expires after the duration of its policy, or never when the policy has none. `expiresAt: null` makes it never expire. Without a `price`, the price paid for the license is unknown: it's left out of the revenue stats. The values of `maxVersion` left out are taken from the max version of the policy: its hard-coded version, or the times after the creation of the license its versions lock. The license belongs to the product's customer with the given `email`, which is created when there's none. With `sendKey: true`, the key is emailed to the customer once the license is created. The license copies the settings of its policy when it's created: later changes to the policy don't affect it. Its key, policy and customer can't be changed afterwards. **Required role permission**: `license:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
+ # @param product_id [String]
25
+ # @param create_license [CreateLicense]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [License]
28
+ def create_license(product_id, create_license, opts = {})
29
+ data, _status_code, _headers = create_license_with_http_info(product_id, create_license, opts)
30
+ data
31
+ end
32
+
33
+ # Create a license
34
+ # Without a `key`, the license gets a random one, like `7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF`: 5 groups of 5 characters separated by dashes, each character an upper case letter or a digit other than `O`, `0`, `I` and `1`. That's 32 possible characters encoding 5 bits each, for 125 random bits. Without a `policyId`, the license follows the product's default policy. Without an `expiresAt`, the license expires after the duration of its policy, or never when the policy has none. `expiresAt: null` makes it never expire. Without a `price`, the price paid for the license is unknown: it's left out of the revenue stats. The values of `maxVersion` left out are taken from the max version of the policy: its hard-coded version, or the times after the creation of the license its versions lock. The license belongs to the product's customer with the given `email`, which is created when there's none. With `sendKey: true`, the key is emailed to the customer once the license is created. The license copies the settings of its policy when it's created: later changes to the policy don't affect it. Its key, policy and customer can't be changed afterwards. **Required role permission**: `license:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
35
+ # @param product_id [String]
36
+ # @param create_license [CreateLicense]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(License, Integer, Hash)>] License data, response status code and response headers
39
+ def create_license_with_http_info(product_id, create_license, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: LicensesApi.create_license ...'
42
+ end
43
+ # verify the required parameter 'product_id' is set
44
+ if @api_client.config.client_side_validation && product_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling LicensesApi.create_license"
46
+ end
47
+ # verify the required parameter 'create_license' is set
48
+ if @api_client.config.client_side_validation && create_license.nil?
49
+ fail ArgumentError, "Missing the required parameter 'create_license' when calling LicensesApi.create_license"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/products/{productId}/licenses'.sub('{productId}', CGI.escape(product_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_license)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'License'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['apiKey']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"LicensesApi.create_license",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: LicensesApi#create_license\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Delete a license
97
+ # Deletes the license along with its deactivated machines. A license used on active machines can't be deleted: deactivate them first. The tokens scoped to the license or its machines stop working, but the license tokens `validateKey` already returned stay valid until they expire. Its events can no longer be listed. **Required role permission**: `license:delete` when called with a session, granted by the member's role. API keys aren't limited by roles.
98
+ # @param id [String]
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [nil]
101
+ def delete_license(id, opts = {})
102
+ delete_license_with_http_info(id, opts)
103
+ nil
104
+ end
105
+
106
+ # Delete a license
107
+ # Deletes the license along with its deactivated machines. A license used on active machines can&#39;t be deleted: deactivate them first. The tokens scoped to the license or its machines stop working, but the license tokens &#x60;validateKey&#x60; already returned stay valid until they expire. Its events can no longer be listed. **Required role permission**: &#x60;license:delete&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
108
+ # @param id [String]
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
111
+ def delete_license_with_http_info(id, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: LicensesApi.delete_license ...'
114
+ end
115
+ # verify the required parameter 'id' is set
116
+ if @api_client.config.client_side_validation && id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'id' when calling LicensesApi.delete_license"
118
+ end
119
+ # resource path
120
+ local_var_path = '/v1/licenses/{id}'.sub('{id}', CGI.escape(id.to_s))
121
+
122
+ # query parameters
123
+ query_params = opts[:query_params] || {}
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+ # HTTP header 'Accept' (if needed)
128
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
129
+
130
+ # form parameters
131
+ form_params = opts[:form_params] || {}
132
+
133
+ # http body (model)
134
+ post_body = opts[:debug_body]
135
+
136
+ # return_type
137
+ return_type = opts[:debug_return_type]
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || ['apiKey']
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"LicensesApi.delete_license",
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => return_type
150
+ )
151
+
152
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: LicensesApi#delete_license\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Get a license
160
+ # **Token access**: customer, license, machine tokens with the `license:read` permission (or the matching write one). A token reaches the license it's scoped to, the licenses of its customer, or the license of its machine.
161
+ # @param id [String]
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [License]
164
+ def get_license(id, opts = {})
165
+ data, _status_code, _headers = get_license_with_http_info(id, opts)
166
+ data
167
+ end
168
+
169
+ # Get a license
170
+ # **Token access**: customer, license, machine tokens with the &#x60;license:read&#x60; permission (or the matching write one). A token reaches the license it&#39;s scoped to, the licenses of its customer, or the license of its machine.
171
+ # @param id [String]
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [Array<(License, Integer, Hash)>] License data, response status code and response headers
174
+ def get_license_with_http_info(id, opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: LicensesApi.get_license ...'
177
+ end
178
+ # verify the required parameter 'id' is set
179
+ if @api_client.config.client_side_validation && id.nil?
180
+ fail ArgumentError, "Missing the required parameter 'id' when calling LicensesApi.get_license"
181
+ end
182
+ # resource path
183
+ local_var_path = '/v1/licenses/{id}'.sub('{id}', CGI.escape(id.to_s))
184
+
185
+ # query parameters
186
+ query_params = opts[:query_params] || {}
187
+
188
+ # header parameters
189
+ header_params = opts[:header_params] || {}
190
+ # HTTP header 'Accept' (if needed)
191
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body]
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type] || 'License'
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || ['apiKey', 'token']
204
+
205
+ new_options = opts.merge(
206
+ :operation => :"LicensesApi.get_license",
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: LicensesApi#get_license\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+
222
+ # Get the stats of a license
223
+ # Daily number of successful activations of the license over the last 90 days, today included, per machine and per version of the application. Days are in UTC.
224
+ # @param id [String]
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [LicenseStats]
227
+ def get_license_stats(id, opts = {})
228
+ data, _status_code, _headers = get_license_stats_with_http_info(id, opts)
229
+ data
230
+ end
231
+
232
+ # Get the stats of a license
233
+ # Daily number of successful activations of the license over the last 90 days, today included, per machine and per version of the application. Days are in UTC.
234
+ # @param id [String]
235
+ # @param [Hash] opts the optional parameters
236
+ # @return [Array<(LicenseStats, Integer, Hash)>] LicenseStats data, response status code and response headers
237
+ def get_license_stats_with_http_info(id, opts = {})
238
+ if @api_client.config.debugging
239
+ @api_client.config.logger.debug 'Calling API: LicensesApi.get_license_stats ...'
240
+ end
241
+ # verify the required parameter 'id' is set
242
+ if @api_client.config.client_side_validation && id.nil?
243
+ fail ArgumentError, "Missing the required parameter 'id' when calling LicensesApi.get_license_stats"
244
+ end
245
+ # resource path
246
+ local_var_path = '/v1/licenses/{id}/stats'.sub('{id}', CGI.escape(id.to_s))
247
+
248
+ # query parameters
249
+ query_params = opts[:query_params] || {}
250
+
251
+ # header parameters
252
+ header_params = opts[:header_params] || {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
255
+
256
+ # form parameters
257
+ form_params = opts[:form_params] || {}
258
+
259
+ # http body (model)
260
+ post_body = opts[:debug_body]
261
+
262
+ # return_type
263
+ return_type = opts[:debug_return_type] || 'LicenseStats'
264
+
265
+ # auth_names
266
+ auth_names = opts[:debug_auth_names] || ['apiKey']
267
+
268
+ new_options = opts.merge(
269
+ :operation => :"LicensesApi.get_license_stats",
270
+ :header_params => header_params,
271
+ :query_params => query_params,
272
+ :form_params => form_params,
273
+ :body => post_body,
274
+ :auth_names => auth_names,
275
+ :return_type => return_type
276
+ )
277
+
278
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
279
+ if @api_client.config.debugging
280
+ @api_client.config.logger.debug "API called: LicensesApi#get_license_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
281
+ end
282
+ return data, status_code, headers
283
+ end
284
+
285
+ # Get the organization's signing key
286
+ # Public key verifying the license tokens returned by `validateKey`, to embed in applications. Created the first time it's needed, and never rotated. The organization has a single key, signing the tokens of its live and test products alike: check the tokens' `aud` to tell them apart.
287
+ # @param [Hash] opts the optional parameters
288
+ # @return [SigningKey]
289
+ def get_signing_key(opts = {})
290
+ data, _status_code, _headers = get_signing_key_with_http_info(opts)
291
+ data
292
+ end
293
+
294
+ # Get the organization&#39;s signing key
295
+ # Public key verifying the license tokens returned by &#x60;validateKey&#x60;, to embed in applications. Created the first time it&#39;s needed, and never rotated. The organization has a single key, signing the tokens of its live and test products alike: check the tokens&#39; &#x60;aud&#x60; to tell them apart.
296
+ # @param [Hash] opts the optional parameters
297
+ # @return [Array<(SigningKey, Integer, Hash)>] SigningKey data, response status code and response headers
298
+ def get_signing_key_with_http_info(opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: LicensesApi.get_signing_key ...'
301
+ end
302
+ # resource path
303
+ local_var_path = '/v1/signing-key'
304
+
305
+ # query parameters
306
+ query_params = opts[:query_params] || {}
307
+
308
+ # header parameters
309
+ header_params = opts[:header_params] || {}
310
+ # HTTP header 'Accept' (if needed)
311
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
312
+
313
+ # form parameters
314
+ form_params = opts[:form_params] || {}
315
+
316
+ # http body (model)
317
+ post_body = opts[:debug_body]
318
+
319
+ # return_type
320
+ return_type = opts[:debug_return_type] || 'SigningKey'
321
+
322
+ # auth_names
323
+ auth_names = opts[:debug_auth_names] || ['apiKey']
324
+
325
+ new_options = opts.merge(
326
+ :operation => :"LicensesApi.get_signing_key",
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => return_type
333
+ )
334
+
335
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "API called: LicensesApi#get_signing_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
338
+ end
339
+ return data, status_code, headers
340
+ end
341
+
342
+ # List the licenses of a customer
343
+ # Sorting by `lastActivatedAt` puts the licenses never activated last in both orders. Sorting by `price` compares the amounts whatever their currency, and puts the licenses without a price last in both orders. **Token access**: customer tokens with the `license:read` permission (or the matching write one). A customer token reaches its own licenses.
344
+ # @param customer_id [String]
345
+ # @param [Hash] opts the optional parameters
346
+ # @option opts [Integer] :page Page to return. Pages are numbered from 1: &#x60;1&#x60; is the first page. A page past the last one returns an empty &#x60;data&#x60;, not an error. Defaults to &#x60;1&#x60;. (default to 1)
347
+ # @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 &#x60;20&#x60;. (default to 20)
348
+ # @option opts [String] :sort Field to sort by, prefixed with &#x60;-&#x60; for descending order. Defaults to &#x60;-createdAt&#x60;. (default to '-createdAt')
349
+ # @option opts [String] :search Case-insensitive text the key contains.
350
+ # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with &#x60;TEST-&#x60;.
351
+ # @option opts [String] :policy_id Only returns the licenses following this policy.
352
+ # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
353
+ # @option opts [LicenseStatus] :status Only returns the licenses with this status.
354
+ # @option opts [Time] :created_from Only returns the licenses created at or after this date.
355
+ # @option opts [Time] :created_to Only returns the licenses created at or before this date.
356
+ # @option opts [Time] :last_activated_from Only returns the licenses last activated at or after this date. Licenses never activated are left out.
357
+ # @option opts [Time] :last_activated_to Only returns the licenses last activated at or before this date. Licenses never activated are left out.
358
+ # @option opts [String] :never_activated &#x60;true&#x60; only returns the licenses never activated, &#x60;false&#x60; only the ones activated at least once.
359
+ # @option opts [Time] :expires_from Only returns the licenses expiring at or after this date. Licenses that never expire are left out.
360
+ # @option opts [Time] :expires_to Only returns the licenses expiring at or before this date. Licenses that never expire are left out.
361
+ # @option opts [String] :never_expires &#x60;true&#x60; only returns the licenses that never expire, &#x60;false&#x60; only the ones with an expiration date.
362
+ # @option opts [String] :currency Only returns the licenses paid in this currency.
363
+ # @option opts [Float] :price Only returns the licenses paid exactly this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
364
+ # @option opts [Float] :price_min Only returns the licenses paid at least this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
365
+ # @option opts [Float] :price_max Only returns the licenses paid at most this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
366
+ # @option opts [String] :has_price &#x60;true&#x60; only returns the licenses with a price, &#x60;false&#x60; only the ones without.
367
+ # @return [LicenseList]
368
+ def list_customer_licenses(customer_id, opts = {})
369
+ data, _status_code, _headers = list_customer_licenses_with_http_info(customer_id, opts)
370
+ data
371
+ end
372
+
373
+ # List the licenses of a customer
374
+ # Sorting by &#x60;lastActivatedAt&#x60; puts the licenses never activated last in both orders. Sorting by &#x60;price&#x60; compares the amounts whatever their currency, and puts the licenses without a price last in both orders. **Token access**: customer tokens with the &#x60;license:read&#x60; permission (or the matching write one). A customer token reaches its own licenses.
375
+ # @param customer_id [String]
376
+ # @param [Hash] opts the optional parameters
377
+ # @option opts [Integer] :page Page to return. Pages are numbered from 1: &#x60;1&#x60; is the first page. A page past the last one returns an empty &#x60;data&#x60;, not an error. Defaults to &#x60;1&#x60;. (default to 1)
378
+ # @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 &#x60;20&#x60;. (default to 20)
379
+ # @option opts [String] :sort Field to sort by, prefixed with &#x60;-&#x60; for descending order. Defaults to &#x60;-createdAt&#x60;. (default to '-createdAt')
380
+ # @option opts [String] :search Case-insensitive text the key contains.
381
+ # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with &#x60;TEST-&#x60;.
382
+ # @option opts [String] :policy_id Only returns the licenses following this policy.
383
+ # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
384
+ # @option opts [LicenseStatus] :status Only returns the licenses with this status.
385
+ # @option opts [Time] :created_from Only returns the licenses created at or after this date.
386
+ # @option opts [Time] :created_to Only returns the licenses created at or before this date.
387
+ # @option opts [Time] :last_activated_from Only returns the licenses last activated at or after this date. Licenses never activated are left out.
388
+ # @option opts [Time] :last_activated_to Only returns the licenses last activated at or before this date. Licenses never activated are left out.
389
+ # @option opts [String] :never_activated &#x60;true&#x60; only returns the licenses never activated, &#x60;false&#x60; only the ones activated at least once.
390
+ # @option opts [Time] :expires_from Only returns the licenses expiring at or after this date. Licenses that never expire are left out.
391
+ # @option opts [Time] :expires_to Only returns the licenses expiring at or before this date. Licenses that never expire are left out.
392
+ # @option opts [String] :never_expires &#x60;true&#x60; only returns the licenses that never expire, &#x60;false&#x60; only the ones with an expiration date.
393
+ # @option opts [String] :currency Only returns the licenses paid in this currency.
394
+ # @option opts [Float] :price Only returns the licenses paid exactly this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
395
+ # @option opts [Float] :price_min Only returns the licenses paid at least this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
396
+ # @option opts [Float] :price_max Only returns the licenses paid at most this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
397
+ # @option opts [String] :has_price &#x60;true&#x60; only returns the licenses with a price, &#x60;false&#x60; only the ones without.
398
+ # @return [Array<(LicenseList, Integer, Hash)>] LicenseList data, response status code and response headers
399
+ def list_customer_licenses_with_http_info(customer_id, opts = {})
400
+ if @api_client.config.debugging
401
+ @api_client.config.logger.debug 'Calling API: LicensesApi.list_customer_licenses ...'
402
+ end
403
+ # verify the required parameter 'customer_id' is set
404
+ if @api_client.config.client_side_validation && customer_id.nil?
405
+ fail ArgumentError, "Missing the required parameter 'customer_id' when calling LicensesApi.list_customer_licenses"
406
+ end
407
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
408
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LicensesApi.list_customer_licenses, must be greater than or equal to 1.'
409
+ end
410
+
411
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
412
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling LicensesApi.list_customer_licenses, must be smaller than or equal to 100.'
413
+ end
414
+
415
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
416
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling LicensesApi.list_customer_licenses, must be greater than or equal to 1.'
417
+ end
418
+
419
+ allowable_values = ["key", "-key", "createdAt", "-createdAt", "expiresAt", "-expiresAt", "maxMachines", "-maxMachines", "maxOfflineDurationSeconds", "-maxOfflineDurationSeconds", "lastActivatedAt", "-lastActivatedAt", "lockMajorAt", "-lockMajorAt", "lockMinorAt", "-lockMinorAt", "updatedAt", "-updatedAt", "price", "-price", "unknown_default_open_api"]
420
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
421
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
422
+ end
423
+ if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length > 200
424
+ fail ArgumentError, 'invalid value for "opts[:"search"]" when calling LicensesApi.list_customer_licenses, the character length must be smaller than or equal to 200.'
425
+ end
426
+
427
+ if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length < 1
428
+ fail ArgumentError, 'invalid value for "opts[:"search"]" when calling LicensesApi.list_customer_licenses, the character length must be greater than or equal to 1.'
429
+ end
430
+
431
+ allowable_values = ["true", "false", "unknown_default_open_api"]
432
+ if @api_client.config.client_side_validation && opts[:'never_activated'] && !allowable_values.include?(opts[:'never_activated'])
433
+ fail ArgumentError, "invalid value for \"never_activated\", must be one of #{allowable_values}"
434
+ end
435
+ allowable_values = ["true", "false", "unknown_default_open_api"]
436
+ if @api_client.config.client_side_validation && opts[:'never_expires'] && !allowable_values.include?(opts[:'never_expires'])
437
+ fail ArgumentError, "invalid value for \"never_expires\", must be one of #{allowable_values}"
438
+ end
439
+ allowable_values = ["true", "false", "unknown_default_open_api"]
440
+ if @api_client.config.client_side_validation && opts[:'has_price'] && !allowable_values.include?(opts[:'has_price'])
441
+ fail ArgumentError, "invalid value for \"has_price\", must be one of #{allowable_values}"
442
+ end
443
+ # resource path
444
+ local_var_path = '/v1/customers/{customerId}/licenses'.sub('{customerId}', CGI.escape(customer_id.to_s))
445
+
446
+ # query parameters
447
+ query_params = opts[:query_params] || {}
448
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
449
+ query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
450
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
451
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
452
+ query_params[:'key'] = opts[:'key'] if !opts[:'key'].nil?
453
+ query_params[:'policyId'] = opts[:'policy_id'] if !opts[:'policy_id'].nil?
454
+ query_params[:'machineVersion'] = opts[:'machine_version'] if !opts[:'machine_version'].nil?
455
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
456
+ query_params[:'createdFrom'] = opts[:'created_from'] if !opts[:'created_from'].nil?
457
+ query_params[:'createdTo'] = opts[:'created_to'] if !opts[:'created_to'].nil?
458
+ query_params[:'lastActivatedFrom'] = opts[:'last_activated_from'] if !opts[:'last_activated_from'].nil?
459
+ query_params[:'lastActivatedTo'] = opts[:'last_activated_to'] if !opts[:'last_activated_to'].nil?
460
+ query_params[:'neverActivated'] = opts[:'never_activated'] if !opts[:'never_activated'].nil?
461
+ query_params[:'expiresFrom'] = opts[:'expires_from'] if !opts[:'expires_from'].nil?
462
+ query_params[:'expiresTo'] = opts[:'expires_to'] if !opts[:'expires_to'].nil?
463
+ query_params[:'neverExpires'] = opts[:'never_expires'] if !opts[:'never_expires'].nil?
464
+ query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
465
+ query_params[:'price'] = opts[:'price'] if !opts[:'price'].nil?
466
+ query_params[:'priceMin'] = opts[:'price_min'] if !opts[:'price_min'].nil?
467
+ query_params[:'priceMax'] = opts[:'price_max'] if !opts[:'price_max'].nil?
468
+ query_params[:'hasPrice'] = opts[:'has_price'] if !opts[:'has_price'].nil?
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] || 'LicenseList'
483
+
484
+ # auth_names
485
+ auth_names = opts[:debug_auth_names] || ['apiKey', 'token']
486
+
487
+ new_options = opts.merge(
488
+ :operation => :"LicensesApi.list_customer_licenses",
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(:GET, local_var_path, new_options)
498
+ if @api_client.config.debugging
499
+ @api_client.config.logger.debug "API called: LicensesApi#list_customer_licenses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
500
+ end
501
+ return data, status_code, headers
502
+ end
503
+
504
+ # List the licenses of a product
505
+ # Sorting by `lastActivatedAt` puts the licenses never activated last in both orders. Sorting by `price` compares the amounts whatever their currency, and puts the licenses without a price last in both orders.
506
+ # @param product_id [String]
507
+ # @param [Hash] opts the optional parameters
508
+ # @option opts [Integer] :page Page to return. Pages are numbered from 1: &#x60;1&#x60; is the first page. A page past the last one returns an empty &#x60;data&#x60;, not an error. Defaults to &#x60;1&#x60;. (default to 1)
509
+ # @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 &#x60;20&#x60;. (default to 20)
510
+ # @option opts [String] :sort Field to sort by, prefixed with &#x60;-&#x60; for descending order. Defaults to &#x60;-createdAt&#x60;. (default to '-createdAt')
511
+ # @option opts [String] :search Case-insensitive text the key contains.
512
+ # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with &#x60;TEST-&#x60;.
513
+ # @option opts [String] :policy_id Only returns the licenses following this policy.
514
+ # @option opts [String] :customer_id Only returns the licenses of this customer.
515
+ # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
516
+ # @option opts [LicenseStatus] :status Only returns the licenses with this status.
517
+ # @option opts [Time] :created_from Only returns the licenses created at or after this date.
518
+ # @option opts [Time] :created_to Only returns the licenses created at or before this date.
519
+ # @option opts [Time] :last_activated_from Only returns the licenses last activated at or after this date. Licenses never activated are left out.
520
+ # @option opts [Time] :last_activated_to Only returns the licenses last activated at or before this date. Licenses never activated are left out.
521
+ # @option opts [String] :never_activated &#x60;true&#x60; only returns the licenses never activated, &#x60;false&#x60; only the ones activated at least once.
522
+ # @option opts [Time] :expires_from Only returns the licenses expiring at or after this date. Licenses that never expire are left out.
523
+ # @option opts [Time] :expires_to Only returns the licenses expiring at or before this date. Licenses that never expire are left out.
524
+ # @option opts [String] :never_expires &#x60;true&#x60; only returns the licenses that never expire, &#x60;false&#x60; only the ones with an expiration date.
525
+ # @option opts [String] :currency Only returns the licenses paid in this currency.
526
+ # @option opts [Float] :price Only returns the licenses paid exactly this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
527
+ # @option opts [Float] :price_min Only returns the licenses paid at least this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
528
+ # @option opts [Float] :price_max Only returns the licenses paid at most this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
529
+ # @option opts [String] :has_price &#x60;true&#x60; only returns the licenses with a price, &#x60;false&#x60; only the ones without.
530
+ # @return [LicenseList]
531
+ def list_licenses(product_id, opts = {})
532
+ data, _status_code, _headers = list_licenses_with_http_info(product_id, opts)
533
+ data
534
+ end
535
+
536
+ # List the licenses of a product
537
+ # Sorting by &#x60;lastActivatedAt&#x60; puts the licenses never activated last in both orders. Sorting by &#x60;price&#x60; compares the amounts whatever their currency, and puts the licenses without a price last in both orders.
538
+ # @param product_id [String]
539
+ # @param [Hash] opts the optional parameters
540
+ # @option opts [Integer] :page Page to return. Pages are numbered from 1: &#x60;1&#x60; is the first page. A page past the last one returns an empty &#x60;data&#x60;, not an error. Defaults to &#x60;1&#x60;. (default to 1)
541
+ # @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 &#x60;20&#x60;. (default to 20)
542
+ # @option opts [String] :sort Field to sort by, prefixed with &#x60;-&#x60; for descending order. Defaults to &#x60;-createdAt&#x60;. (default to '-createdAt')
543
+ # @option opts [String] :search Case-insensitive text the key contains.
544
+ # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with &#x60;TEST-&#x60;.
545
+ # @option opts [String] :policy_id Only returns the licenses following this policy.
546
+ # @option opts [String] :customer_id Only returns the licenses of this customer.
547
+ # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
548
+ # @option opts [LicenseStatus] :status Only returns the licenses with this status.
549
+ # @option opts [Time] :created_from Only returns the licenses created at or after this date.
550
+ # @option opts [Time] :created_to Only returns the licenses created at or before this date.
551
+ # @option opts [Time] :last_activated_from Only returns the licenses last activated at or after this date. Licenses never activated are left out.
552
+ # @option opts [Time] :last_activated_to Only returns the licenses last activated at or before this date. Licenses never activated are left out.
553
+ # @option opts [String] :never_activated &#x60;true&#x60; only returns the licenses never activated, &#x60;false&#x60; only the ones activated at least once.
554
+ # @option opts [Time] :expires_from Only returns the licenses expiring at or after this date. Licenses that never expire are left out.
555
+ # @option opts [Time] :expires_to Only returns the licenses expiring at or before this date. Licenses that never expire are left out.
556
+ # @option opts [String] :never_expires &#x60;true&#x60; only returns the licenses that never expire, &#x60;false&#x60; only the ones with an expiration date.
557
+ # @option opts [String] :currency Only returns the licenses paid in this currency.
558
+ # @option opts [Float] :price Only returns the licenses paid exactly this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
559
+ # @option opts [Float] :price_min Only returns the licenses paid at least this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
560
+ # @option opts [Float] :price_max Only returns the licenses paid at most this amount, in major units of its currency: combine with &#x60;currency&#x60; to compare amounts of one currency. Licenses without a price are left out.
561
+ # @option opts [String] :has_price &#x60;true&#x60; only returns the licenses with a price, &#x60;false&#x60; only the ones without.
562
+ # @return [Array<(LicenseList, Integer, Hash)>] LicenseList data, response status code and response headers
563
+ def list_licenses_with_http_info(product_id, opts = {})
564
+ if @api_client.config.debugging
565
+ @api_client.config.logger.debug 'Calling API: LicensesApi.list_licenses ...'
566
+ end
567
+ # verify the required parameter 'product_id' is set
568
+ if @api_client.config.client_side_validation && product_id.nil?
569
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling LicensesApi.list_licenses"
570
+ end
571
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
572
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LicensesApi.list_licenses, must be greater than or equal to 1.'
573
+ end
574
+
575
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
576
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling LicensesApi.list_licenses, must be smaller than or equal to 100.'
577
+ end
578
+
579
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
580
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling LicensesApi.list_licenses, must be greater than or equal to 1.'
581
+ end
582
+
583
+ allowable_values = ["key", "-key", "createdAt", "-createdAt", "expiresAt", "-expiresAt", "maxMachines", "-maxMachines", "maxOfflineDurationSeconds", "-maxOfflineDurationSeconds", "lastActivatedAt", "-lastActivatedAt", "lockMajorAt", "-lockMajorAt", "lockMinorAt", "-lockMinorAt", "updatedAt", "-updatedAt", "price", "-price", "unknown_default_open_api"]
584
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
585
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
586
+ end
587
+ if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length > 200
588
+ fail ArgumentError, 'invalid value for "opts[:"search"]" when calling LicensesApi.list_licenses, the character length must be smaller than or equal to 200.'
589
+ end
590
+
591
+ if @api_client.config.client_side_validation && !opts[:'search'].nil? && opts[:'search'].to_s.length < 1
592
+ fail ArgumentError, 'invalid value for "opts[:"search"]" when calling LicensesApi.list_licenses, the character length must be greater than or equal to 1.'
593
+ end
594
+
595
+ allowable_values = ["true", "false", "unknown_default_open_api"]
596
+ if @api_client.config.client_side_validation && opts[:'never_activated'] && !allowable_values.include?(opts[:'never_activated'])
597
+ fail ArgumentError, "invalid value for \"never_activated\", must be one of #{allowable_values}"
598
+ end
599
+ allowable_values = ["true", "false", "unknown_default_open_api"]
600
+ if @api_client.config.client_side_validation && opts[:'never_expires'] && !allowable_values.include?(opts[:'never_expires'])
601
+ fail ArgumentError, "invalid value for \"never_expires\", must be one of #{allowable_values}"
602
+ end
603
+ allowable_values = ["true", "false", "unknown_default_open_api"]
604
+ if @api_client.config.client_side_validation && opts[:'has_price'] && !allowable_values.include?(opts[:'has_price'])
605
+ fail ArgumentError, "invalid value for \"has_price\", must be one of #{allowable_values}"
606
+ end
607
+ # resource path
608
+ local_var_path = '/v1/products/{productId}/licenses'.sub('{productId}', CGI.escape(product_id.to_s))
609
+
610
+ # query parameters
611
+ query_params = opts[:query_params] || {}
612
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
613
+ query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
614
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
615
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
616
+ query_params[:'key'] = opts[:'key'] if !opts[:'key'].nil?
617
+ query_params[:'policyId'] = opts[:'policy_id'] if !opts[:'policy_id'].nil?
618
+ query_params[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
619
+ query_params[:'machineVersion'] = opts[:'machine_version'] if !opts[:'machine_version'].nil?
620
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
621
+ query_params[:'createdFrom'] = opts[:'created_from'] if !opts[:'created_from'].nil?
622
+ query_params[:'createdTo'] = opts[:'created_to'] if !opts[:'created_to'].nil?
623
+ query_params[:'lastActivatedFrom'] = opts[:'last_activated_from'] if !opts[:'last_activated_from'].nil?
624
+ query_params[:'lastActivatedTo'] = opts[:'last_activated_to'] if !opts[:'last_activated_to'].nil?
625
+ query_params[:'neverActivated'] = opts[:'never_activated'] if !opts[:'never_activated'].nil?
626
+ query_params[:'expiresFrom'] = opts[:'expires_from'] if !opts[:'expires_from'].nil?
627
+ query_params[:'expiresTo'] = opts[:'expires_to'] if !opts[:'expires_to'].nil?
628
+ query_params[:'neverExpires'] = opts[:'never_expires'] if !opts[:'never_expires'].nil?
629
+ query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
630
+ query_params[:'price'] = opts[:'price'] if !opts[:'price'].nil?
631
+ query_params[:'priceMin'] = opts[:'price_min'] if !opts[:'price_min'].nil?
632
+ query_params[:'priceMax'] = opts[:'price_max'] if !opts[:'price_max'].nil?
633
+ query_params[:'hasPrice'] = opts[:'has_price'] if !opts[:'has_price'].nil?
634
+
635
+ # header parameters
636
+ header_params = opts[:header_params] || {}
637
+ # HTTP header 'Accept' (if needed)
638
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
639
+
640
+ # form parameters
641
+ form_params = opts[:form_params] || {}
642
+
643
+ # http body (model)
644
+ post_body = opts[:debug_body]
645
+
646
+ # return_type
647
+ return_type = opts[:debug_return_type] || 'LicenseList'
648
+
649
+ # auth_names
650
+ auth_names = opts[:debug_auth_names] || ['apiKey']
651
+
652
+ new_options = opts.merge(
653
+ :operation => :"LicensesApi.list_licenses",
654
+ :header_params => header_params,
655
+ :query_params => query_params,
656
+ :form_params => form_params,
657
+ :body => post_body,
658
+ :auth_names => auth_names,
659
+ :return_type => return_type
660
+ )
661
+
662
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
663
+ if @api_client.config.debugging
664
+ @api_client.config.logger.debug "API called: LicensesApi#list_licenses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
665
+ end
666
+ return data, status_code, headers
667
+ end
668
+
669
+ # Email license keys to their customers
670
+ # Emails each customer the keys of its licenses among `ids`, with their expiration date: one email per customer, whatever their number of licenses. The licenses can belong to different products of the organization. Test products only email the members of the organization, so testing never emails real customers: nothing is sent when a license of a test product belongs to a customer whose email isn't a member's. **Required role permission**: `license:send` when called with a session, granted by the member's role. API keys aren't limited by roles.
671
+ # @param send_license_keys [SendLicenseKeys]
672
+ # @param [Hash] opts the optional parameters
673
+ # @return [nil]
674
+ def send_license_keys(send_license_keys, opts = {})
675
+ send_license_keys_with_http_info(send_license_keys, opts)
676
+ nil
677
+ end
678
+
679
+ # Email license keys to their customers
680
+ # Emails each customer the keys of its licenses among &#x60;ids&#x60;, with their expiration date: one email per customer, whatever their number of licenses. The licenses can belong to different products of the organization. Test products only email the members of the organization, so testing never emails real customers: nothing is sent when a license of a test product belongs to a customer whose email isn&#39;t a member&#39;s. **Required role permission**: &#x60;license:send&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
681
+ # @param send_license_keys [SendLicenseKeys]
682
+ # @param [Hash] opts the optional parameters
683
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
684
+ def send_license_keys_with_http_info(send_license_keys, opts = {})
685
+ if @api_client.config.debugging
686
+ @api_client.config.logger.debug 'Calling API: LicensesApi.send_license_keys ...'
687
+ end
688
+ # verify the required parameter 'send_license_keys' is set
689
+ if @api_client.config.client_side_validation && send_license_keys.nil?
690
+ fail ArgumentError, "Missing the required parameter 'send_license_keys' when calling LicensesApi.send_license_keys"
691
+ end
692
+ # resource path
693
+ local_var_path = '/v1/licenses/send-keys'
694
+
695
+ # query parameters
696
+ query_params = opts[:query_params] || {}
697
+
698
+ # header parameters
699
+ header_params = opts[:header_params] || {}
700
+ # HTTP header 'Accept' (if needed)
701
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
702
+ # HTTP header 'Content-Type'
703
+ content_type = @api_client.select_header_content_type(['application/json'])
704
+ if !content_type.nil?
705
+ header_params['Content-Type'] = content_type
706
+ end
707
+
708
+ # form parameters
709
+ form_params = opts[:form_params] || {}
710
+
711
+ # http body (model)
712
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(send_license_keys)
713
+
714
+ # return_type
715
+ return_type = opts[:debug_return_type]
716
+
717
+ # auth_names
718
+ auth_names = opts[:debug_auth_names] || ['apiKey']
719
+
720
+ new_options = opts.merge(
721
+ :operation => :"LicensesApi.send_license_keys",
722
+ :header_params => header_params,
723
+ :query_params => query_params,
724
+ :form_params => form_params,
725
+ :body => post_body,
726
+ :auth_names => auth_names,
727
+ :return_type => return_type
728
+ )
729
+
730
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
731
+ if @api_client.config.debugging
732
+ @api_client.config.logger.debug "API called: LicensesApi#send_license_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
733
+ end
734
+ return data, status_code, headers
735
+ end
736
+
737
+ # Update a license
738
+ # The key, policy and customer of a license can't be changed: sending them does nothing. The changes apply to the next validations of the key, not to the license tokens `validateKey` already returned, which stay valid until they expire. Lowering `maxMachines` doesn't deactivate machines: the ones already active keep validating, and new ones are refused until enough are deactivated. **Required role permission**: `license:update` when called with a session, granted by the member's role. API keys aren't limited by roles.
739
+ # @param id [String]
740
+ # @param update_license [UpdateLicense]
741
+ # @param [Hash] opts the optional parameters
742
+ # @return [License]
743
+ def update_license(id, update_license, opts = {})
744
+ data, _status_code, _headers = update_license_with_http_info(id, update_license, opts)
745
+ data
746
+ end
747
+
748
+ # Update a license
749
+ # The key, policy and customer of a license can&#39;t be changed: sending them does nothing. The changes apply to the next validations of the key, not to the license tokens &#x60;validateKey&#x60; already returned, which stay valid until they expire. Lowering &#x60;maxMachines&#x60; doesn&#39;t deactivate machines: the ones already active keep validating, and new ones are refused until enough are deactivated. **Required role permission**: &#x60;license:update&#x60; when called with a session, granted by the member&#39;s role. API keys aren&#39;t limited by roles.
750
+ # @param id [String]
751
+ # @param update_license [UpdateLicense]
752
+ # @param [Hash] opts the optional parameters
753
+ # @return [Array<(License, Integer, Hash)>] License data, response status code and response headers
754
+ def update_license_with_http_info(id, update_license, opts = {})
755
+ if @api_client.config.debugging
756
+ @api_client.config.logger.debug 'Calling API: LicensesApi.update_license ...'
757
+ end
758
+ # verify the required parameter 'id' is set
759
+ if @api_client.config.client_side_validation && id.nil?
760
+ fail ArgumentError, "Missing the required parameter 'id' when calling LicensesApi.update_license"
761
+ end
762
+ # verify the required parameter 'update_license' is set
763
+ if @api_client.config.client_side_validation && update_license.nil?
764
+ fail ArgumentError, "Missing the required parameter 'update_license' when calling LicensesApi.update_license"
765
+ end
766
+ # resource path
767
+ local_var_path = '/v1/licenses/{id}'.sub('{id}', CGI.escape(id.to_s))
768
+
769
+ # query parameters
770
+ query_params = opts[:query_params] || {}
771
+
772
+ # header parameters
773
+ header_params = opts[:header_params] || {}
774
+ # HTTP header 'Accept' (if needed)
775
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
776
+ # HTTP header 'Content-Type'
777
+ content_type = @api_client.select_header_content_type(['application/json'])
778
+ if !content_type.nil?
779
+ header_params['Content-Type'] = content_type
780
+ end
781
+
782
+ # form parameters
783
+ form_params = opts[:form_params] || {}
784
+
785
+ # http body (model)
786
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_license)
787
+
788
+ # return_type
789
+ return_type = opts[:debug_return_type] || 'License'
790
+
791
+ # auth_names
792
+ auth_names = opts[:debug_auth_names] || ['apiKey']
793
+
794
+ new_options = opts.merge(
795
+ :operation => :"LicensesApi.update_license",
796
+ :header_params => header_params,
797
+ :query_params => query_params,
798
+ :form_params => form_params,
799
+ :body => post_body,
800
+ :auth_names => auth_names,
801
+ :return_type => return_type
802
+ )
803
+
804
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
805
+ if @api_client.config.debugging
806
+ @api_client.config.logger.debug "API called: LicensesApi#update_license\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
807
+ end
808
+ return data, status_code, headers
809
+ end
810
+
811
+ # Validate a license key
812
+ # Checks the license key of the product on a machine and returns a token the application can verify offline with the organization's public key. Doesn't need authentication. The license must allow the `version`: up to its `maxVersion.version` when it has one, like `\"2.3\"` for every 2.3.z version and older. Its `maxVersion.lockMajorAt` and `maxVersion.lockMinorAt` are enforced once they hard-code `maxVersion.version`, within the hour they're reached. When it doesn't, the error's `latestAllowedVersion` is the latest release of the product the license allows, so the application can offer to install it. The machine with the `fingerprint` is created when the license has none, and activated when it's deactivated, unless the license is already active on its maximum number of machines. A machine that's already active is never refused for the maximum number of machines, even when it was lowered below the number of active machines. Its `version`, and its `name` and `platform` when given, are updated: they can't be cleared. The checks run in this order, and the first one failing answers: the license has expired, then it doesn't allow the version, then it's on its maximum number of machines. Each failure is recorded as a `license.validation_failed` event, except for keys that don't exist. Changes to the license, like deactivating the machine or shortening its expiration, don't revoke the tokens already returned: the application only sees them when it validates its key again, at the latest when its token expires.
813
+ # @param product_id [String]
814
+ # @param validate_key [ValidateKey]
815
+ # @param [Hash] opts the optional parameters
816
+ # @return [LicenseToken]
817
+ def validate_key(product_id, validate_key, opts = {})
818
+ data, _status_code, _headers = validate_key_with_http_info(product_id, validate_key, opts)
819
+ data
820
+ end
821
+
822
+ # Validate a license key
823
+ # Checks the license key of the product on a machine and returns a token the application can verify offline with the organization&#39;s public key. Doesn&#39;t need authentication. The license must allow the &#x60;version&#x60;: up to its &#x60;maxVersion.version&#x60; when it has one, like &#x60;\&quot;2.3\&quot;&#x60; for every 2.3.z version and older. Its &#x60;maxVersion.lockMajorAt&#x60; and &#x60;maxVersion.lockMinorAt&#x60; are enforced once they hard-code &#x60;maxVersion.version&#x60;, within the hour they&#39;re reached. When it doesn&#39;t, the error&#39;s &#x60;latestAllowedVersion&#x60; is the latest release of the product the license allows, so the application can offer to install it. The machine with the &#x60;fingerprint&#x60; is created when the license has none, and activated when it&#39;s deactivated, unless the license is already active on its maximum number of machines. A machine that&#39;s already active is never refused for the maximum number of machines, even when it was lowered below the number of active machines. Its &#x60;version&#x60;, and its &#x60;name&#x60; and &#x60;platform&#x60; when given, are updated: they can&#39;t be cleared. The checks run in this order, and the first one failing answers: the license has expired, then it doesn&#39;t allow the version, then it&#39;s on its maximum number of machines. Each failure is recorded as a &#x60;license.validation_failed&#x60; event, except for keys that don&#39;t exist. Changes to the license, like deactivating the machine or shortening its expiration, don&#39;t revoke the tokens already returned: the application only sees them when it validates its key again, at the latest when its token expires.
824
+ # @param product_id [String]
825
+ # @param validate_key [ValidateKey]
826
+ # @param [Hash] opts the optional parameters
827
+ # @return [Array<(LicenseToken, Integer, Hash)>] LicenseToken data, response status code and response headers
828
+ def validate_key_with_http_info(product_id, validate_key, opts = {})
829
+ if @api_client.config.debugging
830
+ @api_client.config.logger.debug 'Calling API: LicensesApi.validate_key ...'
831
+ end
832
+ # verify the required parameter 'product_id' is set
833
+ if @api_client.config.client_side_validation && product_id.nil?
834
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling LicensesApi.validate_key"
835
+ end
836
+ # verify the required parameter 'validate_key' is set
837
+ if @api_client.config.client_side_validation && validate_key.nil?
838
+ fail ArgumentError, "Missing the required parameter 'validate_key' when calling LicensesApi.validate_key"
839
+ end
840
+ # resource path
841
+ local_var_path = '/v1/products/{productId}/validate-key'.sub('{productId}', CGI.escape(product_id.to_s))
842
+
843
+ # query parameters
844
+ query_params = opts[:query_params] || {}
845
+
846
+ # header parameters
847
+ header_params = opts[:header_params] || {}
848
+ # HTTP header 'Accept' (if needed)
849
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
850
+ # HTTP header 'Content-Type'
851
+ content_type = @api_client.select_header_content_type(['application/json'])
852
+ if !content_type.nil?
853
+ header_params['Content-Type'] = content_type
854
+ end
855
+
856
+ # form parameters
857
+ form_params = opts[:form_params] || {}
858
+
859
+ # http body (model)
860
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_key)
861
+
862
+ # return_type
863
+ return_type = opts[:debug_return_type] || 'LicenseToken'
864
+
865
+ # auth_names
866
+ auth_names = opts[:debug_auth_names] || []
867
+
868
+ new_options = opts.merge(
869
+ :operation => :"LicensesApi.validate_key",
870
+ :header_params => header_params,
871
+ :query_params => query_params,
872
+ :form_params => form_params,
873
+ :body => post_body,
874
+ :auth_names => auth_names,
875
+ :return_type => return_type
876
+ )
877
+
878
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
879
+ if @api_client.config.debugging
880
+ @api_client.config.logger.debug "API called: LicensesApi#validate_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
881
+ end
882
+ return data, status_code, headers
883
+ end
884
+ end
885
+ end