mirror of
https://github.com/LukeHagar/plexterraform.git
synced 2025-12-09 12:37:47 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.215.1
This commit is contained in:
63
internal/sdk/models/operations/options.go
Normal file
63
internal/sdk/models/operations/options.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
|
||||
)
|
||||
|
||||
var ErrUnsupportedOption = errors.New("unsupported option")
|
||||
|
||||
const (
|
||||
SupportedOptionServerURL = "serverURL"
|
||||
SupportedOptionRetries = "retries"
|
||||
SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
ServerURL *string
|
||||
Retries *utils.RetryConfig
|
||||
}
|
||||
|
||||
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 {
|
||||
if !utils.Contains(supportedOptions, SupportedOptionServerURL) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
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 !utils.Contains(supportedOptions, SupportedOptionServerURL) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
serverURL = utils.ReplaceParameters(serverURL, params)
|
||||
}
|
||||
|
||||
opts.ServerURL = &serverURL
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithRetries allows customizing the default retry configuration.
|
||||
func WithRetries(config utils.RetryConfig) Option {
|
||||
return func(opts *Options, supportedOptions ...string) error {
|
||||
if !utils.Contains(supportedOptions, SupportedOptionRetries) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
opts.Retries = &config
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user