From cc28c50c8489d41668a8e2f3ae85403c5f11dacd Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 14 Nov 2020 00:43:06 +0100 Subject: [PATCH] add provider reference --- content/references/introduction.md | 12 +++++----- data/repositories.yml | 3 +++ data/sidebars/references.yml | 5 +++++ gatsby-node.js | 36 ++++++++++++++---------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/content/references/introduction.md b/content/references/introduction.md index c2c2398e..12a1ecf0 100644 --- a/content/references/introduction.md +++ b/content/references/introduction.md @@ -1,19 +1,19 @@ --- title: API References -description: +description: --- This section has API reference docs (or links to external ones) for the following Ocean Protocol components and libraries: + + - - -The API references for Aquarius and Provider-py are auto-generated from the Swagger specs (JSON files) of the live instances. On this site you can't execute the documented API calls yet. If you need that, you can run a component's local Swagger UI as outlined in the repository instructions on GitHub. -Additionally, if you need API docs for a past version of Aquarius or Provider-py, check out their specs on SwaggerHub: +The API references for Aquarius and Provider are auto-generated from the Swagger specs (JSON files) of the live instances. On this site you can't execute the documented API calls yet. If you need that, you can run a component's local Swagger UI as outlined in the repository instructions on GitHub. +Additionally, if you need API docs for a past version of Aquarius or Provider, check out their specs on SwaggerHub: - [SwaggerHub: Aquarius](https://app.swaggerhub.com/apis/Ocean-Protocol/aquarius) -- [SwaggerHub: Provider-py](https://app.swaggerhub.com/apis/Ocean-Protocol/provider-py) +- [SwaggerHub: Provider](https://app.swaggerhub.com/apis/Ocean-Protocol/provider) diff --git a/data/repositories.yml b/data/repositories.yml index 5b3fbc25..c2abccd5 100644 --- a/data/repositories.yml +++ b/data/repositories.yml @@ -15,6 +15,9 @@ - name: API reference url: /references/aquarius/ - name: provider + links: + - name: API reference + url: /references/provider/ - group: Ocean Market items: diff --git a/data/sidebars/references.yml b/data/sidebars/references.yml index dfbd4be8..c596563b 100644 --- a/data/sidebars/references.yml +++ b/data/sidebars/references.yml @@ -13,6 +13,11 @@ - title: API Reference link: /references/aquarius/ +- group: provider + items: + - title: API Reference + link: /references/provider/ + - group: react items: - title: API Reference diff --git a/gatsby-node.js b/gatsby-node.js index d749f169..39e6e475 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -198,10 +198,10 @@ const createTypeDocPage = async (createPage, name, downloadUrl) => { // Create pages from swagger json files // // https://github.com/swagger-api/swagger-js -const fetchSwaggerSpec = async () => { +const fetchSwaggerSpec = async (component) => { try { const client = await Swagger( - `https://aquarius.mainnet.oceanprotocol.com/spec` + `https://${component}.mainnet.oceanprotocol.com/spec` ) return client.spec // The resolved spec @@ -219,27 +219,25 @@ const fetchSwaggerSpec = async () => { } const createSwaggerPages = async (createPage) => { - const swaggerComponents = ['aquarius'] + const swaggerComponents = ['aquarius', 'provider'] const apiSwaggerTemplate = path.resolve('./src/templates/Swagger/index.jsx') - const getSlug = (name) => { - const slug = `/references/${name}/` - return slug + const getSlug = (name) => `/references/${name}/` + + for (const component of swaggerComponents) { + const slug = getSlug(component) + + createPage({ + path: slug, + component: apiSwaggerTemplate, + context: { + slug, + name: component, + api: await fetchSwaggerSpec(component) + } + }) } - const specAquarius = await fetchSwaggerSpec(swaggerComponents[0]) - const slugAquarius = getSlug(swaggerComponents[0]) - - createPage({ - path: slugAquarius, - component: apiSwaggerTemplate, - context: { - slug: slugAquarius, - name: swaggerComponents[0], - api: specAquarius - } - }) - // Swagger Pet Store example const petStoreSlug = '/references/petstore/'