enonic-api-reference
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEnonic XP Server-Side API Reference
Enonic XP 服务端API参考
Procedures
操作流程
Step 1: Identify the Target Library
-
Determine whichlibrary the query relates to.
/lib/xp/* -
Map the library to the appropriate reference file:
Library Reference File lib-content references/lib-content-reference.mdlib-node references/lib-node-reference.mdlib-auth references/lib-auth-reference.mdlib-portal references/lib-portal-reference.mdlib-context, lib-event, lib-task references/lib-context-reference.mdlib-io, lib-mail, lib-repo, lib-schema references/lib-utilities-reference.md -
If the query spans multiple libraries or asks for a usage pattern, read.
references/examples.md
Step 2: Look Up the Function
- Read the identified reference file.
- Locate the specific function by name.
- Extract the following details:
- Signature: Function name and import path.
- Parameters: Name, type, required/optional, default value, description.
- Return type: Type and shape of the returned value.
- Example: Code snippet demonstrating correct usage.
Step 3: Provide the Answer
- Present the function signature with its import statement.
- Include the parameter table with types and descriptions.
- Include the return type and shape.
- Add a usage example. If the reference file includes one, use it. Otherwise, compose a minimal working example consistent with the documented signature.
- Note any version requirements (e.g., "Requires XP 7.8.0+").
Step 4: Handle Cross-Library Patterns
- If the query involves combining multiple libraries (e.g., "create content as admin"), read for established patterns.
references/examples.md - If a pattern is not documented, compose it by combining individual function signatures from the relevant reference files.
Step 5: Troubleshoot Common Issues
- If the query describes an error or unexpected behavior, read .
references/troubleshooting.md - Match the error message or symptom to a known issue.
- Provide the documented fix and any version-compatibility notes.
Step 6: Generate Import Blocks
- If the user needs a reusable import block, read .
assets/enonic-imports.template.ts - Uncomment only the libraries required for the user's controller.
步骤1:确定目标库
-
明确查询涉及的库是哪一个。
/lib/xp/* -
将库映射到对应的参考文件:
库 参考文件 lib-content references/lib-content-reference.mdlib-node references/lib-node-reference.mdlib-auth references/lib-auth-reference.mdlib-portal references/lib-portal-reference.mdlib-context, lib-event, lib-task references/lib-context-reference.mdlib-io, lib-mail, lib-repo, lib-schema references/lib-utilities-reference.md -
如果查询涉及多个库或者询问使用模式,请阅读。
references/examples.md
步骤2:查找对应函数
- 打开确定好的参考文件。
- 通过名称定位到具体函数。
- 提取以下详细信息:
- 签名: 函数名称与导入路径。
- 参数: 名称、类型、必填/可选、默认值、描述。
- 返回类型: 返回值的类型与结构。
- 示例: 演示正确用法的代码片段。
步骤3:给出解答
- 展示函数签名及其导入语句。
- 附上包含参数类型与描述的参数表格。
- 说明返回类型与结构。
- 添加使用示例。如果参考文件中有示例直接使用,否则根据文档记录的签名编写一个最小可运行示例。
- 标注任何版本要求(例如:"Requires XP 7.8.0+")。
步骤4:处理跨库使用模式
- 如果查询涉及多个库的组合使用(例如:"create content as admin"),请阅读查看已有的成熟模式。
references/examples.md - 如果没有对应的模式记录,可以结合相关参考文件中的单个函数签名自行编写。
步骤5:常见问题排查
- 如果查询描述了错误或不符合预期的行为,请阅读。
references/troubleshooting.md - 将错误信息或症状匹配到已知问题。
- 提供文档记录的修复方案以及所有版本兼容性说明。
步骤6:生成导入块
- 如果用户需要可复用的导入块,请阅读。
assets/enonic-imports.template.ts - 仅取消注释用户控制器所需的库对应的行。
Error Handling
错误处理
- If a function is not found in any reference file, report that it may belong to a community library or a newer XP version not yet documented, and suggest checking https://developer.enonic.com/docs/xp/stable/api.
- If the query relates to Guillotine/GraphQL, content type schemas, or Enonic CLI, indicate that this skill does not cover those topics.
- If a version mismatch is suspected, consult the version compatibility table in .
references/troubleshooting.md
- 如果在任何参考文件中都找不到对应函数,请说明它可能属于社区库或者尚未被文档覆盖的更新XP版本,建议查看https://developer.enonic.com/docs/xp/stable/api。
- 如果查询涉及Guillotine/GraphQL、内容类型schema或Enonic CLI,请说明本技能不涵盖这些主题。
- 如果怀疑存在版本不匹配问题,请查阅中的版本兼容性表格。
references/troubleshooting.md