dto

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dto owns shared administrative HTTP response values.

Index

Constants

View Source
const (
	ErrorTypeInvalidRequest      = "invalid_request_error"
	ErrorTypeAuthenticationError = "authentication_error"
	ErrorTypePermissionError     = "permission_error"
	ErrorTypeNotFound            = "not_found_error"
	ErrorTypeRateLimit           = "rate_limit_error"
	ErrorTypeServerError         = "server_error"
	ErrorTypeServiceUnavailable  = "service_unavailable"
)

Common error types for OpenAI compatibility

Variables

This section is empty.

Functions

func WriteError

func WriteError(w http.ResponseWriter, status int, errType, message string)

WriteError writes an error response

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, data any) error

WriteJSON writes a JSON response

func WriteValidationError

func WriteValidationError(w http.ResponseWriter, field, message string)

WriteValidationError writes a validation error response

Types

type ErrorDetail

type ErrorDetail struct {
	Message string  `json:"message"`
	Type    string  `json:"type"`
	Code    string  `json:"code,omitempty"`
	Param   *string `json:"param,omitempty"`
}

ErrorDetail contains error details

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

ErrorResponse represents an API error response

type HealthResponse

type HealthResponse struct {
	Status    string `json:"status"`
	Timestamp string `json:"timestamp"`
	Service   string `json:"service,omitempty"`
	Version   string `json:"version,omitempty"`
}

HealthResponse represents a health check response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL