Skip to content

Commit

Permalink
Add openapi-gen for DAG Details API
Browse files Browse the repository at this point in the history
  • Loading branch information
omkar-foss committed Oct 1, 2024
1 parent 11b6a7f commit 5e5fabc
Show file tree
Hide file tree
Showing 7 changed files with 632 additions and 0 deletions.
16 changes: 16 additions & 0 deletions airflow/ui/openapi-gen/queries/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ export const UseDagServiceGetDagsKeyFn = (
},
]),
];
export type DagServiceGetDagDetailsDefaultResponse = Awaited<
ReturnType<typeof DagService.getDagDetails>
>;
export type DagServiceGetDagDetailsQueryResult<
TData = DagServiceGetDagDetailsDefaultResponse,
TError = unknown,
> = UseQueryResult<TData, TError>;
export const useDagServiceGetDagDetailsKey = "DagServiceGetDagDetails";
export const UseDagServiceGetDagDetailsKeyFn = (
{
dagId,
}: {
dagId: string;
},
queryKey?: Array<unknown>,
) => [useDagServiceGetDagDetailsKey, ...(queryKey ?? [{ dagId }])];
export type DagServicePatchDagsMutationResult = Awaited<
ReturnType<typeof DagService.patchDags>
>;
Expand Down
20 changes: 20 additions & 0 deletions airflow/ui/openapi-gen/queries/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,23 @@ export const prefetchUseDagServiceGetDags = (
tags,
}),
});
/**
* Get Dag Details
* Get details of DAG.
* @param data The data for the request.
* @param data.dagId
* @returns DAGDetailsResponse Successful Response
* @throws ApiError
*/
export const prefetchUseDagServiceGetDagDetails = (
queryClient: QueryClient,
{
dagId,
}: {
dagId: string;
},
) =>
queryClient.prefetchQuery({
queryKey: Common.UseDagServiceGetDagDetailsKeyFn({ dagId }),
queryFn: () => DagService.getDagDetails({ dagId }),
});
26 changes: 26 additions & 0 deletions airflow/ui/openapi-gen/queries/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,32 @@ export const useDagServiceGetDags = <
}) as TData,
...options,
});
/**
* Get Dag Details
* Get details of DAG.
* @param data The data for the request.
* @param data.dagId
* @returns DAGDetailsResponse Successful Response
* @throws ApiError
*/
export const useDagServiceGetDagDetails = <
TData = Common.DagServiceGetDagDetailsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
{
dagId,
}: {
dagId: string;
},
queryKey?: TQueryKey,
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useQuery<TData, TError>({
queryKey: Common.UseDagServiceGetDagDetailsKeyFn({ dagId }, queryKey),
queryFn: () => DagService.getDagDetails({ dagId }) as TData,
...options,
});
/**
* Patch Dags
* Patch multiple DAGs.
Expand Down
26 changes: 26 additions & 0 deletions airflow/ui/openapi-gen/queries/suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,29 @@ export const useDagServiceGetDagsSuspense = <
}) as TData,
...options,
});
/**
* Get Dag Details
* Get details of DAG.
* @param data The data for the request.
* @param data.dagId
* @returns DAGDetailsResponse Successful Response
* @throws ApiError
*/
export const useDagServiceGetDagDetailsSuspense = <
TData = Common.DagServiceGetDagDetailsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
{
dagId,
}: {
dagId: string;
},
queryKey?: TQueryKey,
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useSuspenseQuery<TData, TError>({
queryKey: Common.UseDagServiceGetDagDetailsKeyFn({ dagId }, queryKey),
queryFn: () => DagService.getDagDetails({ dagId }) as TData,
...options,
});
Loading

0 comments on commit 5e5fabc

Please sign in to comment.