const brand = await api.brand.create({
name: "Qahwa Lab",
description: "Specialty coffee roasted in Tunis",
logos: [
{ name: "logo.svg", content: svgText, main: true }, // SVG text, bytes, a Blob or base64
{ path: "./icon.png", role: "icon" }, // Node.js only
],
palette: ["#6B3E26", "#D9A441"], // optional
identity: { tagline: "Roasted every morning" },
assets: [{ cloud: "Brand/storefront.jpg", role: "hero" }],
});brand = api.brand.create(
name="Qahwa Lab",
description="Specialty coffee roasted in Tunis",
logos=[
{"name": "logo.svg", "content": svg_text, "main": True}, # SVG text, bytes or base64
{"path": "icon.png", "role": "icon"},
],
palette=["#6B3E26", "#D9A441"], # optional
identity={"tagline": "Roasted every morning"},
assets=[{"cloud": "Brand/storefront.jpg", "role": "hero"}],
)
brand.asset_errors # None, or [{"index", "code", "message"}]namestringrequiredاسم العلامة التجارية.
descriptionstringجملة واحدة، 500 حرف على الأكثر. أما الوصف المطوّل فمكانه identity.longDescription.
logosarray{ name, content } أو { path }، مع role اختياري (primary، secondary، icon، monogram، other) وmain. 12 على الأكثر، بحجم 5 ميغابايت لكل منها؛ SVG أو PNG أو JPEG أو WebP، يُتعرَّف عليها من البايتات لا من الاسم.
palettearray | objectقائمة ألوان ("#6B3E26" أو { hex, role, name })، أو { colors, typography }. وبدونها تُستخرج الألوان من الشعار الرئيسي.
identityobjectالشعار النصي، والوصف المطوّل، والقطاع، واللغات، وسنة التأسيس، والنطاق، وحسابات التواصل.
platformobjectالمهمة، والرؤية، والقيم، والتموضع، والوعد، والجماهير، والنموذج الأصلي، ونبرة الصوت، والرسائل.
assetsarrayصور أو مقاطع فيديو أو رسوم توضيحية — انظر assets.
المورد المرفوض لا يلغي العلامة التجارية
تُنشأ العلامة التجارية أولًا، ثم مواردها. ويُدرج المورد الذي يفشل في brand.assetErrors — مع فهرسه ورمزه ورسالته — وتُحفظ الموارد الأخرى.
الأخطاء
| الرمز | الحالة | متى |
|---|---|---|
| invalid_name | 400 | لا يوجد اسم، أو الاسم فارغ. |
| invalid_field | 400 | حقل غير معروف في identity أو platform، أو قيمة من نوع خاطئ. |
| unsupported_logo | 400 | البايتات ليست صورة SVG أو PNG أو JPEG أو WebP. |
| unsafe_svg | 400 | ملف SVG يحمل نصًا برمجيًا أو معالج أحداث أو HTML مضمّنًا أو رابطًا خارجيًا. |
| too_many_logos | 400 | أكثر من 12 شعارًا. |
| logo_too_large | 413 | شعار يتجاوز 5 ميغابايت. |
| invalid_color | 400 | لون ليس قيمة سداسية عشرية، أو دور غير معروف. |
| too_many_brands | 403 | يملك الحساب بالفعل 50 علامة تجارية. |