# Type Declarations

The package provides typescript declarations for classes, methods and properties.

## Response Types

{% code title="response-types.d.ts" %}

```typescript
export type ActivateBundleResponse = ActivateLicenseResponse[];

export type ActivateLicenseResponse = LicenseResponseBase & {
  request: string,
  active: boolean,
  device_id: number,
  validity_period: string | null,
  is_expired: boolean,
  hardware_id: string,
  username?: string,
  max_license_users?: number,
  is_floating_cloud: boolean,
  floating_in_use?: boolean,
  license_signature: string,
  variables?: ({
    value: string;
    device_id: number;
    variable: string;
    created_at: string | null;
  })[];
}

export type ActivateOfflineBundleResponse = {
  licenses: ActivateOfflineResponseSublicense[];
  bundle_signature_v2: string,
}

export type ActivateOfflineResponseSublicense = ActivateLicenseResponse & {
  date: string,
  offline_signature: string,
}

export type ActivateOfflineResponse = ActivateOfflineResponseSublicense & {
  date: string,
  offline_signature: string,
  license_signature_v2: string,
}

export type AddConsumptionResponse = {
  id: number;
  max_consumptions: number;
  allow_unlimited_consumptions: boolean;
  allow_negative_consumptions: boolean;
  allow_overages: boolean;
  max_overages: number;
  reset_consumption: boolean;
  consumption_period: ConsumptionPeriod | undefined;
  total_consumptions: number;
  company: {
    id: number;
  };
};

export type AddFeatureConsumptionResponse = {
  id: number;
  license_id: number;
  company: {
    id: number;
  };
  total_consumptions: number;
  max_consumptions: number;
  allow_negative_consumptions: boolean;
  allow_unlimited_consumptions: boolean;
  allow_overages: boolean;
  max_overages: number;
  reset_consumption: boolean;
  consumption_period: ConsumptionPeriod;
  is_floating: boolean;
  is_floating_cloud: boolean;
  floating_timeout?: number;
  floating_users?: number;
};

export type ChangePasswordResponse = 'password_changed';

export type CheckBundleResponse = CheckLicenseResponse[];

export type CheckLicenseFeatureResponse = {
  id: number;
  license_id: number;
  code: string;
  name: string;
  metadata: JSONObjectRequired,
  metadata_string?: string;
  is_floating: boolean;
  is_floating_cloud: boolean;
  floating_in_use_devices?: number;
  expiry_date: string | null;
  feature_type: 'activation';
} | {
  id: number;
  license_id: number;
  code: string;
  name: string;
  metadata: JSONObjectRequired,
  metadata_string?: string;
  is_floating: boolean;
  is_floating_cloud: boolean;
  floating_in_use_devices?: number;
  expiry_date: string | null;
  feature_type: 'consumption';
  consumption_period: ConsumptionPeriod;
  allow_negative_consumptions: boolean;
  allow_overages: boolean;
  allow_unlimited_consumptions: boolean;
  max_consumption: number;
  max_overages: number;
  reset_consumption: boolean;
  total_consumptions: number;
};

export type CheckLicenseResponse = LicenseResponse & {
  license_active: boolean,
  license_enabled: boolean,
  license_signature: string,
  license_signature_v2?: string, // isFromPlatform only
};

export type CustomerLicenseUsersResponse = {
  company: {
    id: number;
  };
  customer: CustomerResponse;
  users: ({
    email: string | undefined;
    allow_unlimited_activations: boolean;
    first_name: string;
    initial_password: string;
    is_active: boolean;
    is_initial_password: boolean;
    last_name: string;
    license_id: number;
    max_activations: number;
    order_id: number;
    order_store_id: string;
    phone_number: string;
    total_activations: number;
  })[];
};

export type DeactivateBundleResponse = 'license_deactivated';

export type DeactivateLicenseResponse = 'license_deactivated';

export type DeactivateOfflineBundleResponse = 'license_deactivated';

export type DeactivateOfflineResponse = 'license_deactivated';

export type DeviceLicensesResponse = FormatLicenseResponse & {
  user?: LicenseUserResponse
};

export type FloatingBorrowResponse = {
  borrowed_until: string | null;
  max_borrow_time: number;
  device_id: number;
  license_id: number;
  company: {
    id: number;
  };
};

export type GetDeviceVariablesResponse = {
  id: number;
  created_at: string;
  variable?: string;
  value?: string;
  device_id: number;
}[];

export type GetUserLicensesResponse = ({
  license: FormatLicenseResponse,
  user: LicenseUserResponse,
})[];

export type InstallationFileResponse = {
  id: number;
  version: string | undefined;
  installation_file: string | undefined;
  release_date: string | null;
  hash_md5: string | undefined;
  environment: string;
  eula_link: string | undefined;
  release_notes_link: string | undefined;
  size: string | undefined;
  requires_version: string | undefined;
  channel: string | undefined;
  company: {
    id: number;
  };
};

export type OauthUrlResponse = {
  url: string;
  login_type: string;
};

export type GetProductDetailsResponse = {
  product_id: number,
  product_name: string,
  short_code: string,
  allow_trial: boolean,
  trial_days: number,
  authorization_method: AuthorizationMethod,
  floating_timeout: number,
  allow_overages: boolean,
  max_overages: number,
  prevent_vm: boolean,
  metadata: JSONObjectRequired,
  metadata_string?: string,
  company: {
    id: number
  },
  latest_version?: {
    id: number;
    version: string | undefined;
    full_link: string | undefined;
    filename: string | undefined;
    release_date: string | null;
    hash_md5: string | undefined;
    environment: string;
    eula_link: string | undefined;
    release_notes_link: string | undefined;
    size: string | undefined;
    requires_version: string | undefined;
    channel: string | undefined;
    created_at: string | null;
    updated_at: string | null;
    enabled: boolean;
    product_id: number;
  } | null,
  custom_fields?: { id: number, name: string, default_value: string }[]
};

export type ProductsResponse = ({
  id: number;
  created_at: Date;
  product_name: string;
  short_code: string;
  active: boolean;
  valid_duration?: string;
  trial_days: number;
  max_activations?: number;
  hardware_id_required: boolean;
  is_upgrade: boolean;
  company_id: number;
  allow_trial: boolean;
  enable_maintenance_period?: boolean;
  floating_users: number;
  is_floating: boolean;
  is_node_locked: boolean;
  is_user_locked: boolean;
  maintenance_duration?: string;
  subscription_duration?: string;
  default_license_type: LicenseTypes,
  max_consumptions: number;
  authorization_method: AuthorizationMethod;
  prevent_vm: boolean;
  allow_overages: boolean;
  consumption_period?: ConsumptionPeriod;
  max_overages: number;
  reset_consumption: boolean;
  is_archived: boolean;
  is_floating_cloud: boolean;
  floating_timeout: number;
  is_bundle: boolean;
  metadata: JSONObjectRequired,
  features: {
    id: number;
    code: string;
    feature_type: 'activation' | 'consumption';
    max_consumption: number;
    metadata: JSONObjectRequired,
    metadata_string?: string;
  }[];
})[];

export type SSOUrlResponse = {
  url: string;
  openid_configuration: {
    [key: string]: string | number | boolean;
  };
};

export type TrackDeviceVariablesResponse = {
  variable: string;
  value: string;
  device_id: number;
  created_at: number;
}[];

export type TrialExistingResponse = {
  license_type: LicenseTypes,
  is_trial: boolean,
  license: string,
} | {
  license_type: LicenseTypes,
  is_trial: boolean,
  license_user: string,
};

export type TrialNewResponse = {
  id: number;
  order_id: number;
  product_id: number;
  created_at: number;
  updated_at: number;
  active: boolean;
  enable_maintenance_period: boolean;
  enabled: boolean;
  is_floating: boolean;
  is_hardware_key_auth: boolean;
  is_trial: boolean;
  license_type: LicenseTypes;
  maintenance_duration: string | null;
  max_activations: number;
  max_transfers: number;
  metadata_string: string | undefined;
  metadata: JSONObjectRequired,
  prevent_vm: boolean;
  times_activated: number;
  trial_days: number;
  validity_period?: string;
  company: {
    id: number;
  };
  LicenseProductFeatures: ({
    id: number;
    product_feature_id: number;
    max_consumption: number;
    allow_overages: boolean;
    max_overages: number;
    reset_consumption: boolean;
    consumption_period?: ConsumptionPeriod;
    is_floating: boolean;
    is_floating_cloud: boolean;
    metadata: JSONObjectRequired,
    metadata_string?: string;
    floating_timeout?: number;
    floating_users?: number;
  })[];
  LicenseCustomFields: ({
    product_custom_field_id: number;
    value: string | undefined;
  })[];
  is_floating_cloud: boolean;
  floating_users: number;
  floating_timeout: number;
  allow_overages: boolean;
  max_overages: number;
  max_consumptions: number;
  valid_duration: null;
  consumption_period: ConsumptionPeriod | null;
  reset_consumption?: boolean;
  grace_period: number;
  allow_grace_period: boolean;
} & ({
  license: string;
  license_key: string;
} | {
  license_user: string;
  initial_password: string;
  license_user_id: number | null;
  max_license_users: number;
});

export type TrialResponse = TrialExistingResponse | TrialNewResponse;

export type VersionsResponse = ({
  version: string | undefined;
  release_date: string | null;
})[];

export type LicenseUserResponse = {
  id: number,
  email: string,
  first_name: string,
  is_initial_password: boolean,
  last_name: string,
  phone_number: string,
  allow_unlimited_activations?: boolean,
  max_activations?: number,
  total_activations?: number,
};

export type LicenseResponseBase = {
  id: number,
  allow_grace_period: boolean,
  allow_overages: boolean,
  allow_unlimited_activations: boolean,
  allow_offline_activation: boolean,
  can_borrow: boolean,
  custom_fields: CustomField[],
  customer: CustomerResponse,
  enable_maintenance_period: boolean,
  floating_timeout: number,
  floating_users?: number | null,
  grace_period: number | null,
  is_air_gapped: boolean,
  is_floating: boolean,
  is_floating_cloud: boolean,
  is_hardware_key_auth: boolean,
  license_key: string | undefined,
  license_template_id?: number | null,
  maintenance_period: string | null,
  max_activations: number,
  max_borrow_time: number,
  max_license_users?: number,
  max_overages: number,
  max_transfers?: number,
  metadata: JSONObjectRequired,
  metadata_string?: string,
  order_store_id?: string | null,
  prevent_vm: boolean,
  company: {
    id: number,
  },
  product_details?: ProductDetailsResponse,
  product_features: FeatureResponse[],
  start_date: string | null,
  times_activated: number,
  transfer_count: number,
  validity_period: string | null,
  is_trial: boolean,
  trial_days?: number,
  user?: LicenseUserResponse,
  license_type: LicenseTypes,
  allow_negative_consumptions?: boolean,
  allow_unlimited_consumptions?: boolean,
  consumption_period?: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
  max_consumptions?: number,
  reset_consumption?: boolean,
  total_consumptions?: number,
}

export type FormatLicenseResponse = LicenseResponseBase & {
  license_active: boolean,
  license_enabled: boolean,
};

export type LicenseResponse = LicenseResponseBase & {
  borrowed_until: string | null,
  floating_in_use_devices?: number,
  is_borrowed: boolean,
  is_expired: boolean,
};

export type FeatureResponse = {
  id: number,
  code: string,
  name?: string,
  expiry_date: string | null,
  is_floating: boolean,
  is_floating_cloud: boolean,
  floating_timeout?: number,
  floating_users?: number,
  metadata: JSONObjectRequired,
  metadata_string?: string,
} & ({
  feature_type: 'activation',
} | {
  feature_type: 'consumption',
  allow_negative_consumptions: boolean,
  allow_overages: boolean,
  allow_unlimited_consumptions: boolean,
  consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually',
  max_consumption: number,
  max_overages: number,
  reset_consumption: boolean,
  total_consumptions: number,
});

export type CustomerResponse = {
  email: string | undefined;
  company_name: string | undefined;
  reference: string | undefined;
  phone: string | undefined;
  first_name: string | undefined;
  last_name: string | undefined;
  city: string | undefined;
  postcode: string | undefined;
  state: string | undefined;
  country: string | undefined;
  address: string | undefined;
  customer_account: {
      id: number;
      name: string;
      code: string;
  } | null;
  metadata: JSONObjectRequired;
  metadata_string?: string;
};

export type CustomField = {
  name: string,
  data_type: 'numer' | 'text' | 'date/time',
  value: string | undefined;
};

export type ProductDetailsResponse = {
  product_id: number,
  product_name?: string,
  short_code: string,
  authorization_method: 'license-key' | 'user',
  metadata: JSONObjectRequired,
  metadata_string?: string,
}

export type AuthorizationMethod = 'license-key' | 'user';

export type ConsumptionPeriod = 'daily' | 'weekly' | 'monthly' | 'annually';

export enum LicenseTypes {
  perpetual = 'perpetual',
  time_limited = 'time-limited',
  consumption = 'consumption',
  subscription = 'subscription',
};

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export type JSONObjectRequired = { [key: string]: JSONValue } | {};

type JSONValue =
| string
| number
| boolean
| null
| JSONValue[]
| { [key: string]: JSONValue };
```

