Files
mission-control/frontend/src/api/generated/gateway/gateway.ts

1417 lines
41 KiB
TypeScript

/**
* Generated by orval v8.2.0 🍺
* Do not edit manually.
* Mission Control API
* OpenAPI spec version: 0.1.0
*/
import { useMutation, useQuery } from "@tanstack/react-query";
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult,
} from "@tanstack/react-query";
import type {
GatewayCommandsApiV1GatewayCommandsGet200,
GatewayStatusApiV1GatewayStatusGet200,
GatewayStatusApiV1GatewayStatusGetParams,
GetGatewaySessionApiV1GatewaySessionsSessionIdGet200,
GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200,
GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
HTTPValidationError,
ListSessionsApiV1GatewaySessionsGet200,
ListSessionsApiV1GatewaySessionsGetParams,
SendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200,
SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody,
SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams,
} from ".././model";
import { customFetch } from "../../mutator";
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* @summary Gateway Status
*/
export type gatewayStatusApiV1GatewayStatusGetResponse200 = {
data: GatewayStatusApiV1GatewayStatusGet200;
status: 200;
};
export type gatewayStatusApiV1GatewayStatusGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type gatewayStatusApiV1GatewayStatusGetResponseSuccess =
gatewayStatusApiV1GatewayStatusGetResponse200 & {
headers: Headers;
};
export type gatewayStatusApiV1GatewayStatusGetResponseError =
gatewayStatusApiV1GatewayStatusGetResponse422 & {
headers: Headers;
};
export type gatewayStatusApiV1GatewayStatusGetResponse =
| gatewayStatusApiV1GatewayStatusGetResponseSuccess
| gatewayStatusApiV1GatewayStatusGetResponseError;
export const getGatewayStatusApiV1GatewayStatusGetUrl = (
params?: GatewayStatusApiV1GatewayStatusGetParams,
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? "null" : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/api/v1/gateways/status?${stringifiedParams}`
: `/api/v1/gateways/status`;
};
export const gatewayStatusApiV1GatewayStatusGet = async (
params?: GatewayStatusApiV1GatewayStatusGetParams,
options?: RequestInit,
): Promise<gatewayStatusApiV1GatewayStatusGetResponse> => {
return customFetch<gatewayStatusApiV1GatewayStatusGetResponse>(
getGatewayStatusApiV1GatewayStatusGetUrl(params),
{
...options,
method: "GET",
},
);
};
export const getGatewayStatusApiV1GatewayStatusGetQueryKey = (
params?: GatewayStatusApiV1GatewayStatusGetParams,
) => {
return [`/api/v1/gateways/status`, ...(params ? [params] : [])] as const;
};
export const getGatewayStatusApiV1GatewayStatusGetQueryOptions = <
TData = Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError = HTTPValidationError,
>(
params?: GatewayStatusApiV1GatewayStatusGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getGatewayStatusApiV1GatewayStatusGetQueryKey(params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>
> = ({ signal }) =>
gatewayStatusApiV1GatewayStatusGet(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type GatewayStatusApiV1GatewayStatusGetQueryResult = NonNullable<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>
>;
export type GatewayStatusApiV1GatewayStatusGetQueryError = HTTPValidationError;
export function useGatewayStatusApiV1GatewayStatusGet<
TData = Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError = HTTPValidationError,
>(
params: undefined | GatewayStatusApiV1GatewayStatusGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGatewayStatusApiV1GatewayStatusGet<
TData = Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError = HTTPValidationError,
>(
params?: GatewayStatusApiV1GatewayStatusGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGatewayStatusApiV1GatewayStatusGet<
TData = Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError = HTTPValidationError,
>(
params?: GatewayStatusApiV1GatewayStatusGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Gateway Status
*/
export function useGatewayStatusApiV1GatewayStatusGet<
TData = Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError = HTTPValidationError,
>(
params?: GatewayStatusApiV1GatewayStatusGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayStatusApiV1GatewayStatusGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions = getGatewayStatusApiV1GatewayStatusGetQueryOptions(
params,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary List Sessions
*/
export type listSessionsApiV1GatewaySessionsGetResponse200 = {
data: ListSessionsApiV1GatewaySessionsGet200;
status: 200;
};
export type listSessionsApiV1GatewaySessionsGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type listSessionsApiV1GatewaySessionsGetResponseSuccess =
listSessionsApiV1GatewaySessionsGetResponse200 & {
headers: Headers;
};
export type listSessionsApiV1GatewaySessionsGetResponseError =
listSessionsApiV1GatewaySessionsGetResponse422 & {
headers: Headers;
};
export type listSessionsApiV1GatewaySessionsGetResponse =
| listSessionsApiV1GatewaySessionsGetResponseSuccess
| listSessionsApiV1GatewaySessionsGetResponseError;
export const getListSessionsApiV1GatewaySessionsGetUrl = (
params?: ListSessionsApiV1GatewaySessionsGetParams,
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? "null" : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/api/v1/gateways/sessions?${stringifiedParams}`
: `/api/v1/gateways/sessions`;
};
export const listSessionsApiV1GatewaySessionsGet = async (
params?: ListSessionsApiV1GatewaySessionsGetParams,
options?: RequestInit,
): Promise<listSessionsApiV1GatewaySessionsGetResponse> => {
return customFetch<listSessionsApiV1GatewaySessionsGetResponse>(
getListSessionsApiV1GatewaySessionsGetUrl(params),
{
...options,
method: "GET",
},
);
};
export const getListSessionsApiV1GatewaySessionsGetQueryKey = (
params?: ListSessionsApiV1GatewaySessionsGetParams,
) => {
return [`/api/v1/gateways/sessions`, ...(params ? [params] : [])] as const;
};
export const getListSessionsApiV1GatewaySessionsGetQueryOptions = <
TData = Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError = HTTPValidationError,
>(
params?: ListSessionsApiV1GatewaySessionsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getListSessionsApiV1GatewaySessionsGetQueryKey(params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>
> = ({ signal }) =>
listSessionsApiV1GatewaySessionsGet(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type ListSessionsApiV1GatewaySessionsGetQueryResult = NonNullable<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>
>;
export type ListSessionsApiV1GatewaySessionsGetQueryError = HTTPValidationError;
export function useListSessionsApiV1GatewaySessionsGet<
TData = Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError = HTTPValidationError,
>(
params: undefined | ListSessionsApiV1GatewaySessionsGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListSessionsApiV1GatewaySessionsGet<
TData = Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError = HTTPValidationError,
>(
params?: ListSessionsApiV1GatewaySessionsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListSessionsApiV1GatewaySessionsGet<
TData = Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError = HTTPValidationError,
>(
params?: ListSessionsApiV1GatewaySessionsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary List Sessions
*/
export function useListSessionsApiV1GatewaySessionsGet<
TData = Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError = HTTPValidationError,
>(
params?: ListSessionsApiV1GatewaySessionsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listSessionsApiV1GatewaySessionsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions = getListSessionsApiV1GatewaySessionsGetQueryOptions(
params,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Get Gateway Session
*/
export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse200 = {
data: GetGatewaySessionApiV1GatewaySessionsSessionIdGet200;
status: 200;
};
export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseSuccess =
getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse200 & {
headers: Headers;
};
export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseError =
getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse422 & {
headers: Headers;
};
export type getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse =
| getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseSuccess
| getGatewaySessionApiV1GatewaySessionsSessionIdGetResponseError;
export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetUrl = (
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? "null" : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/api/v1/gateways/sessions/${sessionId}?${stringifiedParams}`
: `/api/v1/gateways/sessions/${sessionId}`;
};
export const getGatewaySessionApiV1GatewaySessionsSessionIdGet = async (
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options?: RequestInit,
): Promise<getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse> => {
return customFetch<getGatewaySessionApiV1GatewaySessionsSessionIdGetResponse>(
getGetGatewaySessionApiV1GatewaySessionsSessionIdGetUrl(sessionId, params),
{
...options,
method: "GET",
},
);
};
export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryKey = (
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
) => {
return [
`/api/v1/gateways/sessions/${sessionId}`,
...(params ? [params] : []),
] as const;
};
export const getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryOptions =
<
TData = Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryKey(
sessionId,
params,
);
const queryFn: QueryFunction<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>
> = ({ signal }) =>
getGatewaySessionApiV1GatewaySessionsSessionIdGet(sessionId, params, {
signal,
...requestOptions,
});
return {
queryKey,
queryFn,
enabled: !!sessionId,
...queryOptions,
} as UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type GetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryResult =
NonNullable<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>
>;
export type GetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryError =
HTTPValidationError;
export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet<
TData = Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params: undefined | GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet<
TData = Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet<
TData = Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Get Gateway Session
*/
export function useGetGatewaySessionApiV1GatewaySessionsSessionIdGet<
TData = Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetGatewaySessionApiV1GatewaySessionsSessionIdGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<typeof getGatewaySessionApiV1GatewaySessionsSessionIdGet>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions =
getGetGatewaySessionApiV1GatewaySessionsSessionIdGetQueryOptions(
sessionId,
params,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Get Session History
*/
export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse200 =
{
data: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200;
status: 200;
};
export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse422 =
{
data: HTTPValidationError;
status: 422;
};
export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseSuccess =
getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse200 & {
headers: Headers;
};
export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseError =
getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse422 & {
headers: Headers;
};
export type getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse =
| getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseSuccess
| getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponseError;
export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetUrl = (
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? "null" : value.toString());
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/api/v1/gateways/sessions/${sessionId}/history?${stringifiedParams}`
: `/api/v1/gateways/sessions/${sessionId}/history`;
};
export const getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet = async (
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options?: RequestInit,
): Promise<getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse> => {
return customFetch<getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetResponse>(
getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetUrl(
sessionId,
params,
),
{
...options,
method: "GET",
},
);
};
export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryKey =
(
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
) => {
return [
`/api/v1/gateways/sessions/${sessionId}/history`,
...(params ? [params] : []),
] as const;
};
export const getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryOptions =
<
TData = Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryKey(
sessionId,
params,
);
const queryFn: QueryFunction<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>
> = ({ signal }) =>
getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet(
sessionId,
params,
{ signal, ...requestOptions },
);
return {
queryKey,
queryFn,
enabled: !!sessionId,
...queryOptions,
} as UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryResult =
NonNullable<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>
>;
export type GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryError =
HTTPValidationError;
export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet<
TData = Awaited<
ReturnType<typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params:
| undefined
| GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet<
TData = Awaited<
ReturnType<typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet<
TData = Awaited<
ReturnType<typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Get Session History
*/
export function useGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet<
TData = Awaited<
ReturnType<typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet>
>,
TError = HTTPValidationError,
>(
sessionId: string,
params?: GetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<
ReturnType<
typeof getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet
>
>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions =
getGetSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetQueryOptions(
sessionId,
params,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Send Session Message
*/
export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse200 =
{
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200;
status: 200;
};
export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse422 =
{
data: HTTPValidationError;
status: 422;
};
export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseSuccess =
sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse200 & {
headers: Headers;
};
export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseError =
sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse422 & {
headers: Headers;
};
export type sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse =
| sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseSuccess
| sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponseError;
export const getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostUrl =
(
sessionId: string,
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams,
) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(
key,
value === null ? "null" : value.toString(),
);
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0
? `/api/v1/gateways/sessions/${sessionId}/message?${stringifiedParams}`
: `/api/v1/gateways/sessions/${sessionId}/message`;
};
export const sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost =
async (
sessionId: string,
sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody,
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams,
options?: RequestInit,
): Promise<sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse> => {
return customFetch<sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostResponse>(
getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostUrl(
sessionId,
params,
),
{
...options,
method: "POST",
headers: { "Content-Type": "application/json", ...options?.headers },
body: JSON.stringify(
sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody,
),
},
);
};
export const getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationOptions =
<TError = HTTPValidationError, TContext = unknown>(options?: {
mutation?: UseMutationOptions<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>,
TError,
{
sessionId: string;
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams;
},
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>,
TError,
{
sessionId: string;
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams;
},
TContext
> => {
const mutationKey = [
"sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost",
];
const { mutation: mutationOptions, request: requestOptions } = options
? options.mutation &&
"mutationKey" in options.mutation &&
options.mutation.mutationKey
? options
: { ...options, mutation: { ...options.mutation, mutationKey } }
: { mutation: { mutationKey }, request: undefined };
const mutationFn: MutationFunction<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>,
{
sessionId: string;
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams;
}
> = (props) => {
const { sessionId, data, params } = props ?? {};
return sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost(
sessionId,
data,
params,
requestOptions,
);
};
return { mutationFn, ...mutationOptions };
};
export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationResult =
NonNullable<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>
>;
export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationBody =
SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
export type SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationError =
HTTPValidationError;
/**
* @summary Send Session Message
*/
export const useSendSessionMessageApiV1GatewaySessionsSessionIdMessagePost = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>,
TError,
{
sessionId: string;
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams;
},
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<
ReturnType<
typeof sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost
>
>,
TError,
{
sessionId: string;
data: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody;
params?: SendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams;
},
TContext
> => {
return useMutation(
getSendSessionMessageApiV1GatewaySessionsSessionIdMessagePostMutationOptions(
options,
),
queryClient,
);
};
/**
* @summary Gateway Commands
*/
export type gatewayCommandsApiV1GatewayCommandsGetResponse200 = {
data: GatewayCommandsApiV1GatewayCommandsGet200;
status: 200;
};
export type gatewayCommandsApiV1GatewayCommandsGetResponseSuccess =
gatewayCommandsApiV1GatewayCommandsGetResponse200 & {
headers: Headers;
};
export type gatewayCommandsApiV1GatewayCommandsGetResponse =
gatewayCommandsApiV1GatewayCommandsGetResponseSuccess;
export const getGatewayCommandsApiV1GatewayCommandsGetUrl = () => {
return `/api/v1/gateways/commands`;
};
export const gatewayCommandsApiV1GatewayCommandsGet = async (
options?: RequestInit,
): Promise<gatewayCommandsApiV1GatewayCommandsGetResponse> => {
return customFetch<gatewayCommandsApiV1GatewayCommandsGetResponse>(
getGatewayCommandsApiV1GatewayCommandsGetUrl(),
{
...options,
method: "GET",
},
);
};
export const getGatewayCommandsApiV1GatewayCommandsGetQueryKey = () => {
return [`/api/v1/gateways/commands`] as const;
};
export const getGatewayCommandsApiV1GatewayCommandsGetQueryOptions = <
TData = Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError = unknown,
>(options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
}) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getGatewayCommandsApiV1GatewayCommandsGetQueryKey();
const queryFn: QueryFunction<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>
> = ({ signal }) =>
gatewayCommandsApiV1GatewayCommandsGet({ signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type GatewayCommandsApiV1GatewayCommandsGetQueryResult = NonNullable<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>
>;
export type GatewayCommandsApiV1GatewayCommandsGetQueryError = unknown;
export function useGatewayCommandsApiV1GatewayCommandsGet<
TData = Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError = unknown,
>(
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGatewayCommandsApiV1GatewayCommandsGet<
TData = Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError = unknown,
>(
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGatewayCommandsApiV1GatewayCommandsGet<
TData = Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError = unknown,
>(
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Gateway Commands
*/
export function useGatewayCommandsApiV1GatewayCommandsGet<
TData = Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError = unknown,
>(
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof gatewayCommandsApiV1GatewayCommandsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions =
getGatewayCommandsApiV1GatewayCommandsGetQueryOptions(options);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}