lisenser
Version:
Official JavaScript SDK for Lisenser API (https://lisenser.com/)
120 lines (118 loc) • 3.48 kB
TypeScript
/**
* Request object for licensing-related operations.
*/
export interface LicenseRequest {
/**
* The license key.
*/
licenseKey: string;
/**
* The machine ID.
*/
machineId: string;
/**
* The product ID.
*/
productId: string;
/**
* An inconsequential flag to indicate whether or not this request
* is made as polling to check license status rather than a one-off check
*/
polling?: boolean;
}
/**
* Status of a license.
*/
export interface LicenseStatus {
/**
* Indicates whether the license is currently active.
*/
isActive: boolean;
/**
* The current status of the license.
* One of 'expired', 'active', 'invalid', or 'no-key'.
*/
status: 'expired' | 'active' | 'invalid' | 'no-key';
/**
* The number of days until the license expires, if applicable.
* `null` if the license is not set to expire.
*/
daysToExpiry: number | null;
/**
* indicating whether or not the License has been activated by
* a different machine
*/
isConflict?: boolean;
/**
* List of features allowed to this license
*/
features?: {
feature: string;
}[];
}
/**
* Status of a trial period.
*/
export interface TrialStatus {
/**
* Indicates whether the trial period is currently active.
*/
isActive: boolean;
/**
* The current status of the trial period.
* One of 'expired', 'active', 'not-started', or 'not-allowed'.
*/
status: 'expired' | 'active' | 'not-started' | 'not-allowed';
/**
* The number of days until the trial period expires.
*/
daysToExpiry: number;
/**
* List of features allowed in trial mode
*/
features?: {
feature: string;
}[];
}
/**
* Possible statuses of trial period activation.
*/
export type TrialActivationStatus = 'started' | 'not-allowed' | 'conflict';
/**
* Returns the current status of a license.
* @param req The license request.
*/
export function getLicenseStatus(req: LicenseRequest): Promise<LicenseStatus>;
/**
* Activates a license key.
* @param req The license request.
*/
export function activateLicenseKey(req: LicenseRequest): Promise<LicenseStatus>;
/**
* Returns the current status of a trial period.
* @param productId The ID of the product for which to retrieve the trial status.
* @param machineId The machine ID for which to retrieve the trial status.
*/
export function getTrialStatus(productId: string, machineId: string): Promise<TrialStatus>;
/**
* Activates a trial period.
* @param productId The ID of the product for which to activate the trial period.
* @param machineId The machine ID for which to activate the trial period.
*/
export function startTrial(productId: string, machineId: string): Promise<TrialActivationStatus>;
/**
* Requests an OTP code to be sent for license reset.
* @param req The license reset request.
*/
export function requestOtpForLicenseReset(productId: string, licenseKey: string): Promise<boolean>;
/**
* Commits a license reset using the provided OTP.
* @param req The license reset commit request.
*/
export function resetLicense(otp: string, productId: string, licenseKey: string): Promise<boolean>;
/**
* Generates a third party token for the given license.
* @param req The license request.
*/
export function generate3rdPartyToken(req: LicenseRequest): Promise<string>;
//# sourceMappingURL=types.d.ts.map