for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package client
import (
"net/http"
"strings"
)
// Option is options for constructing a client
type Option interface {
apply(config *clientConfig)
}
type clientOptionFunc func(config *clientConfig)
func (fn clientOptionFunc) apply(config *clientConfig) {
fn(config)
// WithHTTPClient sets the underlying HTTP client used for API requests.
// By default, http.DefaultClient is used.
func WithHTTPClient(httpClient *http.Client) Option {
return clientOptionFunc(func(config *clientConfig) {
if httpClient != nil {
config.httpClient = httpClient
})
// WithBaseURL set's the base url for the flutterwave API
func WithBaseURL(baseURL string) Option {
if baseURL != "" {
config.baseURL = strings.TrimRight(baseURL, "/")
// WithSecretKey sets the secret key for API authentication.
func WithSecretKey(secretKey string) Option {
config.secretKey = secretKey
// WithPublicKey sets the public key for the public API authentication.
func WithPublicKey(publicKey string) Option {
config.publicKey = publicKey