Skip to content

Commit

Permalink
Add create workspace webhook function
Browse files Browse the repository at this point in the history
  • Loading branch information
VenuManikantaUA committed Aug 22, 2022
1 parent 78a13a7 commit 37b4025
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Client struct {
Teams teams
Repositories *Repositories
Workspaces *Workspace
Webhooks *webhooks
Pagelen int
MaxDepth int
// LimitPages limits the number of pages for a request
Expand Down
14 changes: 14 additions & 0 deletions webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ func (r *Webhooks) Delete(ro *WebhooksOptions) (interface{}, error) {
urlStr := r.c.requestUrl("/repositories/%s/%s/hooks/%s", ro.Owner, ro.RepoSlug, ro.Uuid)
return r.c.execute("DELETE", urlStr, "")
}

func (r *Webhooks) CreateWorkspaceWebhook(ro *WebhooksOptions) (*Webhook, error) {
data, err := r.buildWebhooksBody(ro)
if err != nil {
return nil, err
}
urlStr := r.c.requestUrl("/workspaces/%s/hooks", ro.Owner)
response, err := r.c.execute("POST", urlStr, data)
if err != nil {
return nil, err
}

return decodeWebhook(response)
}

0 comments on commit 37b4025

Please sign in to comment.