From 9b4de97167ed5c4add900cbeb951192ecef888b1 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 24 Feb 2022 23:10:38 +0100 Subject: [PATCH] Issue-#850: Rest api --- data/sidebars/references.yml | 4 +-- gatsby-node.js | 54 ++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/data/sidebars/references.yml b/data/sidebars/references.yml index 2bf0b143..f9bbbd18 100644 --- a/data/sidebars/references.yml +++ b/data/sidebars/references.yml @@ -11,12 +11,12 @@ - group: Aquarius REST API items: - title: API Reference - link: /references/aquarius-rest-api/ + link: /references/aquarius/ - group: provider REST API items: - title: API Reference - link: /references/provider-rest-api/ + link: /references/provider/ - group: Provider Py Module items: diff --git a/gatsby-node.js b/gatsby-node.js index 27110f7f..593d9ec3 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -133,6 +133,34 @@ exports.createPages = ({ graphql, actions }) => { } } } + + providerRestApi: allMarkdownRemark( + filter: { + frontmatter: { + title: { eq: "API.md" } + app: { eq: "aquarius" } + } + } + ) { + edges { + node { + id + html + htmlAst + tableOfContents + frontmatter { + title + description + slug + section + app + module + source + version + } + } + } + } } ` ).then(async (result) => { @@ -194,31 +222,21 @@ exports.createPages = ({ graphql, actions }) => { const oceanPyList = filterMarkdownList(markdowns, 'ocean.py') const providerList = filterMarkdownList(markdowns, 'provider') const subgraphList = filterMarkdownList(markdowns, 'ocean-subgraph') - // const aquariusList = filterMarkdownList(markdowns, 'aquarius') - const r = markdowns.map(({ node }) => [ - node.frontmatter.title, - node.frontmatter.app, - node.frontmatter.source, - node.frontmatter.version - ]) - console.log('Aquarius rest api', r) + const aquariusRestApi = result.data.aquariusRestApi.edges[0].node await createRestApiPage( createPage, aquariusRestApi, - `/references/aquarius-rest-api` + `/references/aquarius` ) - // const providerRestApi = getRestApiPageFromMarkdownList( - // markdowns, - // 'provider' - // )[0].node + const providerRestApi = result.data.providerRestApi.edges[0].node - // await createRestApiPage( - // createPage, - // providerRestApi, - // `/references/provider-rest-api` - // ) + await createRestApiPage( + createPage, + providerRestApi, + `/references/provider` + ) await createReadTheDocsPage(createPage, 'ocean-py', oceanPyList) await createReadTheDocsPage(createPage, 'provider', providerList)