for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package mtnmomo
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, "/")
// WithSubscriptionKey sets the delay in milliseconds before a response is gotten.
func WithSubscriptionKey(subscriptionKey string) Option {
config.subscriptionKey = subscriptionKey
// WithAPIUser sets the delay in milliseconds before a response is gotten.
func WithAPIUser(apiUser string) Option {
config.apiUser = apiUser
// WithAPIKey sets the delay in milliseconds before a response is gotten.
func WithAPIKey(apiKey string) Option {
config.apiKey = apiKey