{% endcode %}

## Parameters and Internal Types

{% code title="internal-types.d.ts" %}

```typescript
export type LicensespringClientAuth = ({
  apiKey: string,
  sharedKey: string,
} | {
  clientID: string,
  clientSecret: string,
  tokenUrl: string,
});

export type LicensespringConfig = LicensespringClientAuth & {
  apiPath: string,
  publicKey: string,
  productCode: string,
  appName: string,
  appVersion: string,
  filePath: string,
  filename: string,
  gracePeriod: number,
  fileKey: string,
  airGapKey?: string,
  isGuardFileEnabled: boolean,
  hardwareIDMethod: number,
  sdkVersion: string,
  proxy?: AxiosProxyConfig,
  logLevel?: LogLevel,
};

export type LicensespringAPIConfig = LicensespringClientAuth & Omit<LicensespringConfig, 'productCode'>;

export type LicensespringConfigDef = Pick<LicensespringConfig, 'productCode'|'appName'|'appVersion'|'airGapKey'> & LicensespringClientAuth & {
  apiPath?: string,
  proxy?: AxiosProxyConfig,
  publicKey?: string,
  filename?: string,
  filePath?: string,
  gracePeriod?: number,
  fileKey?: string,
  isGuardFileEnabled?: boolean,
  hardwareIDMethod?: number,
  logLevel?: LogLevel,
  hardwareID?: string,
};

export type LicensespringAPIConfigDef = Pick<LicensespringConfig, 'appName'|'appVersion'|'airGapKey'> & LicensespringClientAuth & {
  apiPath?: string,
  proxy?: AxiosProxyConfig,
  publicKey?: string,
  filename?: string,
  filePath?: string,
  gracePeriod?: number,
  fileKey?: string,
  isGuardFileEnabled?: boolean,
  hardwareIDMethod?: number,
  logLevel?: LogLevel,
  hardwareID?: string,
};

export type LicensespringFloatingConfig = {
  apiPath: string,
  appVersion: string,
  hardwareIDMethod: number,
  sdkVersion: string,
  proxy?: AxiosProxyConfig,
};

export type LicensespringFloatingConfigDef = Omit<LicensespringFloatingConfig, 'hardwareIDMethod'|'sdkVersion'> & {
  hardwareIDMethod?: number,
};

type LicenseIdentificatorKeyBased = {
  license_key: string,
};

type LicenseIdentificatorUserBased = {
  username: string,
};

type LicenseActivationIdentificatorUserBased = {
  username: string,
  password: string,
};

type LicenseIdentificatorUserSSOBased = ({
  id_token: string,
} | {
  code: string,
}) & {
  customer_account_code: string,
};

type LicenseIdentificatiorRequired = {
  hardware_id: string,
  product: string,
  bundle_code?: string,
  license_id?: number,
};

export type Managed<T> = Omit<T, 'product' | 'hardware_id'>;

/**
 * @type {LicenseIdentificator}
 *
 * An object that identifies a License using either a license-key, user credentials or single sign-on credentials.
 * Optionally can include a `license_id` property to force a specific license is being selected.
 */
export type LicenseIdentificator = (
  XOR<LicenseIdentificatorKeyBased, LicenseIdentificatorUserBased>
) & LicenseIdentificatiorRequired;

export type LicenseActivationIdentificator = (
  XOR<LicenseIdentificatorKeyBased, LicenseActivationIdentificatorUserBased, LicenseIdentificatorUserSSOBased>
) & LicenseIdentificatiorRequired;

/**
 * @type {LicenseUser}
 *
 * An object describing a User associated to a specific license
 */
export type LicenseUser = {
  id: number,
  email: string,
  first_name: string,
  last_name: string,
  phone_number: string,
  is_initial_password: boolean,
  allow_unlimited_activations: boolean,
  max_activations: number,
  total_activations: number,
};

/**
 * @type {ProductDetails}
 *
 * An object describing the basic properties of a Product
 */
export type ProductDetails = {
  product_id: number,
  product_name?: string,
  short_code: string,
  authorization_method: 'license-key' | 'user',
  metadata: JSON,
};

/**
 * @type {Customer}
 *
 * An object describing a Customer
 */
export type Customer = {
  email: string,
  company_name: string,
  reference: string,
  phone: string,
  first_name: string,
  last_name: string,
  city: string,
  postcode: string,
  state: string,
  country: string,
  address: string,
  customer_account: string|null,
  metadata: JSON,
};

/**
 * @type {CustomField}
 *
 * An object describing a Custom Field. These are key-value pairs assigned to a Product and inherited by that product's Licenses. They can be overriden on the License level
 */
export type CustomField = {
  name: string,
  data_type: 'numer' | 'text' | 'date/time',
  value: string,
};

/**
 * @type {ProductFeature}
 *
 * An object describing a Product Feature. These are custom attributes assigned to a Product and inherited by that product's Licenses
 */
export type ProductFeature = {
  id: number,
  code: string,
  name: string,
  expiry_date: string,
  metadata: JSON,
  is_floating_cloud: boolean,
} & XOR<{
  feature_type: 'activation',
}, {
  feature_type: 'consumption',
  max_consumption: number,
  allow_unlimited_consumptions: boolean,
  total_consumptions: number,
  allow_overages: number,
  max_overages: number,
  reset_consumption: boolean,
  consumption_period: 'daily' | 'weekly' | 'monthly' | 'annualy' | null,
}> & XOR<{
  is_floating: false
}, {
  is_floating: true,
  floating_users: number,
  floating_timeout?: number,
}>;

/**
 * @type {LicenseType}
 *
 * Declares the type of License which is always one of the following:
 *
 * - *perpetual*: A perpetual license does not expire. The `is_expired` field on such a license will always be `false`.
 * Note that a perpetual *trial* license (`is_trial` flag is set to `true`) does have an `validity_period`, which refers to the end of the trial period.
 *
 * - *time-limited*: Has a `validity_period` set as a calendar date. After the date has passed, the `is_expired` flag will be set to `true`.
 *
 * - *subscription*: Uses an external source of truth such as a 3rd party service to determine the state of the License.
 *
 * - *consumption*: Permits usage metering. These licenses set a value the vendor wishes to meter, and then record the times that resource has been used.
 * Includes the following properties: `max_consumptions`, `total_consumptions`, `allow_unlimited_consumptions`, `allow_overages`, `max_overages`, `reset_consumption` and `consumption_period`.
 *
 */
export type LicenseType = 'perpetual' | 'time-limited' | 'consumption' | 'subscription';

export type LicenseFilePayload = ActivateOfflineResponse & {
  offline_signature: string,
};

export type LicenseSaved = LicenseResponse & {
  policy_id: string;
};

export type LicenseData = {
  id: number;
  allow_grace_period: boolean,
  allow_overages?: boolean,
  allow_unlimited_activations: boolean,
  allow_unlimited_consumptions?: boolean,
  borrowed_until: string | null,
  can_borrow: boolean,
  channel: string,
  consumption_period?: ConsumptionPeriod,
  custom_fields: CustomField[],
  customer: Customer,
  device_id: number,
  enable_maintenance_period: boolean
  environment: string,
  eula_link: string,
  floating_in_use_devices?: number,
  floating_timeout: number,
  floating_users?: number,
  grace_period: number,
  hardware_id: string,
  hash_md5: string,
  installation_file: string,
  is_air_gapped: boolean,
  is_borrowed: boolean,
  is_expired: boolean,
  is_floating_cloud: boolean,
  is_floating: boolean,
  is_hardware_key_auth: boolean,
  is_trial: boolean,
  license_active: boolean,
  license_enabled: boolean,
  license_signature: string,
  license_type: LicenseType,
  maintenance_period: string | null,
  max_activations: number,
  max_borrow_time: number,
  max_consumptions?: number,
  max_license_users: number,
  max_overages?: number,
  max_transfers?: number,
  metadata: JSON,
  order_store_id: string,
  prevent_vm: boolean,
  product_details: ProductDetails,
  product_features: ProductFeature[],
  release_date: string,
  release_notes_link: string,
  requires_version: string,
  reset_consumption?: boolean,
  size: string,
  start_date: string | null,
  times_activated: number,
  total_consumptions?: number,
  transfer_count: number,
  trial_days?: number,
  validity_period: DateISO8601UTC | null,
  version: string,
} & ({
  license_key: string,
} | {
  user: LicenseUser,
});

export type GuardFileData = {
  id: string,
  device_id: string,
  date_created: string,
};

export type DeviceVariable = {
  id: number,
  device_id: number,
  created_at: DateISO8601UTC,
  variable: string,
  value: string,
};

export type LicenseProductFeature = {
  id: number,
  product_feature_id: number,
  max_consumption: number,
  allow_overages: boolean,
  max_overages: number,
  reset_consumption: number,
  consumption_period: 'daily' | 'weekly' | 'monthly' | 'annually' | null,
  expiry_date: DateISO8601UTC | null,
  is_floating: boolean,
  is_floating_cloud: boolean,
  metadata: JSON,
} & XOR<({ is_floating: true } | { is_floating_cloud: true }) & {
  floating_timeout: number,
  floating_users: number,
},
{}>;

export type CreateOfflineActivationRequestPayload = {
  bundle_code?: string,
  hardware_id: string,
  hostname?: string,
  ip?: string,
  mac_address?: string,
  os_ver?: string,
  product: string,
  variables?: Record<string, any>,
  vm_info?: string,
} & ({
  license_key?: string,
} | {
  username?: string,
  password?: string,
});

export type CreateOfflineDeactivationRequestPayload = {
  bundle_code?: string,
  hardware_id: string,
  hostname?: string,
  ip?: string,
  mac_address?: string,
  os_ver?: string,
  product: string,
  vm_info?: string,
  consumptions?: number,
} & ({
  license_key?: string,
} | {
  username?: string,
  password?: string,
});

export enum HardwareIdAlgorithm {
  Default = 0,
  WindowsHardwareFingerprintId = 1,
  WindowsComputerSystemProductId = 2,
  WindowsCryptographyId = 3,
  LinuxMachineId = 4,
  CloudPlatformsId = 5,
};

/** Date string in ISO 8601 format (always in UTC timezone) with optional separators and optional time component, e.g.:
 *
 * "2024-09-27T23:30:48.016Z"
 *
 * "2024-09-27 23:30:48.016"
 *
 * "2024-09-27 23:30:48"
 *
 * "2024-09-27 23:30"
 *
 * "2024-09-27"
 *
 */
export type DateInputString = string;

/** Date string in full ISO 8601 format, e.g. "2024-09-27T23:30:48.016Z". Note: this is always in UTC timezone */
export type DateISO8601UTC = string;

/** Date string in RFC 7231 format, e.g. "Fri, 27 Sep 2024 23:30:48 GMT". Note: this is always in GMT timezone */
export type DateRFC7231 = string;

/** Length of time expressed in days, months or years, e.g. 5d, 2m, 3y */
export type TimeLength = string;

export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';
```

