Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Options( fx.Provide( NewHTTPRequester, fx.Annotate( NewHTTPAuthManager, fx.As(new(AuthManager)), ), NewHTTPRequestBuilder, ), )
Module provides the requester module dependencies
Functions ¶
This section is empty.
Types ¶
type AuthManager ¶
AuthManager handles request authentication
type FileUploadConfig ¶
type FileUploadConfig struct {
FieldName string `json:"field_name"`
AllowedTypes []string `json:"allowed_types"`
MaxSize int64 `json:"max_size"`
}
FileUploadConfig holds configuration for file uploads
type HTTPAuthManager ¶
type HTTPAuthManager struct {
// contains filtered or unexported fields
}
HTTPAuthManager implements the AuthManager interface
func NewHTTPAuthManager ¶
func NewHTTPAuthManager(serviceConfig *config.EndpointConfig) *HTTPAuthManager
NewHTTPAuthManager creates a new HTTPAuthManager
type HTTPRequestBuilder ¶
type HTTPRequestBuilder struct {
// contains filtered or unexported fields
}
HTTPRequestBuilder implements the RequestBuilder interface
func NewHTTPRequestBuilder ¶
func NewHTTPRequestBuilder(params HTTPRequestBuilderParams) *HTTPRequestBuilder
NewHTTPRequestBuilder creates a new HTTPRequestBuilder
func (*HTTPRequestBuilder) BuildRequest ¶
func (b *HTTPRequestBuilder) BuildRequest(ctx context.Context, params map[string]interface{}) (*Request, error)
BuildRequest builds a request from a route name and parameters
type HTTPRequestBuilderParams ¶
type HTTPRequestBuilderParams struct {
fx.In
EndpointConfig *config.EndpointConfig
AuthManager AuthManager
RouteConfig *RouteConfig
}
HTTPRequestBuilderParams holds the parameters for creating an HTTPRequestBuilder
type HTTPRequester ¶
type HTTPRequester struct {
// contains filtered or unexported fields
}
HTTPRequester handles both request building and execution
func NewHTTPRequester ¶
func NewHTTPRequester(params HTTPRequesterParams) *HTTPRequester
NewHTTPRequester creates a new HTTPRequester with default configuration
func (*HTTPRequester) BuildRouteExecutor ¶
func (r *HTTPRequester) BuildRouteExecutor(config *RouteConfig) (RouteExecutor, error)
BuildRouteExecutor creates a function that can execute requests for a specific route
func (*HTTPRequester) SetTimeout ¶
func (r *HTTPRequester) SetTimeout(timeout time.Duration)
SetTimeout sets the timeout for the HTTP client
type HTTPRequesterParams ¶
type HTTPRequesterParams struct {
fx.In
ServiceConfig *config.EndpointConfig
AuthManager AuthManager
}
type MethodConfig ¶
type MethodConfig struct {
// For GET requests
QueryParams []string `json:"query_params,omitempty"`
// For multipart/form-data
FormFields []string `json:"form_fields,omitempty"`
// For file uploads
FileUpload *FileUploadConfig `json:"file_upload,omitempty"`
}
MethodConfig holds method-specific configurations
type Request ¶
type Request struct {
URL string
Method string
Body io.Reader
Headers map[string]string
ContentType string
HttpRequest *http.Request // The actual HTTP request
}
Request represents a fully built HTTP request
type RequestResult ¶
RequestResult holds the result of a request
type RouteConfig ¶
type RouteConfig struct {
Path string `json:"path"`
Method string `json:"method"`
Description string `json:"description,omitempty"`
Headers map[string]string `json:"headers"`
Parameters map[string]string `json:"parameters"`
// Method specific configurations
MethodConfig MethodConfig `json:"method_config"`
}
RouteConfig holds the configuration for a specific route