-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Generic webhook #8057
base: main
Are you sure you want to change the base?
feat: Generic webhook #8057
Conversation
Nice work! |
Anybody that could have a look at this and help me out ? |
type WebhookGenericReq struct { | ||
Title string `mapstructure:"title" validate:"required"` | ||
Description string `mapstructure:"description"` | ||
Data map[string]interface{} `mapstructure:"json"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the mapstructure
tag value should be data
. Is it a typo?
|
||
err = api.DecodeMapStruct(input.Body, request, true) | ||
if err != nil { | ||
return &plugin.ApiResourceOutput{Body: err.Error(), Status: http.StatusBadRequest}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just return err
as the second returned value.
generic.Title = request.Title | ||
generic.Description = request.Description | ||
generic.CreatedDate = request.CreatedDate | ||
generic.Data = fmt.Sprintf("%s", request.Data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work? I am not sure.
pr-type/bug-fix
,pr-type/feature-development
, etc.Summary
This PR tries to implement #7765 by adding a generic webhook to push any generic/custom data into the database.
Currently WIP, I am struggling to correctly save the information to database looking for feedback to make the code better.
Does this close any open issues?
#7765
Screenshots
Include any relevant screenshots here.
Other Information
Any other information that is important to this PR.