From 900608b940587c979297c018d831a7df361818b2 Mon Sep 17 00:00:00 2001 From: David May <49894298+wass3rw3rk@users.noreply.github.com> Date: Thu, 6 Jul 2023 16:31:44 -0500 Subject: [PATCH] fix(api): support schedule in filter (#900) --- api/build/list_org.go | 29 ++++++++++++++++++++++++++++- api/build/list_repo.go | 9 +++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/api/build/list_org.go b/api/build/list_org.go index 1ccd8b45b..9758bbc6a 100644 --- a/api/build/list_org.go +++ b/api/build/list_org.go @@ -35,6 +35,33 @@ import ( // required: true // type: string // - in: query +// name: event +// description: Filter by build event +// type: string +// enum: +// - comment +// - deployment +// - pull_request +// - push +// - schedule +// - tag +// - in: query +// name: branch +// description: Filter builds by branch +// type: string +// - in: query +// name: status +// description: Filter by build status +// type: string +// enum: +// - canceled +// - error +// - failure +// - killed +// - pending +// - running +// - success +// - in: query // name: page // description: The page of results to retrieve // type: integer @@ -109,7 +136,7 @@ func ListBuildsForOrg(c *gin.Context) { // verify the event provided is a valid event type if event != constants.EventComment && event != constants.EventDeploy && event != constants.EventPush && event != constants.EventPull && - event != constants.EventTag { + event != constants.EventTag && event != constants.EventSchedule { retErr := fmt.Errorf("unable to process event %s: invalid event type provided", event) util.HandleError(c, http.StatusBadRequest, retErr) diff --git a/api/build/list_repo.go b/api/build/list_repo.go index 2dd71fc1a..f11d35b0b 100644 --- a/api/build/list_repo.go +++ b/api/build/list_repo.go @@ -45,11 +45,12 @@ import ( // description: Filter by build event // type: string // enum: -// - push +// - comment +// - deployment // - pull_request +// - push +// - schedule // - tag -// - deployment -// - comment // - in: query // name: commit // description: Filter builds based on the commit hash @@ -159,7 +160,7 @@ func ListBuildsForRepo(c *gin.Context) { // verify the event provided is a valid event type if event != constants.EventComment && event != constants.EventDeploy && event != constants.EventPush && event != constants.EventPull && - event != constants.EventTag { + event != constants.EventTag && event != constants.EventSchedule { retErr := fmt.Errorf("unable to process event %s: invalid event type provided", event) util.HandleError(c, http.StatusBadRequest, retErr)