모든 API 응답은 일관된 구조를 가지며, 성공과 실패를 명확히 구분할 수 있도록 설계되었습니다.
CommonApiResponse<T>모든 API 응답의 기본 구조입니다.
interface CommonApiResponse<T = any> {
success: boolean;
data?: T;
error?: {
code: string;
message: string;
details?: any;
};
}
| Field | Type | Description |
|---|---|---|
success |
boolean | 요청 성공 여부 |
data |
T | 성공 시 반환되는 데이터 (optional) |
error |
object | 실패 시 오류 정보 (optional) |
SuccessResponse<T>성공 응답의 구조입니다.
type SuccessResponse<T = any> = CommonApiResponse<T> & {
success: true;
data: T;
}
ErrorResponse실패 응답의 구조입니다.
type ErrorResponse = CommonApiResponse<never> & {
success: false;
error: {
code: string;
message: string;
details?: any;
};
}
{
"success": true,
"data": {
"function_id": 12345
}
}
{
"success": true,
"data": {
"functions": [
{
"name": "myFunction",
"runtime": "python",
"code": "def handler(event): return event",
"execution_type": "sync"
}
]
}
}
{
"success": false,
"error": {
"code": "FUNCTION_NOT_FOUND",
"message": "Function with id 12345 not found"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid function parameters",
"details": {
"field": "runtime",
"reason": "Must be one of: python, nodejs"
}
}
}