@ireceipt.pro/js
Version:
Create PDF files or images (JPG, PNG, WEBP) from your HTML template.
131 lines • 5.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IReceiptPRO = void 0;
const methods_1 = require("./methods");
class IReceiptPRO {
/**
*
* @param apiKey - IReceipt PRO API KEY, you can get it on <https://dashboard.ireceipt.pro>
*/
constructor(apiKey) {
this.apiKey = apiKey;
}
/**
*
* @param apiKey - IReceipt PRO API KEY, you can get it on <https://dashboard.ireceipt.pro>
* @returns
*/
static useApiKey(apiKey) {
return new IReceiptPRO(apiKey);
}
/**
* Create JPG Image from public template
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createJpgFromPublicTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "jpg", "public", templateId, args, size);
}
/**
* Create PDF File from public template
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createPdfFromPublicTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "pdf", "public", templateId, args, size);
}
/**
* Create PNG Image from public template
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createPngFromPublicTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "png", "public", templateId, args, size);
}
/**
* Create WEBP Image from public template
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createWebpFromPublicTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "webp", "public", templateId, args, size);
}
/**
* Create JPG Image from private template,
* you can manage it on <https://dashboard.ireceipt.pro>
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createJpgFromPrivateTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "jpg", "private", templateId, args, size);
}
/**
* Create PDF File from private template,
* you can manage it on <https://dashboard.ireceipt.pro>
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createPdfFromPrivateTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "pdf", "private", templateId, args, size);
}
/**
* Create PNG Image from private template,
* you can manage it on <https://dashboard.ireceipt.pro>
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createPngFromPrivateTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "png", "private", templateId, args, size);
}
/**
* Create WEBP Image from private template,
* you can manage it on <https://dashboard.ireceipt.pro>
*
* @param templateId - template id, you can find it on <https://dashboard.ireceipt.pro>
* @param args - arguments for substitution in the template
* @param size - the size of the file being created
* @returns
*/
createWebpFromPrivateTemplate(templateId, args, size) {
if (!this.apiKey)
throw new Error("Initialization is required before use");
return (0, methods_1.createFile)(this.apiKey, "webp", "private", templateId, args, size);
}
}
exports.IReceiptPRO = IReceiptPRO;
//# sourceMappingURL=index.js.map