Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

Latest commit

 

History

History
234 lines (171 loc) · 17.2 KB

File metadata and controls

234 lines (171 loc) · 17.2 KB

Licenses

Overview

Available Operations

  • activate - Activates a license key.
  • deactivate - Deactivate a license key instance.
  • validate - Validates a license key or instance.

activate

Activate a license key for a specific device or instance. Register new activations and track usage limits.

Example Usage

import { Creem } from "creem";

const creem = new Creem({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const result = await creem.licenses.activate({
    key: "<key>",
    instanceName: "<value>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { CreemCore } from "creem/core.js";
import { licensesActivate } from "creem/funcs/licensesActivate.js";

// Use `CreemCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const creem = new CreemCore({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const res = await licensesActivate(creem, {
    key: "<key>",
    instanceName: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("licensesActivate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request components.ActivateLicenseRequestEntity ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.LicenseEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

deactivate

Remove a device activation from a license key. Free up activation slots for new devices.

Example Usage

import { Creem } from "creem";

const creem = new Creem({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const result = await creem.licenses.deactivate({
    key: "<key>",
    instanceId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { CreemCore } from "creem/core.js";
import { licensesDeactivate } from "creem/funcs/licensesDeactivate.js";

// Use `CreemCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const creem = new CreemCore({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const res = await licensesDeactivate(creem, {
    key: "<key>",
    instanceId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("licensesDeactivate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request components.DeactivateLicenseRequestEntity ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.LicenseEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

validate

Verify if a license key is valid and active for a specific instance. Check activation status and expiration.

Example Usage

import { Creem } from "creem";

const creem = new Creem({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const result = await creem.licenses.validate({
    key: "<key>",
    instanceId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { CreemCore } from "creem/core.js";
import { licensesValidate } from "creem/funcs/licensesValidate.js";

// Use `CreemCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const creem = new CreemCore({
  apiKey: process.env["CREEM_API_KEY"] ?? "",
});

async function run() {
  const res = await licensesValidate(creem, {
    key: "<key>",
    instanceId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("licensesValidate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request components.ValidateLicenseRequestEntity ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.LicenseEntity>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*