Skip to content

Commit

Permalink
[MM-53425]:Fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar committed Aug 30, 2023
1 parent 6ca1ae8 commit 1d4678e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (p *Plugin) handleTelemetry(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsTelemetryPayloadValid(telemetryRequest); err != nil {
if err = telemetryRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate telemetry payload.", err)
return
}
Expand All @@ -193,7 +193,7 @@ func (p *Plugin) handleAdd(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsAddIssuePayloadValid(addRequest); err != nil {
if err = addRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate add issue payload.", err)
return
}
Expand Down Expand Up @@ -350,7 +350,7 @@ func (p *Plugin) handleEdit(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsEditIssuePayloadValid(editRequest); err != nil {
if err = editRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate edit issue payload.", err)
return
}
Expand Down Expand Up @@ -390,7 +390,7 @@ func (p *Plugin) handleChangeAssignment(w http.ResponseWriter, r *http.Request)
return
}

if err = IsChangeAssignmentPayloadValid(changeRequest); err != nil {
if err = changeRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate change request payload.", err)
return
}
Expand Down Expand Up @@ -436,7 +436,7 @@ func (p *Plugin) handleAccept(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsAcceptRequestPayloadValid(acceptRequest); err != nil {
if err = acceptRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate accept request payload.", err)
return
}
Expand Down Expand Up @@ -468,7 +468,7 @@ func (p *Plugin) handleComplete(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsCompleteIssuePayloadValid(completeRequest); err != nil {
if err = completeRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate complete issue request payload.", err)
return
}
Expand Down Expand Up @@ -508,7 +508,7 @@ func (p *Plugin) handleRemove(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsRemoveIssuePayloadValid(removeRequest); err != nil {
if err = removeRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate remove issue request payload.", err)
return
}
Expand Down Expand Up @@ -554,7 +554,7 @@ func (p *Plugin) handleBump(w http.ResponseWriter, r *http.Request) {
return
}

if err = IsBumpIssuePayloadValid(bumpRequest); err != nil {
if err = bumpRequest.IsValid(); err != nil {
p.handleErrorWithCode(w, http.StatusBadRequest, "Unable to validate bump request payload.", err)
return
}
Expand Down
16 changes: 8 additions & 8 deletions server/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func GetTelemetryPayloadFromJSON(data io.Reader) (*TelemetryAPIRequest, error) {
return body, nil
}

func IsTelemetryPayloadValid(t *TelemetryAPIRequest) error {
func (t *TelemetryAPIRequest) IsValid() error {
if t == nil {
return errors.New("invalid request body")
}
Expand Down Expand Up @@ -49,7 +49,7 @@ func GetAddIssuePayloadFromJSON(data io.Reader) (*AddAPIRequest, error) {
return body, nil
}

func IsAddIssuePayloadValid(a *AddAPIRequest) error {
func (a *AddAPIRequest) IsValid() error {
if a == nil {
return errors.New("invalid request body")
}
Expand All @@ -76,7 +76,7 @@ func GetEditIssuePayloadFromJSON(data io.Reader) (*EditAPIRequest, error) {
return body, nil
}

func IsEditIssuePayloadValid(e *EditAPIRequest) error {
func (e *EditAPIRequest) IsValid() error {
if e == nil {
return errors.New("invalid request body")
}
Expand All @@ -102,7 +102,7 @@ func GetChangeAssignmentPayloadFromJSON(data io.Reader) (*ChangeAssignmentAPIReq
return body, nil
}

func IsChangeAssignmentPayloadValid(c *ChangeAssignmentAPIRequest) error {
func (c *ChangeAssignmentAPIRequest) IsValid() error {
if c == nil {
return errors.New("invalid request body")
}
Expand Down Expand Up @@ -131,7 +131,7 @@ func GetAcceptRequestPayloadFromJSON(data io.Reader) (*AcceptAPIRequest, error)
return body, nil
}

func IsAcceptRequestPayloadValid(a *AcceptAPIRequest) error {
func (a *AcceptAPIRequest) IsValid() error {
if a == nil {
return errors.New("invalid request body")
}
Expand All @@ -156,7 +156,7 @@ func GetCompleteIssuePayloadFromJSON(data io.Reader) (*CompleteAPIRequest, error
return body, nil
}

func IsCompleteIssuePayloadValid(c *CompleteAPIRequest) error {
func (c *CompleteAPIRequest) IsValid() error {
if c == nil {
return errors.New("invalid request body")
}
Expand All @@ -181,7 +181,7 @@ func GetRemoveIssuePayloadFromJSON(data io.Reader) (*RemoveAPIRequest, error) {
return body, nil
}

func IsRemoveIssuePayloadValid(r *RemoveAPIRequest) error {
func (r *RemoveAPIRequest) IsValid() error {
if r == nil {
return errors.New("invalid request body")
}
Expand All @@ -206,7 +206,7 @@ func GetBumpIssuePayloadFromJSON(data io.Reader) (*BumpAPIRequest, error) {
return body, nil
}

func IsBumpIssuePayloadValid(b *BumpAPIRequest) error {
func (b *BumpAPIRequest) IsValid() error {
if b == nil {
return errors.New("invalid request body")
}
Expand Down

0 comments on commit 1d4678e

Please sign in to comment.