@mytiki/tiki-sdk-js
Version:
JS SDK for client-side integration with TIKI
61 lines (60 loc) • 2.77 kB
TypeScript
import { LicenseRecord } from "./license-record";
import { LicenseUse } from "./license-use";
export { LicenseRecord } from "./license-record";
export { LicenseUse } from "./license-use";
export { LicenseUsecase } from "./license-usecase";
/**
* Creates a new {@link LicenseRecord} object.
*
* Note: This method requires an existing {@link Title.TitleRecord}. Use {@link Title.create} first.
*
* The expiry parameter sets the expiration date of the {@link LicenseRecord}. If the license never expires,
* leave this parameter as `undefined`.
*
* @param titleId - The identifier for the corresponding title record
*
* @param uses - A list defining how and where an asset may be used, in the format of `LicenseUse` objects.
* Learn more about specifying uses at https://docs.mytiki.com/docs/specifying-terms-and-usage.
*
* @param terms - A URL to the legal terms of the contract. This is a long text document that explains the
* terms of the license.
*
* @param description - A short, human-readable description of the {@link Title.TitleRecord} as a future reminder.
* This parameter is used only if a {@link Title.TitleRecord} does not already exist for the provided ptr.
*
* @param expiry - The expiration date of the {@link LicenseRecord}. If the license never expires, leave this parameter
* as `undefined`.
*/
export declare function create(titleId: string, uses: Array<LicenseUse>, terms: string, description?: string, expiry?: Date): Promise<LicenseRecord>;
/**
* Retrieves the {@link LicenseRecord} with the specified ID, or `undefined` if the record is not found.
*
* Use this method to retrieve the metadata associated with an license identified by its {@link LicenseRecord} ID.
* @param id - The ID of the LicenseRecord to retrieve.
*/
export declare function getById(id: string): LicenseRecord | undefined;
/**
* Returns all {@link LicenseRecord}s associated with a given {@link Title.TitleRecord}.
*
* Use this method to retrieve all {@link LicenseRecord}s that have been previously stored for a given
* Pointer Record in your system.
*
* @param titleId - The id of the TitleRecord
*/
export declare function getByTitle(titleId: string): Array<LicenseRecord>;
/**
* Returns the latest {@link LicenseRecord} associated with a given {@link Title.TitleRecord} or `undefined` if no
* records are found.
*
* Use this method to retrieve the current {@link LicenseRecord} for a given TitleRecord
*
* @param titleId - The id of the TitleRecord
*/
export declare function getLatest(titleId: string): LicenseRecord | undefined;
/**
* @hidden
* Marshall the {@link RspTitle} object to {@link TitleRecord}
*
* @param rsp - The response object to marshall
*/
export declare function _toLicense(rsp: RspLicense): LicenseRecord;