mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 01:12:46 +00:00
Note: the legacy githubTokensDb migration is not included in this commit. It's used only in `agents.js` and will be removed in a future commit. We will directly use credentials repository instead of github tokens repository.
41 lines
634 B
TypeScript
41 lines
634 B
TypeScript
import type {
|
|
ApiErrorShape,
|
|
ApiMeta,
|
|
ApiSuccessShape,
|
|
} from '@/shared/types/http.js';
|
|
|
|
export function createApiMeta(requestId?: string, startedAt?: string): ApiMeta {
|
|
return {
|
|
requestId,
|
|
startedAt,
|
|
};
|
|
}
|
|
|
|
export function createApiSuccessResponse<TData>(
|
|
data: TData,
|
|
meta?: ApiMeta
|
|
): ApiSuccessShape<TData> {
|
|
return {
|
|
success: true,
|
|
data,
|
|
meta,
|
|
};
|
|
}
|
|
|
|
export function createApiErrorResponse(
|
|
code: string,
|
|
message: string,
|
|
meta?: ApiMeta,
|
|
details?: unknown
|
|
): ApiErrorShape {
|
|
return {
|
|
success: false,
|
|
error: {
|
|
code,
|
|
message,
|
|
details,
|
|
},
|
|
meta,
|
|
};
|
|
}
|