nalu
beta
Anonymous
Home
Help
Coming soon...
Variables
--- naluId: "pokemongo" collectionId: "pokemon" --- export const collectionUrl = `https://nalu.wiki/${naluId}/c/${collectionId}`; export const collectionEdit = `https://nalu.wiki/${naluId}/settings/collections/${collectionId}/edit`;
Templates
Coming soon...
Sign in to save your progress
Save as Draft
ListConfig Generator
## ListConfig Generator ### This utility generates a Nalu Collection ListConfig import qs from "https://esm.sh/qs"; Use this to customize the collection table at <a href={collectionUrl}>{collectionUrl}</a>. ---- V Customize ListConfig below V export const listQueries = { queryString: { populate: "*", //populate: { icon: { fields: ["url"] }}, //fields: ["id", "name"], sort: ["date_start:asc"], }, // populate sort block // relations should use . notation for nested fields sortBy: ["name", "bonus_stattype.name", "term_rarity.id"], //populate filters block //syntax is "relation": "term-pluralName" in schema.json // filters: { // "term_rarity.display_number": "term-rarities", // }, }; ### Strapi API Preview See how the data input for collection table looks like. export const url = `https://${naluId}.api.nalu.wiki/api/${collectionId}?${qs.stringify(listQueries?.queryString, {encodeValuesOnly: true})}` <a href={url}>{url}</a> ### ListConfig JSON Once happy with the data shape, copy the following to <a href={collectionEdit}>{collectionEdit}</a>: {JSON.stringify(listQueries )}
Loading. Please wait...
EntryConfig Generator
## EntryConfig Generator ### This code generates a Nalu Entry query for the Strapi rest API import qs from "https://esm.sh/qs"; export const naluId = "genshinimpact"; export const entryId = 2; export const entryQueries = { restEntryQueries: [ { id: "primary", collection: "characters", type: "single", queryString: { populate: { icon: { fields: ["url"], }, bonus_stattype: { populate: ["*"], }, side_icon: { fields: ["url"], }, image_full: { fields: ["url"], }, image_gacha: { fields: ["url"], }, term_weapontype: { populate: { icon: { fields: ["url"], }, }, }, term_rarity: { populate: { rarity_stars: { fields: ["url"], }, }, }, talent_burst: { populate: { icon: { fields: ["url"], }, talent_parameters: { populate: ["*"], }, level_up_cost: { populate: { material_qty: { populate: { item: { populate: { term_rarity: { fields: ["display_number"], }, icon: { fields: ["url"], }, }, }, }, }, }, }, }, }, talent_main: { populate: { talent: { populate: { icon: { fields: ["url"], }, talent_parameters: { populate: ["*"], }, level_up_cost: { populate: { material_qty: { populate: { item: { populate: { term_rarity: { fields: ["display_number"], }, icon: { fields: ["url"], }, }, }, }, }, }, }, }, }, }, }, talent_passive: { populate: { talent: { populate: { icon: { fields: ["url"], }, }, }, }, }, constellations: { populate: { icon: { fields: ["url"], }, }, }, costumes: { populate: { image_full: { fields: ["url"], }, }, }, prof_vision: { populate: { icon_vision: { fields: ["url"], }, }, }, voice_lines: { populate: { voice_en: { fields: ["url"], }, voice_jp: { fields: ["url"], }, voice_cn: { fields: ["url"], }, voice_kr: { fields: ["url"], }, }, }, ascension_reward: { populate: { material_qty: { populate: { item: { populate: { term_rarity: { fields: ["display_number"], }, icon: { fields: ["url"], }, }, }, }, }, }, }, ascension_cost: { populate: { material_qty: { populate: { item: { populate: { term_rarity: { fields: ["display_number"], }, icon: { fields: ["url"], }, }, }, }, }, }, }, specialty_recipes: { populate: { term_rarity: { fields: ["display_number"], }, result_items: { populate: { item: { populate: { icon: { fields: ["url"], }, }, }, }, }, }, }, }, }, }, { id: "stats", collection: "term-stattypes", type: "list", queryString: { populate: { icon: { fields: ["url"], }, }, }, }, ], }; export const restCollectionEntryData =( query, naluId, entryId ) => { const queryString = qs.stringify(query.queryString, { encodeValuesOnly: true, }); const requestUrl = `https://${naluId}.api.nalu.wiki/api/${ query.collection }${query.type == "single" ? "/" + entryId : ""}${ queryString ? "?" + queryString : "" }`; return requestUrl }; <ul>{entryQueries?.restEntryQueries.map((query, int) => <li><a className="capitalize" href={restCollectionEntryData(query, naluId, entryId)}>{`${query.id} ${query.collection} ${query.type} Query`}</a></li>)}</ul>
Loading. Please wait...
Add Section