feat: add validation for minimum length on various fields and update type definitions
This commit is contained in:
2960
frontend/src/api/generated/agent/agent.ts
Normal file
2960
frontend/src/api/generated/agent/agent.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,16 +22,14 @@ import type {
|
||||
|
||||
import type {
|
||||
AgentCreate,
|
||||
AgentDeleteConfirm,
|
||||
AgentHeartbeat,
|
||||
AgentHeartbeatCreate,
|
||||
AgentProvisionConfirm,
|
||||
AgentRead,
|
||||
AgentUpdate,
|
||||
ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200,
|
||||
ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200,
|
||||
DeleteAgentApiV1AgentsAgentIdDelete200,
|
||||
HTTPValidationError,
|
||||
OkResponse,
|
||||
StreamAgentsApiV1AgentsStreamGetParams,
|
||||
UpdateAgentApiV1AgentsAgentIdPatchParams,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
@@ -326,6 +324,217 @@ export const useCreateAgentApiV1AgentsPost = <
|
||||
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 Get Agent
|
||||
*/
|
||||
@@ -551,17 +760,33 @@ export type updateAgentApiV1AgentsAgentIdPatchResponse =
|
||||
| updateAgentApiV1AgentsAgentIdPatchResponseSuccess
|
||||
| updateAgentApiV1AgentsAgentIdPatchResponseError;
|
||||
|
||||
export const getUpdateAgentApiV1AgentsAgentIdPatchUrl = (agentId: string) => {
|
||||
return `/api/v1/agents/${agentId}`;
|
||||
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),
|
||||
getUpdateAgentApiV1AgentsAgentIdPatchUrl(agentId, params),
|
||||
{
|
||||
...options,
|
||||
method: "PATCH",
|
||||
@@ -578,14 +803,22 @@ export const getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentUpdate },
|
||||
{
|
||||
agentId: string;
|
||||
data: AgentUpdate;
|
||||
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentUpdate },
|
||||
{
|
||||
agentId: string;
|
||||
data: AgentUpdate;
|
||||
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["updateAgentApiV1AgentsAgentIdPatch"];
|
||||
@@ -599,11 +832,20 @@ export const getUpdateAgentApiV1AgentsAgentIdPatchMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
|
||||
{ agentId: string; data: AgentUpdate }
|
||||
{
|
||||
agentId: string;
|
||||
data: AgentUpdate;
|
||||
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
|
||||
}
|
||||
> = (props) => {
|
||||
const { agentId, data } = props ?? {};
|
||||
const { agentId, data, params } = props ?? {};
|
||||
|
||||
return updateAgentApiV1AgentsAgentIdPatch(agentId, data, requestOptions);
|
||||
return updateAgentApiV1AgentsAgentIdPatch(
|
||||
agentId,
|
||||
data,
|
||||
params,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
@@ -627,7 +869,11 @@ export const useUpdateAgentApiV1AgentsAgentIdPatch = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentUpdate },
|
||||
{
|
||||
agentId: string;
|
||||
data: AgentUpdate;
|
||||
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
@@ -636,7 +882,11 @@ export const useUpdateAgentApiV1AgentsAgentIdPatch = <
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateAgentApiV1AgentsAgentIdPatch>>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentUpdate },
|
||||
{
|
||||
agentId: string;
|
||||
data: AgentUpdate;
|
||||
params?: UpdateAgentApiV1AgentsAgentIdPatchParams;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
@@ -648,7 +898,7 @@ export const useUpdateAgentApiV1AgentsAgentIdPatch = <
|
||||
* @summary Delete Agent
|
||||
*/
|
||||
export type deleteAgentApiV1AgentsAgentIdDeleteResponse200 = {
|
||||
data: DeleteAgentApiV1AgentsAgentIdDelete200;
|
||||
data: OkResponse;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
@@ -1014,302 +1264,3 @@ export const useHeartbeatOrCreateAgentApiV1AgentsHeartbeatPost = <
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Confirm Provision Agent
|
||||
*/
|
||||
export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse200 =
|
||||
{
|
||||
data: ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse422 =
|
||||
{
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseSuccess =
|
||||
confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseError =
|
||||
confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse =
|
||||
|
||||
| confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseSuccess
|
||||
| confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponseError;
|
||||
|
||||
export const getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostUrl =
|
||||
(agentId: string) => {
|
||||
return `/api/v1/agents/${agentId}/provision/confirm`;
|
||||
};
|
||||
|
||||
export const confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost =
|
||||
async (
|
||||
agentId: string,
|
||||
agentProvisionConfirm: AgentProvisionConfirm,
|
||||
options?: RequestInit,
|
||||
): Promise<confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse> => {
|
||||
return customFetch<confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostResponse>(
|
||||
getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostUrl(
|
||||
agentId,
|
||||
),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(agentProvisionConfirm),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentProvisionConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentProvisionConfirm },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost",
|
||||
];
|
||||
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 confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>,
|
||||
{ agentId: string; data: AgentProvisionConfirm }
|
||||
> = (props) => {
|
||||
const { agentId, data } = props ?? {};
|
||||
|
||||
return confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost(
|
||||
agentId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>
|
||||
>;
|
||||
export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationBody =
|
||||
AgentProvisionConfirm;
|
||||
export type ConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Confirm Provision Agent
|
||||
*/
|
||||
export const useConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentProvisionConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentProvisionConfirm },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getConfirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Confirm Delete Agent
|
||||
*/
|
||||
export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse200 = {
|
||||
data: ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseSuccess =
|
||||
confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseError =
|
||||
confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse =
|
||||
| confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseSuccess
|
||||
| confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponseError;
|
||||
|
||||
export const getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostUrl = (
|
||||
agentId: string,
|
||||
) => {
|
||||
return `/api/v1/agents/${agentId}/delete/confirm`;
|
||||
};
|
||||
|
||||
export const confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost = async (
|
||||
agentId: string,
|
||||
agentDeleteConfirm: AgentDeleteConfirm,
|
||||
options?: RequestInit,
|
||||
): Promise<confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse> => {
|
||||
return customFetch<confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostResponse>(
|
||||
getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostUrl(agentId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(agentDeleteConfirm),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentDeleteConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentDeleteConfirm },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost",
|
||||
];
|
||||
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 confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>,
|
||||
{ agentId: string; data: AgentDeleteConfirm }
|
||||
> = (props) => {
|
||||
const { agentId, data } = props ?? {};
|
||||
|
||||
return confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost(
|
||||
agentId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>
|
||||
>;
|
||||
export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationBody =
|
||||
AgentDeleteConfirm;
|
||||
export type ConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Confirm Delete Agent
|
||||
*/
|
||||
export const useConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentDeleteConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost>
|
||||
>,
|
||||
TError,
|
||||
{ agentId: string; data: AgentDeleteConfirm },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getConfirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
|
||||
855
frontend/src/api/generated/approvals/approvals.ts
Normal file
855
frontend/src/api/generated/approvals/approvals.ts
Normal file
@@ -0,0 +1,855 @@
|
||||
/**
|
||||
* 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 {
|
||||
ApprovalCreate,
|
||||
ApprovalRead,
|
||||
ApprovalUpdate,
|
||||
HTTPValidationError,
|
||||
ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
/**
|
||||
* @summary List Approvals
|
||||
*/
|
||||
export type listApprovalsApiV1BoardsBoardIdApprovalsGetResponse200 = {
|
||||
data: ApprovalRead[];
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type listApprovalsApiV1BoardsBoardIdApprovalsGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type listApprovalsApiV1BoardsBoardIdApprovalsGetResponseSuccess =
|
||||
listApprovalsApiV1BoardsBoardIdApprovalsGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type listApprovalsApiV1BoardsBoardIdApprovalsGetResponseError =
|
||||
listApprovalsApiV1BoardsBoardIdApprovalsGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type listApprovalsApiV1BoardsBoardIdApprovalsGetResponse =
|
||||
| listApprovalsApiV1BoardsBoardIdApprovalsGetResponseSuccess
|
||||
| listApprovalsApiV1BoardsBoardIdApprovalsGetResponseError;
|
||||
|
||||
export const getListApprovalsApiV1BoardsBoardIdApprovalsGetUrl = (
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
) => {
|
||||
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/boards/${boardId}/approvals?${stringifiedParams}`
|
||||
: `/api/v1/boards/${boardId}/approvals`;
|
||||
};
|
||||
|
||||
export const listApprovalsApiV1BoardsBoardIdApprovalsGet = async (
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<listApprovalsApiV1BoardsBoardIdApprovalsGetResponse> => {
|
||||
return customFetch<listApprovalsApiV1BoardsBoardIdApprovalsGetResponse>(
|
||||
getListApprovalsApiV1BoardsBoardIdApprovalsGetUrl(boardId, params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getListApprovalsApiV1BoardsBoardIdApprovalsGetQueryKey = (
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/boards/${boardId}/approvals`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListApprovalsApiV1BoardsBoardIdApprovalsGetQueryOptions = <
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getListApprovalsApiV1BoardsBoardIdApprovalsGetQueryKey(boardId, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>
|
||||
> = ({ signal }) =>
|
||||
listApprovalsApiV1BoardsBoardIdApprovalsGet(boardId, params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ListApprovalsApiV1BoardsBoardIdApprovalsGetQueryResult =
|
||||
NonNullable<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>
|
||||
>;
|
||||
export type ListApprovalsApiV1BoardsBoardIdApprovalsGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useListApprovalsApiV1BoardsBoardIdApprovalsGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params: undefined | ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListApprovalsApiV1BoardsBoardIdApprovalsGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListApprovalsApiV1BoardsBoardIdApprovalsGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary List Approvals
|
||||
*/
|
||||
|
||||
export function useListApprovalsApiV1BoardsBoardIdApprovalsGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListApprovalsApiV1BoardsBoardIdApprovalsGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listApprovalsApiV1BoardsBoardIdApprovalsGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getListApprovalsApiV1BoardsBoardIdApprovalsGetQueryOptions(
|
||||
boardId,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Create Approval
|
||||
*/
|
||||
export type createApprovalApiV1BoardsBoardIdApprovalsPostResponse200 = {
|
||||
data: ApprovalRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type createApprovalApiV1BoardsBoardIdApprovalsPostResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type createApprovalApiV1BoardsBoardIdApprovalsPostResponseSuccess =
|
||||
createApprovalApiV1BoardsBoardIdApprovalsPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type createApprovalApiV1BoardsBoardIdApprovalsPostResponseError =
|
||||
createApprovalApiV1BoardsBoardIdApprovalsPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type createApprovalApiV1BoardsBoardIdApprovalsPostResponse =
|
||||
| createApprovalApiV1BoardsBoardIdApprovalsPostResponseSuccess
|
||||
| createApprovalApiV1BoardsBoardIdApprovalsPostResponseError;
|
||||
|
||||
export const getCreateApprovalApiV1BoardsBoardIdApprovalsPostUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/approvals`;
|
||||
};
|
||||
|
||||
export const createApprovalApiV1BoardsBoardIdApprovalsPost = async (
|
||||
boardId: string,
|
||||
approvalCreate: ApprovalCreate,
|
||||
options?: RequestInit,
|
||||
): Promise<createApprovalApiV1BoardsBoardIdApprovalsPostResponse> => {
|
||||
return customFetch<createApprovalApiV1BoardsBoardIdApprovalsPostResponse>(
|
||||
getCreateApprovalApiV1BoardsBoardIdApprovalsPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(approvalCreate),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getCreateApprovalApiV1BoardsBoardIdApprovalsPostMutationOptions = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createApprovalApiV1BoardsBoardIdApprovalsPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: ApprovalCreate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createApprovalApiV1BoardsBoardIdApprovalsPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: ApprovalCreate },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["createApprovalApiV1BoardsBoardIdApprovalsPost"];
|
||||
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 createApprovalApiV1BoardsBoardIdApprovalsPost>>,
|
||||
{ boardId: string; data: ApprovalCreate }
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return createApprovalApiV1BoardsBoardIdApprovalsPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type CreateApprovalApiV1BoardsBoardIdApprovalsPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<ReturnType<typeof createApprovalApiV1BoardsBoardIdApprovalsPost>>
|
||||
>;
|
||||
export type CreateApprovalApiV1BoardsBoardIdApprovalsPostMutationBody =
|
||||
ApprovalCreate;
|
||||
export type CreateApprovalApiV1BoardsBoardIdApprovalsPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Create Approval
|
||||
*/
|
||||
export const useCreateApprovalApiV1BoardsBoardIdApprovalsPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createApprovalApiV1BoardsBoardIdApprovalsPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: ApprovalCreate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createApprovalApiV1BoardsBoardIdApprovalsPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: ApprovalCreate },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getCreateApprovalApiV1BoardsBoardIdApprovalsPostMutationOptions(options),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Stream Approvals
|
||||
*/
|
||||
export type streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse200 = {
|
||||
data: unknown;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponseSuccess =
|
||||
streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponseError =
|
||||
streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse =
|
||||
| streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponseSuccess
|
||||
| streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponseError;
|
||||
|
||||
export const getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetUrl = (
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
) => {
|
||||
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/boards/${boardId}/approvals/stream?${stringifiedParams}`
|
||||
: `/api/v1/boards/${boardId}/approvals/stream`;
|
||||
};
|
||||
|
||||
export const streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet = async (
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse> => {
|
||||
return customFetch<streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetResponse>(
|
||||
getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetUrl(boardId, params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryKey = (
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/boards/${boardId}/approvals/stream`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryOptions =
|
||||
<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryKey(
|
||||
boardId,
|
||||
params,
|
||||
);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>
|
||||
> = ({ signal }) =>
|
||||
streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet(boardId, params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>
|
||||
>;
|
||||
export type StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params: undefined | StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet
|
||||
>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet
|
||||
>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Stream Approvals
|
||||
*/
|
||||
|
||||
export function useStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getStreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetQueryOptions(
|
||||
boardId,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Update Approval
|
||||
*/
|
||||
export type updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse200 =
|
||||
{
|
||||
data: ApprovalRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse422 =
|
||||
{
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponseSuccess =
|
||||
updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponseError =
|
||||
updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse =
|
||||
| updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponseSuccess
|
||||
| updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponseError;
|
||||
|
||||
export const getUpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchUrl = (
|
||||
boardId: string,
|
||||
approvalId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/approvals/${approvalId}`;
|
||||
};
|
||||
|
||||
export const updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch = async (
|
||||
boardId: string,
|
||||
approvalId: string,
|
||||
approvalUpdate: ApprovalUpdate,
|
||||
options?: RequestInit,
|
||||
): Promise<updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse> => {
|
||||
return customFetch<updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchResponse>(
|
||||
getUpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchUrl(
|
||||
boardId,
|
||||
approvalId,
|
||||
),
|
||||
{
|
||||
...options,
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(approvalUpdate),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getUpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; approvalId: string; data: ApprovalUpdate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; approvalId: string; data: ApprovalUpdate },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch",
|
||||
];
|
||||
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 updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch
|
||||
>
|
||||
>,
|
||||
{ boardId: string; approvalId: string; data: ApprovalUpdate }
|
||||
> = (props) => {
|
||||
const { boardId, approvalId, data } = props ?? {};
|
||||
|
||||
return updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch(
|
||||
boardId,
|
||||
approvalId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type UpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch
|
||||
>
|
||||
>
|
||||
>;
|
||||
export type UpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchMutationBody =
|
||||
ApprovalUpdate;
|
||||
export type UpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Update Approval
|
||||
*/
|
||||
export const useUpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; approvalId: string; data: ApprovalUpdate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<typeof updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; approvalId: string; data: ApprovalUpdate },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getUpdateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatchMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
689
frontend/src/api/generated/board-memory/board-memory.ts
Normal file
689
frontend/src/api/generated/board-memory/board-memory.ts
Normal file
@@ -0,0 +1,689 @@
|
||||
/**
|
||||
* 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 {
|
||||
BoardMemoryCreate,
|
||||
BoardMemoryRead,
|
||||
HTTPValidationError,
|
||||
ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
/**
|
||||
* @summary List Board Memory
|
||||
*/
|
||||
export type listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse200 = {
|
||||
data: BoardMemoryRead[];
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type listBoardMemoryApiV1BoardsBoardIdMemoryGetResponseSuccess =
|
||||
listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type listBoardMemoryApiV1BoardsBoardIdMemoryGetResponseError =
|
||||
listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse =
|
||||
| listBoardMemoryApiV1BoardsBoardIdMemoryGetResponseSuccess
|
||||
| listBoardMemoryApiV1BoardsBoardIdMemoryGetResponseError;
|
||||
|
||||
export const getListBoardMemoryApiV1BoardsBoardIdMemoryGetUrl = (
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
) => {
|
||||
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/boards/${boardId}/memory?${stringifiedParams}`
|
||||
: `/api/v1/boards/${boardId}/memory`;
|
||||
};
|
||||
|
||||
export const listBoardMemoryApiV1BoardsBoardIdMemoryGet = async (
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse> => {
|
||||
return customFetch<listBoardMemoryApiV1BoardsBoardIdMemoryGetResponse>(
|
||||
getListBoardMemoryApiV1BoardsBoardIdMemoryGetUrl(boardId, params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryKey = (
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/boards/${boardId}/memory`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryOptions = <
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryKey(boardId, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>
|
||||
> = ({ signal }) =>
|
||||
listBoardMemoryApiV1BoardsBoardIdMemoryGet(boardId, params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>
|
||||
>;
|
||||
export type ListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useListBoardMemoryApiV1BoardsBoardIdMemoryGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params: undefined | ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListBoardMemoryApiV1BoardsBoardIdMemoryGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListBoardMemoryApiV1BoardsBoardIdMemoryGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary List Board Memory
|
||||
*/
|
||||
|
||||
export function useListBoardMemoryApiV1BoardsBoardIdMemoryGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listBoardMemoryApiV1BoardsBoardIdMemoryGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getListBoardMemoryApiV1BoardsBoardIdMemoryGetQueryOptions(
|
||||
boardId,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Create Board Memory
|
||||
*/
|
||||
export type createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse200 = {
|
||||
data: BoardMemoryRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type createBoardMemoryApiV1BoardsBoardIdMemoryPostResponseSuccess =
|
||||
createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type createBoardMemoryApiV1BoardsBoardIdMemoryPostResponseError =
|
||||
createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse =
|
||||
| createBoardMemoryApiV1BoardsBoardIdMemoryPostResponseSuccess
|
||||
| createBoardMemoryApiV1BoardsBoardIdMemoryPostResponseError;
|
||||
|
||||
export const getCreateBoardMemoryApiV1BoardsBoardIdMemoryPostUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/memory`;
|
||||
};
|
||||
|
||||
export const createBoardMemoryApiV1BoardsBoardIdMemoryPost = async (
|
||||
boardId: string,
|
||||
boardMemoryCreate: BoardMemoryCreate,
|
||||
options?: RequestInit,
|
||||
): Promise<createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse> => {
|
||||
return customFetch<createBoardMemoryApiV1BoardsBoardIdMemoryPostResponse>(
|
||||
getCreateBoardMemoryApiV1BoardsBoardIdMemoryPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(boardMemoryCreate),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getCreateBoardMemoryApiV1BoardsBoardIdMemoryPostMutationOptions = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBoardMemoryApiV1BoardsBoardIdMemoryPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardMemoryCreate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBoardMemoryApiV1BoardsBoardIdMemoryPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardMemoryCreate },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["createBoardMemoryApiV1BoardsBoardIdMemoryPost"];
|
||||
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 createBoardMemoryApiV1BoardsBoardIdMemoryPost>>,
|
||||
{ boardId: string; data: BoardMemoryCreate }
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return createBoardMemoryApiV1BoardsBoardIdMemoryPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type CreateBoardMemoryApiV1BoardsBoardIdMemoryPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<ReturnType<typeof createBoardMemoryApiV1BoardsBoardIdMemoryPost>>
|
||||
>;
|
||||
export type CreateBoardMemoryApiV1BoardsBoardIdMemoryPostMutationBody =
|
||||
BoardMemoryCreate;
|
||||
export type CreateBoardMemoryApiV1BoardsBoardIdMemoryPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Create Board Memory
|
||||
*/
|
||||
export const useCreateBoardMemoryApiV1BoardsBoardIdMemoryPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBoardMemoryApiV1BoardsBoardIdMemoryPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardMemoryCreate },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createBoardMemoryApiV1BoardsBoardIdMemoryPost>>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardMemoryCreate },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getCreateBoardMemoryApiV1BoardsBoardIdMemoryPostMutationOptions(options),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Stream Board Memory
|
||||
*/
|
||||
export type streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse200 = {
|
||||
data: unknown;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponseSuccess =
|
||||
streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponseError =
|
||||
streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse =
|
||||
| streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponseSuccess
|
||||
| streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponseError;
|
||||
|
||||
export const getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetUrl = (
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
) => {
|
||||
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/boards/${boardId}/memory/stream?${stringifiedParams}`
|
||||
: `/api/v1/boards/${boardId}/memory/stream`;
|
||||
};
|
||||
|
||||
export const streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet = async (
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse> => {
|
||||
return customFetch<streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetResponse>(
|
||||
getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetUrl(boardId, params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryKey = (
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/boards/${boardId}/memory/stream`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryOptions =
|
||||
<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryKey(
|
||||
boardId,
|
||||
params,
|
||||
);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>
|
||||
> = ({ signal }) =>
|
||||
streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet(boardId, params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>
|
||||
>;
|
||||
export type StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params: undefined | StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet
|
||||
>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet
|
||||
>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Stream Board Memory
|
||||
*/
|
||||
|
||||
export function useStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getStreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetQueryOptions(
|
||||
boardId,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
892
frontend/src/api/generated/board-onboarding/board-onboarding.ts
Normal file
892
frontend/src/api/generated/board-onboarding/board-onboarding.ts
Normal file
@@ -0,0 +1,892 @@
|
||||
/**
|
||||
* 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 {
|
||||
BoardOnboardingAgentComplete,
|
||||
BoardOnboardingAgentQuestion,
|
||||
BoardOnboardingAnswer,
|
||||
BoardOnboardingConfirm,
|
||||
BoardOnboardingRead,
|
||||
BoardOnboardingStart,
|
||||
BoardRead,
|
||||
HTTPValidationError,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
/**
|
||||
* @summary Get Onboarding
|
||||
*/
|
||||
export type getOnboardingApiV1BoardsBoardIdOnboardingGetResponse200 = {
|
||||
data: BoardOnboardingRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type getOnboardingApiV1BoardsBoardIdOnboardingGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type getOnboardingApiV1BoardsBoardIdOnboardingGetResponseSuccess =
|
||||
getOnboardingApiV1BoardsBoardIdOnboardingGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type getOnboardingApiV1BoardsBoardIdOnboardingGetResponseError =
|
||||
getOnboardingApiV1BoardsBoardIdOnboardingGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type getOnboardingApiV1BoardsBoardIdOnboardingGetResponse =
|
||||
| getOnboardingApiV1BoardsBoardIdOnboardingGetResponseSuccess
|
||||
| getOnboardingApiV1BoardsBoardIdOnboardingGetResponseError;
|
||||
|
||||
export const getGetOnboardingApiV1BoardsBoardIdOnboardingGetUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/onboarding`;
|
||||
};
|
||||
|
||||
export const getOnboardingApiV1BoardsBoardIdOnboardingGet = async (
|
||||
boardId: string,
|
||||
options?: RequestInit,
|
||||
): Promise<getOnboardingApiV1BoardsBoardIdOnboardingGetResponse> => {
|
||||
return customFetch<getOnboardingApiV1BoardsBoardIdOnboardingGetResponse>(
|
||||
getGetOnboardingApiV1BoardsBoardIdOnboardingGetUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getGetOnboardingApiV1BoardsBoardIdOnboardingGetQueryKey = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return [`/api/v1/boards/${boardId}/onboarding`] as const;
|
||||
};
|
||||
|
||||
export const getGetOnboardingApiV1BoardsBoardIdOnboardingGetQueryOptions = <
|
||||
TData = Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getGetOnboardingApiV1BoardsBoardIdOnboardingGetQueryKey(boardId);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>>
|
||||
> = ({ signal }) =>
|
||||
getOnboardingApiV1BoardsBoardIdOnboardingGet(boardId, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type GetOnboardingApiV1BoardsBoardIdOnboardingGetQueryResult =
|
||||
NonNullable<
|
||||
Awaited<ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>>
|
||||
>;
|
||||
export type GetOnboardingApiV1BoardsBoardIdOnboardingGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useGetOnboardingApiV1BoardsBoardIdOnboardingGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useGetOnboardingApiV1BoardsBoardIdOnboardingGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useGetOnboardingApiV1BoardsBoardIdOnboardingGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Get Onboarding
|
||||
*/
|
||||
|
||||
export function useGetOnboardingApiV1BoardsBoardIdOnboardingGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof getOnboardingApiV1BoardsBoardIdOnboardingGet>
|
||||
>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getGetOnboardingApiV1BoardsBoardIdOnboardingGetQueryOptions(
|
||||
boardId,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Start Onboarding
|
||||
*/
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse200 = {
|
||||
data: BoardOnboardingRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponseSuccess =
|
||||
startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponseError =
|
||||
startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse =
|
||||
| startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponseSuccess
|
||||
| startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponseError;
|
||||
|
||||
export const getStartOnboardingApiV1BoardsBoardIdOnboardingStartPostUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/onboarding/start`;
|
||||
};
|
||||
|
||||
export const startOnboardingApiV1BoardsBoardIdOnboardingStartPost = async (
|
||||
boardId: string,
|
||||
boardOnboardingStart: BoardOnboardingStart,
|
||||
options?: RequestInit,
|
||||
): Promise<startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse> => {
|
||||
return customFetch<startOnboardingApiV1BoardsBoardIdOnboardingStartPostResponse>(
|
||||
getStartOnboardingApiV1BoardsBoardIdOnboardingStartPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(boardOnboardingStart),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getStartOnboardingApiV1BoardsBoardIdOnboardingStartPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingStart },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingStart },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"startOnboardingApiV1BoardsBoardIdOnboardingStartPost",
|
||||
];
|
||||
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 startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>,
|
||||
{ boardId: string; data: BoardOnboardingStart }
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return startOnboardingApiV1BoardsBoardIdOnboardingStartPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type StartOnboardingApiV1BoardsBoardIdOnboardingStartPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<typeof startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>
|
||||
>;
|
||||
export type StartOnboardingApiV1BoardsBoardIdOnboardingStartPostMutationBody =
|
||||
BoardOnboardingStart;
|
||||
export type StartOnboardingApiV1BoardsBoardIdOnboardingStartPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Start Onboarding
|
||||
*/
|
||||
export const useStartOnboardingApiV1BoardsBoardIdOnboardingStartPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingStart },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<typeof startOnboardingApiV1BoardsBoardIdOnboardingStartPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingStart },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getStartOnboardingApiV1BoardsBoardIdOnboardingStartPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Answer Onboarding
|
||||
*/
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse200 =
|
||||
{
|
||||
data: BoardOnboardingRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse422 =
|
||||
{
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponseSuccess =
|
||||
answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponseError =
|
||||
answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse =
|
||||
| answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponseSuccess
|
||||
| answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponseError;
|
||||
|
||||
export const getAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/onboarding/answer`;
|
||||
};
|
||||
|
||||
export const answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost = async (
|
||||
boardId: string,
|
||||
boardOnboardingAnswer: BoardOnboardingAnswer,
|
||||
options?: RequestInit,
|
||||
): Promise<answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse> => {
|
||||
return customFetch<answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostResponse>(
|
||||
getAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(boardOnboardingAnswer),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingAnswer },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingAnswer },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost",
|
||||
];
|
||||
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 answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost
|
||||
>
|
||||
>,
|
||||
{ boardId: string; data: BoardOnboardingAnswer }
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type AnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<typeof answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost>
|
||||
>
|
||||
>;
|
||||
export type AnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostMutationBody =
|
||||
BoardOnboardingAnswer;
|
||||
export type AnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Answer Onboarding
|
||||
*/
|
||||
export const useAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingAnswer },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<typeof answerOnboardingApiV1BoardsBoardIdOnboardingAnswerPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingAnswer },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getAnswerOnboardingApiV1BoardsBoardIdOnboardingAnswerPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Agent Onboarding Update
|
||||
*/
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse200 =
|
||||
{
|
||||
data: BoardOnboardingRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse422 =
|
||||
{
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponseSuccess =
|
||||
agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponseError =
|
||||
agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse =
|
||||
| agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponseSuccess
|
||||
| agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponseError;
|
||||
|
||||
export const getAgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostUrl =
|
||||
(boardId: string) => {
|
||||
return `/api/v1/boards/${boardId}/onboarding/agent`;
|
||||
};
|
||||
|
||||
export const agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost =
|
||||
async (
|
||||
boardId: string,
|
||||
boardOnboardingAgentCompleteBoardOnboardingAgentQuestion:
|
||||
| BoardOnboardingAgentComplete
|
||||
| BoardOnboardingAgentQuestion,
|
||||
options?: RequestInit,
|
||||
): Promise<agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse> => {
|
||||
return customFetch<agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostResponse>(
|
||||
getAgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(
|
||||
boardOnboardingAgentCompleteBoardOnboardingAgentQuestion,
|
||||
),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getAgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{
|
||||
boardId: string;
|
||||
data: BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{
|
||||
boardId: string;
|
||||
data: BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost",
|
||||
];
|
||||
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 agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>,
|
||||
{
|
||||
boardId: string;
|
||||
data: BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
}
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type AgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>
|
||||
>;
|
||||
export type AgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostMutationBody =
|
||||
BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
export type AgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Agent Onboarding Update
|
||||
*/
|
||||
export const useAgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{
|
||||
boardId: string;
|
||||
data: BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof agentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{
|
||||
boardId: string;
|
||||
data: BoardOnboardingAgentComplete | BoardOnboardingAgentQuestion;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getAgentOnboardingUpdateApiV1BoardsBoardIdOnboardingAgentPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
/**
|
||||
* @summary Confirm Onboarding
|
||||
*/
|
||||
export type confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse200 =
|
||||
{
|
||||
data: BoardRead;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse422 =
|
||||
{
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponseSuccess =
|
||||
confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponseError =
|
||||
confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse =
|
||||
| confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponseSuccess
|
||||
| confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponseError;
|
||||
|
||||
export const getConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostUrl = (
|
||||
boardId: string,
|
||||
) => {
|
||||
return `/api/v1/boards/${boardId}/onboarding/confirm`;
|
||||
};
|
||||
|
||||
export const confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost = async (
|
||||
boardId: string,
|
||||
boardOnboardingConfirm: BoardOnboardingConfirm,
|
||||
options?: RequestInit,
|
||||
): Promise<confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse> => {
|
||||
return customFetch<confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostResponse>(
|
||||
getConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostUrl(boardId),
|
||||
{
|
||||
...options,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", ...options?.headers },
|
||||
body: JSON.stringify(boardOnboardingConfirm),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostMutationOptions =
|
||||
<TError = HTTPValidationError, TContext = unknown>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingConfirm },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = [
|
||||
"confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost",
|
||||
];
|
||||
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 confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost
|
||||
>
|
||||
>,
|
||||
{ boardId: string; data: BoardOnboardingConfirm }
|
||||
> = (props) => {
|
||||
const { boardId, data } = props ?? {};
|
||||
|
||||
return confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost(
|
||||
boardId,
|
||||
data,
|
||||
requestOptions,
|
||||
);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type ConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostMutationResult =
|
||||
NonNullable<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost
|
||||
>
|
||||
>
|
||||
>;
|
||||
export type ConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostMutationBody =
|
||||
BoardOnboardingConfirm;
|
||||
export type ConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostMutationError =
|
||||
HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary Confirm Onboarding
|
||||
*/
|
||||
export const useConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost = <
|
||||
TError = HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<
|
||||
ReturnType<
|
||||
typeof confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost
|
||||
>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingConfirm },
|
||||
TContext
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<
|
||||
ReturnType<typeof confirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPost>
|
||||
>,
|
||||
TError,
|
||||
{ boardId: string; data: BoardOnboardingConfirm },
|
||||
TContext
|
||||
> => {
|
||||
return useMutation(
|
||||
getConfirmOnboardingApiV1BoardsBoardIdOnboardingConfirmPostMutationOptions(
|
||||
options,
|
||||
),
|
||||
queryClient,
|
||||
);
|
||||
};
|
||||
@@ -24,8 +24,8 @@ import type {
|
||||
BoardCreate,
|
||||
BoardRead,
|
||||
BoardUpdate,
|
||||
DeleteBoardApiV1BoardsBoardIdDelete200,
|
||||
HTTPValidationError,
|
||||
OkResponse,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
@@ -653,7 +653,7 @@ export const useUpdateBoardApiV1BoardsBoardIdPatch = <
|
||||
* @summary Delete Board
|
||||
*/
|
||||
export type deleteBoardApiV1BoardsBoardIdDeleteResponse200 = {
|
||||
data: DeleteBoardApiV1BoardsBoardIdDelete200;
|
||||
data: OkResponse;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
|
||||
2191
frontend/src/api/generated/gateways/gateways.ts
Normal file
2191
frontend/src/api/generated/gateways/gateways.ts
Normal file
File diff suppressed because it is too large
Load Diff
243
frontend/src/api/generated/metrics/metrics.ts
Normal file
243
frontend/src/api/generated/metrics/metrics.ts
Normal file
@@ -0,0 +1,243 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
DefinedUseQueryResult,
|
||||
QueryClient,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UndefinedInitialDataOptions,
|
||||
UseQueryOptions,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
|
||||
import type {
|
||||
DashboardMetrics,
|
||||
DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
HTTPValidationError,
|
||||
} from ".././model";
|
||||
|
||||
import { customFetch } from "../../mutator";
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
/**
|
||||
* @summary Dashboard Metrics
|
||||
*/
|
||||
export type dashboardMetricsApiV1MetricsDashboardGetResponse200 = {
|
||||
data: DashboardMetrics;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type dashboardMetricsApiV1MetricsDashboardGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type dashboardMetricsApiV1MetricsDashboardGetResponseSuccess =
|
||||
dashboardMetricsApiV1MetricsDashboardGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type dashboardMetricsApiV1MetricsDashboardGetResponseError =
|
||||
dashboardMetricsApiV1MetricsDashboardGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type dashboardMetricsApiV1MetricsDashboardGetResponse =
|
||||
| dashboardMetricsApiV1MetricsDashboardGetResponseSuccess
|
||||
| dashboardMetricsApiV1MetricsDashboardGetResponseError;
|
||||
|
||||
export const getDashboardMetricsApiV1MetricsDashboardGetUrl = (
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
) => {
|
||||
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/metrics/dashboard?${stringifiedParams}`
|
||||
: `/api/v1/metrics/dashboard`;
|
||||
};
|
||||
|
||||
export const dashboardMetricsApiV1MetricsDashboardGet = async (
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<dashboardMetricsApiV1MetricsDashboardGetResponse> => {
|
||||
return customFetch<dashboardMetricsApiV1MetricsDashboardGetResponse>(
|
||||
getDashboardMetricsApiV1MetricsDashboardGetUrl(params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getDashboardMetricsApiV1MetricsDashboardGetQueryKey = (
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
) => {
|
||||
return [`/api/v1/metrics/dashboard`, ...(params ? [params] : [])] as const;
|
||||
};
|
||||
|
||||
export const getDashboardMetricsApiV1MetricsDashboardGetQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getDashboardMetricsApiV1MetricsDashboardGetQueryKey(params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>
|
||||
> = ({ signal }) =>
|
||||
dashboardMetricsApiV1MetricsDashboardGet(params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type DashboardMetricsApiV1MetricsDashboardGetQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>
|
||||
>;
|
||||
export type DashboardMetricsApiV1MetricsDashboardGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useDashboardMetricsApiV1MetricsDashboardGet<
|
||||
TData = Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params: undefined | DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useDashboardMetricsApiV1MetricsDashboardGet<
|
||||
TData = Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useDashboardMetricsApiV1MetricsDashboardGet<
|
||||
TData = Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Dashboard Metrics
|
||||
*/
|
||||
|
||||
export function useDashboardMetricsApiV1MetricsDashboardGet<
|
||||
TData = Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
params?: DashboardMetricsApiV1MetricsDashboardGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof dashboardMetricsApiV1MetricsDashboardGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getDashboardMetricsApiV1MetricsDashboardGetQueryOptions(
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
@@ -5,10 +5,15 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { AgentCreateHeartbeatConfig } from "./agentCreateHeartbeatConfig";
|
||||
import type { AgentCreateIdentityProfile } from "./agentCreateIdentityProfile";
|
||||
|
||||
export interface AgentCreate {
|
||||
board_id?: string | null;
|
||||
/** @minLength 1 */
|
||||
name: string;
|
||||
status?: string;
|
||||
heartbeat_config?: AgentCreateHeartbeatConfig;
|
||||
identity_profile?: AgentCreateIdentityProfile;
|
||||
identity_template?: string | null;
|
||||
soul_template?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type AgentCreateIdentityProfile = { [key: string]: unknown } | null;
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
export interface AgentHeartbeatCreate {
|
||||
status?: string | null;
|
||||
/** @minLength 1 */
|
||||
name: string;
|
||||
board_id?: string | null;
|
||||
}
|
||||
|
||||
11
frontend/src/api/generated/model/agentNudge.ts
Normal file
11
frontend/src/api/generated/model/agentNudge.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface AgentNudge {
|
||||
/** @minLength 1 */
|
||||
message: string;
|
||||
}
|
||||
@@ -5,13 +5,20 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { AgentReadHeartbeatConfig } from "./agentReadHeartbeatConfig";
|
||||
import type { AgentReadIdentityProfile } from "./agentReadIdentityProfile";
|
||||
|
||||
export interface AgentRead {
|
||||
board_id?: string | null;
|
||||
/** @minLength 1 */
|
||||
name: string;
|
||||
status?: string;
|
||||
heartbeat_config?: AgentReadHeartbeatConfig;
|
||||
identity_profile?: AgentReadIdentityProfile;
|
||||
identity_template?: string | null;
|
||||
soul_template?: string | null;
|
||||
id: string;
|
||||
is_board_lead?: boolean;
|
||||
is_gateway_main?: boolean;
|
||||
openclaw_session_id?: string | null;
|
||||
last_seen_at: string | null;
|
||||
created_at: string;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type AgentReadIdentityProfile = { [key: string]: unknown } | null;
|
||||
@@ -5,10 +5,15 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { AgentUpdateHeartbeatConfig } from "./agentUpdateHeartbeatConfig";
|
||||
import type { AgentUpdateIdentityProfile } from "./agentUpdateIdentityProfile";
|
||||
|
||||
export interface AgentUpdate {
|
||||
board_id?: string | null;
|
||||
is_gateway_main?: boolean | null;
|
||||
name?: string | null;
|
||||
status?: string | null;
|
||||
heartbeat_config?: AgentUpdateHeartbeatConfig;
|
||||
identity_profile?: AgentUpdateIdentityProfile;
|
||||
identity_template?: string | null;
|
||||
soul_template?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type AgentUpdateIdentityProfile = { [key: string]: unknown } | null;
|
||||
18
frontend/src/api/generated/model/approvalCreate.ts
Normal file
18
frontend/src/api/generated/model/approvalCreate.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ApprovalCreatePayload } from "./approvalCreatePayload";
|
||||
import type { ApprovalCreateRubricScores } from "./approvalCreateRubricScores";
|
||||
import type { ApprovalCreateStatus } from "./approvalCreateStatus";
|
||||
|
||||
export interface ApprovalCreate {
|
||||
action_type: string;
|
||||
payload?: ApprovalCreatePayload;
|
||||
confidence: number;
|
||||
rubric_scores?: ApprovalCreateRubricScores;
|
||||
status?: ApprovalCreateStatus;
|
||||
agent_id?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalCreatePayload = { [key: string]: unknown } | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalCreateRubricScores = { [key: string]: number } | null;
|
||||
15
frontend/src/api/generated/model/approvalCreateStatus.ts
Normal file
15
frontend/src/api/generated/model/approvalCreateStatus.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalCreateStatus =
|
||||
(typeof ApprovalCreateStatus)[keyof typeof ApprovalCreateStatus];
|
||||
|
||||
export const ApprovalCreateStatus = {
|
||||
pending: "pending",
|
||||
approved: "approved",
|
||||
rejected: "rejected",
|
||||
} as const;
|
||||
22
frontend/src/api/generated/model/approvalRead.ts
Normal file
22
frontend/src/api/generated/model/approvalRead.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ApprovalReadPayload } from "./approvalReadPayload";
|
||||
import type { ApprovalReadRubricScores } from "./approvalReadRubricScores";
|
||||
import type { ApprovalReadStatus } from "./approvalReadStatus";
|
||||
|
||||
export interface ApprovalRead {
|
||||
action_type: string;
|
||||
payload?: ApprovalReadPayload;
|
||||
confidence: number;
|
||||
rubric_scores?: ApprovalReadRubricScores;
|
||||
status?: ApprovalReadStatus;
|
||||
id: string;
|
||||
board_id: string;
|
||||
agent_id?: string | null;
|
||||
created_at: string;
|
||||
resolved_at?: string | null;
|
||||
}
|
||||
8
frontend/src/api/generated/model/approvalReadPayload.ts
Normal file
8
frontend/src/api/generated/model/approvalReadPayload.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalReadPayload = { [key: string]: unknown } | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalReadRubricScores = { [key: string]: number } | null;
|
||||
15
frontend/src/api/generated/model/approvalReadStatus.ts
Normal file
15
frontend/src/api/generated/model/approvalReadStatus.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ApprovalReadStatus =
|
||||
(typeof ApprovalReadStatus)[keyof typeof ApprovalReadStatus];
|
||||
|
||||
export const ApprovalReadStatus = {
|
||||
pending: "pending",
|
||||
approved: "approved",
|
||||
rejected: "rejected",
|
||||
} as const;
|
||||
10
frontend/src/api/generated/model/approvalUpdate.ts
Normal file
10
frontend/src/api/generated/model/approvalUpdate.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface ApprovalUpdate {
|
||||
status?: "pending" | "approved" | "rejected" | null;
|
||||
}
|
||||
@@ -4,9 +4,16 @@
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardCreateSuccessMetrics } from "./boardCreateSuccessMetrics";
|
||||
|
||||
export interface BoardCreate {
|
||||
name: string;
|
||||
slug: string;
|
||||
gateway_id?: string | null;
|
||||
gateway_id: string;
|
||||
board_type?: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: BoardCreateSuccessMetrics;
|
||||
target_date?: string | null;
|
||||
goal_confirmed?: boolean;
|
||||
goal_source?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardCreateSuccessMetrics = { [key: string]: unknown } | null;
|
||||
13
frontend/src/api/generated/model/boardMemoryCreate.ts
Normal file
13
frontend/src/api/generated/model/boardMemoryCreate.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface BoardMemoryCreate {
|
||||
/** @minLength 1 */
|
||||
content: string;
|
||||
tags?: string[] | null;
|
||||
source?: string | null;
|
||||
}
|
||||
16
frontend/src/api/generated/model/boardMemoryRead.ts
Normal file
16
frontend/src/api/generated/model/boardMemoryRead.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface BoardMemoryRead {
|
||||
/** @minLength 1 */
|
||||
content: string;
|
||||
tags?: string[] | null;
|
||||
source?: string | null;
|
||||
id: string;
|
||||
board_id: string;
|
||||
created_at: string;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardOnboardingAgentCompleteSuccessMetrics } from "./boardOnboardingAgentCompleteSuccessMetrics";
|
||||
|
||||
export interface BoardOnboardingAgentComplete {
|
||||
board_type: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: BoardOnboardingAgentCompleteSuccessMetrics;
|
||||
target_date?: string | null;
|
||||
status: "complete";
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardOnboardingAgentCompleteSuccessMetrics = {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardOnboardingQuestionOption } from "./boardOnboardingQuestionOption";
|
||||
|
||||
export interface BoardOnboardingAgentQuestion {
|
||||
/** @minLength 1 */
|
||||
question: string;
|
||||
/** @minItems 1 */
|
||||
options: BoardOnboardingQuestionOption[];
|
||||
}
|
||||
12
frontend/src/api/generated/model/boardOnboardingAnswer.ts
Normal file
12
frontend/src/api/generated/model/boardOnboardingAnswer.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface BoardOnboardingAnswer {
|
||||
/** @minLength 1 */
|
||||
answer: string;
|
||||
other_text?: string | null;
|
||||
}
|
||||
14
frontend/src/api/generated/model/boardOnboardingConfirm.ts
Normal file
14
frontend/src/api/generated/model/boardOnboardingConfirm.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardOnboardingConfirmSuccessMetrics } from "./boardOnboardingConfirmSuccessMetrics";
|
||||
|
||||
export interface BoardOnboardingConfirm {
|
||||
board_type: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: BoardOnboardingConfirmSuccessMetrics;
|
||||
target_date?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardOnboardingConfirmSuccessMetrics = {
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface BoardOnboardingQuestionOption {
|
||||
/** @minLength 1 */
|
||||
id: string;
|
||||
/** @minLength 1 */
|
||||
label: string;
|
||||
}
|
||||
19
frontend/src/api/generated/model/boardOnboardingRead.ts
Normal file
19
frontend/src/api/generated/model/boardOnboardingRead.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardOnboardingReadDraftGoal } from "./boardOnboardingReadDraftGoal";
|
||||
import type { BoardOnboardingReadMessages } from "./boardOnboardingReadMessages";
|
||||
|
||||
export interface BoardOnboardingRead {
|
||||
id: string;
|
||||
board_id: string;
|
||||
session_key: string;
|
||||
status: string;
|
||||
messages?: BoardOnboardingReadMessages;
|
||||
draft_goal?: BoardOnboardingReadDraftGoal;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardOnboardingReadDraftGoal = { [key: string]: unknown } | null;
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardOnboardingReadMessages = { [key: string]: unknown }[] | null;
|
||||
10
frontend/src/api/generated/model/boardOnboardingStart.ts
Normal file
10
frontend/src/api/generated/model/boardOnboardingStart.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface BoardOnboardingStart {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
@@ -4,11 +4,18 @@
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardReadSuccessMetrics } from "./boardReadSuccessMetrics";
|
||||
|
||||
export interface BoardRead {
|
||||
name: string;
|
||||
slug: string;
|
||||
gateway_id?: string | null;
|
||||
board_type?: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: BoardReadSuccessMetrics;
|
||||
target_date?: string | null;
|
||||
goal_confirmed?: boolean;
|
||||
goal_source?: string | null;
|
||||
id: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardReadSuccessMetrics = { [key: string]: unknown } | null;
|
||||
@@ -4,9 +4,16 @@
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { BoardUpdateSuccessMetrics } from "./boardUpdateSuccessMetrics";
|
||||
|
||||
export interface BoardUpdate {
|
||||
name?: string | null;
|
||||
slug?: string | null;
|
||||
gateway_id?: string | null;
|
||||
board_type?: string | null;
|
||||
objective?: string | null;
|
||||
success_metrics?: BoardUpdateSuccessMetrics;
|
||||
target_date?: string | null;
|
||||
goal_confirmed?: boolean | null;
|
||||
goal_source?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type BoardUpdateSuccessMetrics = { [key: string]: unknown } | null;
|
||||
13
frontend/src/api/generated/model/dashboardKpis.ts
Normal file
13
frontend/src/api/generated/model/dashboardKpis.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface DashboardKpis {
|
||||
active_agents: number;
|
||||
tasks_in_progress: number;
|
||||
error_rate_pct: number;
|
||||
median_cycle_time_hours_7d: number | null;
|
||||
}
|
||||
20
frontend/src/api/generated/model/dashboardMetrics.ts
Normal file
20
frontend/src/api/generated/model/dashboardMetrics.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardKpis } from "./dashboardKpis";
|
||||
import type { DashboardMetricsRange } from "./dashboardMetricsRange";
|
||||
import type { DashboardSeriesSet } from "./dashboardSeriesSet";
|
||||
import type { DashboardWipSeriesSet } from "./dashboardWipSeriesSet";
|
||||
|
||||
export interface DashboardMetrics {
|
||||
range: DashboardMetricsRange;
|
||||
generated_at: string;
|
||||
kpis: DashboardKpis;
|
||||
throughput: DashboardSeriesSet;
|
||||
cycle_time: DashboardSeriesSet;
|
||||
error_rate: DashboardSeriesSet;
|
||||
wip: DashboardWipSeriesSet;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardMetricsApiV1MetricsDashboardGetRange } from "./dashboardMetricsApiV1MetricsDashboardGetRange";
|
||||
|
||||
export type DashboardMetricsApiV1MetricsDashboardGetParams = {
|
||||
range?: DashboardMetricsApiV1MetricsDashboardGetRange;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardMetricsApiV1MetricsDashboardGetRange =
|
||||
(typeof DashboardMetricsApiV1MetricsDashboardGetRange)[keyof typeof DashboardMetricsApiV1MetricsDashboardGetRange];
|
||||
|
||||
export const DashboardMetricsApiV1MetricsDashboardGetRange = {
|
||||
"24h": "24h",
|
||||
"7d": "7d",
|
||||
} as const;
|
||||
14
frontend/src/api/generated/model/dashboardMetricsRange.ts
Normal file
14
frontend/src/api/generated/model/dashboardMetricsRange.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardMetricsRange =
|
||||
(typeof DashboardMetricsRange)[keyof typeof DashboardMetricsRange];
|
||||
|
||||
export const DashboardMetricsRange = {
|
||||
"24h": "24h",
|
||||
"7d": "7d",
|
||||
} as const;
|
||||
15
frontend/src/api/generated/model/dashboardRangeSeries.ts
Normal file
15
frontend/src/api/generated/model/dashboardRangeSeries.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardRangeSeriesBucket } from "./dashboardRangeSeriesBucket";
|
||||
import type { DashboardRangeSeriesRange } from "./dashboardRangeSeriesRange";
|
||||
import type { DashboardSeriesPoint } from "./dashboardSeriesPoint";
|
||||
|
||||
export interface DashboardRangeSeries {
|
||||
range: DashboardRangeSeriesRange;
|
||||
bucket: DashboardRangeSeriesBucket;
|
||||
points: DashboardSeriesPoint[];
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardRangeSeriesBucket =
|
||||
(typeof DashboardRangeSeriesBucket)[keyof typeof DashboardRangeSeriesBucket];
|
||||
|
||||
export const DashboardRangeSeriesBucket = {
|
||||
hour: "hour",
|
||||
day: "day",
|
||||
} as const;
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardRangeSeriesRange =
|
||||
(typeof DashboardRangeSeriesRange)[keyof typeof DashboardRangeSeriesRange];
|
||||
|
||||
export const DashboardRangeSeriesRange = {
|
||||
"24h": "24h",
|
||||
"7d": "7d",
|
||||
} as const;
|
||||
11
frontend/src/api/generated/model/dashboardSeriesPoint.ts
Normal file
11
frontend/src/api/generated/model/dashboardSeriesPoint.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface DashboardSeriesPoint {
|
||||
period: string;
|
||||
value: number;
|
||||
}
|
||||
12
frontend/src/api/generated/model/dashboardSeriesSet.ts
Normal file
12
frontend/src/api/generated/model/dashboardSeriesSet.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardRangeSeries } from "./dashboardRangeSeries";
|
||||
|
||||
export interface DashboardSeriesSet {
|
||||
primary: DashboardRangeSeries;
|
||||
comparison: DashboardRangeSeries;
|
||||
}
|
||||
13
frontend/src/api/generated/model/dashboardWipPoint.ts
Normal file
13
frontend/src/api/generated/model/dashboardWipPoint.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface DashboardWipPoint {
|
||||
period: string;
|
||||
inbox: number;
|
||||
in_progress: number;
|
||||
review: number;
|
||||
}
|
||||
15
frontend/src/api/generated/model/dashboardWipRangeSeries.ts
Normal file
15
frontend/src/api/generated/model/dashboardWipRangeSeries.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardWipPoint } from "./dashboardWipPoint";
|
||||
import type { DashboardWipRangeSeriesBucket } from "./dashboardWipRangeSeriesBucket";
|
||||
import type { DashboardWipRangeSeriesRange } from "./dashboardWipRangeSeriesRange";
|
||||
|
||||
export interface DashboardWipRangeSeries {
|
||||
range: DashboardWipRangeSeriesRange;
|
||||
bucket: DashboardWipRangeSeriesBucket;
|
||||
points: DashboardWipPoint[];
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardWipRangeSeriesBucket =
|
||||
(typeof DashboardWipRangeSeriesBucket)[keyof typeof DashboardWipRangeSeriesBucket];
|
||||
|
||||
export const DashboardWipRangeSeriesBucket = {
|
||||
hour: "hour",
|
||||
day: "day",
|
||||
} as const;
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type DashboardWipRangeSeriesRange =
|
||||
(typeof DashboardWipRangeSeriesRange)[keyof typeof DashboardWipRangeSeriesRange];
|
||||
|
||||
export const DashboardWipRangeSeriesRange = {
|
||||
"24h": "24h",
|
||||
"7d": "7d",
|
||||
} as const;
|
||||
12
frontend/src/api/generated/model/dashboardWipSeriesSet.ts
Normal file
12
frontend/src/api/generated/model/dashboardWipSeriesSet.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DashboardWipRangeSeries } from "./dashboardWipRangeSeries";
|
||||
|
||||
export interface DashboardWipSeriesSet {
|
||||
primary: DashboardWipRangeSeries;
|
||||
comparison: DashboardWipRangeSeries;
|
||||
}
|
||||
12
frontend/src/api/generated/model/gatewayCommandsResponse.ts
Normal file
12
frontend/src/api/generated/model/gatewayCommandsResponse.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewayCommandsResponse {
|
||||
protocol_version: number;
|
||||
methods: string[];
|
||||
events: string[];
|
||||
}
|
||||
15
frontend/src/api/generated/model/gatewayCreate.ts
Normal file
15
frontend/src/api/generated/model/gatewayCreate.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewayCreate {
|
||||
name: string;
|
||||
url: string;
|
||||
main_session_key: string;
|
||||
workspace_root: string;
|
||||
skyll_enabled?: boolean;
|
||||
token?: string | null;
|
||||
}
|
||||
18
frontend/src/api/generated/model/gatewayRead.ts
Normal file
18
frontend/src/api/generated/model/gatewayRead.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewayRead {
|
||||
name: string;
|
||||
url: string;
|
||||
main_session_key: string;
|
||||
workspace_root: string;
|
||||
skyll_enabled?: boolean;
|
||||
id: string;
|
||||
token?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewaySessionHistoryResponse {
|
||||
history: unknown[];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewaySessionMessageRequest {
|
||||
/** @minLength 1 */
|
||||
content: string;
|
||||
}
|
||||
10
frontend/src/api/generated/model/gatewaySessionResponse.ts
Normal file
10
frontend/src/api/generated/model/gatewaySessionResponse.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewaySessionResponse {
|
||||
session: unknown;
|
||||
}
|
||||
12
frontend/src/api/generated/model/gatewaySessionsResponse.ts
Normal file
12
frontend/src/api/generated/model/gatewaySessionsResponse.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewaySessionsResponse {
|
||||
sessions: unknown[];
|
||||
main_session_key?: string | null;
|
||||
main_session?: unknown | null;
|
||||
}
|
||||
15
frontend/src/api/generated/model/gatewayUpdate.ts
Normal file
15
frontend/src/api/generated/model/gatewayUpdate.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewayUpdate {
|
||||
name?: string | null;
|
||||
url?: string | null;
|
||||
token?: string | null;
|
||||
main_session_key?: string | null;
|
||||
workspace_root?: string | null;
|
||||
skyll_enabled?: boolean | null;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GatewaysStatusApiV1GatewaysStatusGetParams = {
|
||||
board_id?: string | null;
|
||||
gateway_url?: string | null;
|
||||
gateway_token?: string | null;
|
||||
gateway_main_session_key?: string | null;
|
||||
};
|
||||
17
frontend/src/api/generated/model/gatewaysStatusResponse.ts
Normal file
17
frontend/src/api/generated/model/gatewaysStatusResponse.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface GatewaysStatusResponse {
|
||||
connected: boolean;
|
||||
gateway_url: string;
|
||||
sessions_count?: number | null;
|
||||
sessions?: unknown[] | null;
|
||||
main_session_key?: string | null;
|
||||
main_session?: unknown | null;
|
||||
main_session_error?: string | null;
|
||||
error?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GetGatewaySessionApiV1GatewaysSessionsSessionIdGetParams = {
|
||||
board_id?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type GetSessionHistoryApiV1GatewaysSessionsSessionIdHistoryGetParams = {
|
||||
board_id?: string | null;
|
||||
};
|
||||
@@ -8,45 +8,117 @@
|
||||
export * from "./activityEventRead";
|
||||
export * from "./agentCreate";
|
||||
export * from "./agentCreateHeartbeatConfig";
|
||||
export * from "./agentCreateIdentityProfile";
|
||||
export * from "./agentDeleteConfirm";
|
||||
export * from "./agentHeartbeat";
|
||||
export * from "./agentHeartbeatCreate";
|
||||
export * from "./agentNudge";
|
||||
export * from "./agentProvisionConfirm";
|
||||
export * from "./agentRead";
|
||||
export * from "./agentReadHeartbeatConfig";
|
||||
export * from "./agentReadIdentityProfile";
|
||||
export * from "./agentUpdate";
|
||||
export * from "./agentUpdateHeartbeatConfig";
|
||||
export * from "./agentUpdateIdentityProfile";
|
||||
export * from "./approvalCreate";
|
||||
export * from "./approvalCreatePayload";
|
||||
export * from "./approvalCreateRubricScores";
|
||||
export * from "./approvalCreateStatus";
|
||||
export * from "./approvalRead";
|
||||
export * from "./approvalReadPayload";
|
||||
export * from "./approvalReadRubricScores";
|
||||
export * from "./approvalReadStatus";
|
||||
export * from "./approvalUpdate";
|
||||
export * from "./boardCreate";
|
||||
export * from "./boardCreateSuccessMetrics";
|
||||
export * from "./boardMemoryCreate";
|
||||
export * from "./boardMemoryRead";
|
||||
export * from "./boardOnboardingAgentComplete";
|
||||
export * from "./boardOnboardingAgentCompleteSuccessMetrics";
|
||||
export * from "./boardOnboardingAgentQuestion";
|
||||
export * from "./boardOnboardingAnswer";
|
||||
export * from "./boardOnboardingConfirm";
|
||||
export * from "./boardOnboardingConfirmSuccessMetrics";
|
||||
export * from "./boardOnboardingQuestionOption";
|
||||
export * from "./boardOnboardingRead";
|
||||
export * from "./boardOnboardingReadDraftGoal";
|
||||
export * from "./boardOnboardingReadMessages";
|
||||
export * from "./boardOnboardingStart";
|
||||
export * from "./boardRead";
|
||||
export * from "./boardReadSuccessMetrics";
|
||||
export * from "./boardUpdate";
|
||||
export * from "./boardUpdateSuccessMetrics";
|
||||
export * from "./confirmDeleteAgentApiV1AgentsAgentIdDeleteConfirmPost200";
|
||||
export * from "./confirmProvisionAgentApiV1AgentsAgentIdProvisionConfirmPost200";
|
||||
export * from "./dashboardKpis";
|
||||
export * from "./dashboardMetrics";
|
||||
export * from "./dashboardMetricsApiV1MetricsDashboardGetParams";
|
||||
export * from "./dashboardMetricsApiV1MetricsDashboardGetRange";
|
||||
export * from "./dashboardMetricsRange";
|
||||
export * from "./dashboardRangeSeries";
|
||||
export * from "./dashboardRangeSeriesBucket";
|
||||
export * from "./dashboardRangeSeriesRange";
|
||||
export * from "./dashboardSeriesPoint";
|
||||
export * from "./dashboardSeriesSet";
|
||||
export * from "./dashboardWipPoint";
|
||||
export * from "./dashboardWipRangeSeries";
|
||||
export * from "./dashboardWipRangeSeriesBucket";
|
||||
export * from "./dashboardWipRangeSeriesRange";
|
||||
export * from "./dashboardWipSeriesSet";
|
||||
export * from "./deleteAgentApiV1AgentsAgentIdDelete200";
|
||||
export * from "./deleteBoardApiV1BoardsBoardIdDelete200";
|
||||
export * from "./deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200";
|
||||
export * from "./gatewayCommandsApiV1GatewayCommandsGet200";
|
||||
export * from "./gatewayCommandsResponse";
|
||||
export * from "./gatewayCreate";
|
||||
export * from "./gatewayRead";
|
||||
export * from "./gatewaySessionHistoryResponse";
|
||||
export * from "./gatewaySessionMessageRequest";
|
||||
export * from "./gatewaySessionResponse";
|
||||
export * from "./gatewaySessionsResponse";
|
||||
export * from "./gatewaysStatusApiV1GatewaysStatusGetParams";
|
||||
export * from "./gatewaysStatusResponse";
|
||||
export * from "./gatewayStatusApiV1GatewayStatusGet200";
|
||||
export * from "./gatewayStatusApiV1GatewayStatusGetParams";
|
||||
export * from "./gatewayUpdate";
|
||||
export * from "./getGatewaySessionApiV1GatewaySessionsSessionIdGet200";
|
||||
export * from "./getGatewaySessionApiV1GatewaySessionsSessionIdGetParams";
|
||||
export * from "./getGatewaySessionApiV1GatewaysSessionsSessionIdGetParams";
|
||||
export * from "./getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGet200";
|
||||
export * from "./getSessionHistoryApiV1GatewaySessionsSessionIdHistoryGetParams";
|
||||
export * from "./getSessionHistoryApiV1GatewaysSessionsSessionIdHistoryGetParams";
|
||||
export * from "./healthHealthGet200";
|
||||
export * from "./healthzHealthzGet200";
|
||||
export * from "./hTTPValidationError";
|
||||
export * from "./listActivityApiV1ActivityGetParams";
|
||||
export * from "./listAgentsApiV1AgentAgentsGetParams";
|
||||
export * from "./listApprovalsApiV1AgentBoardsBoardIdApprovalsGetParams";
|
||||
export * from "./listApprovalsApiV1BoardsBoardIdApprovalsGetParams";
|
||||
export * from "./listBoardMemoryApiV1AgentBoardsBoardIdMemoryGetParams";
|
||||
export * from "./listBoardMemoryApiV1BoardsBoardIdMemoryGetParams";
|
||||
export * from "./listGatewaySessionsApiV1GatewaysSessionsGetParams";
|
||||
export * from "./listSessionsApiV1GatewaySessionsGet200";
|
||||
export * from "./listSessionsApiV1GatewaySessionsGetParams";
|
||||
export * from "./listTasksApiV1AgentBoardsBoardIdTasksGetParams";
|
||||
export * from "./listTasksApiV1BoardsBoardIdTasksGetParams";
|
||||
export * from "./okResponse";
|
||||
export * from "./readyzReadyzGet200";
|
||||
export * from "./sendGatewaySessionMessageApiV1GatewaysSessionsSessionIdMessagePostParams";
|
||||
export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePost200";
|
||||
export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostBody";
|
||||
export * from "./sendSessionMessageApiV1GatewaySessionsSessionIdMessagePostParams";
|
||||
export * from "./streamAgentsApiV1AgentsStreamGetParams";
|
||||
export * from "./streamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams";
|
||||
export * from "./streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams";
|
||||
export * from "./streamTasksApiV1BoardsBoardIdTasksStreamGetParams";
|
||||
export * from "./taskCommentCreate";
|
||||
export * from "./taskCommentRead";
|
||||
export * from "./taskCreate";
|
||||
export * from "./taskCreateStatus";
|
||||
export * from "./taskRead";
|
||||
export * from "./taskReadStatus";
|
||||
export * from "./taskUpdate";
|
||||
export * from "./updateAgentApiV1AgentsAgentIdPatchParams";
|
||||
export * from "./userRead";
|
||||
export * from "./userUpdate";
|
||||
export * from "./validationError";
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListAgentsApiV1AgentAgentsGetParams = {
|
||||
board_id?: string | null;
|
||||
limit?: number | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListApprovalsApiV1AgentBoardsBoardIdApprovalsGetParams = {
|
||||
status?: "pending" | "approved" | "rejected" | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListApprovalsApiV1BoardsBoardIdApprovalsGetParams = {
|
||||
status?: "pending" | "approved" | "rejected" | null;
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListBoardMemoryApiV1AgentBoardsBoardIdMemoryGetParams = {
|
||||
/**
|
||||
* @minimum 1
|
||||
* @maximum 200
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* @minimum 0
|
||||
*/
|
||||
offset?: number;
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListBoardMemoryApiV1BoardsBoardIdMemoryGetParams = {
|
||||
/**
|
||||
* @minimum 1
|
||||
* @maximum 200
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* @minimum 0
|
||||
*/
|
||||
offset?: number;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListGatewaySessionsApiV1GatewaysSessionsGetParams = {
|
||||
board_id?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ListTasksApiV1AgentBoardsBoardIdTasksGetParams = {
|
||||
status?: string | null;
|
||||
assigned_agent_id?: string | null;
|
||||
unassigned?: boolean | null;
|
||||
limit?: number | null;
|
||||
};
|
||||
10
frontend/src/api/generated/model/okResponse.ts
Normal file
10
frontend/src/api/generated/model/okResponse.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface OkResponse {
|
||||
ok?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type SendGatewaySessionMessageApiV1GatewaysSessionsSessionIdMessagePostParams =
|
||||
{
|
||||
board_id?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type StreamAgentsApiV1AgentsStreamGetParams = {
|
||||
board_id?: string | null;
|
||||
since?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type StreamApprovalsApiV1BoardsBoardIdApprovalsStreamGetParams = {
|
||||
since?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type StreamBoardMemoryApiV1BoardsBoardIdMemoryStreamGetParams = {
|
||||
since?: string | null;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type StreamTasksApiV1BoardsBoardIdTasksStreamGetParams = {
|
||||
since?: string | null;
|
||||
};
|
||||
@@ -6,5 +6,6 @@
|
||||
*/
|
||||
|
||||
export interface TaskCommentCreate {
|
||||
/** @minLength 1 */
|
||||
message: string;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { TaskCreateStatus } from "./taskCreateStatus";
|
||||
|
||||
export interface TaskCreate {
|
||||
title: string;
|
||||
description?: string | null;
|
||||
status?: string;
|
||||
status?: TaskCreateStatus;
|
||||
priority?: string;
|
||||
due_at?: string | null;
|
||||
assigned_agent_id?: string | null;
|
||||
|
||||
16
frontend/src/api/generated/model/taskCreateStatus.ts
Normal file
16
frontend/src/api/generated/model/taskCreateStatus.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type TaskCreateStatus =
|
||||
(typeof TaskCreateStatus)[keyof typeof TaskCreateStatus];
|
||||
|
||||
export const TaskCreateStatus = {
|
||||
inbox: "inbox",
|
||||
in_progress: "in_progress",
|
||||
review: "review",
|
||||
done: "done",
|
||||
} as const;
|
||||
@@ -4,11 +4,12 @@
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { TaskReadStatus } from "./taskReadStatus";
|
||||
|
||||
export interface TaskRead {
|
||||
title: string;
|
||||
description?: string | null;
|
||||
status?: string;
|
||||
status?: TaskReadStatus;
|
||||
priority?: string;
|
||||
due_at?: string | null;
|
||||
assigned_agent_id?: string | null;
|
||||
|
||||
16
frontend/src/api/generated/model/taskReadStatus.ts
Normal file
16
frontend/src/api/generated/model/taskReadStatus.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type TaskReadStatus =
|
||||
(typeof TaskReadStatus)[keyof typeof TaskReadStatus];
|
||||
|
||||
export const TaskReadStatus = {
|
||||
inbox: "inbox",
|
||||
in_progress: "in_progress",
|
||||
review: "review",
|
||||
done: "done",
|
||||
} as const;
|
||||
@@ -8,7 +8,7 @@
|
||||
export interface TaskUpdate {
|
||||
title?: string | null;
|
||||
description?: string | null;
|
||||
status?: string | null;
|
||||
status?: "inbox" | "in_progress" | "review" | "done" | null;
|
||||
priority?: string | null;
|
||||
due_at?: string | null;
|
||||
assigned_agent_id?: string | null;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Generated by orval v8.2.0 🍺
|
||||
* Do not edit manually.
|
||||
* Mission Control API
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type UpdateAgentApiV1AgentsAgentIdPatchParams = {
|
||||
force?: boolean;
|
||||
};
|
||||
@@ -21,9 +21,10 @@ import type {
|
||||
} from "@tanstack/react-query";
|
||||
|
||||
import type {
|
||||
DeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200,
|
||||
HTTPValidationError,
|
||||
ListTasksApiV1BoardsBoardIdTasksGetParams,
|
||||
OkResponse,
|
||||
StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
TaskCommentCreate,
|
||||
TaskCommentRead,
|
||||
TaskCreate,
|
||||
@@ -35,6 +36,258 @@ import { customFetch } from "../../mutator";
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
/**
|
||||
* @summary Stream Tasks
|
||||
*/
|
||||
export type streamTasksApiV1BoardsBoardIdTasksStreamGetResponse200 = {
|
||||
data: unknown;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
export type streamTasksApiV1BoardsBoardIdTasksStreamGetResponse422 = {
|
||||
data: HTTPValidationError;
|
||||
status: 422;
|
||||
};
|
||||
|
||||
export type streamTasksApiV1BoardsBoardIdTasksStreamGetResponseSuccess =
|
||||
streamTasksApiV1BoardsBoardIdTasksStreamGetResponse200 & {
|
||||
headers: Headers;
|
||||
};
|
||||
export type streamTasksApiV1BoardsBoardIdTasksStreamGetResponseError =
|
||||
streamTasksApiV1BoardsBoardIdTasksStreamGetResponse422 & {
|
||||
headers: Headers;
|
||||
};
|
||||
|
||||
export type streamTasksApiV1BoardsBoardIdTasksStreamGetResponse =
|
||||
| streamTasksApiV1BoardsBoardIdTasksStreamGetResponseSuccess
|
||||
| streamTasksApiV1BoardsBoardIdTasksStreamGetResponseError;
|
||||
|
||||
export const getStreamTasksApiV1BoardsBoardIdTasksStreamGetUrl = (
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
) => {
|
||||
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/boards/${boardId}/tasks/stream?${stringifiedParams}`
|
||||
: `/api/v1/boards/${boardId}/tasks/stream`;
|
||||
};
|
||||
|
||||
export const streamTasksApiV1BoardsBoardIdTasksStreamGet = async (
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options?: RequestInit,
|
||||
): Promise<streamTasksApiV1BoardsBoardIdTasksStreamGetResponse> => {
|
||||
return customFetch<streamTasksApiV1BoardsBoardIdTasksStreamGetResponse>(
|
||||
getStreamTasksApiV1BoardsBoardIdTasksStreamGetUrl(boardId, params),
|
||||
{
|
||||
...options,
|
||||
method: "GET",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getStreamTasksApiV1BoardsBoardIdTasksStreamGetQueryKey = (
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/boards/${boardId}/tasks/stream`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getStreamTasksApiV1BoardsBoardIdTasksStreamGetQueryOptions = <
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getStreamTasksApiV1BoardsBoardIdTasksStreamGetQueryKey(boardId, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>
|
||||
> = ({ signal }) =>
|
||||
streamTasksApiV1BoardsBoardIdTasksStreamGet(boardId, params, {
|
||||
signal,
|
||||
...requestOptions,
|
||||
});
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!boardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type StreamTasksApiV1BoardsBoardIdTasksStreamGetQueryResult =
|
||||
NonNullable<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>
|
||||
>;
|
||||
export type StreamTasksApiV1BoardsBoardIdTasksStreamGetQueryError =
|
||||
HTTPValidationError;
|
||||
|
||||
export function useStreamTasksApiV1BoardsBoardIdTasksStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params: undefined | StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamTasksApiV1BoardsBoardIdTasksStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError,
|
||||
Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useStreamTasksApiV1BoardsBoardIdTasksStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Stream Tasks
|
||||
*/
|
||||
|
||||
export function useStreamTasksApiV1BoardsBoardIdTasksStreamGet<
|
||||
TData = Awaited<
|
||||
ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>
|
||||
>,
|
||||
TError = HTTPValidationError,
|
||||
>(
|
||||
boardId: string,
|
||||
params?: StreamTasksApiV1BoardsBoardIdTasksStreamGetParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<
|
||||
Awaited<ReturnType<typeof streamTasksApiV1BoardsBoardIdTasksStreamGet>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
request?: SecondParameter<typeof customFetch>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions =
|
||||
getStreamTasksApiV1BoardsBoardIdTasksStreamGetQueryOptions(
|
||||
boardId,
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List Tasks
|
||||
*/
|
||||
@@ -521,7 +774,7 @@ export const useUpdateTaskApiV1BoardsBoardIdTasksTaskIdPatch = <
|
||||
* @summary Delete Task
|
||||
*/
|
||||
export type deleteTaskApiV1BoardsBoardIdTasksTaskIdDeleteResponse200 = {
|
||||
data: DeleteTaskApiV1BoardsBoardIdTasksTaskIdDelete200;
|
||||
data: OkResponse;
|
||||
status: 200;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,38 @@
|
||||
type ClerkSession = {
|
||||
getToken: () => Promise<string>;
|
||||
};
|
||||
|
||||
type ClerkGlobal = {
|
||||
session?: ClerkSession | null;
|
||||
};
|
||||
|
||||
export class ApiError<TData = unknown> extends Error {
|
||||
status: number;
|
||||
data: TData | null;
|
||||
|
||||
constructor(status: number, message: string, data: TData | null) {
|
||||
super(message);
|
||||
this.name = "ApiError";
|
||||
this.status = status;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
const resolveClerkToken = async (): Promise<string | null> => {
|
||||
if (typeof window === "undefined") {
|
||||
return null;
|
||||
}
|
||||
const clerk = (window as unknown as { Clerk?: ClerkGlobal }).Clerk;
|
||||
if (!clerk?.session) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return await clerk.session.getToken();
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const customFetch = async <T>(
|
||||
url: string,
|
||||
options: RequestInit
|
||||
@@ -7,21 +42,73 @@ export const customFetch = async <T>(
|
||||
throw new Error("NEXT_PUBLIC_API_URL is not set.");
|
||||
}
|
||||
const baseUrl = rawBaseUrl.replace(/\/+$/, "");
|
||||
|
||||
const headers = new Headers(options.headers);
|
||||
const hasBody = options.body !== undefined && options.body !== null;
|
||||
if (hasBody && !headers.has("Content-Type")) {
|
||||
headers.set("Content-Type", "application/json");
|
||||
}
|
||||
if (!headers.has("Authorization")) {
|
||||
const token = await resolveClerkToken();
|
||||
if (token) {
|
||||
headers.set("Authorization", `Bearer ${token}`);
|
||||
}
|
||||
}
|
||||
|
||||
const response = await fetch(`${baseUrl}${url}`, {
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(options.headers ?? {}),
|
||||
},
|
||||
headers,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Request failed");
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
let errorData: unknown = null;
|
||||
const isJson =
|
||||
contentType.includes("application/json") || contentType.includes("+json");
|
||||
if (isJson) {
|
||||
errorData = (await response.json().catch(() => null)) as unknown;
|
||||
} else {
|
||||
errorData = await response.text().catch(() => "");
|
||||
}
|
||||
|
||||
let message =
|
||||
typeof errorData === "string" && errorData ? errorData : "Request failed";
|
||||
if (errorData && typeof errorData === "object") {
|
||||
const detail = (errorData as { detail?: unknown }).detail;
|
||||
if (typeof detail === "string" && detail) {
|
||||
message = detail;
|
||||
} else if (Array.isArray(detail) && detail.length) {
|
||||
const first = detail[0] as { msg?: unknown };
|
||||
if (first && typeof first === "object" && typeof first.msg === "string") {
|
||||
message = first.msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new ApiError(response.status, message, errorData);
|
||||
}
|
||||
|
||||
if (response.status === 204) {
|
||||
return undefined as T;
|
||||
return {
|
||||
data: undefined,
|
||||
status: response.status,
|
||||
headers: response.headers,
|
||||
} as T;
|
||||
}
|
||||
|
||||
return (await response.json()) as T;
|
||||
const contentType = response.headers.get("content-type") ?? "";
|
||||
const isJson =
|
||||
contentType.includes("application/json") || contentType.includes("+json");
|
||||
if (isJson) {
|
||||
const data = (await response.json()) as unknown;
|
||||
return { data, status: response.status, headers: response.headers } as T;
|
||||
}
|
||||
if (contentType.includes("text/event-stream")) {
|
||||
return {
|
||||
data: response,
|
||||
status: response.status,
|
||||
headers: response.headers,
|
||||
} as T;
|
||||
}
|
||||
const text = await response.text().catch(() => "");
|
||||
return { data: text, status: response.status, headers: response.headers } as T;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
|
||||
import { SignInButton, SignedIn, SignedOut, useAuth } from "@clerk/nextjs";
|
||||
|
||||
import { ApiError } from "@/api/mutator";
|
||||
import {
|
||||
type getAgentApiV1AgentsAgentIdGetResponse,
|
||||
useGetAgentApiV1AgentsAgentIdGet,
|
||||
useUpdateAgentApiV1AgentsAgentIdPatch,
|
||||
} from "@/api/generated/agents/agents";
|
||||
import {
|
||||
type listBoardsApiV1BoardsGetResponse,
|
||||
useListBoardsApiV1BoardsGet,
|
||||
} from "@/api/generated/boards/boards";
|
||||
import type { AgentRead, AgentUpdate, BoardRead } from "@/api/generated/model";
|
||||
import { DashboardSidebar } from "@/components/organisms/DashboardSidebar";
|
||||
import { DashboardShell } from "@/components/templates/DashboardShell";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -20,34 +31,11 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { getApiBaseUrl } from "@/lib/api-base";
|
||||
import {
|
||||
DEFAULT_IDENTITY_PROFILE,
|
||||
DEFAULT_SOUL_TEMPLATE,
|
||||
} from "@/lib/agent-templates";
|
||||
|
||||
const apiBase = getApiBaseUrl();
|
||||
|
||||
type Agent = {
|
||||
id: string;
|
||||
name: string;
|
||||
board_id?: string | null;
|
||||
is_gateway_main?: boolean;
|
||||
heartbeat_config?: {
|
||||
every?: string;
|
||||
target?: string;
|
||||
} | null;
|
||||
identity_profile?: IdentityProfile | null;
|
||||
identity_template?: string | null;
|
||||
soul_template?: string | null;
|
||||
};
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
type IdentityProfile = {
|
||||
role: string;
|
||||
communication_style: string;
|
||||
@@ -72,7 +60,7 @@ const HEARTBEAT_TARGET_OPTIONS: SearchableSelectOption[] = [
|
||||
{ value: "last", label: "Last channel" },
|
||||
];
|
||||
|
||||
const getBoardOptions = (boards: Board[]): SearchableSelectOption[] =>
|
||||
const getBoardOptions = (boards: BoardRead[]): SearchableSelectOption[] =>
|
||||
boards.map((board) => ({
|
||||
value: board.id,
|
||||
label: board.name,
|
||||
@@ -100,157 +88,169 @@ const withIdentityDefaults = (
|
||||
});
|
||||
|
||||
export default function EditAgentPage() {
|
||||
const { getToken, isSignedIn } = useAuth();
|
||||
const { isSignedIn } = useAuth();
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
const agentIdParam = params?.agentId;
|
||||
const agentId = Array.isArray(agentIdParam) ? agentIdParam[0] : agentIdParam;
|
||||
|
||||
const [agent, setAgent] = useState<Agent | null>(null);
|
||||
const [name, setName] = useState("");
|
||||
const [boards, setBoards] = useState<Board[]>([]);
|
||||
const [boardId, setBoardId] = useState("");
|
||||
const [boardTouched, setBoardTouched] = useState(false);
|
||||
const [isGatewayMain, setIsGatewayMain] = useState(false);
|
||||
const [heartbeatEvery, setHeartbeatEvery] = useState("10m");
|
||||
const [heartbeatTarget, setHeartbeatTarget] = useState("none");
|
||||
const [identityProfile, setIdentityProfile] = useState<IdentityProfile>({
|
||||
...DEFAULT_IDENTITY_PROFILE,
|
||||
});
|
||||
const [soulTemplate, setSoulTemplate] = useState(DEFAULT_SOUL_TEMPLATE);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [name, setName] = useState<string | undefined>(undefined);
|
||||
const [boardId, setBoardId] = useState<string | undefined>(undefined);
|
||||
const [isGatewayMain, setIsGatewayMain] = useState<boolean | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const [heartbeatEvery, setHeartbeatEvery] = useState<string | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const [heartbeatTarget, setHeartbeatTarget] = useState<string | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const [identityProfile, setIdentityProfile] = useState<
|
||||
IdentityProfile | undefined
|
||||
>(undefined);
|
||||
const [soulTemplate, setSoulTemplate] = useState<string | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const loadBoards = async () => {
|
||||
if (!isSignedIn) return;
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/boards`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const agentQuery = useGetAgentApiV1AgentsAgentIdGet<
|
||||
getAgentApiV1AgentsAgentIdGetResponse,
|
||||
ApiError
|
||||
>(agentId ?? "", {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn && agentId),
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const updateMutation = useUpdateAgentApiV1AgentsAgentIdPatch<ApiError>({
|
||||
mutation: {
|
||||
onSuccess: () => {
|
||||
if (agentId) {
|
||||
router.push(`/agents/${agentId}`);
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
setError(err.message || "Something went wrong.");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const boards = boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
const loadedAgent: AgentRead | null =
|
||||
agentQuery.data?.status === 200 ? agentQuery.data.data : null;
|
||||
|
||||
const loadedHeartbeat = useMemo(() => {
|
||||
const heartbeat = loadedAgent?.heartbeat_config;
|
||||
if (heartbeat && typeof heartbeat === "object") {
|
||||
const record = heartbeat as Record<string, unknown>;
|
||||
const every = record.every;
|
||||
const target = record.target;
|
||||
return {
|
||||
every: typeof every === "string" && every.trim() ? every : "10m",
|
||||
target: typeof target === "string" && target.trim() ? target : "none",
|
||||
};
|
||||
}
|
||||
return { every: "10m", target: "none" };
|
||||
}, [loadedAgent?.heartbeat_config]);
|
||||
|
||||
const loadedIdentityProfile = useMemo(() => {
|
||||
const identity = loadedAgent?.identity_profile;
|
||||
if (identity && typeof identity === "object") {
|
||||
const record = identity as Record<string, unknown>;
|
||||
return withIdentityDefaults({
|
||||
role: typeof record.role === "string" ? record.role : undefined,
|
||||
communication_style:
|
||||
typeof record.communication_style === "string"
|
||||
? record.communication_style
|
||||
: undefined,
|
||||
emoji: typeof record.emoji === "string" ? record.emoji : undefined,
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load boards.");
|
||||
}
|
||||
const data = (await response.json()) as Board[];
|
||||
setBoards(data);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
}
|
||||
};
|
||||
return withIdentityDefaults(null);
|
||||
}, [loadedAgent?.identity_profile]);
|
||||
|
||||
const loadAgent = async () => {
|
||||
if (!isSignedIn || !agentId) return;
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/agents/${agentId}`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load agent.");
|
||||
}
|
||||
const data = (await response.json()) as Agent;
|
||||
setAgent(data);
|
||||
setName(data.name);
|
||||
setIsGatewayMain(Boolean(data.is_gateway_main));
|
||||
if (!data.is_gateway_main && data.board_id) {
|
||||
setBoardId(data.board_id);
|
||||
} else {
|
||||
setBoardId("");
|
||||
}
|
||||
setBoardTouched(false);
|
||||
if (data.heartbeat_config?.every) {
|
||||
setHeartbeatEvery(data.heartbeat_config.every);
|
||||
}
|
||||
if (data.heartbeat_config?.target) {
|
||||
setHeartbeatTarget(data.heartbeat_config.target);
|
||||
}
|
||||
setIdentityProfile(withIdentityDefaults(data.identity_profile));
|
||||
setSoulTemplate(data.soul_template?.trim() || DEFAULT_SOUL_TEMPLATE);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
const loadedSoulTemplate = useMemo(() => {
|
||||
return loadedAgent?.soul_template?.trim() || DEFAULT_SOUL_TEMPLATE;
|
||||
}, [loadedAgent?.soul_template]);
|
||||
|
||||
useEffect(() => {
|
||||
loadBoards();
|
||||
loadAgent();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isSignedIn, agentId]);
|
||||
const isLoading =
|
||||
boardsQuery.isLoading || agentQuery.isLoading || updateMutation.isPending;
|
||||
const errorMessage =
|
||||
error ?? agentQuery.error?.message ?? boardsQuery.error?.message ?? null;
|
||||
|
||||
useEffect(() => {
|
||||
if (boardTouched || boardId || isGatewayMain) return;
|
||||
if (agent?.board_id) {
|
||||
setBoardId(agent.board_id);
|
||||
return;
|
||||
}
|
||||
if (boards.length > 0) {
|
||||
setBoardId(boards[0].id);
|
||||
}
|
||||
}, [agent, boards, boardId, isGatewayMain, boardTouched]);
|
||||
const resolvedName = name ?? loadedAgent?.name ?? "";
|
||||
const resolvedIsGatewayMain =
|
||||
isGatewayMain ?? Boolean(loadedAgent?.is_gateway_main);
|
||||
const resolvedHeartbeatEvery = heartbeatEvery ?? loadedHeartbeat.every;
|
||||
const resolvedHeartbeatTarget = heartbeatTarget ?? loadedHeartbeat.target;
|
||||
const resolvedIdentityProfile = identityProfile ?? loadedIdentityProfile;
|
||||
const resolvedSoulTemplate = soulTemplate ?? loadedSoulTemplate;
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
const resolvedBoardId = useMemo(() => {
|
||||
if (resolvedIsGatewayMain) return boardId ?? "";
|
||||
return boardId ?? loadedAgent?.board_id ?? boards[0]?.id ?? "";
|
||||
}, [boardId, boards, loadedAgent?.board_id, resolvedIsGatewayMain]);
|
||||
|
||||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (!isSignedIn || !agentId) return;
|
||||
const trimmed = name.trim();
|
||||
if (!isSignedIn || !agentId || !loadedAgent) return;
|
||||
const trimmed = resolvedName.trim();
|
||||
if (!trimmed) {
|
||||
setError("Agent name is required.");
|
||||
return;
|
||||
}
|
||||
if (!isGatewayMain && !boardId) {
|
||||
if (!resolvedIsGatewayMain && !resolvedBoardId) {
|
||||
setError("Select a board or mark this agent as the gateway main.");
|
||||
return;
|
||||
}
|
||||
if (isGatewayMain && !boardId && !agent?.is_gateway_main && !agent?.board_id) {
|
||||
if (
|
||||
resolvedIsGatewayMain &&
|
||||
!resolvedBoardId &&
|
||||
!loadedAgent.is_gateway_main &&
|
||||
!loadedAgent.board_id
|
||||
) {
|
||||
setError(
|
||||
"Select a board once so we can resolve the gateway main session key."
|
||||
);
|
||||
return;
|
||||
}
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const payload: Record<string, unknown> = {
|
||||
name: trimmed,
|
||||
heartbeat_config: {
|
||||
every: heartbeatEvery.trim() || "10m",
|
||||
target: heartbeatTarget,
|
||||
},
|
||||
identity_profile: normalizeIdentityProfile(identityProfile),
|
||||
soul_template: soulTemplate.trim() || null,
|
||||
};
|
||||
if (!isGatewayMain) {
|
||||
payload.board_id = boardId || null;
|
||||
} else if (boardId) {
|
||||
payload.board_id = boardId;
|
||||
}
|
||||
if (agent?.is_gateway_main !== isGatewayMain) {
|
||||
payload.is_gateway_main = isGatewayMain;
|
||||
}
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/agents/${agentId}?force=true`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
}
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to update agent.");
|
||||
}
|
||||
router.push(`/agents/${agentId}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
||||
const payload: AgentUpdate = {
|
||||
name: trimmed,
|
||||
heartbeat_config: {
|
||||
every: resolvedHeartbeatEvery.trim() || "10m",
|
||||
target: resolvedHeartbeatTarget,
|
||||
} as unknown as Record<string, unknown>,
|
||||
identity_profile: normalizeIdentityProfile(resolvedIdentityProfile) as unknown as Record<
|
||||
string,
|
||||
unknown
|
||||
> | null,
|
||||
soul_template: resolvedSoulTemplate.trim() || null,
|
||||
};
|
||||
if (!resolvedIsGatewayMain) {
|
||||
payload.board_id = resolvedBoardId || null;
|
||||
} else if (resolvedBoardId) {
|
||||
payload.board_id = resolvedBoardId;
|
||||
}
|
||||
if (Boolean(loadedAgent.is_gateway_main) !== resolvedIsGatewayMain) {
|
||||
payload.is_gateway_main = resolvedIsGatewayMain;
|
||||
}
|
||||
|
||||
updateMutation.mutate({ agentId, params: { force: true }, data: payload });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -275,7 +275,7 @@ export default function EditAgentPage() {
|
||||
<div className="border-b border-slate-200 bg-white px-8 py-6">
|
||||
<div>
|
||||
<h1 className="font-heading text-2xl font-semibold text-slate-900 tracking-tight">
|
||||
{agent?.name ?? "Edit agent"}
|
||||
{resolvedName.trim() ? resolvedName : loadedAgent?.name ?? "Edit agent"}
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-slate-500">
|
||||
Status is controlled by agent heartbeat.
|
||||
@@ -299,7 +299,7 @@ export default function EditAgentPage() {
|
||||
Agent name <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<Input
|
||||
value={name}
|
||||
value={resolvedName}
|
||||
onChange={(event) => setName(event.target.value)}
|
||||
placeholder="e.g. Deploy bot"
|
||||
disabled={isLoading}
|
||||
@@ -310,12 +310,12 @@ export default function EditAgentPage() {
|
||||
Role
|
||||
</label>
|
||||
<Input
|
||||
value={identityProfile.role}
|
||||
value={resolvedIdentityProfile.role}
|
||||
onChange={(event) =>
|
||||
setIdentityProfile((current) => ({
|
||||
...current,
|
||||
setIdentityProfile({
|
||||
...resolvedIdentityProfile,
|
||||
role: event.target.value,
|
||||
}))
|
||||
})
|
||||
}
|
||||
placeholder="e.g. Founder, Social Media Manager"
|
||||
disabled={isLoading}
|
||||
@@ -327,7 +327,7 @@ export default function EditAgentPage() {
|
||||
<div className="flex items-center justify-between">
|
||||
<label className="text-sm font-medium text-slate-900">
|
||||
Board
|
||||
{isGatewayMain ? (
|
||||
{resolvedIsGatewayMain ? (
|
||||
<span className="ml-2 text-xs font-normal text-slate-500">
|
||||
optional
|
||||
</span>
|
||||
@@ -335,12 +335,11 @@ export default function EditAgentPage() {
|
||||
<span className="text-red-500"> *</span>
|
||||
)}
|
||||
</label>
|
||||
{boardId ? (
|
||||
{resolvedBoardId ? (
|
||||
<button
|
||||
type="button"
|
||||
className="text-xs font-medium text-slate-600 hover:text-slate-900"
|
||||
onClick={() => {
|
||||
setBoardTouched(true);
|
||||
setBoardId("");
|
||||
}}
|
||||
disabled={isLoading}
|
||||
@@ -351,13 +350,10 @@ export default function EditAgentPage() {
|
||||
</div>
|
||||
<SearchableSelect
|
||||
ariaLabel="Select board"
|
||||
value={boardId}
|
||||
onValueChange={(value) => {
|
||||
setBoardTouched(true);
|
||||
setBoardId(value);
|
||||
}}
|
||||
value={resolvedBoardId}
|
||||
onValueChange={(value) => setBoardId(value)}
|
||||
options={getBoardOptions(boards)}
|
||||
placeholder={isGatewayMain ? "No board (main agent)" : "Select board"}
|
||||
placeholder={resolvedIsGatewayMain ? "No board (main agent)" : "Select board"}
|
||||
searchPlaceholder="Search boards..."
|
||||
emptyMessage="No matching boards."
|
||||
triggerClassName="w-full h-11 rounded-xl border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-900 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-200"
|
||||
@@ -365,7 +361,7 @@ export default function EditAgentPage() {
|
||||
itemClassName="px-4 py-3 text-sm text-slate-700 data-[selected=true]:bg-slate-50 data-[selected=true]:text-slate-900"
|
||||
disabled={boards.length === 0}
|
||||
/>
|
||||
{isGatewayMain ? (
|
||||
{resolvedIsGatewayMain ? (
|
||||
<p className="text-xs text-slate-500">
|
||||
Main agents are not attached to a board. If a board is
|
||||
selected, it is only used to resolve the gateway main
|
||||
@@ -382,12 +378,12 @@ export default function EditAgentPage() {
|
||||
Emoji
|
||||
</label>
|
||||
<Select
|
||||
value={identityProfile.emoji}
|
||||
value={resolvedIdentityProfile.emoji}
|
||||
onValueChange={(value) =>
|
||||
setIdentityProfile((current) => ({
|
||||
...current,
|
||||
setIdentityProfile({
|
||||
...resolvedIdentityProfile,
|
||||
emoji: value,
|
||||
}))
|
||||
})
|
||||
}
|
||||
disabled={isLoading}
|
||||
>
|
||||
@@ -410,7 +406,7 @@ export default function EditAgentPage() {
|
||||
<input
|
||||
type="checkbox"
|
||||
className="mt-1 h-4 w-4 rounded border-slate-300 text-blue-600 focus:ring-blue-200"
|
||||
checked={isGatewayMain}
|
||||
checked={resolvedIsGatewayMain}
|
||||
onChange={(event) => setIsGatewayMain(event.target.checked)}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
@@ -437,12 +433,12 @@ export default function EditAgentPage() {
|
||||
Communication style
|
||||
</label>
|
||||
<Input
|
||||
value={identityProfile.communication_style}
|
||||
value={resolvedIdentityProfile.communication_style}
|
||||
onChange={(event) =>
|
||||
setIdentityProfile((current) => ({
|
||||
...current,
|
||||
setIdentityProfile({
|
||||
...resolvedIdentityProfile,
|
||||
communication_style: event.target.value,
|
||||
}))
|
||||
})
|
||||
}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
@@ -452,7 +448,7 @@ export default function EditAgentPage() {
|
||||
Soul template
|
||||
</label>
|
||||
<Textarea
|
||||
value={soulTemplate}
|
||||
value={resolvedSoulTemplate}
|
||||
onChange={(event) => setSoulTemplate(event.target.value)}
|
||||
rows={10}
|
||||
disabled={isLoading}
|
||||
@@ -471,7 +467,7 @@ export default function EditAgentPage() {
|
||||
Interval
|
||||
</label>
|
||||
<Input
|
||||
value={heartbeatEvery}
|
||||
value={resolvedHeartbeatEvery}
|
||||
onChange={(event) => setHeartbeatEvery(event.target.value)}
|
||||
placeholder="e.g. 10m"
|
||||
disabled={isLoading}
|
||||
@@ -486,7 +482,7 @@ export default function EditAgentPage() {
|
||||
</label>
|
||||
<SearchableSelect
|
||||
ariaLabel="Select heartbeat target"
|
||||
value={heartbeatTarget}
|
||||
value={resolvedHeartbeatTarget}
|
||||
onValueChange={setHeartbeatTarget}
|
||||
options={HEARTBEAT_TARGET_OPTIONS}
|
||||
placeholder="Select target"
|
||||
@@ -501,9 +497,9 @@ export default function EditAgentPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error ? (
|
||||
{errorMessage ? (
|
||||
<div className="rounded-lg border border-slate-200 bg-white p-3 text-sm text-slate-600 shadow-sm">
|
||||
{error}
|
||||
{errorMessage}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
|
||||
import { SignInButton, SignedIn, SignedOut, useAuth } from "@clerk/nextjs";
|
||||
|
||||
import { ApiError } from "@/api/mutator";
|
||||
import {
|
||||
type getAgentApiV1AgentsAgentIdGetResponse,
|
||||
useDeleteAgentApiV1AgentsAgentIdDelete,
|
||||
useGetAgentApiV1AgentsAgentIdGet,
|
||||
} from "@/api/generated/agents/agents";
|
||||
import {
|
||||
type listActivityApiV1ActivityGetResponse,
|
||||
useListActivityApiV1ActivityGet,
|
||||
} from "@/api/generated/activity/activity";
|
||||
import {
|
||||
type listBoardsApiV1BoardsGetResponse,
|
||||
useListBoardsApiV1BoardsGet,
|
||||
} from "@/api/generated/boards/boards";
|
||||
import type { ActivityEventRead, AgentRead, BoardRead } from "@/api/generated/model";
|
||||
import { StatusPill } from "@/components/atoms/StatusPill";
|
||||
import { DashboardSidebar } from "@/components/organisms/DashboardSidebar";
|
||||
import { DashboardShell } from "@/components/templates/DashboardShell";
|
||||
@@ -18,36 +33,6 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { getApiBaseUrl } from "@/lib/api-base";
|
||||
|
||||
const apiBase = getApiBaseUrl();
|
||||
|
||||
type Agent = {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
openclaw_session_id?: string | null;
|
||||
last_seen_at: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
board_id?: string | null;
|
||||
is_board_lead?: boolean;
|
||||
is_gateway_main?: boolean;
|
||||
};
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
type ActivityEvent = {
|
||||
id: string;
|
||||
event_type: string;
|
||||
message?: string | null;
|
||||
agent_id?: string | null;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
const parseTimestamp = (value?: string | null) => {
|
||||
if (!value) return null;
|
||||
@@ -83,95 +68,96 @@ const formatRelative = (value?: string | null) => {
|
||||
};
|
||||
|
||||
export default function AgentDetailPage() {
|
||||
const { getToken, isSignedIn } = useAuth();
|
||||
const { isSignedIn } = useAuth();
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
const agentIdParam = params?.agentId;
|
||||
const agentId = Array.isArray(agentIdParam) ? agentIdParam[0] : agentIdParam;
|
||||
|
||||
const [agent, setAgent] = useState<Agent | null>(null);
|
||||
const [events, setEvents] = useState<ActivityEvent[]>([]);
|
||||
const [boards, setBoards] = useState<Board[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||
const [isDeleting, setIsDeleting] = useState(false);
|
||||
const [deleteError, setDeleteError] = useState<string | null>(null);
|
||||
|
||||
const agentQuery = useGetAgentApiV1AgentsAgentIdGet<
|
||||
getAgentApiV1AgentsAgentIdGetResponse,
|
||||
ApiError
|
||||
>(agentId ?? "", {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn && agentId),
|
||||
refetchInterval: 30_000,
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const activityQuery = useListActivityApiV1ActivityGet<
|
||||
listActivityApiV1ActivityGetResponse,
|
||||
ApiError
|
||||
>(
|
||||
{ limit: 200 },
|
||||
{
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 30_000,
|
||||
retry: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 60_000,
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const agent: AgentRead | null =
|
||||
agentQuery.data?.status === 200 ? agentQuery.data.data : null;
|
||||
const events: ActivityEventRead[] =
|
||||
activityQuery.data?.status === 200 ? activityQuery.data.data : [];
|
||||
const boards: BoardRead[] =
|
||||
boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
|
||||
const agentEvents = useMemo(() => {
|
||||
if (!agent) return [];
|
||||
return events.filter((event) => event.agent_id === agent.id);
|
||||
}, [events, agent]);
|
||||
const linkedBoard = useMemo(() => {
|
||||
if (!agent?.board_id || agent?.is_gateway_main) return null;
|
||||
return boards.find((board) => board.id === agent.board_id) ?? null;
|
||||
}, [boards, agent?.board_id, agent?.is_gateway_main]);
|
||||
const linkedBoard =
|
||||
!agent?.board_id || agent?.is_gateway_main
|
||||
? null
|
||||
: boards.find((board) => board.id === agent.board_id) ?? null;
|
||||
|
||||
const deleteMutation = useDeleteAgentApiV1AgentsAgentIdDelete<ApiError>({
|
||||
mutation: {
|
||||
onSuccess: () => {
|
||||
setDeleteOpen(false);
|
||||
router.push("/agents");
|
||||
},
|
||||
onError: (err) => {
|
||||
setDeleteError(err.message || "Something went wrong.");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const loadAgent = async () => {
|
||||
if (!isSignedIn || !agentId) return;
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const [agentResponse, activityResponse, boardsResponse] = await Promise.all([
|
||||
fetch(`${apiBase}/api/v1/agents/${agentId}`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
}),
|
||||
fetch(`${apiBase}/api/v1/activity?limit=200`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
}),
|
||||
fetch(`${apiBase}/api/v1/boards`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
}),
|
||||
]);
|
||||
if (!agentResponse.ok) {
|
||||
throw new Error("Unable to load agent.");
|
||||
}
|
||||
if (!activityResponse.ok) {
|
||||
throw new Error("Unable to load activity.");
|
||||
}
|
||||
if (!boardsResponse.ok) {
|
||||
throw new Error("Unable to load boards.");
|
||||
}
|
||||
const agentData = (await agentResponse.json()) as Agent;
|
||||
const eventsData = (await activityResponse.json()) as ActivityEvent[];
|
||||
const boardsData = (await boardsResponse.json()) as Board[];
|
||||
setAgent(agentData);
|
||||
setEvents(eventsData);
|
||||
setBoards(boardsData);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
const isLoading =
|
||||
agentQuery.isLoading || activityQuery.isLoading || boardsQuery.isLoading;
|
||||
const error =
|
||||
agentQuery.error?.message ??
|
||||
activityQuery.error?.message ??
|
||||
boardsQuery.error?.message ??
|
||||
null;
|
||||
|
||||
useEffect(() => {
|
||||
loadAgent();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isSignedIn, agentId]);
|
||||
const isDeleting = deleteMutation.isPending;
|
||||
const agentStatus = agent?.status ?? "unknown";
|
||||
|
||||
const handleDelete = async () => {
|
||||
if (!agent || !isSignedIn) return;
|
||||
setIsDeleting(true);
|
||||
const handleDelete = () => {
|
||||
if (!agentId || !isSignedIn) return;
|
||||
setDeleteError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/agents/${agent.id}`, {
|
||||
method: "DELETE",
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to delete agent.");
|
||||
}
|
||||
router.push("/agents");
|
||||
} catch (err) {
|
||||
setDeleteError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsDeleting(false);
|
||||
}
|
||||
deleteMutation.mutate({ agentId });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -247,7 +233,7 @@ export default function AgentDetailPage() {
|
||||
{agent.name}
|
||||
</p>
|
||||
</div>
|
||||
<StatusPill status={agent.status} />
|
||||
<StatusPill status={agentStatus} />
|
||||
</div>
|
||||
<div className="mt-4 grid gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
@@ -316,7 +302,7 @@ export default function AgentDetailPage() {
|
||||
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-quiet">
|
||||
Health
|
||||
</p>
|
||||
<StatusPill status={agent.status} />
|
||||
<StatusPill status={agentStatus} />
|
||||
</div>
|
||||
<div className="mt-4 grid gap-3 text-sm text-muted">
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -329,7 +315,7 @@ export default function AgentDetailPage() {
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<span>Status</span>
|
||||
<span className="text-strong">{agent.status}</span>
|
||||
<span className="text-strong">{agentStatus}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { SignInButton, SignedIn, SignedOut, useAuth } from "@clerk/nextjs";
|
||||
|
||||
import { ApiError } from "@/api/mutator";
|
||||
import {
|
||||
type listBoardsApiV1BoardsGetResponse,
|
||||
useListBoardsApiV1BoardsGet,
|
||||
} from "@/api/generated/boards/boards";
|
||||
import { useCreateAgentApiV1AgentsPost } from "@/api/generated/agents/agents";
|
||||
import type { BoardRead } from "@/api/generated/model";
|
||||
import { DashboardSidebar } from "@/components/organisms/DashboardSidebar";
|
||||
import { DashboardShell } from "@/components/templates/DashboardShell";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -20,25 +27,11 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { getApiBaseUrl } from "@/lib/api-base";
|
||||
import {
|
||||
DEFAULT_IDENTITY_PROFILE,
|
||||
DEFAULT_SOUL_TEMPLATE,
|
||||
} from "@/lib/agent-templates";
|
||||
|
||||
const apiBase = getApiBaseUrl();
|
||||
|
||||
type Agent = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
type IdentityProfile = {
|
||||
role: string;
|
||||
communication_style: string;
|
||||
@@ -63,7 +56,7 @@ const HEARTBEAT_TARGET_OPTIONS: SearchableSelectOption[] = [
|
||||
{ value: "last", label: "Last channel" },
|
||||
];
|
||||
|
||||
const getBoardOptions = (boards: Board[]): SearchableSelectOption[] =>
|
||||
const getBoardOptions = (boards: BoardRead[]): SearchableSelectOption[] =>
|
||||
boards.map((board) => ({
|
||||
value: board.id,
|
||||
label: board.name,
|
||||
@@ -83,10 +76,9 @@ const normalizeIdentityProfile = (
|
||||
|
||||
export default function NewAgentPage() {
|
||||
const router = useRouter();
|
||||
const { getToken, isSignedIn } = useAuth();
|
||||
const { isSignedIn } = useAuth();
|
||||
|
||||
const [name, setName] = useState("");
|
||||
const [boards, setBoards] = useState<Board[]>([]);
|
||||
const [boardId, setBoardId] = useState<string>("");
|
||||
const [heartbeatEvery, setHeartbeatEvery] = useState("10m");
|
||||
const [heartbeatTarget, setHeartbeatTarget] = useState("none");
|
||||
@@ -94,35 +86,37 @@ export default function NewAgentPage() {
|
||||
...DEFAULT_IDENTITY_PROFILE,
|
||||
});
|
||||
const [soulTemplate, setSoulTemplate] = useState(DEFAULT_SOUL_TEMPLATE);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const loadBoards = async () => {
|
||||
if (!isSignedIn) return;
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/boards`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load boards.");
|
||||
}
|
||||
const data = (await response.json()) as Board[];
|
||||
setBoards(data);
|
||||
if (!boardId && data.length > 0) {
|
||||
setBoardId(data[0].id);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
}
|
||||
};
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchOnMount: "always",
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
loadBoards();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isSignedIn]);
|
||||
const createAgentMutation = useCreateAgentApiV1AgentsPost<ApiError>({
|
||||
mutation: {
|
||||
onSuccess: (result) => {
|
||||
if (result.status === 200) {
|
||||
router.push(`/agents/${result.data.id}`);
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
setError(err.message || "Something went wrong.");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
const boards = boardsQuery.data?.status === 200 ? boardsQuery.data.data : [];
|
||||
const displayBoardId = boardId || boards[0]?.id || "";
|
||||
const isLoading = boardsQuery.isLoading || createAgentMutation.isPending;
|
||||
const errorMessage = error ?? boardsQuery.error?.message ?? null;
|
||||
|
||||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (!isSignedIn) return;
|
||||
const trimmed = name.trim();
|
||||
@@ -130,41 +124,27 @@ export default function NewAgentPage() {
|
||||
setError("Agent name is required.");
|
||||
return;
|
||||
}
|
||||
if (!boardId) {
|
||||
const resolvedBoardId = displayBoardId;
|
||||
if (!resolvedBoardId) {
|
||||
setError("Select a board before creating an agent.");
|
||||
return;
|
||||
}
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/agents`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
createAgentMutation.mutate({
|
||||
data: {
|
||||
name: trimmed,
|
||||
board_id: resolvedBoardId,
|
||||
heartbeat_config: {
|
||||
every: heartbeatEvery.trim() || "10m",
|
||||
target: heartbeatTarget,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: trimmed,
|
||||
board_id: boardId,
|
||||
heartbeat_config: {
|
||||
every: heartbeatEvery.trim() || "10m",
|
||||
target: heartbeatTarget,
|
||||
},
|
||||
identity_profile: normalizeIdentityProfile(identityProfile),
|
||||
soul_template: soulTemplate.trim() || null,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to create agent.");
|
||||
}
|
||||
const created = (await response.json()) as Agent;
|
||||
router.push(`/agents/${created.id}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
identity_profile: normalizeIdentityProfile(identityProfile) as unknown as Record<
|
||||
string,
|
||||
unknown
|
||||
> | null,
|
||||
soul_template: soulTemplate.trim() || null,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -243,7 +223,7 @@ export default function NewAgentPage() {
|
||||
</label>
|
||||
<SearchableSelect
|
||||
ariaLabel="Select board"
|
||||
value={boardId}
|
||||
value={displayBoardId}
|
||||
onValueChange={setBoardId}
|
||||
options={getBoardOptions(boards)}
|
||||
placeholder="Select board"
|
||||
@@ -364,9 +344,9 @@ export default function NewAgentPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error ? (
|
||||
{errorMessage ? (
|
||||
<div className="rounded-lg border border-slate-200 bg-white p-3 text-sm text-slate-600 shadow-sm">
|
||||
{error}
|
||||
{errorMessage}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { SignInButton, SignedIn, SignedOut } from "@clerk/nextjs";
|
||||
import { SignInButton, SignedIn, SignedOut, useAuth } from "@clerk/nextjs";
|
||||
import {
|
||||
type ColumnDef,
|
||||
type SortingState,
|
||||
@@ -27,25 +27,20 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { apiRequest, useAuthedMutation, useAuthedQuery } from "@/lib/api-query";
|
||||
|
||||
type Agent = {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
openclaw_session_id?: string | null;
|
||||
last_seen_at: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
board_id?: string | null;
|
||||
is_board_lead?: boolean;
|
||||
};
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
import { ApiError } from "@/api/mutator";
|
||||
import {
|
||||
type listAgentsApiV1AgentsGetResponse,
|
||||
getListAgentsApiV1AgentsGetQueryKey,
|
||||
useDeleteAgentApiV1AgentsAgentIdDelete,
|
||||
useListAgentsApiV1AgentsGet,
|
||||
} from "@/api/generated/agents/agents";
|
||||
import {
|
||||
type listBoardsApiV1BoardsGetResponse,
|
||||
getListBoardsApiV1BoardsGetQueryKey,
|
||||
useListBoardsApiV1BoardsGet,
|
||||
} from "@/api/generated/boards/boards";
|
||||
import type { AgentRead, BoardRead } from "@/api/generated/model";
|
||||
|
||||
const parseTimestamp = (value?: string | null) => {
|
||||
if (!value) return null;
|
||||
@@ -87,6 +82,7 @@ const truncate = (value?: string | null, max = 18) => {
|
||||
};
|
||||
|
||||
export default function AgentsPage() {
|
||||
const { isSignedIn } = useAuth();
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -94,47 +90,72 @@ export default function AgentsPage() {
|
||||
{ id: "name", desc: false },
|
||||
]);
|
||||
|
||||
const [deleteTarget, setDeleteTarget] = useState<Agent | null>(null);
|
||||
const [deleteTarget, setDeleteTarget] = useState<AgentRead | null>(null);
|
||||
|
||||
const boardsQuery = useAuthedQuery<Board[]>(["boards"], "/api/v1/boards", {
|
||||
refetchInterval: 30_000,
|
||||
refetchOnMount: "always",
|
||||
});
|
||||
const agentsQuery = useAuthedQuery<Agent[]>(["agents"], "/api/v1/agents", {
|
||||
refetchInterval: 15_000,
|
||||
refetchOnMount: "always",
|
||||
const boardsKey = getListBoardsApiV1BoardsGetQueryKey();
|
||||
const agentsKey = getListAgentsApiV1AgentsGetQueryKey();
|
||||
|
||||
const boardsQuery = useListBoardsApiV1BoardsGet<
|
||||
listBoardsApiV1BoardsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 30_000,
|
||||
refetchOnMount: "always",
|
||||
},
|
||||
});
|
||||
|
||||
const boards = useMemo(() => boardsQuery.data ?? [], [boardsQuery.data]);
|
||||
const agents = useMemo(() => agentsQuery.data ?? [], [agentsQuery.data]);
|
||||
const agentsQuery = useListAgentsApiV1AgentsGet<
|
||||
listAgentsApiV1AgentsGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchInterval: 15_000,
|
||||
refetchOnMount: "always",
|
||||
},
|
||||
});
|
||||
|
||||
const deleteMutation = useAuthedMutation<void, Agent, { previous?: Agent[] }>(
|
||||
async (agent, token) =>
|
||||
apiRequest(`/api/v1/agents/${agent.id}`, {
|
||||
method: "DELETE",
|
||||
token,
|
||||
}),
|
||||
const boards = useMemo(
|
||||
() => (boardsQuery.data?.status === 200 ? boardsQuery.data.data : []),
|
||||
[boardsQuery.data]
|
||||
);
|
||||
const agents = useMemo(() => agentsQuery.data?.data ?? [], [agentsQuery.data]);
|
||||
|
||||
const deleteMutation = useDeleteAgentApiV1AgentsAgentIdDelete<
|
||||
ApiError,
|
||||
{ previous?: listAgentsApiV1AgentsGetResponse }
|
||||
>(
|
||||
{
|
||||
onMutate: async (agent) => {
|
||||
await queryClient.cancelQueries({ queryKey: ["agents"] });
|
||||
const previous = queryClient.getQueryData<Agent[]>(["agents"]);
|
||||
queryClient.setQueryData<Agent[]>(["agents"], (old = []) =>
|
||||
old.filter((item) => item.id !== agent.id)
|
||||
);
|
||||
return { previous };
|
||||
mutation: {
|
||||
onMutate: async ({ agentId }) => {
|
||||
await queryClient.cancelQueries({ queryKey: agentsKey });
|
||||
const previous =
|
||||
queryClient.getQueryData<listAgentsApiV1AgentsGetResponse>(agentsKey);
|
||||
if (previous) {
|
||||
queryClient.setQueryData<listAgentsApiV1AgentsGetResponse>(agentsKey, {
|
||||
...previous,
|
||||
data: previous.data.filter((agent) => agent.id !== agentId),
|
||||
});
|
||||
}
|
||||
return { previous };
|
||||
},
|
||||
onError: (_error, _agent, context) => {
|
||||
if (context?.previous) {
|
||||
queryClient.setQueryData(agentsKey, context.previous);
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
setDeleteTarget(null);
|
||||
},
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries({ queryKey: agentsKey });
|
||||
queryClient.invalidateQueries({ queryKey: boardsKey });
|
||||
},
|
||||
},
|
||||
onError: (_error, _agent, context) => {
|
||||
if (context?.previous) {
|
||||
queryClient.setQueryData(["agents"], context.previous);
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
setDeleteTarget(null);
|
||||
},
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["agents"] });
|
||||
},
|
||||
}
|
||||
},
|
||||
queryClient
|
||||
);
|
||||
|
||||
const sortedAgents = useMemo(() => [...agents], [agents]);
|
||||
@@ -142,12 +163,12 @@ export default function AgentsPage() {
|
||||
|
||||
const handleDelete = () => {
|
||||
if (!deleteTarget) return;
|
||||
deleteMutation.mutate(deleteTarget);
|
||||
deleteMutation.mutate({ agentId: deleteTarget.id });
|
||||
};
|
||||
|
||||
const columns = useMemo<ColumnDef<Agent>[]>(
|
||||
const columns = useMemo<ColumnDef<AgentRead>[]>(
|
||||
() => {
|
||||
const resolveBoardName = (agent: Agent) =>
|
||||
const resolveBoardName = (agent: AgentRead) =>
|
||||
boards.find((board) => board.id === agent.board_id)?.name ?? "—";
|
||||
|
||||
return [
|
||||
@@ -166,7 +187,9 @@ export default function AgentsPage() {
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: "Status",
|
||||
cell: ({ row }) => <StatusPill status={row.original.status} />,
|
||||
cell: ({ row }) => (
|
||||
<StatusPill status={row.original.status ?? "unknown"} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "openclaw_session_id",
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
|
||||
import { SignInButton, SignedIn, SignedOut, useAuth } from "@clerk/nextjs";
|
||||
|
||||
import { ApiError } from "@/api/mutator";
|
||||
import {
|
||||
type getBoardApiV1BoardsBoardIdGetResponse,
|
||||
useGetBoardApiV1BoardsBoardIdGet,
|
||||
useUpdateBoardApiV1BoardsBoardIdPatch,
|
||||
} from "@/api/generated/boards/boards";
|
||||
import {
|
||||
type listGatewaysApiV1GatewaysGetResponse,
|
||||
useListGatewaysApiV1GatewaysGet,
|
||||
} from "@/api/generated/gateways/gateways";
|
||||
import type { BoardRead, BoardUpdate } from "@/api/generated/model";
|
||||
import { BoardApprovalsPanel } from "@/components/BoardApprovalsPanel";
|
||||
import { BoardGoalPanel } from "@/components/BoardGoalPanel";
|
||||
import { BoardOnboardingChat } from "@/components/BoardOnboardingChat";
|
||||
@@ -22,28 +33,6 @@ import {
|
||||
} from "@/components/ui/select";
|
||||
import SearchableSelect from "@/components/ui/searchable-select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { getApiBaseUrl } from "@/lib/api-base";
|
||||
|
||||
const apiBase = getApiBaseUrl();
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
gateway_id?: string | null;
|
||||
board_type?: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: Record<string, unknown> | null;
|
||||
target_date?: string | null;
|
||||
};
|
||||
|
||||
type Gateway = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
main_session_key: string;
|
||||
workspace_root: string;
|
||||
};
|
||||
|
||||
const slugify = (value: string) =>
|
||||
value
|
||||
@@ -60,158 +49,147 @@ const toDateInput = (value?: string | null) => {
|
||||
};
|
||||
|
||||
export default function EditBoardPage() {
|
||||
const { getToken, isSignedIn } = useAuth();
|
||||
const { isSignedIn } = useAuth();
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
const boardIdParam = params?.boardId;
|
||||
const boardId = Array.isArray(boardIdParam) ? boardIdParam[0] : boardIdParam;
|
||||
|
||||
const [board, setBoard] = useState<Board | null>(null);
|
||||
const [name, setName] = useState("");
|
||||
const [gateways, setGateways] = useState<Gateway[]>([]);
|
||||
const [gatewayId, setGatewayId] = useState<string>("");
|
||||
const [boardType, setBoardType] = useState("goal");
|
||||
const [objective, setObjective] = useState("");
|
||||
const [successMetrics, setSuccessMetrics] = useState("");
|
||||
const [targetDate, setTargetDate] = useState("");
|
||||
const [board, setBoard] = useState<BoardRead | null>(null);
|
||||
const [name, setName] = useState<string | undefined>(undefined);
|
||||
const [gatewayId, setGatewayId] = useState<string | undefined>(undefined);
|
||||
const [boardType, setBoardType] = useState<string | undefined>(undefined);
|
||||
const [objective, setObjective] = useState<string | undefined>(undefined);
|
||||
const [successMetrics, setSuccessMetrics] = useState<string | undefined>(
|
||||
undefined,
|
||||
);
|
||||
const [targetDate, setTargetDate] = useState<string | undefined>(undefined);
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [metricsError, setMetricsError] = useState<string | null>(null);
|
||||
const [isOnboardingOpen, setIsOnboardingOpen] = useState(false);
|
||||
|
||||
const isFormReady = Boolean(name.trim() && gatewayId);
|
||||
const gatewaysQuery = useListGatewaysApiV1GatewaysGet<
|
||||
listGatewaysApiV1GatewaysGetResponse,
|
||||
ApiError
|
||||
>({
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn),
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const boardQuery = useGetBoardApiV1BoardsBoardIdGet<
|
||||
getBoardApiV1BoardsBoardIdGetResponse,
|
||||
ApiError
|
||||
>(boardId ?? "", {
|
||||
query: {
|
||||
enabled: Boolean(isSignedIn && boardId),
|
||||
refetchOnMount: "always",
|
||||
retry: false,
|
||||
},
|
||||
});
|
||||
|
||||
const updateBoardMutation = useUpdateBoardApiV1BoardsBoardIdPatch<ApiError>({
|
||||
mutation: {
|
||||
onSuccess: (result) => {
|
||||
if (result.status === 200) {
|
||||
router.push(`/boards/${result.data.id}`);
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
setError(err.message || "Something went wrong.");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const gateways =
|
||||
gatewaysQuery.data?.status === 200 ? gatewaysQuery.data.data : [];
|
||||
const loadedBoard: BoardRead | null =
|
||||
boardQuery.data?.status === 200 ? boardQuery.data.data : null;
|
||||
const baseBoard = board ?? loadedBoard;
|
||||
|
||||
const resolvedName = name ?? baseBoard?.name ?? "";
|
||||
const resolvedGatewayId = gatewayId ?? baseBoard?.gateway_id ?? "";
|
||||
const resolvedBoardType = boardType ?? baseBoard?.board_type ?? "goal";
|
||||
const resolvedObjective = objective ?? baseBoard?.objective ?? "";
|
||||
const resolvedSuccessMetrics =
|
||||
successMetrics ??
|
||||
(baseBoard?.success_metrics
|
||||
? JSON.stringify(baseBoard.success_metrics, null, 2)
|
||||
: "");
|
||||
const resolvedTargetDate =
|
||||
targetDate ?? toDateInput(baseBoard?.target_date);
|
||||
|
||||
const displayGatewayId = resolvedGatewayId || gateways[0]?.id || "";
|
||||
|
||||
const isLoading =
|
||||
gatewaysQuery.isLoading || boardQuery.isLoading || updateBoardMutation.isPending;
|
||||
const errorMessage =
|
||||
error ??
|
||||
gatewaysQuery.error?.message ??
|
||||
boardQuery.error?.message ??
|
||||
null;
|
||||
|
||||
const isFormReady = Boolean(resolvedName.trim() && displayGatewayId);
|
||||
|
||||
const gatewayOptions = useMemo(
|
||||
() => gateways.map((gateway) => ({ value: gateway.id, label: gateway.name })),
|
||||
[gateways]
|
||||
[gateways],
|
||||
);
|
||||
|
||||
const loadGateways = async (): Promise<Gateway[]> => {
|
||||
if (!isSignedIn) return [];
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/gateways`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load gateways.");
|
||||
}
|
||||
const data = (await response.json()) as Gateway[];
|
||||
setGateways(data);
|
||||
return data;
|
||||
};
|
||||
|
||||
const loadBoard = async () => {
|
||||
if (!isSignedIn || !boardId) return;
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/boards/${boardId}`, {
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load board.");
|
||||
}
|
||||
const data = (await response.json()) as Board;
|
||||
setBoard(data);
|
||||
setName(data.name ?? "");
|
||||
if (data.gateway_id) {
|
||||
setGatewayId(data.gateway_id);
|
||||
}
|
||||
setBoardType(data.board_type ?? "goal");
|
||||
setObjective(data.objective ?? "");
|
||||
setSuccessMetrics(
|
||||
data.success_metrics ? JSON.stringify(data.success_metrics, null, 2) : ""
|
||||
);
|
||||
setTargetDate(toDateInput(data.target_date));
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
}
|
||||
};
|
||||
|
||||
const handleOnboardingConfirmed = (updated: Board) => {
|
||||
const handleOnboardingConfirmed = (updated: BoardRead) => {
|
||||
setBoard(updated);
|
||||
setBoardType(updated.board_type ?? "goal");
|
||||
setObjective(updated.objective ?? "");
|
||||
setSuccessMetrics(
|
||||
updated.success_metrics ? JSON.stringify(updated.success_metrics, null, 2) : ""
|
||||
updated.success_metrics ? JSON.stringify(updated.success_metrics, null, 2) : "",
|
||||
);
|
||||
setTargetDate(toDateInput(updated.target_date));
|
||||
setIsOnboardingOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadBoard();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSignedIn) return;
|
||||
loadGateways()
|
||||
.then((configs) => {
|
||||
if (!gatewayId && configs.length > 0) {
|
||||
setGatewayId(configs[0].id);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isSignedIn]);
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (!isSignedIn || !boardId) return;
|
||||
if (!name.trim()) {
|
||||
const trimmedName = resolvedName.trim();
|
||||
if (!trimmedName) {
|
||||
setError("Board name is required.");
|
||||
return;
|
||||
}
|
||||
if (!gatewayId) {
|
||||
const resolvedGatewayId = displayGatewayId;
|
||||
if (!resolvedGatewayId) {
|
||||
setError("Select a gateway before saving.");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
setMetricsError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
let parsedMetrics: Record<string, unknown> | null = null;
|
||||
if (successMetrics.trim()) {
|
||||
try {
|
||||
parsedMetrics = JSON.parse(successMetrics) as Record<string, unknown>;
|
||||
} catch {
|
||||
setMetricsError("Success metrics must be valid JSON.");
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const response = await fetch(`${apiBase}/api/v1/boards/${boardId}`, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: name.trim(),
|
||||
slug: slugify(name.trim()),
|
||||
gateway_id: gatewayId || null,
|
||||
board_type: boardType,
|
||||
objective: objective.trim() || null,
|
||||
success_metrics: parsedMetrics,
|
||||
target_date: targetDate ? new Date(targetDate).toISOString() : null,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to update board.");
|
||||
let parsedMetrics: Record<string, unknown> | null = null;
|
||||
if (resolvedSuccessMetrics.trim()) {
|
||||
try {
|
||||
parsedMetrics = JSON.parse(resolvedSuccessMetrics) as Record<string, unknown>;
|
||||
} catch {
|
||||
setMetricsError("Success metrics must be valid JSON.");
|
||||
return;
|
||||
}
|
||||
const updated = (await response.json()) as Board;
|
||||
router.push(`/boards/${updated.id}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
const payload: BoardUpdate = {
|
||||
name: trimmedName,
|
||||
slug: slugify(trimmedName),
|
||||
gateway_id: resolvedGatewayId || null,
|
||||
board_type: resolvedBoardType,
|
||||
objective: resolvedObjective.trim() || null,
|
||||
success_metrics: parsedMetrics,
|
||||
target_date: resolvedTargetDate
|
||||
? new Date(resolvedTargetDate).toISOString()
|
||||
: null,
|
||||
};
|
||||
|
||||
updateBoardMutation.mutate({ boardId, data: payload });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -249,7 +227,7 @@ export default function EditBoardPage() {
|
||||
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
|
||||
<div className="space-y-6">
|
||||
<BoardGoalPanel
|
||||
board={board}
|
||||
board={baseBoard}
|
||||
onStartOnboarding={() => setIsOnboardingOpen(true)}
|
||||
/>
|
||||
<form
|
||||
@@ -262,22 +240,22 @@ export default function EditBoardPage() {
|
||||
Board name <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<Input
|
||||
value={name}
|
||||
value={resolvedName}
|
||||
onChange={(event) => setName(event.target.value)}
|
||||
placeholder="Board name"
|
||||
disabled={isLoading || !board}
|
||||
disabled={isLoading || !baseBoard}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-900">
|
||||
Gateway <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<SearchableSelect
|
||||
ariaLabel="Select gateway"
|
||||
value={gatewayId}
|
||||
onValueChange={setGatewayId}
|
||||
options={gatewayOptions}
|
||||
placeholder="Select gateway"
|
||||
<SearchableSelect
|
||||
ariaLabel="Select gateway"
|
||||
value={displayGatewayId}
|
||||
onValueChange={setGatewayId}
|
||||
options={gatewayOptions}
|
||||
placeholder="Select gateway"
|
||||
searchPlaceholder="Search gateways..."
|
||||
emptyMessage="No gateways found."
|
||||
triggerClassName="w-full h-11 rounded-xl border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-900 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-200"
|
||||
@@ -292,7 +270,7 @@ export default function EditBoardPage() {
|
||||
<label className="text-sm font-medium text-slate-900">
|
||||
Board type
|
||||
</label>
|
||||
<Select value={boardType} onValueChange={setBoardType}>
|
||||
<Select value={resolvedBoardType} onValueChange={setBoardType}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select board type" />
|
||||
</SelectTrigger>
|
||||
@@ -308,7 +286,7 @@ export default function EditBoardPage() {
|
||||
</label>
|
||||
<Input
|
||||
type="date"
|
||||
value={targetDate}
|
||||
value={resolvedTargetDate}
|
||||
onChange={(event) => setTargetDate(event.target.value)}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
@@ -320,7 +298,7 @@ export default function EditBoardPage() {
|
||||
Objective
|
||||
</label>
|
||||
<Textarea
|
||||
value={objective}
|
||||
value={resolvedObjective}
|
||||
onChange={(event) => setObjective(event.target.value)}
|
||||
placeholder="What should this board achieve?"
|
||||
className="min-h-[120px]"
|
||||
@@ -333,7 +311,7 @@ export default function EditBoardPage() {
|
||||
Success metrics (JSON)
|
||||
</label>
|
||||
<Textarea
|
||||
value={successMetrics}
|
||||
value={resolvedSuccessMetrics}
|
||||
onChange={(event) => setSuccessMetrics(event.target.value)}
|
||||
placeholder='e.g. { "target": "Launch by week 2" }'
|
||||
className="min-h-[140px] font-mono text-xs"
|
||||
@@ -353,7 +331,9 @@ export default function EditBoardPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{error ? <p className="text-sm text-red-500">{error}</p> : null}
|
||||
{errorMessage ? (
|
||||
<p className="text-sm text-red-500">{errorMessage}</p>
|
||||
) : null}
|
||||
|
||||
<div className="flex justify-end gap-3">
|
||||
<Button
|
||||
@@ -364,7 +344,7 @@ export default function EditBoardPage() {
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button type="submit" disabled={isLoading || !board || !isFormReady}>
|
||||
<Button type="submit" disabled={isLoading || !baseBoard || !isFormReady}>
|
||||
{isLoading ? "Saving…" : "Save changes"}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -28,75 +28,71 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { getApiBaseUrl } from "@/lib/api-base";
|
||||
import { listAgentsApiV1AgentsGet, streamAgentsApiV1AgentsStreamGet } from "@/api/generated/agents/agents";
|
||||
import {
|
||||
listApprovalsApiV1BoardsBoardIdApprovalsGet,
|
||||
streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet,
|
||||
updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch,
|
||||
} from "@/api/generated/approvals/approvals";
|
||||
import { getBoardApiV1BoardsBoardIdGet } from "@/api/generated/boards/boards";
|
||||
import {
|
||||
createBoardMemoryApiV1BoardsBoardIdMemoryPost,
|
||||
listBoardMemoryApiV1BoardsBoardIdMemoryGet,
|
||||
streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet,
|
||||
} from "@/api/generated/board-memory/board-memory";
|
||||
import {
|
||||
createTaskApiV1BoardsBoardIdTasksPost,
|
||||
createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost,
|
||||
deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete,
|
||||
listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet,
|
||||
listTasksApiV1BoardsBoardIdTasksGet,
|
||||
streamTasksApiV1BoardsBoardIdTasksStreamGet,
|
||||
updateTaskApiV1BoardsBoardIdTasksTaskIdPatch,
|
||||
} from "@/api/generated/tasks/tasks";
|
||||
import type {
|
||||
AgentRead,
|
||||
ApprovalRead,
|
||||
BoardMemoryRead,
|
||||
BoardRead,
|
||||
TaskCommentRead,
|
||||
TaskRead,
|
||||
} from "@/api/generated/model";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Board = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
board_type?: string;
|
||||
objective?: string | null;
|
||||
success_metrics?: Record<string, unknown> | null;
|
||||
target_date?: string | null;
|
||||
goal_confirmed?: boolean;
|
||||
};
|
||||
type Board = BoardRead;
|
||||
|
||||
type Task = {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string | null;
|
||||
status: string;
|
||||
type TaskStatus = Exclude<TaskRead["status"], undefined>;
|
||||
|
||||
type Task = TaskRead & {
|
||||
status: TaskStatus;
|
||||
priority: string;
|
||||
due_at?: string | null;
|
||||
assigned_agent_id?: string | null;
|
||||
created_at?: string | null;
|
||||
updated_at?: string | null;
|
||||
approvalsCount?: number;
|
||||
approvalsPendingCount?: number;
|
||||
};
|
||||
|
||||
type Agent = {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
board_id?: string | null;
|
||||
is_board_lead?: boolean;
|
||||
updated_at?: string | null;
|
||||
last_seen_at?: string | null;
|
||||
identity_profile?: {
|
||||
emoji?: string | null;
|
||||
} | null;
|
||||
};
|
||||
type Agent = AgentRead & { status: string };
|
||||
|
||||
type TaskComment = {
|
||||
id: string;
|
||||
message?: string | null;
|
||||
agent_id?: string | null;
|
||||
task_id?: string | null;
|
||||
created_at: string;
|
||||
};
|
||||
type TaskComment = TaskCommentRead;
|
||||
|
||||
type Approval = {
|
||||
id: string;
|
||||
action_type: string;
|
||||
payload?: Record<string, unknown> | null;
|
||||
confidence: number;
|
||||
rubric_scores?: Record<string, number> | null;
|
||||
status: string;
|
||||
created_at: string;
|
||||
resolved_at?: string | null;
|
||||
};
|
||||
type Approval = ApprovalRead & { status: string };
|
||||
|
||||
type BoardChatMessage = {
|
||||
id: string;
|
||||
content: string;
|
||||
tags?: string[] | null;
|
||||
source?: string | null;
|
||||
created_at: string;
|
||||
};
|
||||
type BoardChatMessage = BoardMemoryRead;
|
||||
|
||||
const apiBase = getApiBaseUrl();
|
||||
const normalizeTask = (task: TaskRead): Task => ({
|
||||
...task,
|
||||
status: task.status ?? "inbox",
|
||||
priority: task.priority ?? "medium",
|
||||
});
|
||||
|
||||
const normalizeAgent = (agent: AgentRead): Agent => ({
|
||||
...agent,
|
||||
status: agent.status ?? "offline",
|
||||
});
|
||||
|
||||
const normalizeApproval = (approval: ApprovalRead): Approval => ({
|
||||
...approval,
|
||||
status: approval.status ?? "pending",
|
||||
});
|
||||
|
||||
const approvalTaskId = (approval: Approval) => {
|
||||
const payload = approval.payload ?? {};
|
||||
@@ -137,7 +133,7 @@ export default function BoardDetailPage() {
|
||||
const params = useParams();
|
||||
const boardIdParam = params?.boardId;
|
||||
const boardId = Array.isArray(boardIdParam) ? boardIdParam[0] : boardIdParam;
|
||||
const { getToken, isSignedIn } = useAuth();
|
||||
const { isSignedIn } = useAuth();
|
||||
|
||||
const [board, setBoard] = useState<Board | null>(null);
|
||||
const [tasks, setTasks] = useState<Task[]>([]);
|
||||
@@ -195,7 +191,7 @@ export default function BoardDetailPage() {
|
||||
|
||||
const [editTitle, setEditTitle] = useState("");
|
||||
const [editDescription, setEditDescription] = useState("");
|
||||
const [editStatus, setEditStatus] = useState("inbox");
|
||||
const [editStatus, setEditStatus] = useState<TaskStatus>("inbox");
|
||||
const [editPriority, setEditPriority] = useState("medium");
|
||||
const [editAssigneeId, setEditAssigneeId] = useState("");
|
||||
const [isSavingTask, setIsSavingTask] = useState(false);
|
||||
@@ -250,41 +246,18 @@ export default function BoardDetailPage() {
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const [boardResponse, tasksResponse, agentsResponse] = await Promise.all([
|
||||
fetch(`${apiBase}/api/v1/boards/${boardId}`, {
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
}),
|
||||
fetch(`${apiBase}/api/v1/boards/${boardId}/tasks`, {
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
}),
|
||||
fetch(`${apiBase}/api/v1/agents`, {
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
}),
|
||||
const [boardResult, tasksResult, agentsResult] = await Promise.all([
|
||||
getBoardApiV1BoardsBoardIdGet(boardId),
|
||||
listTasksApiV1BoardsBoardIdTasksGet(boardId),
|
||||
listAgentsApiV1AgentsGet(),
|
||||
]);
|
||||
|
||||
if (!boardResponse.ok) {
|
||||
throw new Error("Unable to load board.");
|
||||
}
|
||||
if (!tasksResponse.ok) {
|
||||
throw new Error("Unable to load tasks.");
|
||||
}
|
||||
if (!agentsResponse.ok) {
|
||||
throw new Error("Unable to load agents.");
|
||||
}
|
||||
if (boardResult.status !== 200) throw new Error("Unable to load board.");
|
||||
if (tasksResult.status !== 200) throw new Error("Unable to load tasks.");
|
||||
|
||||
const boardData = (await boardResponse.json()) as Board;
|
||||
const taskData = (await tasksResponse.json()) as Task[];
|
||||
const agentData = (await agentsResponse.json()) as Agent[];
|
||||
setBoard(boardData);
|
||||
setTasks(taskData);
|
||||
setAgents(agentData);
|
||||
setBoard(boardResult.data);
|
||||
setTasks(tasksResult.data.map(normalizeTask));
|
||||
setAgents(agentsResult.data.map(normalizeAgent));
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
@@ -326,20 +299,9 @@ export default function BoardDetailPage() {
|
||||
setIsApprovalsLoading(true);
|
||||
setApprovalsError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/approvals`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load approvals.");
|
||||
}
|
||||
const data = (await response.json()) as Approval[];
|
||||
setApprovals(data);
|
||||
const result = await listApprovalsApiV1BoardsBoardIdApprovalsGet(boardId);
|
||||
if (result.status !== 200) throw new Error("Unable to load approvals.");
|
||||
setApprovals(result.data.map(normalizeApproval));
|
||||
} catch (err) {
|
||||
setApprovalsError(
|
||||
err instanceof Error ? err.message : "Unable to load approvals.",
|
||||
@@ -347,7 +309,7 @@ export default function BoardDetailPage() {
|
||||
} finally {
|
||||
setIsApprovalsLoading(false);
|
||||
}
|
||||
}, [boardId, getToken, isSignedIn]);
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
loadApprovals();
|
||||
@@ -357,19 +319,11 @@ export default function BoardDetailPage() {
|
||||
if (!isSignedIn || !boardId) return;
|
||||
setChatError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/memory?limit=200`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load board chat.");
|
||||
}
|
||||
const data = (await response.json()) as BoardChatMessage[];
|
||||
const result = await listBoardMemoryApiV1BoardsBoardIdMemoryGet(boardId, {
|
||||
limit: 200,
|
||||
});
|
||||
if (result.status !== 200) throw new Error("Unable to load board chat.");
|
||||
const data = result.data;
|
||||
const chatOnly = data.filter((item) => item.tags?.includes("chat"));
|
||||
const ordered = chatOnly.sort((a, b) => {
|
||||
const aTime = new Date(a.created_at).getTime();
|
||||
@@ -382,7 +336,7 @@ export default function BoardDetailPage() {
|
||||
err instanceof Error ? err.message : "Unable to load board chat.",
|
||||
);
|
||||
}
|
||||
}, [boardId, getToken, isSignedIn]);
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
loadBoardChat();
|
||||
@@ -405,22 +359,21 @@ export default function BoardDetailPage() {
|
||||
|
||||
const connect = async () => {
|
||||
try {
|
||||
const token = await getToken();
|
||||
if (!token || isCancelled) return;
|
||||
const url = new URL(
|
||||
`${apiBase}/api/v1/boards/${boardId}/memory/stream`,
|
||||
);
|
||||
const since = latestChatTimestamp(chatMessagesRef.current);
|
||||
if (since) {
|
||||
url.searchParams.set("since", since);
|
||||
const streamResult =
|
||||
await streamBoardMemoryApiV1BoardsBoardIdMemoryStreamGet(
|
||||
boardId,
|
||||
since ? { since } : undefined,
|
||||
{
|
||||
headers: { Accept: "text/event-stream" },
|
||||
signal: abortController.signal,
|
||||
},
|
||||
);
|
||||
if (streamResult.status !== 200) {
|
||||
throw new Error("Unable to connect board chat stream.");
|
||||
}
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
signal: abortController.signal,
|
||||
});
|
||||
if (!response.ok || !response.body) {
|
||||
const response = streamResult.data as Response;
|
||||
if (!(response instanceof Response) || !response.body) {
|
||||
throw new Error("Unable to connect board chat stream.");
|
||||
}
|
||||
const reader = response.body.getReader();
|
||||
@@ -483,7 +436,7 @@ export default function BoardDetailPage() {
|
||||
isCancelled = true;
|
||||
abortController.abort();
|
||||
};
|
||||
}, [boardId, getToken, isSignedIn]);
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSignedIn || !boardId) return;
|
||||
@@ -492,22 +445,21 @@ export default function BoardDetailPage() {
|
||||
|
||||
const connect = async () => {
|
||||
try {
|
||||
const token = await getToken();
|
||||
if (!token || isCancelled) return;
|
||||
const url = new URL(
|
||||
`${apiBase}/api/v1/boards/${boardId}/approvals/stream`,
|
||||
);
|
||||
const since = latestApprovalTimestamp(approvalsRef.current);
|
||||
if (since) {
|
||||
url.searchParams.set("since", since);
|
||||
const streamResult =
|
||||
await streamApprovalsApiV1BoardsBoardIdApprovalsStreamGet(
|
||||
boardId,
|
||||
since ? { since } : undefined,
|
||||
{
|
||||
headers: { Accept: "text/event-stream" },
|
||||
signal: abortController.signal,
|
||||
},
|
||||
);
|
||||
if (streamResult.status !== 200) {
|
||||
throw new Error("Unable to connect approvals stream.");
|
||||
}
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
signal: abortController.signal,
|
||||
});
|
||||
if (!response.ok || !response.body) {
|
||||
const response = streamResult.data as Response;
|
||||
if (!(response instanceof Response) || !response.body) {
|
||||
throw new Error("Unable to connect approvals stream.");
|
||||
}
|
||||
const reader = response.body.getReader();
|
||||
@@ -535,19 +487,20 @@ export default function BoardDetailPage() {
|
||||
}
|
||||
if (eventType === "approval" && data) {
|
||||
try {
|
||||
const payload = JSON.parse(data) as { approval?: Approval };
|
||||
const payload = JSON.parse(data) as { approval?: ApprovalRead };
|
||||
if (payload.approval) {
|
||||
const normalized = normalizeApproval(payload.approval);
|
||||
setApprovals((prev) => {
|
||||
const index = prev.findIndex(
|
||||
(item) => item.id === payload.approval?.id,
|
||||
(item) => item.id === normalized.id,
|
||||
);
|
||||
if (index === -1) {
|
||||
return [payload.approval as Approval, ...prev];
|
||||
return [normalized, ...prev];
|
||||
}
|
||||
const next = [...prev];
|
||||
next[index] = {
|
||||
...next[index],
|
||||
...(payload.approval as Approval),
|
||||
...normalized,
|
||||
};
|
||||
return next;
|
||||
});
|
||||
@@ -571,7 +524,7 @@ export default function BoardDetailPage() {
|
||||
isCancelled = true;
|
||||
abortController.abort();
|
||||
};
|
||||
}, [boardId, getToken, isSignedIn]);
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedTask) {
|
||||
@@ -598,20 +551,20 @@ export default function BoardDetailPage() {
|
||||
|
||||
const connect = async () => {
|
||||
try {
|
||||
const token = await getToken();
|
||||
if (!token || isCancelled) return;
|
||||
const url = new URL(`${apiBase}/api/v1/boards/${boardId}/tasks/stream`);
|
||||
const since = latestTaskTimestamp(tasksRef.current);
|
||||
if (since) {
|
||||
url.searchParams.set("since", since);
|
||||
}
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
const streamResult = await streamTasksApiV1BoardsBoardIdTasksStreamGet(
|
||||
boardId,
|
||||
since ? { since } : undefined,
|
||||
{
|
||||
headers: { Accept: "text/event-stream" },
|
||||
signal: abortController.signal,
|
||||
},
|
||||
signal: abortController.signal,
|
||||
});
|
||||
if (!response.ok || !response.body) {
|
||||
);
|
||||
if (streamResult.status !== 200) {
|
||||
throw new Error("Unable to connect task stream.");
|
||||
}
|
||||
const response = streamResult.data as Response;
|
||||
if (!(response instanceof Response) || !response.body) {
|
||||
throw new Error("Unable to connect task stream.");
|
||||
}
|
||||
const reader = response.body.getReader();
|
||||
@@ -641,11 +594,11 @@ export default function BoardDetailPage() {
|
||||
try {
|
||||
const payload = JSON.parse(data) as {
|
||||
type?: string;
|
||||
task?: Task;
|
||||
comment?: TaskComment;
|
||||
task?: TaskRead;
|
||||
comment?: TaskCommentRead;
|
||||
};
|
||||
if (payload.comment?.task_id && payload.type === "task.comment") {
|
||||
pushLiveFeed(payload.comment as TaskComment);
|
||||
pushLiveFeed(payload.comment);
|
||||
setComments((prev) => {
|
||||
if (selectedTask?.id !== payload.comment?.task_id) {
|
||||
return prev;
|
||||
@@ -657,13 +610,14 @@ export default function BoardDetailPage() {
|
||||
return [...prev, payload.comment as TaskComment];
|
||||
});
|
||||
} else if (payload.task) {
|
||||
const normalizedTask = normalizeTask(payload.task);
|
||||
setTasks((prev) => {
|
||||
const index = prev.findIndex((item) => item.id === payload.task?.id);
|
||||
const index = prev.findIndex((item) => item.id === normalizedTask.id);
|
||||
if (index === -1) {
|
||||
return [payload.task as Task, ...prev];
|
||||
return [normalizedTask, ...prev];
|
||||
}
|
||||
const next = [...prev];
|
||||
next[index] = { ...next[index], ...(payload.task as Task) };
|
||||
next[index] = { ...next[index], ...normalizedTask };
|
||||
return next;
|
||||
});
|
||||
}
|
||||
@@ -686,7 +640,7 @@ export default function BoardDetailPage() {
|
||||
isCancelled = true;
|
||||
abortController.abort();
|
||||
};
|
||||
}, [board, boardId, getToken, isSignedIn, selectedTask?.id, pushLiveFeed]);
|
||||
}, [board, boardId, isSignedIn, selectedTask?.id, pushLiveFeed]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSignedIn || !boardId) return;
|
||||
@@ -695,21 +649,22 @@ export default function BoardDetailPage() {
|
||||
|
||||
const connect = async () => {
|
||||
try {
|
||||
const token = await getToken();
|
||||
if (!token || isCancelled) return;
|
||||
const url = new URL(`${apiBase}/api/v1/agents/stream`);
|
||||
url.searchParams.set("board_id", boardId);
|
||||
const since = latestAgentTimestamp(agentsRef.current);
|
||||
if (since) {
|
||||
url.searchParams.set("since", since);
|
||||
}
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
const streamResult = await streamAgentsApiV1AgentsStreamGet(
|
||||
{
|
||||
board_id: boardId,
|
||||
since: since ?? null,
|
||||
},
|
||||
signal: abortController.signal,
|
||||
});
|
||||
if (!response.ok || !response.body) {
|
||||
{
|
||||
headers: { Accept: "text/event-stream" },
|
||||
signal: abortController.signal,
|
||||
},
|
||||
);
|
||||
if (streamResult.status !== 200) {
|
||||
throw new Error("Unable to connect agent stream.");
|
||||
}
|
||||
const response = streamResult.data as Response;
|
||||
if (!(response instanceof Response) || !response.body) {
|
||||
throw new Error("Unable to connect agent stream.");
|
||||
}
|
||||
const reader = response.body.getReader();
|
||||
@@ -737,19 +692,18 @@ export default function BoardDetailPage() {
|
||||
}
|
||||
if (eventType === "agent" && data) {
|
||||
try {
|
||||
const payload = JSON.parse(data) as { agent?: Agent };
|
||||
const payload = JSON.parse(data) as { agent?: AgentRead };
|
||||
if (payload.agent) {
|
||||
const normalized = normalizeAgent(payload.agent);
|
||||
setAgents((prev) => {
|
||||
const index = prev.findIndex(
|
||||
(item) => item.id === payload.agent?.id,
|
||||
);
|
||||
const index = prev.findIndex((item) => item.id === normalized.id);
|
||||
if (index === -1) {
|
||||
return [payload.agent as Agent, ...prev];
|
||||
return [normalized, ...prev];
|
||||
}
|
||||
const next = [...prev];
|
||||
next[index] = {
|
||||
...next[index],
|
||||
...(payload.agent as Agent),
|
||||
...normalized,
|
||||
};
|
||||
return next;
|
||||
});
|
||||
@@ -773,7 +727,7 @@ export default function BoardDetailPage() {
|
||||
isCancelled = true;
|
||||
abortController.abort();
|
||||
};
|
||||
}, [boardId, getToken, isSignedIn]);
|
||||
}, [boardId, isSignedIn]);
|
||||
|
||||
const resetForm = () => {
|
||||
setTitle("");
|
||||
@@ -792,26 +746,15 @@ export default function BoardDetailPage() {
|
||||
setIsCreating(true);
|
||||
setCreateError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(`${apiBase}/api/v1/boards/${boardId}/tasks`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: trimmed,
|
||||
description: description.trim() || null,
|
||||
status: "inbox",
|
||||
priority,
|
||||
}),
|
||||
const result = await createTaskApiV1BoardsBoardIdTasksPost(boardId, {
|
||||
title: trimmed,
|
||||
description: description.trim() || null,
|
||||
status: "inbox",
|
||||
priority,
|
||||
});
|
||||
if (result.status !== 200) throw new Error("Unable to create task.");
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to create task.");
|
||||
}
|
||||
|
||||
const created = (await response.json()) as Task;
|
||||
const created = normalizeTask(result.data);
|
||||
setTasks((prev) => [created, ...prev]);
|
||||
setIsDialogOpen(false);
|
||||
resetForm();
|
||||
@@ -829,25 +772,14 @@ export default function BoardDetailPage() {
|
||||
setIsChatSending(true);
|
||||
setChatError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/memory`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
content: trimmed,
|
||||
tags: ["chat"],
|
||||
}),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
const result = await createBoardMemoryApiV1BoardsBoardIdMemoryPost(boardId, {
|
||||
content: trimmed,
|
||||
tags: ["chat"],
|
||||
});
|
||||
if (result.status !== 200) {
|
||||
throw new Error("Unable to send message.");
|
||||
}
|
||||
const created = (await response.json()) as BoardChatMessage;
|
||||
const created = result.data;
|
||||
if (created.tags?.includes("chat")) {
|
||||
setChatMessages((prev) => {
|
||||
const exists = prev.some((item) => item.id === created.id);
|
||||
@@ -1015,18 +947,13 @@ export default function BoardDetailPage() {
|
||||
setIsCommentsLoading(true);
|
||||
setCommentsError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/tasks/${taskId}/comments`,
|
||||
{
|
||||
headers: { Authorization: token ? `Bearer ${token}` : "" },
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to load comments.");
|
||||
}
|
||||
const data = (await response.json()) as TaskComment[];
|
||||
setComments(data);
|
||||
const result =
|
||||
await listTaskCommentsApiV1BoardsBoardIdTasksTaskIdCommentsGet(
|
||||
boardId,
|
||||
taskId,
|
||||
);
|
||||
if (result.status !== 200) throw new Error("Unable to load comments.");
|
||||
setComments(result.data);
|
||||
} catch (err) {
|
||||
setCommentsError(err instanceof Error ? err.message : "Something went wrong.");
|
||||
} finally {
|
||||
@@ -1034,10 +961,12 @@ export default function BoardDetailPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const openComments = (task: Task) => {
|
||||
const openComments = (task: { id: string }) => {
|
||||
setIsChatOpen(false);
|
||||
setIsLiveFeedOpen(false);
|
||||
setSelectedTask(task);
|
||||
const fullTask = tasksRef.current.find((item) => item.id === task.id);
|
||||
if (!fullTask) return;
|
||||
setSelectedTask(fullTask);
|
||||
setIsDetailOpen(true);
|
||||
void loadComments(task.id);
|
||||
};
|
||||
@@ -1089,22 +1018,14 @@ export default function BoardDetailPage() {
|
||||
setIsPostingComment(true);
|
||||
setPostCommentError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/tasks/${selectedTask.id}/comments`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({ message: trimmed }),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to send message.");
|
||||
}
|
||||
const created = (await response.json()) as TaskComment;
|
||||
const result =
|
||||
await createTaskCommentApiV1BoardsBoardIdTasksTaskIdCommentsPost(
|
||||
boardId,
|
||||
selectedTask.id,
|
||||
{ message: trimmed },
|
||||
);
|
||||
if (result.status !== 200) throw new Error("Unable to send message.");
|
||||
const created = result.data;
|
||||
setComments((prev) => [created, ...prev]);
|
||||
setNewComment("");
|
||||
} catch (err) {
|
||||
@@ -1126,28 +1047,19 @@ export default function BoardDetailPage() {
|
||||
setIsSavingTask(true);
|
||||
setSaveTaskError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/tasks/${selectedTask.id}`,
|
||||
const result = await updateTaskApiV1BoardsBoardIdTasksTaskIdPatch(
|
||||
boardId,
|
||||
selectedTask.id,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: trimmedTitle,
|
||||
description: editDescription.trim() || null,
|
||||
status: editStatus,
|
||||
priority: editPriority,
|
||||
assigned_agent_id: editAssigneeId || null,
|
||||
}),
|
||||
title: trimmedTitle,
|
||||
description: editDescription.trim() || null,
|
||||
status: editStatus,
|
||||
priority: editPriority,
|
||||
assigned_agent_id: editAssigneeId || null,
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to update task.");
|
||||
}
|
||||
const updated = (await response.json()) as Task;
|
||||
if (result.status !== 200) throw new Error("Unable to update task.");
|
||||
const updated = normalizeTask(result.data);
|
||||
setTasks((prev) =>
|
||||
prev.map((task) => (task.id === updated.id ? updated : task)),
|
||||
);
|
||||
@@ -1177,19 +1089,11 @@ export default function BoardDetailPage() {
|
||||
setIsDeletingTask(true);
|
||||
setDeleteTaskError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/tasks/${selectedTask.id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
},
|
||||
const result = await deleteTaskApiV1BoardsBoardIdTasksTaskIdDelete(
|
||||
boardId,
|
||||
selectedTask.id,
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to delete task.");
|
||||
}
|
||||
if (result.status !== 200) throw new Error("Unable to delete task.");
|
||||
setTasks((prev) => prev.filter((task) => task.id !== selectedTask.id));
|
||||
setIsDeleteDialogOpen(false);
|
||||
closeComments();
|
||||
@@ -1202,7 +1106,7 @@ export default function BoardDetailPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleTaskMove = async (taskId: string, status: string) => {
|
||||
const handleTaskMove = async (taskId: string, status: TaskStatus) => {
|
||||
if (!isSignedIn || !boardId) return;
|
||||
const currentTask = tasksRef.current.find((task) => task.id === taskId);
|
||||
if (!currentTask || currentTask.status === status) return;
|
||||
@@ -1220,22 +1124,13 @@ export default function BoardDetailPage() {
|
||||
),
|
||||
);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/tasks/${taskId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({ status }),
|
||||
},
|
||||
const result = await updateTaskApiV1BoardsBoardIdTasksTaskIdPatch(
|
||||
boardId,
|
||||
taskId,
|
||||
{ status },
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error("Unable to move task.");
|
||||
}
|
||||
const updated = (await response.json()) as Task;
|
||||
if (result.status !== 200) throw new Error("Unable to move task.");
|
||||
const updated = normalizeTask(result.data);
|
||||
setTasks((prev) =>
|
||||
prev.map((task) => (task.id === updated.id ? updated : task)),
|
||||
);
|
||||
@@ -1265,7 +1160,12 @@ export default function BoardDetailPage() {
|
||||
|
||||
const agentAvatarLabel = (agent: Agent) => {
|
||||
if (agent.is_board_lead) return "⚙️";
|
||||
const emoji = resolveEmoji(agent.identity_profile?.emoji ?? null);
|
||||
let emojiValue: string | null = null;
|
||||
if (agent.identity_profile && typeof agent.identity_profile === "object") {
|
||||
const rawEmoji = (agent.identity_profile as Record<string, unknown>).emoji;
|
||||
emojiValue = typeof rawEmoji === "string" ? rawEmoji : null;
|
||||
}
|
||||
const emoji = resolveEmoji(emojiValue);
|
||||
return emoji ?? agentInitials(agent);
|
||||
};
|
||||
|
||||
@@ -1351,8 +1251,8 @@ export default function BoardDetailPage() {
|
||||
payload: Approval["payload"],
|
||||
key: string,
|
||||
) => {
|
||||
if (!payload) return null;
|
||||
const value = payload[key as keyof typeof payload];
|
||||
if (!payload || typeof payload !== "object") return null;
|
||||
const value = (payload as Record<string, unknown>)[key];
|
||||
if (typeof value === "string" || typeof value === "number") {
|
||||
return String(value);
|
||||
}
|
||||
@@ -1393,22 +1293,16 @@ export default function BoardDetailPage() {
|
||||
setApprovalsUpdatingId(approvalId);
|
||||
setApprovalsError(null);
|
||||
try {
|
||||
const token = await getToken();
|
||||
const response = await fetch(
|
||||
`${apiBase}/api/v1/boards/${boardId}/approvals/${approvalId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
body: JSON.stringify({ status }),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
const result =
|
||||
await updateApprovalApiV1BoardsBoardIdApprovalsApprovalIdPatch(
|
||||
boardId,
|
||||
approvalId,
|
||||
{ status },
|
||||
);
|
||||
if (result.status !== 200) {
|
||||
throw new Error("Unable to update approval.");
|
||||
}
|
||||
const updated = (await response.json()) as Approval;
|
||||
const updated = normalizeApproval(result.data);
|
||||
setApprovals((prev) =>
|
||||
prev.map((item) => (item.id === approvalId ? updated : item)),
|
||||
);
|
||||
@@ -1420,7 +1314,7 @@ export default function BoardDetailPage() {
|
||||
setApprovalsUpdatingId(null);
|
||||
}
|
||||
},
|
||||
[boardId, getToken, isSignedIn],
|
||||
[boardId, isSignedIn],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -2219,7 +2113,7 @@ export default function BoardDetailPage() {
|
||||
</label>
|
||||
<Select
|
||||
value={editStatus}
|
||||
onValueChange={setEditStatus}
|
||||
onValueChange={(value) => setEditStatus(value as TaskStatus)}
|
||||
disabled={!selectedTask || isSavingTask}
|
||||
>
|
||||
<SelectTrigger>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user