Replies: 8 comments 17 replies
-
DBAPI only handles time series and ratings so you might find using that for a template against all endpoints will shoehorn you into certain patterns. |
Beta Was this translation helpful? Give feedback.
-
I like it. Though I think a factory style would work better. Something like
could even have
That will make it easier to alter exactly which CDA instance is being targeted. I'll also 2nd what Adam said. I don't think a similar API is a bad idea, but it should be a layer in front of an API better suited to javascript. |
Beta Was this translation helpful? Give feedback.
-
Also that seems like the kind of thing to put in this repo. since it needs to stay up-to-date anyways. There are several OpenAPI to "client impl" libraries available so it'd mostly be the hec-cwms-data-access esque glue to keep up-to-date. |
Beta Was this translation helpful? Give feedback.
-
Using a Fluent API style for this would really make nice examples for users. That's something the DBAPI is lacking. |
Beta Was this translation helpful? Give feedback.
-
The Jython API for CDA that you were referring to is RADARAPI. Its just the time series and rating methods from DBAPI but backed by CDA instead of JDBC. I think your idea is different. |
Beta Was this translation helpful? Give feedback.
-
The RADARAPI write side of things is still being developed - I've been held back b/c I've had difficulties setting up the docker integration tests. Mainly its just calling the java cda client code from jython and translating objects |
Beta Was this translation helpful? Give feedback.
-
Just to update folks on where this is. Neilson created a repo here: I was able to generate TypeScript and JavaScript client libraries using a trimmed version of the Swagger Docs API. I need to do more testing with the library and have had issues importing it (something to do with modules / ES6). But it appears to be a solid route and would enable us to integrate it in the build automation for future updates of CDA. |
Beta Was this translation helpful? Give feedback.
-
When implementing the swagger doc into the openapi generator one issue I ran into was that we have the api path (/cwms-data) added to all the endpoints. This makes it very difficult to override this in the generated library for the end user. I propose we remove the I manually made this change to my It is also possible this is a limitation of the generator. Doing this would alter my #588 to change the servers to this Example client source after the change: import { OFFICE, HOURLY_INST } from "../js/constants.js";
import { Configuration, TimeSeriesApi } from "cwmsjs";
import { getDate } from "../js/utils"
const CONF = new Configuration({
basePath: "https://t7-hostname:tomcatport/district-data",
headers: { accept: "application/json;version=2" },
});
const TSA = new TimeSeriesApi(CONF);
TSA
.getCwmsDataTimeseries({
name: ts,
office: OFFICE,
begin: getDate(-5, `YYYY-MM-DDT${HOURLY_INST.time}:00Z`),
})
.then(
(data) => {
console.log("API called successfully. Returned data: ", data);
setTSValues(data?.values || []);
},
(error) => {
console.error(error);
}
); This also could be a knowledge issue on my part as the auto generated documentation also needs some help. (May end up writing it manually, On the docs, one option is to use mustache/templates. typescript-fetch generator docs |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
CWMS Data API Software Development Kit
Posting here to open discussion on the creation of a browser based software development kit for CDA
Ideally the software would be modeled after the existing DBAPI python api. This would give users of CWMS that already use DBAPI an advantage.
Some icebreakers:
fetch()
and/orXHR
are, what api version we are on, etcName Suggestions
Ideally it would be written with typescript, and could be used by both javascript and typescript projects.
Some examples would be:
Getting a catalog of locations
Fetching a specific timeseries ID for the last 24 hours
Other Notes: In theory this could work just fine with NodeJS for server side calls as well.
Beta Was this translation helpful? Give feedback.
All reactions