{% endcode %}

## Floating API v2 Types

{% code title="floating-api-v2.d.ts" %}

```typescript
type FloatingAPIConfig = {
  apiPath: string,
  hardwareID?: string,
  hardwareIDMethod?: number,
  logLevel?: LogLevel,
  proxy?: AxiosProxyConfig,
  certChain: string,
  disableUserAuth?: boolean,
} & (
    {
      apiKey: string,
      sharedKey: string
    } | {
      clientID: string,
      clientSecret: string,
      tokenUrl: string
    }
  );

type AnyJson = Record<string, any>;
type RFC3339 = string; // RFC3339 (UTC), e.g. "2025-06-01T12:00:00Z"

interface PingResponse {
  message: string;
  version: string;
}

interface LoginResponse {
  token: string;
  expires_at: RFC3339;
  expires_in: number;  // seconds (float)
}

interface User {
  id: number;
  username: string;
  role: 'admin' | 'user';
  created_at: RFC3339;
  updated_at: RFC3339;
}

interface LoginUser {
  username: string;
  password: string;
}

interface ChangePasswordReq {
  username: string;
  old_password: string;
  new_password: string;
}

interface SetPasswordReq {
  password: string;
}

type AuthMeSuccessBody = {
  expires_at?: RFC3339;
  ExpiresAt?: RFC3339; 
  [key: string]: unknown;
};

interface CloudConfig {
  airGapPublicKey: string;
  apikey: string;
  apiprefix: string;
  baseURL: string;
  cacertificatePath: string;
  certificatePath: string;
  clientId: string;
  clientSecret: string;
  disableSync: boolean;
  id: number;
  privateKeyPath: string;
  serverPublicKey: string;
  sharedKey: string;
  syncIntervalHours: number;
  syncIntervalMinutes: number;
  useHardwareKey: boolean;
  useOAuth: boolean;
}

interface CloudConfigUpdate {
  airgap_public_key?: string;
  api_key?: string;
  api_prefix?: string;
  base_url?: string;
  client_id?: string;
  client_secret?: string;
  server_public_key?: string;
  shared_key?: string;
  use_oauth?: boolean;
}

interface AddLicenseRequest {
  product?: string;
  license_key?: string;
}

interface Company {
  id: number;
}

interface LicenseUser {
  id: number;
  email: string;
  is_active?: boolean;
  first_name: string;
  last_name: string;
  phone_number: string;
  is_initial_password: boolean;
  initial_password?: string;
  license_id?: number;
  order_store_id?: string;
  order_id?: number;
  max_activations: number;
  allow_unlimited_activations: boolean;
  total_activations: number;
}

interface ProductDetails {
  product_id: number;
  product_name: string;
  short_code: string;
  authorization_method: string;
  metadata: AnyJson | null;
  company_id: number;
  trial_days?: number;
  allow_overages?: boolean;
  max_overages?: number;
  prevent_vm?: boolean;
  floating_timeout?: number;
  validity_period?: string | null;
}

interface CustomerAccount {
  code: string;
  id: number;
  name: string;
}

interface Customer {
  email: string;
  first_name: string;
  last_name: string;
  company_name: string;
  phone: string;
  reference: string;
  address: string;
  postcode: string;
  city: string;
  country: string;
  state: string;
  customer_account?: CustomerAccount;
  metadata: AnyJson | null;
}

interface CustomField {
  name: string,
  value: string,
  data_type: string,
}

interface LicenseData {

  product?: string;
  hardware_id?: string;
  policy_id: number; // air-gapped
  is_licensed?: boolean;
  is_unlicensed_copy?: boolean;
  is_valid?: boolean;
  is_dirty?: boolean;
  local_consumptions?: number;
  last_check?: RFC3339;
  last_usage_date?: RFC3339;
  grace_period_start?: RFC3339;
  floating_vp?: RFC3339;

  custom_fields: CustomField[] | null;
  user_data?: Record<string, string>;
  metadata: AnyJson | null;

  // License Info
  id: number;
  license_active: boolean;
  license_enabled: boolean;
  is_expired: boolean;
  license_type: string;
  start_date: RFC3339 | null;
  signature?: string;
  is_trial?: boolean;
  trial_days: number;
  validity_period: RFC3339 | null;
  maintenance_period: RFC3339 | null;

  // consumption
  allow_overages: boolean;
  max_overages: number;
  max_consumptions: number;
  total_consumptions: number;
  allow_unlimited_consumptions: boolean;
  allow_negative_consumptions?: boolean;
  reset_consumption: boolean;
  consumption_period: string | null;

  // floating
  is_floating_cloud: boolean;
  is_floating: boolean;
  floating_timeout: number;
  floating_in_use_devices: number;
  floating_users: number;

  // borrowing / transfer
  max_borrow_time: number;
  prevent_vm: boolean;
  is_air_gapped: boolean;
  times_activated: number;
  max_activations: number;
  transfer_count: number;
  max_transfers: number;
  is_borrowed: boolean;
  offline_activated?: boolean;
  grace_period: number;

  // bundle
  is_bundle_activated?: boolean;
  bundle_license_id?: number;
  bundle_licenses?: LicenseData[];
  is_bundle?: boolean;

  customer: Customer;
  user?: LicenseUser;
  product_details: ProductDetails;
  license_features: LicenseFeature[];
  company?: Company;
  variables: DeviceVariable[];

  channel: string;
  enable_maintenance_period: boolean;
  environment: string;
  eula_link: string;
  hash_md5: string;
  installation_file: string;
  is_hardware_key_auth: boolean;
  offline_signature: string;
  license_signature_v2: string;
  release_date: string;
  release_notes_link: string;
  requires_version: string;
  size: string;
  version: string;
  max_license_users: number;

  allow_grace_period: boolean;
  allow_unlimited_activations: boolean;
  can_borrow: boolean;
  device_id: number;
  license_signature: string;
  order_store_id: string;
}

interface DeviceVariable {
  id?: number;
  name?: string;
  value?: string;
  variable?: string;
  created_at: RFC3339;
  device_id?: number;
}

interface LicenseFeature {
  id: number;
  code: string;
  name: string;
  feature_type: string;
  expiry_date: string;
  max_consumption: number;
  total_consumptions: number;
  local_consumptions?: number;
  allow_overages: boolean;
  max_overages: number;
  allow_unlimited_consumptions: boolean;
  allow_negative_consumptions?: boolean;
  reset_consumption: boolean;
  consumption_period: string | null;
  is_floating_cloud: boolean;
  is_floating: boolean;
  floating_timeout?: number;
  floating_users?: number;
  floating_in_use_devices?: number;
  floating_start?: RFC3339;
  floating_end?: RFC3339;
  metadata: AnyJson | null;
}

interface ActivateBundleResponse {
  status: 'ok';
  message: 'bundle added';
  license_ids: number[];
  bundle_license_id: number;
}

interface DeactivateBundleResponse {
  status: 'ok';
  message: 'bundle deactivated';
}

interface FloatingUser {
  id?: number; // ommited?
  username: string;
  email: string;
  license_id: number;
  product: string;
  product_id: number;
  floating_amount: number;
  floating_end_time: RFC3339;
  created_at: RFC3339;
  last_check: RFC3339;
  vendor_id: number;
  is_borrowed: boolean;
}

interface ActivateLicenseResponse {
  status: 'ok';
  message: 'license added';
  product: string;
  license_id: number;
}

interface AddConsumptionRequest {
  consumptions: number;
  allow_overages?: boolean;
  max_overages?: number;
}

interface ConsumptionResponse {
  id: number;
  max_consumptions: number;
  total_consumptions: number;
  allow_unlimited_consumptions: boolean;
  allow_negative_consumptions: boolean;
  allow_overages: boolean;
  max_overages: number;
  reset_consumption: boolean;
  consumption_period: string | null;
  license_signature: string;
}

interface FeatureConsumptionResponse extends ConsumptionResponse {
  is_floating_cloud: boolean;
  is_floating: boolean;
  floating_timeout: number;
  floating_users: number;
}

interface AddFeatureConsumptionRequest {
  consumptions: number;
  feature: string;
}

interface RegisterFeatureRequest {
  username: string;
  feature?: string;
  email?: string;
}
interface UnregisterFeatureRequest {
  username?: string;
  feature?: string;
}

interface AllFeatureUsersRequest {
  feature?: string;
}

interface RegisterRequestBody {
  username: string,
  role?: string,
  password: string,
}

interface RegisterRequestBodyInternal {
  Username: string,
  Role: string,
  Password: string,
}

interface UsernameRequest {
  username: string;
}

interface BorrowUserRequest {
  username: string;
  borrowed_until?: RFC3339;
}

interface BorrowResponse {
  license_id?: number;
  device_id?: string;
  borrowed_until?: string;
  license_signature?: string;
  max_borrow_time?: number;
}

interface OfflineRequestInput {
  product?: string;
  license_key?: string;
}

interface BundleRequest {
  bundle: string;
  license_key: string;
}

interface GenerateOfflineRequestResponse {
  status: 'ok';
  request_data: string; // base64 payload
}

interface GenerateAirgapRequestBody {
  initialization_code: string;
  license_key: string;
  product: string;
}

interface GenerateAirgapDeactivationRequestBody {
  initialization_code: string;
  license_key: string;
}

interface DeactivateAirgapRequestBody {
  confirmation_code: string;
  license_key: string;
}

interface SyncConfig {
  enabled: boolean;
  hours: number;
  minutes: number;
}

interface SyncEnableReq {
  enabled: boolean;
  hours?: number;
  minutes?: number;
}

interface FloatingFeatureUser {
  feature_id: number;
  username: string;
  email: string;
  license_id: number;
  feature: string;
  product: string;
  floating_amount: number;
  floating_end_time: RFC3339; 
  created_at: RFC3339;        
  last_check: RFC3339;        
  vendor_code: string;
  vendor_id: number;
}

interface FeatureCodeID {
  feature_id: number;
  feature_code: string;
  users_list: FloatingFeatureUser[];
}

type AllFeatureUsersResponse = FeatureCodeID[];

interface RegisterFeatureResponse extends LicenseFeature {
  license_id: number,
}

interface FeatureReleasedAllResponse {
  status: 'ok';
  message: 'all features released';
  license_id: number;
  feature: string;
}

interface UnregisterAllUsersResponse {
  status: 'ok';
  message: 'all users unregistered';
  license_id: number;
}

interface AirgapActivationCodeResponse {
  status: 'ok';
  hardware_id: string,
  activation_code: string,
}

interface AirgapDeactivationCodeResponse {
  status: 'ok';
  hardware_id: string,
  deactivation_code: string,
}

interface AirgapeDeactivatedResponse {
  status: 'ok';
  message: 'license_deactivated';
}

interface AirgapActivatedResponse {
  status: 'ok';
  message: 'airgap license activated';
  license_id: number;
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.licensespring.com/sdks/node.js-sdk/type-declarations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
