Skip curl output when using automatic versioning and reading (#858)

This makes it so that the actual output is the update/delete.

Fixes #856
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-01-08 17:30:41 -05:00
1 parent 31ece74a92
commit 9de928318d
29 files changed
+228 -49

No files matched your search

+12
View File
@@ -17,6 +17,7 @@ type options struct {
postMap map[string]interface{}
queryMap map[string]string
withAutomaticVersioning bool
withSkipCurlOutput bool
}
func getDefaultOptions() options {
@@ -32,6 +33,9 @@ func getOpts(opt ...Option) (options, []api.Option) {
o(&opts)
}
var apiOpts []api.Option
if opts.withSkipCurlOutput {
apiOpts = append(apiOpts, api.WithSkipCurlOutput(true))
}
return opts, apiOpts
}
@@ -45,6 +49,14 @@ func WithAutomaticVersioning(enable bool) Option {
}
}
// WithSkipCurlOutput tells the API to not use the current call for cURL output.
// Useful for when we need to look up versions.
func WithSkipCurlOutput(skip bool) Option {
return func(o *options) {
o.withSkipCurlOutput = true
}
}
func WithAttributes(inAttributes map[string]interface{}) Option {
return func(o *options) {
o.postMap["attributes"] = inAttributes