DatoCMS REST API 参考文献
要浏览的公用事业 达多CMS 方案参考文件。 获取并淡化官方的超文本描述, 解析资源方案, 并让 Markdown 描述资源及其行动 .
安装
npm install @datocms/rest-api-reference
使用量
import {
fetchHyperschema,
parseResourcesSchema,
listResources,
describeResource,
describeResourceAction,
} from '@datocms/rest-api-reference';
// Fetch and dereference a hyperschema using a shorthand...
const hyperschema = await fetchHyperschema('cma');
// ...or the dashboard API
const dashboardSchema = await fetchHyperschema('dashboard');
// ...or a custom URL
const custom = await fetchHyperschema('https://example.com/schema.json');
// Parse a resources.json file (shipped with @datocms/cma-client)
const resourcesSchema = parseResourcesSchema(rawResourcesJson);
// List all available resources grouped by theme
const listing = listResources(hyperschema, resourcesSchema);
// Describe a specific resource and its available actions
const resource = describeResource(hyperschema, resourcesSchema, 'items');
// Describe a specific action with examples
const action = describeResourceAction(
hyperschema,
resourcesSchema,
'items',
'create',
);
扩展 <details> 块
describeResource 财务报告和审定财务报表 describeResourceAction 接受选项 expandDetails 参数 — 一组 <summary> 扩充文本。 提供时,仅匹配 <details> 块返回, 完全打开 :
const expanded = describeResourceAction(
hyperschema,
resourcesSchema,
'items',
'create',
['Example: Basic creation'],
);
下级公用事业
软件包还导出 finder 函数和一个 Markdown 构建器 :
import {
findHyperschemaEntity,
findHyperschemaLink,
findResourcesEntityByJsonApiType,
findResourcesEntityByNamespace,
findResourcesEndpointByRel,
render,
h1,
h2,
p,
ul,
li,
code,
} from '@datocms/rest-api-reference';
捐款
GitHub 上欢迎错误报告和拉取请求 https://github.com/datocms/js-rest-api-客户端 互联网档案馆的存檔,存档日期2013-12-11本项目旨在成为合作的安全和受欢迎的空间,预期捐助者将坚持 《促进者公约》 行为守则.
许可证
该软件包可按以下规定作为开源: MIT 许可证。 。 。 .