arcast/pkg/client/options.go

44 lines
659 B
Go
Raw Normal View History

2023-12-13 20:07:22 +01:00
package client
import "net/http"
type HTTPOptions struct {
Headers http.Header
}
type HTTPOptionFunc func(opts *HTTPOptions)
func NewHTTPOptions(funcs ...HTTPOptionFunc) *HTTPOptions {
opts := &HTTPOptions{}
for _, fn := range funcs {
fn(opts)
}
return opts
}
type ScanOptions struct {
PlayerIDs []string
}
func NewScanOptions(funcs ...ScanOptionFunc) *ScanOptions {
opts := &ScanOptions{
PlayerIDs: make([]string, 0),
}
for _, fn := range funcs {
fn(opts)
}
return opts
}
type ScanOptionFunc func(opts *ScanOptions)
func WithPlayerIDs(ids ...string) ScanOptionFunc {
return func(opts *ScanOptions) {
opts.PlayerIDs = ids
}
}