diff options
Diffstat (limited to 'api4/context.go')
-rw-r--r-- | api4/context.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/api4/context.go b/api4/context.go index c30a975f2..fe2e8d35b 100644 --- a/api4/context.go +++ b/api4/context.go @@ -396,6 +396,17 @@ func (c *Context) RequireFileId() *Context { return c } +func (c *Context) RequireReportId() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.ReportId) != 26 { + c.SetInvalidUrlParam("report_id") + } + return c +} + func (c *Context) RequireTeamName() *Context { if c.Err != nil { return c @@ -455,3 +466,15 @@ func (c *Context) RequirePreferenceName() *Context { return c } + +func (c *Context) RequireHookId() *Context { + if c.Err != nil { + return c + } + + if len(c.Params.HookId) != 26 { + c.SetInvalidUrlParam("hook_id") + } + + return c +} |