adding WebhookURLTimeoutArg for retrieving and validating webhookURLTimeout form field

This commit is contained in:
Julien Neuhart
2019-08-19 16:44:13 +02:00
parent cf5e530ed9
commit e839430270
2 changed files with 66 additions and 1 deletions

View File

@@ -121,6 +121,27 @@ func WaitDelayArg(r Resource, config conf.Config) (float64, error) {
return result, nil
}
/*
WebhookURLTimeoutArg is a helper for retrieving
the "webhookURLTimeout" argument as float64.
It also validates it against the application
configuration.
*/
func WebhookURLTimeoutArg(r Resource, config conf.Config) (float64, error) {
const op string = "resource.WebhookURLTimeoutArg"
result, err := r.Float64Arg(
WebhookURLTimeoutArgKey,
config.DefaultWebhookURLTimeout(),
xassert.Float64NotInferiorTo(0),
xassert.Float64NotSuperiorTo(config.MaximumWebhookURLTimeout()),
)
if err != nil {
return result, xerror.New(op, err)
}
return result, nil
}
/*
PaperSizeArgs is a helper for retrieving
the "paperWidth" and "paperHeight" arguments