mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
- go.mod module path + all self-imports: github.com/formancehq/payments -> github.com/hanzo-fi/payments (1590 .go files / 3152 refs; 20 modules: root, pkg/client, pkg/domain, 18 ce/plugins). External dep kept: formancehq/go-libs. - plugins: each ce/plugins/* consumed a *published* pkg/domain; added local 'replace .../pkg/domain => ../../../pkg/domain' (consistent with root) so every standalone plugin module builds in-monorepo. compile-plugin.sh MOD var rebranded too. - branding: README, LICENSE (dual MIT+EE; upstream copyright retained + Hanzo added), goreleaser (release images -> registry.hanzo.ai/hanzo-fi, OCI labels, homepage), proto go_package, renovate, speakeasy gen.yaml, connector-template *.gotpl. - CI: removed Numary/Formance workflows + composite action; added canonical hanzo.yml + cicd.yml (hanzoai/ci, gated HANZO_CI_ENABLED) + secretless ci.yml (go build/vet). - kept as data/compat keys: wire capability enums ALLOW_FORMANCE_*, generated SDK type client.Formance, domain field FormanceRedirectURL, OTEL_SERVICE_NAME, upstream base image. - verified: go build ./... (default + -tags ee) + all 20 nested modules green.
95 lines
2.6 KiB
Go
95 lines
2.6 KiB
Go
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
|
|
package operations
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/hanzo-fi/payments/pkg/client/internal/utils"
|
|
"github.com/hanzo-fi/payments/pkg/client/retry"
|
|
"time"
|
|
)
|
|
|
|
var ErrUnsupportedOption = errors.New("unsupported option")
|
|
|
|
const (
|
|
SupportedOptionRetries = "retries"
|
|
SupportedOptionTimeout = "timeout"
|
|
SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride"
|
|
SupportedOptionURLOverride = "urlOverride"
|
|
)
|
|
|
|
type Options struct {
|
|
ServerURL *string
|
|
Retries *retry.Config
|
|
Timeout *time.Duration
|
|
URLOverride *string
|
|
SetHeaders map[string]string
|
|
}
|
|
|
|
type Option func(*Options, ...string) error
|
|
|
|
// WithServerURL allows providing an alternative server URL.
|
|
func WithServerURL(serverURL string) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
opts.ServerURL = &serverURL
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithTemplatedServerURL allows providing an alternative server URL with templated parameters.
|
|
func WithTemplatedServerURL(serverURL string, params map[string]string) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
if params != nil {
|
|
serverURL = utils.ReplaceParameters(serverURL, params)
|
|
}
|
|
|
|
opts.ServerURL = &serverURL
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithRetries allows customizing the default retry configuration.
|
|
func WithRetries(config retry.Config) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
if !utils.Contains(supportedOptions, SupportedOptionRetries) {
|
|
return ErrUnsupportedOption
|
|
}
|
|
|
|
opts.Retries = &config
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithOperationTimeout allows setting the request timeout applied for an operation.
|
|
func WithOperationTimeout(timeout time.Duration) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
if !utils.Contains(supportedOptions, SupportedOptionRetries) {
|
|
return ErrUnsupportedOption
|
|
}
|
|
|
|
opts.Timeout = &timeout
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithURLOverride allows overriding the URL.
|
|
func WithURLOverride(urlOverride string) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
if !utils.Contains(supportedOptions, SupportedOptionURLOverride) {
|
|
return ErrUnsupportedOption
|
|
}
|
|
|
|
opts.URLOverride = &urlOverride
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithSetHeaders takes a map of headers that will applied to a request. If the
|
|
// request contains headers that are in the map then they will be overwritten.
|
|
func WithSetHeaders(hdrs map[string]string) Option {
|
|
return func(opts *Options, supportedOptions ...string) error {
|
|
opts.SetHeaders = hdrs
|
|
return nil
|
|
}
|
|
}
|