@humation/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -0
- package/dist/index.d.mts +699 -0
- package/dist/index.d.ts +699 -0
- package/dist/index.js +520 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +495 -0
- package/dist/index.mjs.map +1 -0
- package/openapi.json +778 -0
- package/package.json +54 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AvatarSession: () => AvatarSession,
|
|
24
|
+
HumationApiError: () => HumationApiError,
|
|
25
|
+
HumationClient: () => HumationClient,
|
|
26
|
+
createHumationClient: () => createHumationClient,
|
|
27
|
+
raw: () => api_exports
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
|
|
31
|
+
// src/constants.ts
|
|
32
|
+
var DEFAULT_BASE_URL = "https://api.humation.app/v1";
|
|
33
|
+
var DEFAULT_BACKGROUND = "F6F5F4";
|
|
34
|
+
var HEX_COLOR_RE = /^[0-9a-fA-F]{6}$/;
|
|
35
|
+
|
|
36
|
+
// src/svg.ts
|
|
37
|
+
function applySvgColors(svg, colors) {
|
|
38
|
+
return svg.replace(/<([a-zA-Z][\w:-]*)([^<>]*)>/g, (tag) => {
|
|
39
|
+
const colorKey = getAttr(tag, "data-color-key");
|
|
40
|
+
const fillKey = getAttr(tag, "data-fill-color-key") ?? colorKey;
|
|
41
|
+
const strokeKey = getAttr(tag, "data-stroke-color-key") ?? colorKey;
|
|
42
|
+
let next = tag;
|
|
43
|
+
if (fillKey && colors[fillKey] && hasPaintAttr(tag, "fill")) {
|
|
44
|
+
next = setAttr(next, "fill", `#${normalizeHex(colors[fillKey])}`);
|
|
45
|
+
}
|
|
46
|
+
if (strokeKey && colors[strokeKey] && hasPaintAttr(tag, "stroke")) {
|
|
47
|
+
next = setAttr(next, "stroke", `#${normalizeHex(colors[strokeKey])}`);
|
|
48
|
+
}
|
|
49
|
+
if (colorKey && colors[colorKey] && !hasPaintAttr(tag, "fill") && !hasPaintAttr(tag, "stroke")) {
|
|
50
|
+
next = setAttr(next, "fill", `#${normalizeHex(colors[colorKey])}`);
|
|
51
|
+
}
|
|
52
|
+
return next;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function stripSvgWrapper(svg) {
|
|
56
|
+
return svg.replace(/<svg[^>]*>/i, "").replace(/<\/svg>\s*$/i, "");
|
|
57
|
+
}
|
|
58
|
+
async function svgToPngBlob(svg) {
|
|
59
|
+
if (typeof Image === "undefined" || typeof document === "undefined") {
|
|
60
|
+
throw new Error("toPngBlob() is only available in browser environments.");
|
|
61
|
+
}
|
|
62
|
+
const image = new Image();
|
|
63
|
+
image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
image.onload = () => {
|
|
66
|
+
const targetSize = 1024;
|
|
67
|
+
const width = image.naturalWidth || image.width || 400;
|
|
68
|
+
const height = image.naturalHeight || image.height || 960;
|
|
69
|
+
const scale = targetSize / Math.max(width, height);
|
|
70
|
+
const canvas = document.createElement("canvas");
|
|
71
|
+
canvas.width = Math.round(width * scale);
|
|
72
|
+
canvas.height = Math.round(height * scale);
|
|
73
|
+
const context = canvas.getContext("2d");
|
|
74
|
+
if (!context) {
|
|
75
|
+
reject(new Error("Canvas context is unavailable."));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
context.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
79
|
+
canvas.toBlob((blob) => {
|
|
80
|
+
if (blob) resolve(blob);
|
|
81
|
+
else reject(new Error("Canvas toBlob returned null."));
|
|
82
|
+
}, "image/png");
|
|
83
|
+
};
|
|
84
|
+
image.onerror = () => reject(new Error("Failed to load SVG for PNG export."));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function normalizeHex(value) {
|
|
88
|
+
const normalized = value.replace(/^#/, "").trim();
|
|
89
|
+
if (!HEX_COLOR_RE.test(normalized)) {
|
|
90
|
+
throw new Error(`Invalid hex color: ${value}`);
|
|
91
|
+
}
|
|
92
|
+
return normalized.toUpperCase();
|
|
93
|
+
}
|
|
94
|
+
function getAttr(tag, name) {
|
|
95
|
+
const match = tag.match(new RegExp(`\\s${name}=["']([^"']+)["']`, "i"));
|
|
96
|
+
return match?.[1];
|
|
97
|
+
}
|
|
98
|
+
function hasPaintAttr(tag, name) {
|
|
99
|
+
const value = getAttr(tag, name);
|
|
100
|
+
return Boolean(value && value !== "none");
|
|
101
|
+
}
|
|
102
|
+
function setAttr(tag, name, value) {
|
|
103
|
+
if (new RegExp(`\\s${name}=["'][^"']*["']`, "i").test(tag)) {
|
|
104
|
+
return tag.replace(
|
|
105
|
+
new RegExp(`(\\s${name}=)["'][^"']*["']`, "i"),
|
|
106
|
+
`$1"${value}"`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return tag.replace(/\/?>$/, (end) => ` ${name}="${value}"${end}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/avatar-session.ts
|
|
113
|
+
var AvatarSession = class {
|
|
114
|
+
constructor(template, baseUrl, state) {
|
|
115
|
+
this.template = template;
|
|
116
|
+
this.assets = template.assets;
|
|
117
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
118
|
+
this.state = {
|
|
119
|
+
templateId: template.id,
|
|
120
|
+
parts: {
|
|
121
|
+
...Object.fromEntries(
|
|
122
|
+
template.groups.map((group) => [group.id, group.defaultPart])
|
|
123
|
+
),
|
|
124
|
+
...state?.parts ?? {}
|
|
125
|
+
},
|
|
126
|
+
colors: {
|
|
127
|
+
...Object.fromEntries(
|
|
128
|
+
template.colorOptions.map((option) => [option.id, option.default])
|
|
129
|
+
),
|
|
130
|
+
...state?.colors ?? {}
|
|
131
|
+
},
|
|
132
|
+
background: state?.background ?? DEFAULT_BACKGROUND,
|
|
133
|
+
crop: state?.crop ?? template.defaultCrop
|
|
134
|
+
};
|
|
135
|
+
this.resolveLinkedSelections();
|
|
136
|
+
}
|
|
137
|
+
getState() {
|
|
138
|
+
return {
|
|
139
|
+
templateId: this.state.templateId,
|
|
140
|
+
parts: { ...this.state.parts },
|
|
141
|
+
colors: { ...this.state.colors },
|
|
142
|
+
background: this.state.background,
|
|
143
|
+
crop: this.state.crop
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
toJSON() {
|
|
147
|
+
return this.getState();
|
|
148
|
+
}
|
|
149
|
+
getGroups(options = {}) {
|
|
150
|
+
return this.template.groups.filter(
|
|
151
|
+
(group) => options.includeHidden || !group.hidden
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
getParts(groupId) {
|
|
155
|
+
return this.getGroup(groupId).parts;
|
|
156
|
+
}
|
|
157
|
+
getColors() {
|
|
158
|
+
return this.template.colorOptions;
|
|
159
|
+
}
|
|
160
|
+
setPart(groupId, partId) {
|
|
161
|
+
const group = this.getGroup(groupId);
|
|
162
|
+
const normalized = this.normalizePartValue(group, partId);
|
|
163
|
+
if (!normalized) {
|
|
164
|
+
throw new Error(`Invalid part for ${groupId}: ${partId}`);
|
|
165
|
+
}
|
|
166
|
+
this.state.parts[group.id] = normalized;
|
|
167
|
+
this.resolveLinkedSelections();
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
setColor(colorId, color) {
|
|
171
|
+
if (!this.template.colorOptions.some((option) => option.id === colorId)) {
|
|
172
|
+
throw new Error(`Unknown color option: ${colorId}`);
|
|
173
|
+
}
|
|
174
|
+
this.state.colors[colorId] = normalizeHex(color);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
setBackground(background) {
|
|
178
|
+
if (background !== "transparent" && !HEX_COLOR_RE.test(background.replace(/^#/, ""))) {
|
|
179
|
+
throw new Error(`Invalid background: ${background}`);
|
|
180
|
+
}
|
|
181
|
+
this.state.background = background === "transparent" ? background : normalizeHex(background);
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
setCrop(crop) {
|
|
185
|
+
if (!this.template.cropOptions.some((option) => option.id === crop)) {
|
|
186
|
+
throw new Error(`Unknown crop: ${crop}`);
|
|
187
|
+
}
|
|
188
|
+
this.state.crop = crop;
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
191
|
+
toSvg() {
|
|
192
|
+
const layers = this.buildRenderLayers();
|
|
193
|
+
const contents = layers.map((layer) => {
|
|
194
|
+
const asset = this.findAsset(layer.groupId, layer.partId);
|
|
195
|
+
if (!asset)
|
|
196
|
+
throw new Error(`Missing asset: ${layer.groupId}/${layer.partId}`);
|
|
197
|
+
const content = stripSvgWrapper(
|
|
198
|
+
applySvgColors(asset.svg, this.state.colors)
|
|
199
|
+
);
|
|
200
|
+
return `<g data-group-id="${escapeAttr(layer.groupId)}" data-part-id="${escapeAttr(layer.partId)}" transform="translate(${formatNumber(layer.offset.x)}, ${formatNumber(layer.offset.y)})">${content}</g>`;
|
|
201
|
+
});
|
|
202
|
+
const viewBox = this.resolveViewBox(this.state.crop);
|
|
203
|
+
const background = this.state.background === "transparent" ? "" : `<rect x="${formatNumber(viewBox.x)}" y="${formatNumber(viewBox.y)}" width="${formatNumber(viewBox.width)}" height="${formatNumber(viewBox.height)}" fill="#${normalizeHex(this.state.background)}" />`;
|
|
204
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${formatNumber(viewBox.width)}" height="${formatNumber(viewBox.height)}" viewBox="${formatNumber(viewBox.x)} ${formatNumber(viewBox.y)} ${formatNumber(viewBox.width)} ${formatNumber(viewBox.height)}">${background}${contents.join("")}</svg>`;
|
|
205
|
+
}
|
|
206
|
+
async toPngBlob() {
|
|
207
|
+
return svgToPngBlob(this.toSvg());
|
|
208
|
+
}
|
|
209
|
+
renderUrl() {
|
|
210
|
+
const url = new URL(
|
|
211
|
+
`${this.baseUrl}/templates/${encodeURIComponent(this.template.id)}/render.svg`
|
|
212
|
+
);
|
|
213
|
+
for (const [groupId, partId] of Object.entries(this.state.parts)) {
|
|
214
|
+
const group = this.template.groups.find(
|
|
215
|
+
(candidate) => candidate.id === groupId
|
|
216
|
+
);
|
|
217
|
+
if (!group || group.hidden) continue;
|
|
218
|
+
url.searchParams.set(groupId, partId);
|
|
219
|
+
}
|
|
220
|
+
for (const [colorId, color] of Object.entries(this.state.colors)) {
|
|
221
|
+
url.searchParams.set(`color.${colorId}`, normalizeHex(color));
|
|
222
|
+
}
|
|
223
|
+
url.searchParams.set("bg", this.state.background);
|
|
224
|
+
url.searchParams.set("crop", this.state.crop);
|
|
225
|
+
return url.toString();
|
|
226
|
+
}
|
|
227
|
+
getGroup(groupId) {
|
|
228
|
+
const group = this.template.groups.find(
|
|
229
|
+
(candidate) => candidate.id === groupId
|
|
230
|
+
);
|
|
231
|
+
if (!group) throw new Error(`Unknown group: ${groupId}`);
|
|
232
|
+
return group;
|
|
233
|
+
}
|
|
234
|
+
normalizePartValue(group, value) {
|
|
235
|
+
const trimmed = value.trim();
|
|
236
|
+
if (group.control === "toggle") {
|
|
237
|
+
const normalized = trimmed.toLowerCase();
|
|
238
|
+
if (["true", "1", "on"].includes(normalized)) {
|
|
239
|
+
return group.onPart && hasPart(group, group.onPart) ? group.onPart : null;
|
|
240
|
+
}
|
|
241
|
+
if (["false", "0", "off"].includes(normalized)) {
|
|
242
|
+
return group.offPart && hasPart(group, group.offPart) ? group.offPart : null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (hasPart(group, trimmed)) return trimmed;
|
|
246
|
+
const padded = trimmed.length === 2 ? `0${trimmed}` : trimmed;
|
|
247
|
+
return hasPart(group, padded) ? padded : null;
|
|
248
|
+
}
|
|
249
|
+
resolveLinkedSelections() {
|
|
250
|
+
for (const group of this.template.groups) {
|
|
251
|
+
const selectedPart = this.state.parts[group.id] ?? group.defaultPart;
|
|
252
|
+
this.state.parts[group.id] = selectedPart;
|
|
253
|
+
for (const link of group.links ?? []) {
|
|
254
|
+
if (link.behavior !== "mirror_selection") continue;
|
|
255
|
+
const target = this.template.groups.find(
|
|
256
|
+
(candidate) => candidate.id === link.targetGroupId
|
|
257
|
+
);
|
|
258
|
+
if (!target) continue;
|
|
259
|
+
const linkedPart = this.normalizePartValue(target, selectedPart);
|
|
260
|
+
if (linkedPart) this.state.parts[target.id] = linkedPart;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
buildRenderLayers() {
|
|
265
|
+
return [...this.template.groups].sort((left, right) => left.layerOrder - right.layerOrder).map((group) => ({
|
|
266
|
+
groupId: group.id,
|
|
267
|
+
partId: this.state.parts[group.id] ?? group.defaultPart,
|
|
268
|
+
offset: group.offset,
|
|
269
|
+
size: group.size
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
resolveViewBox(cropId) {
|
|
273
|
+
const bounds = this.getBounds();
|
|
274
|
+
const crop = this.template.cropOptions.find(
|
|
275
|
+
(option) => option.id === cropId
|
|
276
|
+
);
|
|
277
|
+
if (!crop) throw new Error(`Missing crop: ${cropId}`);
|
|
278
|
+
if (crop.mode === "view_box" && crop.viewBox) return crop.viewBox;
|
|
279
|
+
if (crop.mode === "bounds") return bounds;
|
|
280
|
+
const padding = bounds.width * (crop.paddingRatio ?? 0);
|
|
281
|
+
const side = bounds.width + padding * 2;
|
|
282
|
+
return {
|
|
283
|
+
x: bounds.x - padding,
|
|
284
|
+
y: bounds.y - padding,
|
|
285
|
+
width: side,
|
|
286
|
+
height: side
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
getBounds() {
|
|
290
|
+
let minX = Infinity;
|
|
291
|
+
let minY = Infinity;
|
|
292
|
+
let maxX = -Infinity;
|
|
293
|
+
let maxY = -Infinity;
|
|
294
|
+
for (const group of this.template.groups) {
|
|
295
|
+
minX = Math.min(minX, group.offset.x);
|
|
296
|
+
minY = Math.min(minY, group.offset.y);
|
|
297
|
+
maxX = Math.max(maxX, group.offset.x + group.size.width);
|
|
298
|
+
maxY = Math.max(maxY, group.offset.y + group.size.height);
|
|
299
|
+
}
|
|
300
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
301
|
+
}
|
|
302
|
+
findAsset(groupId, partId) {
|
|
303
|
+
return this.assets.find(
|
|
304
|
+
(asset) => asset.groupId === groupId && asset.partId === partId
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
function hasPart(group, partId) {
|
|
309
|
+
return group.parts.some((part) => part.id === partId);
|
|
310
|
+
}
|
|
311
|
+
function formatNumber(value) {
|
|
312
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(4).replace(/0+$/, "").replace(/\.$/, "");
|
|
313
|
+
}
|
|
314
|
+
function escapeAttr(value) {
|
|
315
|
+
return value.replace(/&/g, "&").replace(/"/g, """);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/errors.ts
|
|
319
|
+
var HumationApiError = class extends Error {
|
|
320
|
+
constructor(response, body) {
|
|
321
|
+
super(`Humation API request failed: ${response.status}`);
|
|
322
|
+
this.name = "HumationApiError";
|
|
323
|
+
this.status = response.status;
|
|
324
|
+
this.statusText = response.statusText;
|
|
325
|
+
this.body = body;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
async function createHumationApiError(response) {
|
|
329
|
+
return new HumationApiError(response, await readErrorBody(response));
|
|
330
|
+
}
|
|
331
|
+
async function readErrorBody(response) {
|
|
332
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
333
|
+
if (contentType.includes("application/json")) {
|
|
334
|
+
try {
|
|
335
|
+
return await response.json();
|
|
336
|
+
} catch {
|
|
337
|
+
return void 0;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
try {
|
|
341
|
+
return await response.text();
|
|
342
|
+
} catch {
|
|
343
|
+
return void 0;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/raw-client.ts
|
|
348
|
+
var rawConfig = {};
|
|
349
|
+
function setRawConfig(config) {
|
|
350
|
+
rawConfig = config;
|
|
351
|
+
}
|
|
352
|
+
async function humationRawFetch(url, options = {}) {
|
|
353
|
+
const fetcher = rawConfig.fetch ?? globalThis.fetch;
|
|
354
|
+
if (!fetcher) {
|
|
355
|
+
throw new Error("Humation SDK requires a fetch implementation.");
|
|
356
|
+
}
|
|
357
|
+
const response = await fetcher(toUrl(url), {
|
|
358
|
+
...options,
|
|
359
|
+
headers: buildHeaders(options.headers)
|
|
360
|
+
});
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
throw await createHumationApiError(response);
|
|
363
|
+
}
|
|
364
|
+
if ([204, 205, 304].includes(response.status)) {
|
|
365
|
+
return void 0;
|
|
366
|
+
}
|
|
367
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
368
|
+
if (contentType.includes("application/json")) {
|
|
369
|
+
return await response.json();
|
|
370
|
+
}
|
|
371
|
+
return await response.blob();
|
|
372
|
+
}
|
|
373
|
+
function toUrl(pathOrUrl) {
|
|
374
|
+
if (/^https?:\/\//i.test(pathOrUrl)) return pathOrUrl;
|
|
375
|
+
return `${normalizeBaseUrl(rawConfig.baseUrl ?? DEFAULT_BASE_URL)}${pathOrUrl.startsWith("/") ? pathOrUrl : `/${pathOrUrl}`}`;
|
|
376
|
+
}
|
|
377
|
+
function buildHeaders(headers) {
|
|
378
|
+
const result = new Headers(rawConfig.headers);
|
|
379
|
+
if (rawConfig.apiKey)
|
|
380
|
+
result.set("Authorization", `Bearer ${rawConfig.apiKey}`);
|
|
381
|
+
new Headers(headers).forEach((value, key) => result.set(key, value));
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
function normalizeBaseUrl(url) {
|
|
385
|
+
return url.replace(/\/+$/, "");
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/client.ts
|
|
389
|
+
var HumationClient = class {
|
|
390
|
+
constructor(options = {}) {
|
|
391
|
+
this.baseUrl = normalizeBaseUrl2(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
392
|
+
this.apiKey = options.apiKey;
|
|
393
|
+
this.fetcher = options.fetch ?? globalThis.fetch;
|
|
394
|
+
this.headers = options.headers;
|
|
395
|
+
if (!this.fetcher) {
|
|
396
|
+
throw new Error("Humation SDK requires a fetch implementation.");
|
|
397
|
+
}
|
|
398
|
+
setRawConfig({
|
|
399
|
+
baseUrl: this.baseUrl,
|
|
400
|
+
apiKey: this.apiKey,
|
|
401
|
+
fetch: this.fetcher,
|
|
402
|
+
headers: this.headers
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
async listTemplates() {
|
|
406
|
+
const response = await this.requestJson(
|
|
407
|
+
"/templates"
|
|
408
|
+
);
|
|
409
|
+
return response.templates;
|
|
410
|
+
}
|
|
411
|
+
async getTemplate(templateId) {
|
|
412
|
+
return this.requestJson(
|
|
413
|
+
`/templates/${encodeURIComponent(templateId)}`
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
async getTemplateAssets(templateId) {
|
|
417
|
+
return this.requestJson(
|
|
418
|
+
`/templates/${encodeURIComponent(templateId)}/assets`
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
async loadAvatar(templateId, options = {}) {
|
|
422
|
+
const template = await this.getTemplateAssets(templateId);
|
|
423
|
+
return new AvatarSession(template, this.baseUrl, options.state);
|
|
424
|
+
}
|
|
425
|
+
renderUrl(templateId) {
|
|
426
|
+
return `${this.baseUrl}/templates/${encodeURIComponent(templateId)}/render.svg`;
|
|
427
|
+
}
|
|
428
|
+
async requestJson(path) {
|
|
429
|
+
const response = await this.fetcher(`${this.baseUrl}${path}`, {
|
|
430
|
+
headers: this.buildHeaders()
|
|
431
|
+
});
|
|
432
|
+
if (!response.ok) {
|
|
433
|
+
throw await createHumationApiError(response);
|
|
434
|
+
}
|
|
435
|
+
return await response.json();
|
|
436
|
+
}
|
|
437
|
+
buildHeaders() {
|
|
438
|
+
const headers = new Headers(this.headers);
|
|
439
|
+
if (this.apiKey) headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
440
|
+
return headers;
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
function createHumationClient(options) {
|
|
444
|
+
return new HumationClient(options);
|
|
445
|
+
}
|
|
446
|
+
function normalizeBaseUrl2(url) {
|
|
447
|
+
return url.replace(/\/+$/, "");
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// src/generated/api.ts
|
|
451
|
+
var api_exports = {};
|
|
452
|
+
__export(api_exports, {
|
|
453
|
+
getGetHealthUrl: () => getGetHealthUrl,
|
|
454
|
+
getGetTemplateAssetsUrl: () => getGetTemplateAssetsUrl,
|
|
455
|
+
getGetTemplateUrl: () => getGetTemplateUrl,
|
|
456
|
+
getHealth: () => getHealth,
|
|
457
|
+
getListTemplatesUrl: () => getListTemplatesUrl,
|
|
458
|
+
getRenderTemplateSvgUrl: () => getRenderTemplateSvgUrl,
|
|
459
|
+
getTemplate: () => getTemplate,
|
|
460
|
+
getTemplateAssets: () => getTemplateAssets,
|
|
461
|
+
listTemplates: () => listTemplates,
|
|
462
|
+
renderTemplateSvg: () => renderTemplateSvg
|
|
463
|
+
});
|
|
464
|
+
var getGetHealthUrl = () => {
|
|
465
|
+
return `/health`;
|
|
466
|
+
};
|
|
467
|
+
var getHealth = async (options) => {
|
|
468
|
+
return humationRawFetch(getGetHealthUrl(), {
|
|
469
|
+
...options,
|
|
470
|
+
method: "GET"
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
var getListTemplatesUrl = () => {
|
|
474
|
+
return `/templates`;
|
|
475
|
+
};
|
|
476
|
+
var listTemplates = async (options) => {
|
|
477
|
+
return humationRawFetch(getListTemplatesUrl(), {
|
|
478
|
+
...options,
|
|
479
|
+
method: "GET"
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
var getGetTemplateUrl = (templateId) => {
|
|
483
|
+
return `/templates/${templateId}`;
|
|
484
|
+
};
|
|
485
|
+
var getTemplate = async (templateId, options) => {
|
|
486
|
+
return humationRawFetch(getGetTemplateUrl(templateId), {
|
|
487
|
+
...options,
|
|
488
|
+
method: "GET"
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
var getGetTemplateAssetsUrl = (templateId) => {
|
|
492
|
+
return `/templates/${templateId}/assets`;
|
|
493
|
+
};
|
|
494
|
+
var getTemplateAssets = async (templateId, options) => {
|
|
495
|
+
return humationRawFetch(
|
|
496
|
+
getGetTemplateAssetsUrl(templateId),
|
|
497
|
+
{
|
|
498
|
+
...options,
|
|
499
|
+
method: "GET"
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
};
|
|
503
|
+
var getRenderTemplateSvgUrl = (templateId) => {
|
|
504
|
+
return `/templates/${templateId}/render.svg`;
|
|
505
|
+
};
|
|
506
|
+
var renderTemplateSvg = async (templateId, options) => {
|
|
507
|
+
return humationRawFetch(getRenderTemplateSvgUrl(templateId), {
|
|
508
|
+
...options,
|
|
509
|
+
method: "GET"
|
|
510
|
+
});
|
|
511
|
+
};
|
|
512
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
513
|
+
0 && (module.exports = {
|
|
514
|
+
AvatarSession,
|
|
515
|
+
HumationApiError,
|
|
516
|
+
HumationClient,
|
|
517
|
+
createHumationClient,
|
|
518
|
+
raw
|
|
519
|
+
});
|
|
520
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/constants.ts","../src/svg.ts","../src/avatar-session.ts","../src/errors.ts","../src/raw-client.ts","../src/client.ts","../src/generated/api.ts"],"sourcesContent":["export { createHumationClient, HumationClient } from './client';\nexport { AvatarSession } from './avatar-session';\nexport { HumationApiError } from './errors';\nexport type {\n AvatarAsset,\n AvatarAssetsResponse,\n AvatarState,\n AvatarTemplate,\n Background,\n CropId,\n HexColor,\n HumationClientOptions,\n LoadAvatarOptions,\n TemplateColorOption,\n TemplateCropOption,\n TemplateGroup,\n TemplatePart,\n TemplateSummary,\n} from './types';\nexport * as raw from './generated/api';\n","export const DEFAULT_BASE_URL = 'https://api.humation.app/v1';\nexport const DEFAULT_BACKGROUND = 'F6F5F4';\nexport const HEX_COLOR_RE = /^[0-9a-fA-F]{6}$/;\n","import { HEX_COLOR_RE } from './constants';\n\nexport function applySvgColors(svg: string, colors: Record<string, string>) {\n return svg.replace(/<([a-zA-Z][\\w:-]*)([^<>]*)>/g, (tag) => {\n const colorKey = getAttr(tag, 'data-color-key');\n const fillKey = getAttr(tag, 'data-fill-color-key') ?? colorKey;\n const strokeKey = getAttr(tag, 'data-stroke-color-key') ?? colorKey;\n let next = tag;\n\n if (fillKey && colors[fillKey] && hasPaintAttr(tag, 'fill')) {\n next = setAttr(next, 'fill', `#${normalizeHex(colors[fillKey])}`);\n }\n if (strokeKey && colors[strokeKey] && hasPaintAttr(tag, 'stroke')) {\n next = setAttr(next, 'stroke', `#${normalizeHex(colors[strokeKey])}`);\n }\n if (\n colorKey &&\n colors[colorKey] &&\n !hasPaintAttr(tag, 'fill') &&\n !hasPaintAttr(tag, 'stroke')\n ) {\n next = setAttr(next, 'fill', `#${normalizeHex(colors[colorKey])}`);\n }\n\n return next;\n });\n}\n\nexport function stripSvgWrapper(svg: string) {\n return svg.replace(/<svg[^>]*>/i, '').replace(/<\\/svg>\\s*$/i, '');\n}\n\nexport async function svgToPngBlob(svg: string): Promise<Blob> {\n if (typeof Image === 'undefined' || typeof document === 'undefined') {\n throw new Error('toPngBlob() is only available in browser environments.');\n }\n\n const image = new Image();\n image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n\n return new Promise((resolve, reject) => {\n image.onload = () => {\n const targetSize = 1024;\n const width = image.naturalWidth || image.width || 400;\n const height = image.naturalHeight || image.height || 960;\n const scale = targetSize / Math.max(width, height);\n const canvas = document.createElement('canvas');\n canvas.width = Math.round(width * scale);\n canvas.height = Math.round(height * scale);\n const context = canvas.getContext('2d');\n if (!context) {\n reject(new Error('Canvas context is unavailable.'));\n return;\n }\n context.drawImage(image, 0, 0, canvas.width, canvas.height);\n canvas.toBlob((blob) => {\n if (blob) resolve(blob);\n else reject(new Error('Canvas toBlob returned null.'));\n }, 'image/png');\n };\n image.onerror = () =>\n reject(new Error('Failed to load SVG for PNG export.'));\n });\n}\n\nexport function normalizeHex(value: string) {\n const normalized = value.replace(/^#/, '').trim();\n if (!HEX_COLOR_RE.test(normalized)) {\n throw new Error(`Invalid hex color: ${value}`);\n }\n return normalized.toUpperCase();\n}\n\nfunction getAttr(tag: string, name: string) {\n const match = tag.match(new RegExp(`\\\\s${name}=[\"']([^\"']+)[\"']`, 'i'));\n return match?.[1];\n}\n\nfunction hasPaintAttr(tag: string, name: 'fill' | 'stroke') {\n const value = getAttr(tag, name);\n return Boolean(value && value !== 'none');\n}\n\nfunction setAttr(tag: string, name: string, value: string) {\n if (new RegExp(`\\\\s${name}=[\"'][^\"']*[\"']`, 'i').test(tag)) {\n return tag.replace(\n new RegExp(`(\\\\s${name}=)[\"'][^\"']*[\"']`, 'i'),\n `$1\"${value}\"`\n );\n }\n return tag.replace(/\\/?>$/, (end) => ` ${name}=\"${value}\"${end}`);\n}\n","import { DEFAULT_BACKGROUND, HEX_COLOR_RE } from './constants';\nimport {\n applySvgColors,\n normalizeHex,\n stripSvgWrapper,\n svgToPngBlob,\n} from './svg';\nimport type {\n AvatarAsset,\n AvatarAssetsResponse,\n AvatarState,\n Background,\n CropId,\n TemplateGroup,\n} from './types';\n\ntype ViewBox = { x: number; y: number; width: number; height: number };\n\nexport class AvatarSession {\n readonly template: AvatarAssetsResponse;\n private readonly assets: AvatarAsset[];\n private readonly baseUrl: string;\n private state: AvatarState;\n\n constructor(\n template: AvatarAssetsResponse,\n baseUrl: string,\n state?: Partial<AvatarState>\n ) {\n this.template = template;\n this.assets = template.assets;\n this.baseUrl = baseUrl.replace(/\\/+$/, '');\n this.state = {\n templateId: template.id,\n parts: {\n ...Object.fromEntries(\n template.groups.map((group) => [group.id, group.defaultPart])\n ),\n ...(state?.parts ?? {}),\n },\n colors: {\n ...Object.fromEntries(\n template.colorOptions.map((option) => [option.id, option.default])\n ),\n ...(state?.colors ?? {}),\n },\n background: state?.background ?? DEFAULT_BACKGROUND,\n crop: state?.crop ?? template.defaultCrop,\n };\n this.resolveLinkedSelections();\n }\n\n getState(): AvatarState {\n return {\n templateId: this.state.templateId,\n parts: { ...this.state.parts },\n colors: { ...this.state.colors },\n background: this.state.background,\n crop: this.state.crop,\n };\n }\n\n toJSON(): AvatarState {\n return this.getState();\n }\n\n getGroups(options: { includeHidden?: boolean } = {}) {\n return this.template.groups.filter(\n (group) => options.includeHidden || !group.hidden\n );\n }\n\n getParts(groupId: string) {\n return this.getGroup(groupId).parts;\n }\n\n getColors() {\n return this.template.colorOptions;\n }\n\n setPart(groupId: string, partId: string) {\n const group = this.getGroup(groupId);\n const normalized = this.normalizePartValue(group, partId);\n if (!normalized) {\n throw new Error(`Invalid part for ${groupId}: ${partId}`);\n }\n this.state.parts[group.id] = normalized;\n this.resolveLinkedSelections();\n return this;\n }\n\n setColor(colorId: string, color: string) {\n if (!this.template.colorOptions.some((option) => option.id === colorId)) {\n throw new Error(`Unknown color option: ${colorId}`);\n }\n this.state.colors[colorId] = normalizeHex(color);\n return this;\n }\n\n setBackground(background: Background) {\n if (\n background !== 'transparent' &&\n !HEX_COLOR_RE.test(background.replace(/^#/, ''))\n ) {\n throw new Error(`Invalid background: ${background}`);\n }\n this.state.background =\n background === 'transparent' ? background : normalizeHex(background);\n return this;\n }\n\n setCrop(crop: CropId) {\n if (!this.template.cropOptions.some((option) => option.id === crop)) {\n throw new Error(`Unknown crop: ${crop}`);\n }\n this.state.crop = crop;\n return this;\n }\n\n toSvg() {\n const layers = this.buildRenderLayers();\n const contents = layers.map((layer) => {\n const asset = this.findAsset(layer.groupId, layer.partId);\n if (!asset)\n throw new Error(`Missing asset: ${layer.groupId}/${layer.partId}`);\n const content = stripSvgWrapper(\n applySvgColors(asset.svg, this.state.colors)\n );\n return `<g data-group-id=\"${escapeAttr(layer.groupId)}\" data-part-id=\"${escapeAttr(layer.partId)}\" transform=\"translate(${formatNumber(layer.offset.x)}, ${formatNumber(layer.offset.y)})\">${content}</g>`;\n });\n const viewBox = this.resolveViewBox(this.state.crop);\n const background =\n this.state.background === 'transparent'\n ? ''\n : `<rect x=\"${formatNumber(viewBox.x)}\" y=\"${formatNumber(viewBox.y)}\" width=\"${formatNumber(viewBox.width)}\" height=\"${formatNumber(viewBox.height)}\" fill=\"#${normalizeHex(this.state.background)}\" />`;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${formatNumber(viewBox.width)}\" height=\"${formatNumber(viewBox.height)}\" viewBox=\"${formatNumber(viewBox.x)} ${formatNumber(viewBox.y)} ${formatNumber(viewBox.width)} ${formatNumber(viewBox.height)}\">${background}${contents.join('')}</svg>`;\n }\n\n async toPngBlob() {\n return svgToPngBlob(this.toSvg());\n }\n\n renderUrl() {\n const url = new URL(\n `${this.baseUrl}/templates/${encodeURIComponent(this.template.id)}/render.svg`\n );\n for (const [groupId, partId] of Object.entries(this.state.parts)) {\n const group = this.template.groups.find(\n (candidate) => candidate.id === groupId\n );\n if (!group || group.hidden) continue;\n url.searchParams.set(groupId, partId);\n }\n for (const [colorId, color] of Object.entries(this.state.colors)) {\n url.searchParams.set(`color.${colorId}`, normalizeHex(color));\n }\n url.searchParams.set('bg', this.state.background);\n url.searchParams.set('crop', this.state.crop);\n return url.toString();\n }\n\n private getGroup(groupId: string) {\n const group = this.template.groups.find(\n (candidate) => candidate.id === groupId\n );\n if (!group) throw new Error(`Unknown group: ${groupId}`);\n return group;\n }\n\n private normalizePartValue(group: TemplateGroup, value: string) {\n const trimmed = value.trim();\n if (group.control === 'toggle') {\n const normalized = trimmed.toLowerCase();\n if (['true', '1', 'on'].includes(normalized)) {\n return group.onPart && hasPart(group, group.onPart)\n ? group.onPart\n : null;\n }\n if (['false', '0', 'off'].includes(normalized)) {\n return group.offPart && hasPart(group, group.offPart)\n ? group.offPart\n : null;\n }\n }\n if (hasPart(group, trimmed)) return trimmed;\n const padded = trimmed.length === 2 ? `0${trimmed}` : trimmed;\n return hasPart(group, padded) ? padded : null;\n }\n\n private resolveLinkedSelections() {\n for (const group of this.template.groups) {\n const selectedPart = this.state.parts[group.id] ?? group.defaultPart;\n this.state.parts[group.id] = selectedPart;\n for (const link of group.links ?? []) {\n if (link.behavior !== 'mirror_selection') continue;\n const target = this.template.groups.find(\n (candidate) => candidate.id === link.targetGroupId\n );\n if (!target) continue;\n const linkedPart = this.normalizePartValue(target, selectedPart);\n if (linkedPart) this.state.parts[target.id] = linkedPart;\n }\n }\n }\n\n private buildRenderLayers() {\n return [...this.template.groups]\n .sort((left, right) => left.layerOrder - right.layerOrder)\n .map((group) => ({\n groupId: group.id,\n partId: this.state.parts[group.id] ?? group.defaultPart,\n offset: group.offset,\n size: group.size,\n }));\n }\n\n private resolveViewBox(cropId: CropId): ViewBox {\n const bounds = this.getBounds();\n const crop = this.template.cropOptions.find(\n (option) => option.id === cropId\n );\n if (!crop) throw new Error(`Missing crop: ${cropId}`);\n if (crop.mode === 'view_box' && crop.viewBox) return crop.viewBox;\n if (crop.mode === 'bounds') return bounds;\n\n const padding = bounds.width * (crop.paddingRatio ?? 0);\n const side = bounds.width + padding * 2;\n return {\n x: bounds.x - padding,\n y: bounds.y - padding,\n width: side,\n height: side,\n };\n }\n\n private getBounds(): ViewBox {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (const group of this.template.groups) {\n minX = Math.min(minX, group.offset.x);\n minY = Math.min(minY, group.offset.y);\n maxX = Math.max(maxX, group.offset.x + group.size.width);\n maxY = Math.max(maxY, group.offset.y + group.size.height);\n }\n\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n }\n\n private findAsset(groupId: string, partId: string) {\n return this.assets.find(\n (asset) => asset.groupId === groupId && asset.partId === partId\n );\n }\n}\n\nfunction hasPart(group: TemplateGroup, partId: string) {\n return group.parts.some((part) => part.id === partId);\n}\n\nfunction formatNumber(value: number) {\n return Number.isInteger(value)\n ? String(value)\n : value.toFixed(4).replace(/0+$/, '').replace(/\\.$/, '');\n}\n\nfunction escapeAttr(value: string) {\n return value.replace(/&/g, '&').replace(/\"/g, '"');\n}\n","export class HumationApiError extends Error {\n readonly status: number;\n readonly statusText: string;\n readonly body: unknown;\n\n constructor(response: Response, body?: unknown) {\n super(`Humation API request failed: ${response.status}`);\n this.name = 'HumationApiError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.body = body;\n }\n}\n\nexport async function createHumationApiError(response: Response) {\n return new HumationApiError(response, await readErrorBody(response));\n}\n\nasync function readErrorBody(response: Response) {\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.includes('application/json')) {\n try {\n return await response.json();\n } catch {\n return undefined;\n }\n }\n\n try {\n return await response.text();\n } catch {\n return undefined;\n }\n}\n","import { DEFAULT_BASE_URL } from './constants';\nimport { createHumationApiError } from './errors';\n\nexport type HumationRawConfig = {\n baseUrl?: string;\n apiKey?: string;\n fetch?: typeof fetch;\n headers?: HeadersInit;\n};\n\nlet rawConfig: HumationRawConfig = {};\n\nexport function setRawConfig(config: HumationRawConfig) {\n rawConfig = config;\n}\n\nexport async function humationRawFetch<T>(\n url: string,\n options: RequestInit = {}\n): Promise<T> {\n const fetcher = rawConfig.fetch ?? globalThis.fetch;\n if (!fetcher) {\n throw new Error('Humation SDK requires a fetch implementation.');\n }\n\n const response = await fetcher(toUrl(url), {\n ...options,\n headers: buildHeaders(options.headers),\n });\n if (!response.ok) {\n throw await createHumationApiError(response);\n }\n\n if ([204, 205, 304].includes(response.status)) {\n return undefined as T;\n }\n\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.includes('application/json')) {\n return (await response.json()) as T;\n }\n\n return (await response.blob()) as T;\n}\n\nfunction toUrl(pathOrUrl: string) {\n if (/^https?:\\/\\//i.test(pathOrUrl)) return pathOrUrl;\n return `${normalizeBaseUrl(rawConfig.baseUrl ?? DEFAULT_BASE_URL)}${pathOrUrl.startsWith('/') ? pathOrUrl : `/${pathOrUrl}`}`;\n}\n\nfunction buildHeaders(headers?: HeadersInit): Headers {\n const result = new Headers(rawConfig.headers);\n if (rawConfig.apiKey)\n result.set('Authorization', `Bearer ${rawConfig.apiKey}`);\n new Headers(headers).forEach((value, key) => result.set(key, value));\n return result;\n}\n\nfunction normalizeBaseUrl(url: string) {\n return url.replace(/\\/+$/, '');\n}\n","import { AvatarSession } from './avatar-session';\nimport { DEFAULT_BASE_URL } from './constants';\nimport { createHumationApiError } from './errors';\nimport { setRawConfig } from './raw-client';\nimport type {\n AvatarAssetsResponse,\n AvatarTemplate,\n HumationClientOptions,\n LoadAvatarOptions,\n TemplateSummary,\n} from './types';\n\nexport class HumationClient {\n readonly baseUrl: string;\n private readonly apiKey?: string;\n private readonly fetcher: typeof fetch;\n private readonly headers?: HeadersInit;\n\n constructor(options: HumationClientOptions = {}) {\n this.baseUrl = normalizeBaseUrl(options.baseUrl ?? DEFAULT_BASE_URL);\n this.apiKey = options.apiKey;\n this.fetcher = options.fetch ?? globalThis.fetch;\n this.headers = options.headers;\n\n if (!this.fetcher) {\n throw new Error('Humation SDK requires a fetch implementation.');\n }\n\n setRawConfig({\n baseUrl: this.baseUrl,\n apiKey: this.apiKey,\n fetch: this.fetcher,\n headers: this.headers,\n });\n }\n\n async listTemplates(): Promise<TemplateSummary[]> {\n const response = await this.requestJson<{ templates: TemplateSummary[] }>(\n '/templates'\n );\n return response.templates;\n }\n\n async getTemplate(templateId: string): Promise<AvatarTemplate> {\n return this.requestJson<AvatarTemplate>(\n `/templates/${encodeURIComponent(templateId)}`\n );\n }\n\n async getTemplateAssets(templateId: string): Promise<AvatarAssetsResponse> {\n return this.requestJson<AvatarAssetsResponse>(\n `/templates/${encodeURIComponent(templateId)}/assets`\n );\n }\n\n async loadAvatar(\n templateId: string,\n options: LoadAvatarOptions = {}\n ): Promise<AvatarSession> {\n const template = await this.getTemplateAssets(templateId);\n return new AvatarSession(template, this.baseUrl, options.state);\n }\n\n renderUrl(templateId: string): string {\n return `${this.baseUrl}/templates/${encodeURIComponent(templateId)}/render.svg`;\n }\n\n private async requestJson<T>(path: string): Promise<T> {\n const response = await this.fetcher(`${this.baseUrl}${path}`, {\n headers: this.buildHeaders(),\n });\n if (!response.ok) {\n throw await createHumationApiError(response);\n }\n return (await response.json()) as T;\n }\n\n private buildHeaders(): Headers {\n const headers = new Headers(this.headers);\n if (this.apiKey) headers.set('Authorization', `Bearer ${this.apiKey}`);\n return headers;\n }\n}\n\nexport function createHumationClient(\n options?: HumationClientOptions\n): HumationClient {\n return new HumationClient(options);\n}\n\nfunction normalizeBaseUrl(url: string) {\n return url.replace(/\\/+$/, '');\n}\n","/**\n * Generated by orval v8.13.0 🍺\n * Do not edit manually.\n * Humation Public API v1\n * Public API for rendering Humation SVG assets.\n * OpenAPI spec version: 0.1.0\n */\nimport type {\n GetHealth200,\n GetTemplate200,\n GetTemplateAssets200,\n ListTemplates200,\n} from './model';\n\nimport { humationRawFetch } from '../raw-client';\nexport const getGetHealthUrl = () => {\n return `/health`;\n};\n\n/**\n * @summary Check API availability\n */\nexport const getHealth = async (\n options?: RequestInit\n): Promise<GetHealth200> => {\n return humationRawFetch<GetHealth200>(getGetHealthUrl(), {\n ...options,\n method: 'GET',\n });\n};\n\nexport const getListTemplatesUrl = () => {\n return `/templates`;\n};\n\n/**\n * @summary List published templates\n */\nexport const listTemplates = async (\n options?: RequestInit\n): Promise<ListTemplates200> => {\n return humationRawFetch<ListTemplates200>(getListTemplatesUrl(), {\n ...options,\n method: 'GET',\n });\n};\n\nexport const getGetTemplateUrl = (templateId: string) => {\n return `/templates/${templateId}`;\n};\n\n/**\n * @summary Get a published template\n */\nexport const getTemplate = async (\n templateId: string,\n options?: RequestInit\n): Promise<GetTemplate200> => {\n return humationRawFetch<GetTemplate200>(getGetTemplateUrl(templateId), {\n ...options,\n method: 'GET',\n });\n};\n\nexport const getGetTemplateAssetsUrl = (templateId: string) => {\n return `/templates/${templateId}/assets`;\n};\n\n/**\n * @summary Get template assets\n */\nexport const getTemplateAssets = async (\n templateId: string,\n options?: RequestInit\n): Promise<GetTemplateAssets200> => {\n return humationRawFetch<GetTemplateAssets200>(\n getGetTemplateAssetsUrl(templateId),\n {\n ...options,\n method: 'GET',\n }\n );\n};\n\nexport const getRenderTemplateSvgUrl = (templateId: string) => {\n return `/templates/${templateId}/render.svg`;\n};\n\n/**\n * @summary Render a customized SVG avatar\n */\nexport const renderTemplateSvg = async (\n templateId: string,\n options?: RequestInit\n): Promise<Blob> => {\n return humationRawFetch<Blob>(getRenderTemplateSvgUrl(templateId), {\n ...options,\n method: 'GET',\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAC3B,IAAM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