import type { RoboRequest } from '@robojs/server'; import type { Guild } from 'discord.js'; /** * API Success Response */ export interface ApiSuccessResponse { success: true; data: T; } /** * API Error Response */ export interface ApiErrorResponse { success: false; error: { code: string; message: string; }; } /** * API Response Union Type */ export type ApiResponse = ApiSuccessResponse | ApiErrorResponse; /** * Error Codes */ export declare const ERROR_CODES: { readonly MISSING_GUILD_ID: "MISSING_GUILD_ID"; readonly GUILD_NOT_FOUND: "GUILD_NOT_FOUND"; readonly MISSING_USER_ID: "MISSING_USER_ID"; readonly USER_NOT_FOUND: "USER_NOT_FOUND"; readonly METHOD_NOT_ALLOWED: "METHOD_NOT_ALLOWED"; readonly INVALID_REQUEST: "INVALID_REQUEST"; readonly INVALID_AMOUNT: "INVALID_AMOUNT"; readonly INVALID_CONFIG: "INVALID_CONFIG"; readonly INVALID_LEVEL: "INVALID_LEVEL"; readonly INVALID_ROLE_ID: "INVALID_ROLE_ID"; readonly INVALID_MULTIPLIER: "INVALID_MULTIPLIER"; readonly DUPLICATE_REWARD: "DUPLICATE_REWARD"; readonly REWARD_NOT_FOUND: "REWARD_NOT_FOUND"; readonly INTERNAL_ERROR: "INTERNAL_ERROR"; }; /** * Get guild from request parameters */ export declare function getGuildFromRequest(request: RoboRequest): Promise; /** * Create success response */ export declare function success(data: T): ApiSuccessResponse; /** * Create error response */ export declare function error(code: string, message: string, statusCode?: number, headers?: Record): Response; /** * Validate HTTP method */ export declare function validateMethod(request: RoboRequest, allowedMethods: string[]): void; /** * Validate XP amount */ export declare function validateAmount(amount: unknown): { valid: boolean; error?: string; }; /** * Validate Discord snowflake ID */ export declare function validateSnowflake(id: string): boolean; /** * Validate user ID */ export declare function validateUserId(userId: unknown): { valid: boolean; error?: string; }; /** * Wrap handler with error handling */ export declare function wrapHandler(handler: (request: RoboRequest) => Promise>): (request: RoboRequest) => Promise;