Documentation
¶
Overview ¶
Package proxyc implements a client to proxy requests to external services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoAvailableServer = errors.New(
"failed to initialize servers. Require at least 1 server has URL",
)
)
Functions ¶
func BuildMetadataTree ¶
func BuildMetadataTree( ctx context.Context, document *schema.RelyProxyAPIDocument, clientOptions *ProxyClientOptions, ) (*internal.Node, error)
BuildMetadataTree builds the metadata tree from the API document.
Types ¶
type ProxyClient ¶
type ProxyClient struct {
// contains filtered or unexported fields
}
ProxyClient helps manage and execute REST and GraphQL APIs from the API document.
func NewProxyClient ¶
func NewProxyClient( ctx context.Context, metadata *schema.RelyProxyAPIDocument, clientOptions *ProxyClientOptions, ) (*ProxyClient, error)
NewProxyClient creates a proxy client from the API document.
func (*ProxyClient) Close ¶
func (pc *ProxyClient) Close() error
Close method performs cleanup and closure activities on the client instance.
func (*ProxyClient) Execute ¶
func (pc *ProxyClient) Execute( ctx context.Context, req *http.Request, ) (*http.Response, any, error)
Execute routes and proxies the request to the remote server.
func (*ProxyClient) Metadata ¶
func (pc *ProxyClient) Metadata() *schema.RelyProxyAPIDocument
Metadata returns the metadata of the proxy client.
type ProxyClientOptions ¶
type ProxyClientOptions struct {
*gohttpc.ClientOptions
BasePath string
}
ProxyClientOptions holds optional options to create a proxy client.
Directories
¶
| Path | Synopsis |
|---|---|
|
handler
|
|
|
graphqlhandler
Package graphqlhandler evaluates and execute GraphQL requests to the remote server.
|
Package graphqlhandler evaluates and execute GraphQL requests to the remote server. |
|
resthandler
Package resthandler evaluates and execute REST requests to the remote server.
|
Package resthandler evaluates and execute REST requests to the remote server. |
|
Package internal implements internal functionality for the proxy client.
|
Package internal implements internal functionality for the proxy client. |
Click to show internal directories.
Click to hide internal directories.