Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first wack at openapi tools #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const post = async <S extends z.Schema>(
...(auth && { Authorization: `Bearer ${auth}` }),
},
body: JSON.stringify(input),
}).catch(console.warn);
});//.catch(console.warn);
console.log(res.json());
if (!res?.ok) throw res;
return schema.parse(await res.json());
};
Expand Down
19 changes: 18 additions & 1 deletion components/QueryForm/QueryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ import "ag-grid-community/styles/ag-theme-quartz.css"; // Theme

import styles from "./QueryForm.module.scss";

import { ApiV1QueryInstallsListRequest, Configuration, LegacyQueryFormApi, PaginatedQueryFormList } from "@/src/generated-sources/openapi";

async function chom() {
const configuration = new Configuration({
basePath: "http://127.0.0.1:8000"
});

const api = new LegacyQueryFormApi(configuration);

const queryResponse: Promise<PaginatedQueryFormList> = api.apiV1QueryInstallsList({
password: "localdev",
networkNumber: 713,
});
console.log(await queryResponse);
}

chom();

export function QueryForm() {
const [isLoading, setIsLoading] = useState(false);
const [tableVisible, setTableVisible] = useState(true);
Expand Down Expand Up @@ -73,7 +91,6 @@ export function QueryForm() {
route = "installs";
break;
}
console.log(queryForm);
let resp = await submitQueryForm(
route,
queryForm.query_type,
Expand Down
7 changes: 7 additions & 0 deletions openapitools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.8.0"
}
}
Loading
Loading