Files
openclaw-mission-control/frontend/src/api/generated/agents/agents.ts

1305 lines
36 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 {
AgentCreate,
AgentHeartbeat,
AgentHeartbeatCreate,
AgentRead,
AgentUpdate,
HTTPValidationError,
LimitOffsetPageTypeVarCustomizedAgentRead,
ListAgentsApiV1AgentsGetParams,
OkResponse,
StreamAgentsApiV1AgentsStreamGetParams,
UpdateAgentApiV1AgentsAgentIdPatchParams,
} from ".././model";
import { customFetch } from "../../mutator";
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* @summary List Agents
*/
export type listAgentsApiV1AgentsGetResponse200 = {
data: LimitOffsetPageTypeVarCustomizedAgentRead;
status: 200;
};
export type listAgentsApiV1AgentsGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type listAgentsApiV1AgentsGetResponseSuccess =
listAgentsApiV1AgentsGetResponse200 & {
headers: Headers;
};
export type listAgentsApiV1AgentsGetResponseError =
listAgentsApiV1AgentsGetResponse422 & {
headers: Headers;
};
export type listAgentsApiV1AgentsGetResponse =
| listAgentsApiV1AgentsGetResponseSuccess
| listAgentsApiV1AgentsGetResponseError;
export const getListAgentsApiV1AgentsGetUrl = (
params?: ListAgentsApiV1AgentsGetParams,
) => {
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/agents?${stringifiedParams}`
: `/api/v1/agents`;
};
export const listAgentsApiV1AgentsGet = async (
params?: ListAgentsApiV1AgentsGetParams,
options?: RequestInit,
): Promise<listAgentsApiV1AgentsGetResponse> => {
return customFetch<listAgentsApiV1AgentsGetResponse>(
getListAgentsApiV1AgentsGetUrl(params),
{
...options,
method: "GET",
},
);
};
export const getListAgentsApiV1AgentsGetQueryKey = (
params?: ListAgentsApiV1AgentsGetParams,
) => {
return [`/api/v1/agents`, ...(params ? [params] : [])] as const;
};
export const getListAgentsApiV1AgentsGetQueryOptions = <
TData = Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError = HTTPValidationError,
>(
params?: ListAgentsApiV1AgentsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ?? getListAgentsApiV1AgentsGetQueryKey(params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>
> = ({ signal }) =>
listAgentsApiV1AgentsGet(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type ListAgentsApiV1AgentsGetQueryResult = NonNullable<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>
>;
export type ListAgentsApiV1AgentsGetQueryError = HTTPValidationError;
export function useListAgentsApiV1AgentsGet<
TData = Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError = HTTPValidationError,
>(
params: undefined | ListAgentsApiV1AgentsGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListAgentsApiV1AgentsGet<
TData = Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError = HTTPValidationError,
>(
params?: ListAgentsApiV1AgentsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListAgentsApiV1AgentsGet<
TData = Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError = HTTPValidationError,
>(
params?: ListAgentsApiV1AgentsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary List Agents
*/
export function useListAgentsApiV1AgentsGet<
TData = Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError = HTTPValidationError,
>(
params?: ListAgentsApiV1AgentsGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof listAgentsApiV1AgentsGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions = getListAgentsApiV1AgentsGetQueryOptions(params, options);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Create Agent
*/
export type createAgentApiV1AgentsPostResponse200 = {
data: AgentRead;
status: 200;
};
export type createAgentApiV1AgentsPostResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type createAgentApiV1AgentsPostResponseSuccess =
createAgentApiV1AgentsPostResponse200 & {
headers: Headers;
};
export type createAgentApiV1AgentsPostResponseError =
createAgentApiV1AgentsPostResponse422 & {
headers: Headers;
};
export type createAgentApiV1AgentsPostResponse =
| createAgentApiV1AgentsPostResponseSuccess
| createAgentApiV1AgentsPostResponseError;
export const getCreateAgentApiV1AgentsPostUrl = () => {
return `/api/v1/agents`;
};
export const createAgentApiV1AgentsPost = async (
agentCreate: AgentCreate,
options?: RequestInit,
): Promise<createAgentApiV1AgentsPostResponse> => {
return customFetch<createAgentApiV1AgentsPostResponse>(
getCreateAgentApiV1AgentsPostUrl(),
{
...options,
method: "POST",
headers: { "Content-Type": "application/json", ...options?.headers },
body: JSON.stringify(agentCreate),
},
);
};
export const getCreateAgentApiV1AgentsPostMutationOptions = <
TError = HTTPValidationError,
TContext = unknown,
>(options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAgentApiV1AgentsPost>>,
TError,
{ data: AgentCreate },
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<ReturnType<typeof createAgentApiV1AgentsPost>>,
TError,
{ data: AgentCreate },
TContext
> => {
const mutationKey = ["createAgentApiV1AgentsPost"];
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 createAgentApiV1AgentsPost>>,
{ data: AgentCreate }
> = (props) => {
const { data } = props ?? {};
return createAgentApiV1AgentsPost(data, requestOptions);
};
return { mutationFn, ...mutationOptions };
};
export type CreateAgentApiV1AgentsPostMutationResult = NonNullable<
Awaited<ReturnType<typeof createAgentApiV1AgentsPost>>
>;
export type CreateAgentApiV1AgentsPostMutationBody = AgentCreate;
export type CreateAgentApiV1AgentsPostMutationError = HTTPValidationError;
/**
* @summary Create Agent
*/
export const useCreateAgentApiV1AgentsPost = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof createAgentApiV1AgentsPost>>,
TError,
{ data: AgentCreate },
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<ReturnType<typeof createAgentApiV1AgentsPost>>,
TError,
{ data: AgentCreate },
TContext
> => {
return useMutation(
getCreateAgentApiV1AgentsPostMutationOptions(options),
queryClient,
);
};
/**
* @summary Heartbeat Or Create Agent
*/
export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse200 = {
data: AgentRead;
status: 200;
};
export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseSuccess =
heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse200 & {
headers: Headers;
};
export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseError =
heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse422 & {
headers: Headers;
};
export type heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse =
| heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseSuccess
| heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponseError;
export const getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostUrl = () => {
return `/api/v1/agents/heartbeat`;
};
export const heartbeatOrCreateAgentApiV1AgentsHeartbeatPost = async (
agentHeartbeatCreate: AgentHeartbeatCreate,
options?: RequestInit,
): Promise<heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse> => {
return customFetch<heartbeatOrCreateAgentApiV1AgentsHeartbeatPostResponse>(
getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostUrl(),
{
...options,
method: "POST",
headers: { "Content-Type": "application/json", ...options?.headers },
body: JSON.stringify(agentHeartbeatCreate),
},
);
};
export const getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationOptions =
<TError = HTTPValidationError, TContext = unknown>(options?: {
mutation?: UseMutationOptions<
Awaited<
ReturnType<typeof heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>
>,
TError,
{ data: AgentHeartbeatCreate },
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<ReturnType<typeof heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>>,
TError,
{ data: AgentHeartbeatCreate },
TContext
> => {
const mutationKey = ["heartbeatOrCreateAgentApiV1AgentsHeartbeatPost"];
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 heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>
>,
{ data: AgentHeartbeatCreate }
> = (props) => {
const { data } = props ?? {};
return heartbeatOrCreateAgentApiV1AgentsHeartbeatPost(
data,
requestOptions,
);
};
return { mutationFn, ...mutationOptions };
};
export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationResult =
NonNullable<
Awaited<ReturnType<typeof heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>>
>;
export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationBody =
AgentHeartbeatCreate;
export type HeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationError =
HTTPValidationError;
/**
* @summary Heartbeat Or Create Agent
*/
export const useHeartbeatOrCreateAgentApiV1AgentsHeartbeatPost = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<
ReturnType<typeof heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>
>,
TError,
{ data: AgentHeartbeatCreate },
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<ReturnType<typeof heartbeatOrCreateAgentApiV1AgentsHeartbeatPost>>,
TError,
{ data: AgentHeartbeatCreate },
TContext
> => {
return useMutation(
getHeartbeatOrCreateAgentApiV1AgentsHeartbeatPostMutationOptions(options),
queryClient,
);
};
/**
* @summary Stream Agents
*/
export type streamAgentsApiV1AgentsStreamGetResponse200 = {
data: unknown;
status: 200;
};
export type streamAgentsApiV1AgentsStreamGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type streamAgentsApiV1AgentsStreamGetResponseSuccess =
streamAgentsApiV1AgentsStreamGetResponse200 & {
headers: Headers;
};
export type streamAgentsApiV1AgentsStreamGetResponseError =
streamAgentsApiV1AgentsStreamGetResponse422 & {
headers: Headers;
};
export type streamAgentsApiV1AgentsStreamGetResponse =
| streamAgentsApiV1AgentsStreamGetResponseSuccess
| streamAgentsApiV1AgentsStreamGetResponseError;
export const getStreamAgentsApiV1AgentsStreamGetUrl = (
params?: StreamAgentsApiV1AgentsStreamGetParams,
) => {
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/agents/stream?${stringifiedParams}`
: `/api/v1/agents/stream`;
};
export const streamAgentsApiV1AgentsStreamGet = async (
params?: StreamAgentsApiV1AgentsStreamGetParams,
options?: RequestInit,
): Promise<streamAgentsApiV1AgentsStreamGetResponse> => {
return customFetch<streamAgentsApiV1AgentsStreamGetResponse>(
getStreamAgentsApiV1AgentsStreamGetUrl(params),
{
...options,
method: "GET",
},
);
};
export const getStreamAgentsApiV1AgentsStreamGetQueryKey = (
params?: StreamAgentsApiV1AgentsStreamGetParams,
) => {
return [`/api/v1/agents/stream`, ...(params ? [params] : [])] as const;
};
export const getStreamAgentsApiV1AgentsStreamGetQueryOptions = <
TData = Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError = HTTPValidationError,
>(
params?: StreamAgentsApiV1AgentsStreamGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getStreamAgentsApiV1AgentsStreamGetQueryKey(params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>
> = ({ signal }) =>
streamAgentsApiV1AgentsStreamGet(params, { signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type StreamAgentsApiV1AgentsStreamGetQueryResult = NonNullable<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>
>;
export type StreamAgentsApiV1AgentsStreamGetQueryError = HTTPValidationError;
export function useStreamAgentsApiV1AgentsStreamGet<
TData = Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError = HTTPValidationError,
>(
params: undefined | StreamAgentsApiV1AgentsStreamGetParams,
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useStreamAgentsApiV1AgentsStreamGet<
TData = Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError = HTTPValidationError,
>(
params?: StreamAgentsApiV1AgentsStreamGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useStreamAgentsApiV1AgentsStreamGet<
TData = Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError = HTTPValidationError,
>(
params?: StreamAgentsApiV1AgentsStreamGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Stream Agents
*/
export function useStreamAgentsApiV1AgentsStreamGet<
TData = Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError = HTTPValidationError,
>(
params?: StreamAgentsApiV1AgentsStreamGetParams,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof streamAgentsApiV1AgentsStreamGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions = getStreamAgentsApiV1AgentsStreamGetQueryOptions(
params,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Delete Agent
*/
export type deleteAgentApiV1AgentsAgentIdDeleteResponse200 = {
data: OkResponse;
status: 200;
};
export type deleteAgentApiV1AgentsAgentIdDeleteResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type deleteAgentApiV1AgentsAgentIdDeleteResponseSuccess =
deleteAgentApiV1AgentsAgentIdDeleteResponse200 & {
headers: Headers;
};
export type deleteAgentApiV1AgentsAgentIdDeleteResponseError =
deleteAgentApiV1AgentsAgentIdDeleteResponse422 & {
headers: Headers;
};
export type deleteAgentApiV1AgentsAgentIdDeleteResponse =
| deleteAgentApiV1AgentsAgentIdDeleteResponseSuccess
| deleteAgentApiV1AgentsAgentIdDeleteResponseError;
export const getDeleteAgentApiV1AgentsAgentIdDeleteUrl = (agentId: string) => {
return `/api/v1/agents/${agentId}`;
};
export const deleteAgentApiV1AgentsAgentIdDelete = async (
agentId: string,
options?: RequestInit,
): Promise<deleteAgentApiV1AgentsAgentIdDeleteResponse> => {
return customFetch<deleteAgentApiV1AgentsAgentIdDeleteResponse>(
getDeleteAgentApiV1AgentsAgentIdDeleteUrl(agentId),
{
...options,
method: "DELETE",
},
);
};
export const getDeleteAgentApiV1AgentsAgentIdDeleteMutationOptions = <
TError = HTTPValidationError,
TContext = unknown,
>(options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof deleteAgentApiV1AgentsAgentIdDelete>>,
TError,
{ agentId: string },
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<ReturnType<typeof deleteAgentApiV1AgentsAgentIdDelete>>,
TError,
{ agentId: string },
TContext
> => {
const mutationKey = ["deleteAgentApiV1AgentsAgentIdDelete"];
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 deleteAgentApiV1AgentsAgentIdDelete>>,
{ agentId: string }
> = (props) => {
const { agentId } = props ?? {};
return deleteAgentApiV1AgentsAgentIdDelete(agentId, requestOptions);
};
return { mutationFn, ...mutationOptions };
};
export type DeleteAgentApiV1AgentsAgentIdDeleteMutationResult = NonNullable<
Awaited<ReturnType<typeof deleteAgentApiV1AgentsAgentIdDelete>>
>;
export type DeleteAgentApiV1AgentsAgentIdDeleteMutationError =
HTTPValidationError;
/**
* @summary Delete Agent
*/
export const useDeleteAgentApiV1AgentsAgentIdDelete = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof deleteAgentApiV1AgentsAgentIdDelete>>,
TError,
{ agentId: string },
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<ReturnType<typeof deleteAgentApiV1AgentsAgentIdDelete>>,
TError,
{ agentId: string },
TContext
> => {
return useMutation(
getDeleteAgentApiV1AgentsAgentIdDeleteMutationOptions(options),
queryClient,
);
};
/**
* @summary Get Agent
*/
export type getAgentApiV1AgentsAgentIdGetResponse200 = {
data: AgentRead;
status: 200;
};
export type getAgentApiV1AgentsAgentIdGetResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type getAgentApiV1AgentsAgentIdGetResponseSuccess =
getAgentApiV1AgentsAgentIdGetResponse200 & {
headers: Headers;
};
export type getAgentApiV1AgentsAgentIdGetResponseError =
getAgentApiV1AgentsAgentIdGetResponse422 & {
headers: Headers;
};
export type getAgentApiV1AgentsAgentIdGetResponse =
| getAgentApiV1AgentsAgentIdGetResponseSuccess
| getAgentApiV1AgentsAgentIdGetResponseError;
export const getGetAgentApiV1AgentsAgentIdGetUrl = (agentId: string) => {
return `/api/v1/agents/${agentId}`;
};
export const getAgentApiV1AgentsAgentIdGet = async (
agentId: string,
options?: RequestInit,
): Promise<getAgentApiV1AgentsAgentIdGetResponse> => {
return customFetch<getAgentApiV1AgentsAgentIdGetResponse>(
getGetAgentApiV1AgentsAgentIdGetUrl(agentId),
{
...options,
method: "GET",
},
);
};
export const getGetAgentApiV1AgentsAgentIdGetQueryKey = (agentId: string) => {
return [`/api/v1/agents/${agentId}`] as const;
};
export const getGetAgentApiV1AgentsAgentIdGetQueryOptions = <
TData = Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError = HTTPValidationError,
>(
agentId: string,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
) => {
const { query: queryOptions, request: requestOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ?? getGetAgentApiV1AgentsAgentIdGetQueryKey(agentId);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>
> = ({ signal }) =>
getAgentApiV1AgentsAgentIdGet(agentId, { signal, ...requestOptions });
return {
queryKey,
queryFn,
enabled: !!agentId,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
> & { queryKey: DataTag<QueryKey, TData, TError> };
};
export type GetAgentApiV1AgentsAgentIdGetQueryResult = NonNullable<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>
>;
export type GetAgentApiV1AgentsAgentIdGetQueryError = HTTPValidationError;
export function useGetAgentApiV1AgentsAgentIdGet<
TData = Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError = HTTPValidationError,
>(
agentId: string,
options: {
query: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
>
> &
Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetAgentApiV1AgentsAgentIdGet<
TData = Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError = HTTPValidationError,
>(
agentId: string,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
>
> &
Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>
>,
"initialData"
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetAgentApiV1AgentsAgentIdGet<
TData = Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError = HTTPValidationError,
>(
agentId: string,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
};
/**
* @summary Get Agent
*/
export function useGetAgentApiV1AgentsAgentIdGet<
TData = Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError = HTTPValidationError,
>(
agentId: string,
options?: {
query?: Partial<
UseQueryOptions<
Awaited<ReturnType<typeof getAgentApiV1AgentsAgentIdGet>>,
TError,
TData
>
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
queryKey: DataTag<QueryKey, TData, TError>;
} {
const queryOptions = getGetAgentApiV1AgentsAgentIdGetQueryOptions(
agentId,
options,
);
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
TData,
TError
> & { queryKey: DataTag<QueryKey, TData, TError> };
return { ...query, queryKey: queryOptions.queryKey };
}
/**
* @summary Update Agent
*/
export type updateAgentApiV1AgentsAgentIdPatchResponse200 = {
data: AgentRead;
status: 200;
};
export type updateAgentApiV1AgentsAgentIdPatchResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type updateAgentApiV1AgentsAgentIdPatchResponseSuccess =
updateAgentApiV1AgentsAgentIdPatchResponse200 & {
headers: Headers;
};
export type updateAgentApiV1AgentsAgentIdPatchResponseError =
updateAgentApiV1AgentsAgentIdPatchResponse422 & {
headers: Headers;
};
export type updateAgentApiV1AgentsAgentIdPatchResponse =
| updateAgentApiV1AgentsAgentIdPatchResponseSuccess
| updateAgentApiV1AgentsAgentIdPatchResponseError;
export const getUpdateAgentApiV1AgentsAgentIdPatchUrl = (
agentId: string,
params?: UpdateAgentApiV1AgentsAgentIdPatchParams,
) => {
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/agents/${agentId}?${stringifiedParams}`
: `/api/v1/agents/${agentId}`;
};
export const updateAgentApiV1AgentsAgentIdPatch = async (
agentId: string,
agentUpdate: AgentUpdate,
params?: UpdateAgentApiV1AgentsAgentIdPatchParams,
options?: RequestInit,
): Promise<updateAgentApiV1AgentsAgentIdPatchResponse> => {
return customFetch<updateAgentApiV1AgentsAgentIdPatchResponse>(
getUpdateAgentApiV1AgentsAgentIdPatchUrl(agentId, params),
{
...options,
method: "PATCH",
headers: { "Content-Type": "application/json", ...options?.headers },
body: JSON.stringify(agentUpdate),
},
);
};
export const getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions = <
TError = HTTPValidationError,
TContext = unknown,
>(options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
TError,
{
agentId: string;
data: AgentUpdate;
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
},
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
TError,
{
agentId: string;
data: AgentUpdate;
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
},
TContext
> => {
const mutationKey = ["updateAgentApiV1AgentsAgentIdPatch"];
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 updateAgentApiV1AgentsAgentIdPatch>>,
{
agentId: string;
data: AgentUpdate;
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
}
> = (props) => {
const { agentId, data, params } = props ?? {};
return updateAgentApiV1AgentsAgentIdPatch(
agentId,
data,
params,
requestOptions,
);
};
return { mutationFn, ...mutationOptions };
};
export type UpdateAgentApiV1AgentsAgentIdPatchMutationResult = NonNullable<
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>
>;
export type UpdateAgentApiV1AgentsAgentIdPatchMutationBody = AgentUpdate;
export type UpdateAgentApiV1AgentsAgentIdPatchMutationError =
HTTPValidationError;
/**
* @summary Update Agent
*/
export const useUpdateAgentApiV1AgentsAgentIdPatch = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
TError,
{
agentId: string;
data: AgentUpdate;
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
},
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
TError,
{
agentId: string;
data: AgentUpdate;
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
},
TContext
> => {
return useMutation(
getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions(options),
queryClient,
);
};
/**
* @summary Heartbeat Agent
*/
export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse200 = {
data: AgentRead;
status: 200;
};
export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse422 = {
data: HTTPValidationError;
status: 422;
};
export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseSuccess =
heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse200 & {
headers: Headers;
};
export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseError =
heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse422 & {
headers: Headers;
};
export type heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse =
| heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseSuccess
| heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponseError;
export const getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostUrl = (
agentId: string,
) => {
return `/api/v1/agents/${agentId}/heartbeat`;
};
export const heartbeatAgentApiV1AgentsAgentIdHeartbeatPost = async (
agentId: string,
agentHeartbeat: AgentHeartbeat,
options?: RequestInit,
): Promise<heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse> => {
return customFetch<heartbeatAgentApiV1AgentsAgentIdHeartbeatPostResponse>(
getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostUrl(agentId),
{
...options,
method: "POST",
headers: { "Content-Type": "application/json", ...options?.headers },
body: JSON.stringify(agentHeartbeat),
},
);
};
export const getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationOptions = <
TError = HTTPValidationError,
TContext = unknown,
>(options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>,
TError,
{ agentId: string; data: AgentHeartbeat },
TContext
>;
request?: SecondParameter<typeof customFetch>;
}): UseMutationOptions<
Awaited<ReturnType<typeof heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>,
TError,
{ agentId: string; data: AgentHeartbeat },
TContext
> => {
const mutationKey = ["heartbeatAgentApiV1AgentsAgentIdHeartbeatPost"];
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 heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>,
{ agentId: string; data: AgentHeartbeat }
> = (props) => {
const { agentId, data } = props ?? {};
return heartbeatAgentApiV1AgentsAgentIdHeartbeatPost(
agentId,
data,
requestOptions,
);
};
return { mutationFn, ...mutationOptions };
};
export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationResult =
NonNullable<
Awaited<ReturnType<typeof heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>
>;
export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationBody =
AgentHeartbeat;
export type HeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationError =
HTTPValidationError;
/**
* @summary Heartbeat Agent
*/
export const useHeartbeatAgentApiV1AgentsAgentIdHeartbeatPost = <
TError = HTTPValidationError,
TContext = unknown,
>(
options?: {
mutation?: UseMutationOptions<
Awaited<ReturnType<typeof heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>,
TError,
{ agentId: string; data: AgentHeartbeat },
TContext
>;
request?: SecondParameter<typeof customFetch>;
},
queryClient?: QueryClient,
): UseMutationResult<
Awaited<ReturnType<typeof heartbeatAgentApiV1AgentsAgentIdHeartbeatPost>>,
TError,
{ agentId: string; data: AgentHeartbeat },
TContext
> => {
return useMutation(
getHeartbeatAgentApiV1AgentsAgentIdHeartbeatPostMutationOptions(options),
queryClient,
);
};