1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Merge pull request #902 from oceanprotocol/issue-850-aquarius-rest-api

Issue 850 aquarius rest api
This commit is contained in:
Alex Coseru 2022-03-02 11:31:59 +02:00 committed by GitHub
commit b89242af83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 173 additions and 32 deletions

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ yarn-error.log
.env.*
markdowns/
.vscode/
size-plugin.json
size-plugin.json
read-the-docs/

View File

@ -92,7 +92,7 @@ module.exports = {
swaggerComponents: [
{
name: 'aquarius',
url: 'https://aquarius.oceanprotocol.com/spec'
url: 'https://v4.aquarius.oceanprotocol.com/spec'
},
{
name: 'provider',

View File

@ -42,7 +42,7 @@ To do so, create a Dockerfile with the appropriate instructions for dependency m
We also collect some [example images](https://github.com/oceanprotocol/algo_dockers) which you can also view in Dockerhub.
When publishing an algorithm through the [Ocean Market](https://market.oceanprotoco.com), these properties can be set via the publish UI.
When publishing an algorithm through the [Ocean Market](https://market.oceanprotocol.com), these properties can be set via the publish UI.
### Environment Examples

View File

@ -155,19 +155,19 @@ module.exports = {
options: {
name: 'repo-read-the-docs',
remote: `https://github.com/oceanprotocol/readthedocs.git`,
local: 'markdowns/',
branch: 'main',
local: 'read-the-docs',
branch: 'v4',
patterns: [
'markdowns/ocean-py',
'markdowns/aquarius',
'markdowns/provider'
'read-the-docs/ocean-py',
'read-the-docs/aquarius',
'read-the-docs/provider'
]
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/markdowns/markdowns`,
path: `${__dirname}/read-the-docs/markdowns`,
name: 'markdowns'
}
},

View File

@ -59,7 +59,9 @@ exports.createPages = ({ graphql, actions }) => {
}
allRepoMarkdown: allMarkdownRemark(
filter: { fileAbsolutePath: { regex: "/markdowns/markdowns/" } }
filter: {
fileAbsolutePath: { regex: "/read-the-docs/markdowns/" }
}
) {
edges {
node {
@ -103,6 +105,62 @@ exports.createPages = ({ graphql, actions }) => {
}
}
}
aquariusRestApi: 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
}
}
}
}
providerRestApi: allMarkdownRemark(
filter: {
frontmatter: {
title: { eq: "API.md" }
app: { eq: "provider" }
}
}
) {
edges {
node {
id
html
htmlAst
tableOfContents
frontmatter {
title
description
slug
section
app
module
source
version
}
}
}
}
}
`
).then(async (result) => {
@ -165,6 +223,21 @@ exports.createPages = ({ graphql, actions }) => {
const providerList = filterMarkdownList(markdowns, 'provider')
const subgraphList = filterMarkdownList(markdowns, 'ocean-subgraph')
const aquariusRestApi = result.data.aquariusRestApi.edges[0].node
await createRestApiPage(
createPage,
aquariusRestApi,
`/references/aquarius`
)
const providerRestApi = result.data.providerRestApi.edges[0].node
await createRestApiPage(
createPage,
providerRestApi,
`/references/provider`
)
await createReadTheDocsPage(createPage, 'ocean-py', oceanPyList)
await createReadTheDocsPage(createPage, 'provider', providerList)
await createReadTheDocsPage(createPage, 'ocean-subgraph', subgraphList)
@ -292,3 +365,22 @@ const createReadTheDocsPage = async (createPage, name, list) => {
const filterMarkdownList = (markdownList, string) => {
return markdownList.filter(({ node }) => node.frontmatter.app === string)
}
const createRestApiPage = async (createPage, node, slug) => {
const template = path.resolve('./src/templates/RestApi.jsx')
createPage({
path: slug,
component: template,
context: {
node,
slug
}
})
}
// const getRestApiPageFromMarkdownList = (markdownList, string) => {
// return markdownList.filter(
// ({ node }) =>
// node.frontmatter.app === string && node.frontmatter.slug === 'API.md'
// )
// }

View File

@ -10,7 +10,7 @@
"ssr": "npm run build && serve -s public/",
"format": "prettier --ignore-path .gitignore './**/*.{css,scss,yml,js,jsx,ts,tsx,json}' --write",
"lint:js": "eslint --ignore-path .gitignore --ignore-path .prettierignore --ext .js,.jsx .",
"lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,external,public,.cache,markdowns}/**/*'",
"lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,external,public,.cache,markdowns,read-the-docs}/**/*'",
"lint:yml": "prettier '**/*.{yml,yaml}' --list-different",
"lint": "run-p --continue-on-error lint:js lint:md lint:yml",
"test": "npm run lint"

View File

@ -48,5 +48,5 @@
}
.searchButtonContainer {
margin-top: $spacer * 0.5 ;
margin-top: $spacer * 0.5;
}

View File

@ -68,4 +68,4 @@ $narrowWidth: 35rem;
$box-shadow-color: rgba(0, 0, 0, 0.2);
$border-color: #e2e2e2;
$background-content: #fff;
$background-content: #fff;

View File

@ -1,23 +1,23 @@
@import 'variables';
.box {
display: block;
background: $background-content;
border-radius: $border-radius;
border: 1px solid $border-color;
box-shadow: 0 6px 17px 0 $box-shadow-color;
padding: $spacer * 0.5;
}
@media (min-width: 40rem) {
.box {
padding: var($spacer);
}
}
a.box:hover,
a.box:focus {
outline: 0;
transform: translate3d(0, -0.1rem, 0);
box-shadow: 0 10px 25px 0 $box-shadow-color;
display: block;
background: $background-content;
border-radius: $border-radius;
border: 1px solid $border-color;
box-shadow: 0 6px 17px 0 $box-shadow-color;
padding: $spacer * 0.5;
}
@media (min-width: 40rem) {
.box {
padding: var($spacer);
}
}
a.box:hover,
a.box:focus {
outline: 0;
transform: translate3d(0, -0.1rem, 0);
box-shadow: 0 10px 25px 0 $box-shadow-color;
}

48
src/templates/RestApi.jsx Normal file
View File

@ -0,0 +1,48 @@
import React from 'react'
import { Helmet } from 'react-helmet'
import Layout from '../components/Layout'
import Content from '../components/Content'
import HeaderSection from '../components/HeaderSection'
import Sidebar from '../components/Sidebar'
import stylesDoc from '../templates/Doc.module.scss'
import Seo from '../components/Seo'
import DocContent from '../components/DocContent'
import PropTypes from 'prop-types'
export default function RestApiDoc({ location, pageContext }) {
const { node, slug } = pageContext
return (
<>
<Helmet>
<body className="references" />
</Helmet>
<Seo
title="Rest api documentation"
description=""
slug={slug}
article
location={location}
/>
<Layout location={location}>
<HeaderSection title="Rest Api documentation" />
<Content>
<main className={stylesDoc.wrapper}>
<aside className={stylesDoc.sidebar}>
<Sidebar location={location} sidebar="references" collapsed />
</aside>
<article className={stylesDoc.main}>
<DocContent html={node.html} htmlAst={node.htmlAst} />
</article>
</main>
</Content>
</Layout>
</>
)
}
RestApiDoc.propTypes = {
location: PropTypes.object.isRequired,
pageContext: PropTypes.object.isRequired
}