|
2 | 2 |
|
3 | 3 | import io.cryptolens.internal.BasicResult; |
4 | 4 | import io.cryptolens.internal.HelperMethods; |
5 | | -import io.cryptolens.models.ActivateModel; |
| 5 | +import io.cryptolens.models.*; |
6 | 6 | import io.cryptolens.internal.ActivateResult; |
7 | | -import io.cryptolens.models.DeactivateModel; |
8 | | -import io.cryptolens.models.LicenseKey; |
9 | 7 |
|
10 | 8 | import java.util.HashMap; |
11 | 9 | import java.util.Map; |
@@ -92,4 +90,24 @@ public static boolean Deactivate (String token, DeactivateModel model) { |
92 | 90 | return true; |
93 | 91 | } |
94 | 92 |
|
| 93 | + /** |
| 94 | + * <p>This method creates a license key that is time-limited, <a href="https://help.cryptolens.io/licensing-models/node-locked" target="_blank">node-locked</a> |
| 95 | + * and with the "Time-Limited" and "Trial" features set to true (which can be set by editing the |
| 96 | + * <a href="https://help.cryptolens.io/web-interface/feature-definitions" target="_blank">feature definitions</a> on the product page). |
| 97 | + * Note, by default, the trial will work for 15 days. To change this limit, you can set the <b>Feature Lock</b> |
| 98 | + * to the desired value, when creating the access token.</p> |
| 99 | + * |
| 100 | + * <p>If a trial key was already created for a certain machine code, this method will try to find the license |
| 101 | + * key and return it instead. However, this will only occur if the license key is still a trial key (based |
| 102 | + * on feature definitions) and is not blocked.</p> |
| 103 | + * @param token The access token with 'CreateTrialKey' permission. |
| 104 | + * @param model Method parameters. |
| 105 | + * @return A new license key or error message. |
| 106 | + */ |
| 107 | + public static CreateKeyResult CreateTrialKey(String token, CreateTrialKeyModel model) { |
| 108 | + Map<String,String> extraParams = new HashMap<>(); |
| 109 | + extraParams.put("token", token); |
| 110 | + |
| 111 | + return HelperMethods.SendRequestToWebAPI("key/createtrialkey", model, extraParams, CreateKeyResult.class); |
| 112 | + } |
95 | 113 | } |
0 commit comments