diff options
Diffstat (limited to 'api4/context.go')
-rw-r--r-- | api4/context.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/api4/context.go b/api4/context.go index 37af2c6d4..8d4ed7f79 100644 --- a/api4/context.go +++ b/api4/context.go @@ -540,3 +540,25 @@ func (c *Context) RequireCommandId() *Context { } return c } + +func (c *Context) RequireJobId() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.JobId) != 26 { + c.SetInvalidUrlParam("job_id") + } + return c +} + +func (c *Context) RequireJobType() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.JobType) == 0 || len(c.Params.JobType) > 32 { + c.SetInvalidUrlParam("job_type") + } + return c +} |