Skip to content

Commit 552db0e

Browse files
authored
Dedicated User Documentation (#1095)
# Dedicated CDA Documentation ## Notes * Uses Read the Docs * ReStructured Text ## Plan Provides additional information that can be cross referenced through swagger pages and other places for users to read more on a topic. Decided the Wiki GitHub pages were not extensible enough. Will potentially migrate some of the wiki topics into this. *Drafting for now to provide awareness but also solicit help more*
1 parent afaf4c1 commit 552db0e

21 files changed

Lines changed: 446 additions & 0 deletions

.readthedocs.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
# Required
4+
version: 2
5+
# Set the OS, Python version, and other tools you might need
6+
build:
7+
os: ubuntu-24.04
8+
tools:
9+
python: "3.13"
10+
# Build documentation in the "docs/" directory with Sphinx
11+
sphinx:
12+
configuration: docs/conf.py
13+
# Optionally, but recommended,
14+
# declare the Python requirements required to build your documentation
15+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
16+
python:
17+
install:
18+
- requirements: docs/requirements.txt
19+
20+
21+
formats:
22+
- pdf
23+
- epub
24+
25+

cwms-data-api/src/main/webapp/templates/HEC.header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ul class="top-level-menu">
1717
<li><a href="./swagger-docs">Swagger Docs</a></li>
1818
<li><a href="./swagger-ui.html">Swagger UI</a></li>
19+
<li id="sphinx-docs" />
1920
</ul>
2021
</div>
2122
<div id="mobile-menu">

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx
2+
sphinx_rtd_theme

docs/source/conf.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
3+
# -- Project information
4+
5+
project = "CWMS Data API"
6+
copyright = "Public Domain"
7+
author = "HEC, Various"
8+
9+
# TODO: Sort this out later, what version? Does this get used?
10+
release = "0.0"
11+
version = "0.0.0"
12+
13+
# -- General configuration
14+
15+
# TODO: sphinxjs? direct use of API in the docs?
16+
extensions = [
17+
"sphinx.ext.duration",
18+
"sphinx.ext.doctest",
19+
"sphinx.ext.autodoc",
20+
"sphinx.ext.autosummary",
21+
"sphinx.ext.intersphinx",
22+
]
23+
24+
intersphinx_mapping = {
25+
"python": ("https://docs.python.org/3/", None),
26+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
27+
}
28+
intersphinx_disabled_domains = ["std"]
29+
30+
templates_path = ["_templates"]
31+
32+
# -- Options for HTML output
33+
34+
html_theme = "sphinx_rtd_theme"
35+
36+
# -- Options for EPUB output
37+
epub_show_urls = "footnote"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
###############
2+
Location Levels
3+
###############
4+

docs/source/data/timeseries.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
##########
2+
TimeSeries
3+
##########

docs/source/datatypes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#########
2+
Datatypes
3+
#########
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#############
2+
Authorization
3+
#############
4+
5+
6+
This document provides an overview of the `Authorization API` endpoints used for managing `CWMS Data API` authentication keys.
7+
8+
Endpoints
9+
---------
10+
11+
*Authentication is required to access these endpoints*
12+
13+
14+
* GET `/cwms-data/auth/keys/{key-name}` : Retrieve `CDA` authentication keys by a specific `name`.
15+
16+
17+
18+
**Request**
19+
-
20+
**Response**
21+
- **Status**: 200 OK
22+
- **Body**: Returns the details of the specified authentication key.
23+
24+
#### Retrieve a Key
25+
26+
27+
The following table provides an overview of the available endpoints in the Authorization API:
28+
29+
+--------------------------------------------+---------------------------------------------+-----------------------------------+
30+
| **Endpoint** | **Description** | **Details** |
31+
+============================================+=============================================+===================================+
32+
| `GET /cwms-data/auth/keys/{key-name}` | Retrieve a specific auth key by `keyName`. | Returns key details in JSON. |
33+
+--------------------------------------------+---------------------------------------------+-----------------------------------+
34+
| `DELETE /cwms-data/auth/keys/{key-name}` | Delete a specific auth key by `keyName`. | Returns `204 No Content` status. |
35+
+--------------------------------------------+---------------------------------------------+-----------------------------------+
36+
| `GET /cwms-data/auth/keys` | Retrieve all available auth keys. | Returns list of keys in JSON. |
37+
+--------------------------------------------+---------------------------------------------+-----------------------------------+
38+
| `POST /cwms-data/auth/keys` | Create or update an auth key. | Returns created/updated key. |
39+
+--------------------------------------------+---------------------------------------------+-----------------------------------+
40+
41+
========== ================================= ========================================== ===========
42+
**Method** **Endpoint** **Description** **Details**
43+
========== ================================= ========================================== ===========
44+
`GET` `/cwms-data/auth/keys/{key-name}` Retrieve a specific auth key by `keyName`.
45+
`DELETE` `/cwms-data/auth/keys/{key-name}` Delete a specific auth key by `keyName`.
46+
`GET` `/cwms-data/auth/keys` Retrieve all available auth keys.
47+
`POST` `/cwms-data/auth/keys` Create or update an auth key.
48+
========== ================================= ========================================== ===========
49+
50+
Notes
51+
-----
52+
- Replace `{key-name}` with the name of the key you are targeting.
53+
- Ensure authentication headers are included if required.

0 commit comments

Comments
 (0)