Documentation
¶
Index ¶
- type APIFeature
- type APIHandler
- type APIRequest
- func (r *APIRequest) AddFile(name, filename, contentType string, data []byte)
- func (r *APIRequest) AddFormData(name, value string)
- func (r *APIRequest) AddHeader(name, value string)
- func (r *APIRequest) AddMetadata(key string, value interface{})
- func (r *APIRequest) AddQueryParam(name, value string)
- func (r *APIRequest) GetHeader(name string) (string, bool)
- func (r *APIRequest) GetMetadata(key string) (interface{}, bool)
- func (r *APIRequest) GetQueryParam(name string) (string, bool)
- func (r *APIRequest) SetAuth(auth *Authentication)
- func (r *APIRequest) SetRetries(retries int)
- func (r *APIRequest) SetTimeout(timeout time.Duration)
- type APIResponse
- type APIStats
- type AuthType
- type Authentication
- type BatchRequest
- type BatchResponse
- type ConnectionInfo
- type ContentType
- type FileUpload
- type FormData
- type GRPCRequest
- type GRPCResponse
- type GRPCStatus
- type GraphQLError
- type GraphQLLocation
- type GraphQLRequest
- func (r *GraphQLRequest) AddHeader(name, value string)
- func (r *GraphQLRequest) AddMetadata(key string, value interface{})
- func (r *GraphQLRequest) AddVariable(name string, value interface{})
- func (r *GraphQLRequest) GetHeader(name string) (string, bool)
- func (r *GraphQLRequest) GetMetadata(key string) (interface{}, bool)
- func (r *GraphQLRequest) GetVariable(name string) (interface{}, bool)
- func (r *GraphQLRequest) SetAuth(auth *Authentication)
- func (r *GraphQLRequest) SetTimeout(timeout time.Duration)
- type GraphQLResponse
- type HTTPMethod
- type Header
- type JWTConfig
- type OAuth2Config
- type PaginationRequest
- type PaginationResponse
- type QueryParam
- type WebSocketHandler
- type WebSocketRequest
- func (r *WebSocketRequest) AddHeader(name, value string)
- func (r *WebSocketRequest) AddMetadata(key string, value interface{})
- func (r *WebSocketRequest) AddProtocol(protocol string)
- func (r *WebSocketRequest) GetHeader(name string) (string, bool)
- func (r *WebSocketRequest) GetMetadata(key string) (interface{}, bool)
- func (r *WebSocketRequest) SetAuth(auth *Authentication)
- func (r *WebSocketRequest) SetTimeout(timeout time.Duration)
- type WebSocketResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIFeature ¶
type APIFeature string
APIFeature represents an API feature
const ( FeatureHTTP APIFeature = "http" FeatureHTTPS APIFeature = "https" FeatureGraphQL APIFeature = "graphql" FeaturegRPC APIFeature = "grpc" FeatureWebSocket APIFeature = "websocket" FeatureAuthentication APIFeature = "authentication" FeatureRateLimit APIFeature = "rate_limit" FeatureRetry APIFeature = "retry" FeatureCircuitBreaker APIFeature = "circuit_breaker" FeatureCaching APIFeature = "caching" FeatureCompression APIFeature = "compression" FeatureEncryption APIFeature = "encryption" FeatureLogging APIFeature = "logging" FeatureMonitoring APIFeature = "monitoring" FeatureTracing APIFeature = "tracing" FeatureValidation APIFeature = "validation" FeatureTransformation APIFeature = "transformation" FeaturePagination APIFeature = "pagination" FeatureBatch APIFeature = "batch" FeatureStreaming APIFeature = "streaming" FeatureAsync APIFeature = "async" FeatureSync APIFeature = "sync" )
type APIHandler ¶
type APIHandler func(response *APIResponse) error
APIHandler handles API responses
type APIRequest ¶
type APIRequest struct {
ID uuid.UUID `json:"id"`
Method HTTPMethod `json:"method"`
URL string `json:"url"`
Headers []Header `json:"headers,omitempty"`
QueryParams []QueryParam `json:"query_params,omitempty"`
Body interface{} `json:"body,omitempty"`
FormData []FormData `json:"form_data,omitempty"`
Files []FileUpload `json:"files,omitempty"`
Auth *Authentication `json:"auth,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Retries int `json:"retries,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
APIRequest represents a generic API request
func CreateAPIRequest ¶
func CreateAPIRequest(method HTTPMethod, url string) *APIRequest
CreateAPIRequest creates a new API request with default values
func (*APIRequest) AddFile ¶
func (r *APIRequest) AddFile(name, filename, contentType string, data []byte)
AddFile adds a file to the request
func (*APIRequest) AddFormData ¶
func (r *APIRequest) AddFormData(name, value string)
AddFormData adds form data to the request
func (*APIRequest) AddHeader ¶
func (r *APIRequest) AddHeader(name, value string)
AddHeader adds a header to the request
func (*APIRequest) AddMetadata ¶
func (r *APIRequest) AddMetadata(key string, value interface{})
AddMetadata adds metadata to the request
func (*APIRequest) AddQueryParam ¶
func (r *APIRequest) AddQueryParam(name, value string)
AddQueryParam adds a query parameter to the request
func (*APIRequest) GetHeader ¶
func (r *APIRequest) GetHeader(name string) (string, bool)
GetHeader retrieves a header from the request
func (*APIRequest) GetMetadata ¶
func (r *APIRequest) GetMetadata(key string) (interface{}, bool)
GetMetadata retrieves metadata from the request
func (*APIRequest) GetQueryParam ¶
func (r *APIRequest) GetQueryParam(name string) (string, bool)
GetQueryParam retrieves a query parameter from the request
func (*APIRequest) SetAuth ¶
func (r *APIRequest) SetAuth(auth *Authentication)
SetAuth sets authentication for the request
func (*APIRequest) SetRetries ¶
func (r *APIRequest) SetRetries(retries int)
SetRetries sets retry count for the request
func (*APIRequest) SetTimeout ¶
func (r *APIRequest) SetTimeout(timeout time.Duration)
SetTimeout sets timeout for the request
type APIResponse ¶
type APIResponse struct {
ID uuid.UUID `json:"id"`
RequestID uuid.UUID `json:"request_id"`
StatusCode int `json:"status_code"`
Headers []Header `json:"headers,omitempty"`
Body interface{} `json:"body,omitempty"`
RawBody []byte `json:"raw_body,omitempty"`
ContentType string `json:"content_type,omitempty"`
Size int64 `json:"size"`
Duration time.Duration `json:"duration"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
APIResponse represents a generic API response
type APIStats ¶
type APIStats struct {
TotalRequests int64 `json:"total_requests"`
SuccessfulRequests int64 `json:"successful_requests"`
FailedRequests int64 `json:"failed_requests"`
AverageResponseTime time.Duration `json:"average_response_time"`
ActiveConnections int `json:"active_connections"`
ProviderData map[string]interface{} `json:"provider_data"`
}
APIStats represents API statistics
type Authentication ¶
type Authentication struct {
Type AuthType `json:"type"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Token string `json:"token,omitempty"`
APIKey string `json:"api_key,omitempty"`
APIKeyHeader string `json:"api_key_header,omitempty"`
APIKeyQuery string `json:"api_key_query,omitempty"`
OAuth2 *OAuth2Config `json:"oauth2,omitempty"`
JWT *JWTConfig `json:"jwt,omitempty"`
Custom map[string]interface{} `json:"custom,omitempty"`
}
Authentication represents authentication configuration
type BatchRequest ¶
type BatchRequest struct {
ID uuid.UUID `json:"id"`
Requests []APIRequest `json:"requests"`
Options map[string]interface{} `json:"options,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
BatchRequest represents a batch API request
type BatchResponse ¶
type BatchResponse struct {
ID uuid.UUID `json:"id"`
RequestID uuid.UUID `json:"request_id"`
Responses []APIResponse `json:"responses"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
BatchResponse represents a batch API response
type ConnectionInfo ¶
type ConnectionInfo struct {
Host string `json:"host"`
Port int `json:"port"`
Protocol string `json:"protocol"`
Version string `json:"version"`
Secure bool `json:"secure"`
}
ConnectionInfo represents API connection information
type ContentType ¶
type ContentType string
ContentType represents content types
const ( ContentTypeJSON ContentType = "application/json" ContentTypeXML ContentType = "application/xml" ContentTypeForm ContentType = "application/x-www-form-urlencoded" ContentTypeMultipart ContentType = "multipart/form-data" ContentTypeText ContentType = "text/plain" ContentTypeHTML ContentType = "text/html" ContentTypeBinary ContentType = "application/octet-stream" ContentTypeGraphQL ContentType = "application/graphql" ContentTypeProtobuf ContentType = "application/x-protobuf" )
type FileUpload ¶
type FileUpload struct {
Name string `json:"name"`
Filename string `json:"filename"`
ContentType string `json:"content_type"`
Data []byte `json:"data"`
}
FileUpload represents a file upload
type GRPCRequest ¶
type GRPCRequest struct {
ID uuid.UUID `json:"id"`
Service string `json:"service"`
Method string `json:"method"`
Data interface{} `json:"data,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GRPCRequest represents a gRPC request
func CreateGRPCRequest ¶
func CreateGRPCRequest(service, method string) *GRPCRequest
CreateGRPCRequest creates a new gRPC request with default values
func (*GRPCRequest) AddMetadata ¶
func (r *GRPCRequest) AddMetadata(key, value string)
AddMetadata adds metadata to the gRPC request
func (*GRPCRequest) AddOption ¶
func (r *GRPCRequest) AddOption(key string, value interface{})
AddOption adds an option to the gRPC request
func (*GRPCRequest) GetMetadata ¶
func (r *GRPCRequest) GetMetadata(key string) (string, bool)
GetMetadata retrieves metadata from the gRPC request
func (*GRPCRequest) GetOption ¶
func (r *GRPCRequest) GetOption(key string) (interface{}, bool)
GetOption retrieves an option from the gRPC request
func (*GRPCRequest) SetTimeout ¶
func (r *GRPCRequest) SetTimeout(timeout time.Duration)
SetTimeout sets timeout for the gRPC request
type GRPCResponse ¶
type GRPCResponse struct {
ID uuid.UUID `json:"id"`
RequestID uuid.UUID `json:"request_id"`
Data interface{} `json:"data,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Status *GRPCStatus `json:"status,omitempty"`
Duration time.Duration `json:"duration"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GRPCResponse represents a gRPC response
type GRPCStatus ¶
type GRPCStatus struct {
Code int `json:"code"`
Message string `json:"message"`
Details string `json:"details,omitempty"`
}
GRPCStatus represents gRPC status
type GraphQLError ¶
type GraphQLError struct {
Message string `json:"message"`
Locations []GraphQLLocation `json:"locations,omitempty"`
Path []interface{} `json:"path,omitempty"`
Extensions map[string]interface{} `json:"extensions,omitempty"`
}
GraphQLError represents a GraphQL error
type GraphQLLocation ¶
GraphQLLocation represents a GraphQL error location
type GraphQLRequest ¶
type GraphQLRequest struct {
ID uuid.UUID `json:"id"`
Query string `json:"query"`
Variables map[string]interface{} `json:"variables,omitempty"`
Operation string `json:"operation,omitempty"`
Headers []Header `json:"headers,omitempty"`
Auth *Authentication `json:"auth,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GraphQLRequest represents a GraphQL request
func CreateGraphQLRequest ¶
func CreateGraphQLRequest(query string) *GraphQLRequest
CreateGraphQLRequest creates a new GraphQL request with default values
func (*GraphQLRequest) AddHeader ¶
func (r *GraphQLRequest) AddHeader(name, value string)
AddHeader adds a header to the GraphQL request
func (*GraphQLRequest) AddMetadata ¶
func (r *GraphQLRequest) AddMetadata(key string, value interface{})
AddMetadata adds metadata to the GraphQL request
func (*GraphQLRequest) AddVariable ¶
func (r *GraphQLRequest) AddVariable(name string, value interface{})
AddVariable adds a variable to the GraphQL request
func (*GraphQLRequest) GetHeader ¶
func (r *GraphQLRequest) GetHeader(name string) (string, bool)
GetHeader retrieves a header from the GraphQL request
func (*GraphQLRequest) GetMetadata ¶
func (r *GraphQLRequest) GetMetadata(key string) (interface{}, bool)
GetMetadata retrieves metadata from the GraphQL request
func (*GraphQLRequest) GetVariable ¶
func (r *GraphQLRequest) GetVariable(name string) (interface{}, bool)
GetVariable retrieves a variable from the GraphQL request
func (*GraphQLRequest) SetAuth ¶
func (r *GraphQLRequest) SetAuth(auth *Authentication)
SetAuth sets authentication for the GraphQL request
func (*GraphQLRequest) SetTimeout ¶
func (r *GraphQLRequest) SetTimeout(timeout time.Duration)
SetTimeout sets timeout for the GraphQL request
type GraphQLResponse ¶
type GraphQLResponse struct {
ID uuid.UUID `json:"id"`
RequestID uuid.UUID `json:"request_id"`
Data interface{} `json:"data,omitempty"`
Errors []GraphQLError `json:"errors,omitempty"`
Headers []Header `json:"headers,omitempty"`
Duration time.Duration `json:"duration"`
Success bool `json:"success"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GraphQLResponse represents a GraphQL response
type HTTPMethod ¶
type HTTPMethod string
HTTPMethod represents HTTP methods
const ( MethodGET HTTPMethod = "GET" MethodPOST HTTPMethod = "POST" MethodPUT HTTPMethod = "PUT" MethodPATCH HTTPMethod = "PATCH" MethodDELETE HTTPMethod = "DELETE" MethodHEAD HTTPMethod = "HEAD" MethodOPTIONS HTTPMethod = "OPTIONS" )
type JWTConfig ¶
type JWTConfig struct {
Secret string `json:"secret"`
Algorithm string `json:"algorithm,omitempty"`
Claims map[string]interface{} `json:"claims,omitempty"`
Expiration time.Duration `json:"expiration,omitempty"`
}
JWTConfig represents JWT configuration
type OAuth2Config ¶
type OAuth2Config struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
TokenURL string `json:"token_url"`
AuthURL string `json:"auth_url,omitempty"`
Scopes []string `json:"scopes,omitempty"`
RedirectURL string `json:"redirect_url,omitempty"`
}
OAuth2Config represents OAuth2 configuration
type PaginationRequest ¶
type PaginationRequest struct {
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Cursor string `json:"cursor,omitempty"`
SortBy string `json:"sort_by,omitempty"`
SortDir string `json:"sort_dir,omitempty"`
}
PaginationRequest represents pagination parameters
type PaginationResponse ¶
type PaginationResponse struct {
Page int `json:"page"`
Limit int `json:"limit"`
Total int64 `json:"total"`
TotalPages int `json:"total_pages"`
HasNext bool `json:"has_next"`
HasPrev bool `json:"has_prev"`
NextCursor string `json:"next_cursor,omitempty"`
PrevCursor string `json:"prev_cursor,omitempty"`
}
PaginationResponse represents pagination response
type QueryParam ¶
QueryParam represents a query parameter
type WebSocketHandler ¶
type WebSocketHandler func(response *WebSocketResponse) error
WebSocketHandler handles WebSocket messages
type WebSocketRequest ¶
type WebSocketRequest struct {
ID uuid.UUID `json:"id"`
URL string `json:"url"`
Headers []Header `json:"headers,omitempty"`
Auth *Authentication `json:"auth,omitempty"`
Protocols []string `json:"protocols,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
WebSocketRequest represents a WebSocket request
func CreateWebSocketRequest ¶
func CreateWebSocketRequest(url string) *WebSocketRequest
CreateWebSocketRequest creates a new WebSocket request with default values
func (*WebSocketRequest) AddHeader ¶
func (r *WebSocketRequest) AddHeader(name, value string)
AddHeader adds a header to the WebSocket request
func (*WebSocketRequest) AddMetadata ¶
func (r *WebSocketRequest) AddMetadata(key string, value interface{})
AddMetadata adds metadata to the WebSocket request
func (*WebSocketRequest) AddProtocol ¶
func (r *WebSocketRequest) AddProtocol(protocol string)
AddProtocol adds a protocol to the WebSocket request
func (*WebSocketRequest) GetHeader ¶
func (r *WebSocketRequest) GetHeader(name string) (string, bool)
GetHeader retrieves a header from the WebSocket request
func (*WebSocketRequest) GetMetadata ¶
func (r *WebSocketRequest) GetMetadata(key string) (interface{}, bool)
GetMetadata retrieves metadata from the WebSocket request
func (*WebSocketRequest) SetAuth ¶
func (r *WebSocketRequest) SetAuth(auth *Authentication)
SetAuth sets authentication for the WebSocket request
func (*WebSocketRequest) SetTimeout ¶
func (r *WebSocketRequest) SetTimeout(timeout time.Duration)
SetTimeout sets timeout for the WebSocket request
type WebSocketResponse ¶
type WebSocketResponse struct {
ID uuid.UUID `json:"id"`
RequestID uuid.UUID `json:"request_id"`
Message interface{} `json:"message,omitempty"`
Type string `json:"type,omitempty"`
Duration time.Duration `json:"duration"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
WebSocketResponse represents a WebSocket response