xanzy / go-gitlab

GitLab Go SDK
Apache License 2.0
2.37k stars 940 forks source link

webhook events query and retry #1858

Closed xiazhilei closed 8 months ago

xiazhilei commented 8 months ago

` for , hook := range hooks { hookEvents, , err := git.Projects.ListHookWebhookEvents(projectID, hook.ID, nil) if err != nil { fmt.Printf("Error fetching hook events for hook %d: %v\n", hook.ID, err) continue }

        for _, event := range hookEvents {
            if event.Status == "failed" {
                _, err := git.Projects.RedeliverHook(projectID, hook.ID, event.ID)
                if err != nil {
                    fmt.Printf("Error retrying webhook for event %d: %v\n", event.ID, err)
                } else {
                    fmt.Printf("Webhook retried for event %d\n", event.ID)
                }
            }
        }
    }`

ChatGPT gives the ListHookWebhookEvents method to query the list of events sent, and then retries those with a status of failure. However, I didn't find these two methods in the SDK. Is the SDK missing this method, or did GPT make it up?

svanharmelen commented 8 months ago

You can find out by reading the docs: https://docs.gitlab.com/ee/api/api_resources.html