Skip to content

gi-nx


gi-nx / addContentPackToProject

ts
function addContentPackToProject(id: number): Promise<{
  contents: PackContents;
  mergeDecisions?: MergeDecisions;
}>;

Fetches the content pack specified by id and imports everything in it into the current project.

To bring in only part of a pack, read its contents with fetchPackContents and apply the pieces you want with the matching SDK function:

Pack contentsApply with
layersaddLayerToProject
usagescreateUsage
flowsaddFlow
blockscreateBlock
sectionsimportRawSections

Parameters ​

ParameterTypeDescription
idnumberThe file id of the pack to import, as returned by fetchContentPacks.

Returns ​

Promise<{ contents: PackContents; mergeDecisions?: MergeDecisions; }>

The fetched pack contents and the merge decisions that were applied (e.g. 'replace', 'ignore', 'keep both' for each conflict).

Needs Permission ​

Example ​

ts
const [pack] = await fetchContentPacks();
const { contents, mergeDecisions } = await addContentPackToProject(pack.id);
console.log(contents.sections, contents.layers);
console.log(mergeDecisions?.projectApp); // decisions for each feature category conflict