Show both http and python api on pages
This commit is contained in:
parent
4071b81d5f
commit
7cce823bd1
4 changed files with 151 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -65,7 +65,8 @@ picamera_test_hashes.json
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
apidocs
|
apidocs/python
|
||||||
|
apidocs/http/*.json
|
||||||
|
|
||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
|
|
|
||||||
|
|
@ -180,11 +180,13 @@ build-docs:
|
||||||
- |
|
- |
|
||||||
pydoctor -W \
|
pydoctor -W \
|
||||||
--docformat restructuredtext \
|
--docformat restructuredtext \
|
||||||
|
--html-output apidocs/python \
|
||||||
--project-name "OpenFlexure Microscope Server" \
|
--project-name "OpenFlexure Microscope Server" \
|
||||||
--project-version $CI_COMMIT_REF_NAME \
|
--project-version $CI_COMMIT_REF_NAME \
|
||||||
--theme readthedocs \
|
--theme readthedocs \
|
||||||
--html-viewsource-base https://gitlab.com/openflexure/openflexure-microscope-server/-/tree/$CI_COMMIT_SHA/ \
|
--html-viewsource-base https://gitlab.com/openflexure/openflexure-microscope-server/-/tree/$CI_COMMIT_SHA/ \
|
||||||
src/openflexure_microscope_server
|
src/openflexure_microscope_server
|
||||||
|
- ./generate_http_api_data.py
|
||||||
- echo "JOB_ID=$CI_JOB_ID" > build-docs.env
|
- echo "JOB_ID=$CI_JOB_ID" > build-docs.env
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
|
||||||
87
apidocs/http/index.html
Normal file
87
apidocs/http/index.html
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>OpenFlexure Microscope HTTP API Docs</title>
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" />
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.intro {
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
max-width: 900px;
|
||||||
|
margin: 2.5rem auto 2rem;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
color: #2a2a2a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro h1 {
|
||||||
|
color: #c5247f;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro p {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro code {
|
||||||
|
background: #f5f5f5;
|
||||||
|
padding: 0.2rem 0.4rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro aside {
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
background: #f8f8f8;
|
||||||
|
border-left: 4px solid #c5247f;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#swagger-ui {
|
||||||
|
max-width: 1100px;
|
||||||
|
margin: 0 auto 3rem;
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="intro">
|
||||||
|
<h1>OpenFlexure Microscope HTTP API</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
These docs are provided for reference only. They cannot control a running microscope.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
For interactive documentation on a live microscope, visit:
|
||||||
|
<br>
|
||||||
|
<code>http://microscope.local:5000/docs</code>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<aside>
|
||||||
|
Replace <strong>microscope.local</strong> with your microscope's hostname or IP address
|
||||||
|
if your network uses a different name.
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
SwaggerUIBundle({
|
||||||
|
url: "./openapi.json",
|
||||||
|
dom_id: "#swagger-ui",
|
||||||
|
supportedSubmitMethods: [],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
apidocs/index.html
Normal file
60
apidocs/index.html
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>OpenFlexure Microscope Server API Docs</title>
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
background: #fff;
|
||||||
|
color: #2a2a2a;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
max-width: 700px;
|
||||||
|
margin: 4rem auto;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #c5247f;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
margin: 1rem 0;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 2px solid #c5247f;
|
||||||
|
color: #c5247f;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 6px;
|
||||||
|
width: fit-content;
|
||||||
|
transition: 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
background: #c5247f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h1>OpenFlexure Microscope Server API Docs</h1>
|
||||||
|
<p>Select documentation:</p>
|
||||||
|
|
||||||
|
<a href="./http">HTTP API (Swagger)</a>
|
||||||
|
<a href="./python">Python API</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue