Adobe App 构建器模板库
这是用于 Adobe I/O CLI 和 SDKs 通信的辅助库 Adobe App 构建器模板注册 通过它的REST API.
安装
$ npm install @adobe/aio-lib-templates
使用量
搜索 Adobe 应用程序构建模板
搜索 Adobe App 构建器模板 Adobe App 构建器模板注册 并且通过结果而凝聚.
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init();
// an optional Search Criteria object
// without Search Criteria the following code will paginate through all Adobe App Builder templates
const searchCriteria = {
[sdk.SEARCH_CRITERIA_CATEGORIES]: ['action', sdk.SEARCH_CRITERIA_FILTER_NOT + 'ui', sdk.SEARCH_CRITERIA_FILTER_OR + 'runtime'],
[sdk.SEARCH_CRITERIA_STATUSES]: [sdk.TEMPLATE_STATUS_APPROVED],
[sdk.SEARCH_CRITERIA_ADOBE_RECOMMENDED]: true
};
// an optional OrderBy Criteria object
const orderByCriteria = {
[sdk.ORDER_BY_CRITERIA_NAMES]: sdk.ORDER_BY_CRITERIA_SORT_DESC
};
for await (const templates of templateRegistryClient.getTemplates(searchCriteria, orderByCriteria)) {
for (const template of templates) {
console.log(template);
}
}
}
支助 搜索标准 属性
| 密钥 | 数值 | SDK 常数 | 说明 |
|---|---|---|---|
names | 字符串列表 | (中文(简体) ) | 通过模板名称过滤 . |
categories | 字符串列表 | (原始内容存档于2013-10-12) (中文(简体) ) | 按模板类别过滤 . |
statuses | 字符串列表 | (原始内容存档于2017-10-21) (中文(简体) ) | 通过模板状态过滤(TEMPLATE STATUS IN VERIVIation,TEMPLATE STATUS APPROVED,TEMPLATE STATUS REJETED). |
apis | 字符串列表 | (原始内容存档于2017-10-21) (中文(简体) ) | 通过模板 API 过滤 。 支持EMPTY和任意过滤器. |
extensions | 字符串列表 | 研究 标准 延长 | 通过模板扩展点过滤 。 支持EMPTY和任意过滤器. |
events | 只有EMPTY和任何过滤器 | 搜索 标准 测试 | 通过模板事件过滤 。 现在只支持EMPTY和任何过滤器. |
runtime | 布尔 | 搜索 标准 运行 | 是否需要 Adobe I/O 运行时间 ? 支持EMPTY和任意过滤器. |
adobeRecommended | 布尔 | (原始内容存档于2017-10-21) (中文(简体) ) | 表示 Adobe 的模板 . |
过滤运算符
| 过滤类型 | 数值 | SDK 常数 | 说明 |
|---|---|---|---|
| (无) | '',一个空字符串 | (原始内容存档于2013-10-12). SEARCH CRITERIA FILTER NONE | 返回所有没有属性集的模板 . |
| 没有 | *,星号符号 | (原始内容存档于2017-10-21) (中文(中国大陆) ). SEARCH CRITIA FILLTER ANY | 返回所有拥有属性集的模板 . |
| 没有 | 一个感叹点符号 | (原始内容存档于2017-10-21) (中文(简体) ). SEARCH CRITERIA FILTER NOT | 不包括包含已取消的查询参数值的所有模板. |
| 或 | |,一个管子符号 | (原始内容存档于2013-10-12) (中文(简体) ). SEARCH CRITERIA FILLTER OR | 阵列过滤器, 例如: categories,默认返回所有匹配模板的相交点(AND)。 这个过滤操作员增加了为单个值指定逻辑"OR"的能力. |
支助 按标准排列 属性
| 密钥 | 数值 | SDK 常数 | 说明 |
|---|---|---|---|
names | 字符串、 desc 或 asc | 命令 BY 标准 名称 | 按模板名称排序 . |
statuses | 字符串、 desc 或 asc | 命令 BY 标准 统计 | 按模板状态排序 . |
adobeRecommended | 字符串、 desc 或 asc | 命令 BY 标准 ADOBE 建议 | 按"Adobe推荐"旗来排序. |
publishDate | 字符串、 desc 或 asc | 命令 BY 标准 日期 | 按出版日期排序. |
从 Adobe App 构建器模板注册处获取模板
获取模板从 Adobe App 构建器模板注册。 。 。 .
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init();
const templateName = '@author/app-builder-template';
try {
const template = await templateRegistryClient.getTemplate(templateName);
console.log(template);
} catch (error) {
console.log(error.toString());
}
}
向 Adobe App 构建器模板注册处添加新模板
添加新模板到 Adobe App 构建器模板注册。 。 。 .
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init({
'auth': {
'token': '<IMS_ACCESS_TOKEN>'
}
});
const templateName = '@author/app-builder-template';
const githubRepoUrl = 'https://github.com/author/app-builder-template';
try {
const template = await templateRegistryClient.addTemplate(templateName, githubRepoUrl);
console.log(`A new template "${template.name}" has been successfully added to Adobe App Builder Template Registry.`);
console.log(`Its status is "${sdk.TEMPLATE_STATUS_IN_VERIFICATION}". Please use the "${template.reviewLink}" link to check the verification status.`);
} catch (error) {
console.log(error.toString());
}
}
更新模板到 Adobe App 构建器模板注册
更新模板到 Adobe App 构建器模板注册。 。 。 .
注:仅凭IMS服务代号即可访问
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init({
'auth': {
'token': '<IMS_ACCESS_TOKEN>'
}
});
const templateId = '66431bb2f682a35bf4b1b002';
const githubRepoUrl = 'https://github.com/author/app-builder-template';
try {
const template = await templateRegistryClient.updateTemplate(templateId, githubRepoUrl);
console.log(`template with Id "${template.templateId}" has been successfully updated to Adobe App Builder Template Registry.`);
} catch (error) {
console.log(error.toString());
}
}
从 Adobe App 构建器模板注册处删除模板
删除模板 Adobe App 构建器模板注册。 。 。 .
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init({
'auth': {
'token': '<IMS_ACCESS_TOKEN>'
}
});
const templateName = '@author/app-builder-template';
try {
await templateRegistryClient.deleteTemplate(templateName);
console.log(`"${templateName}" has been successfully deleted from Adobe App Builder Template Registry.`);
} catch (error) {
console.log(error.toString());
}
}
安装模板
从开发者控制台安装模板
注:仅凭IMS服务代号即可访问
const sdk = require('@adobe/aio-lib-templates');
async function sdkTest() {
const templateRegistryClient = sdk.init({
'auth': {
'token': '<IMS_ACCESS_TOKEN>'
}
});
const templateId = '<valid templateId>';
const templateInstallRequestBody = {
orgId: '<valid orgId>',
projectName: '<projectName>',
description: '<description>',
metadata: {
domain : '<domain>',
defaultRedirectUri: '<defaultRedirectUri>'
},
apis: [
{
code: 'SDKCode',
credentialType: 'valid credentialType',
flowType: 'valid flowType',
licenseConfigs: [
{
id: 'valid id',
productId: 'valid productId',
op: 'valid op',
}
]
}
]
}
try {
await templateRegistryClient.installTemplate(templateId, templateInstallRequestBody);
console.log(`Template with id "${templateId}" has been successfully installed.`);
} catch (error) {
console.log(error.toString());
}
}
探索
goto API 密码
捐款
欢迎捐款! 读取 贡献指南 更多信息.
许可证发放
这个项目根据Apache V2许可证获得许可. 见 自由主义 更多信息.