mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-04 18:21:06 +02:00
* github.com/Microsoft/go-winio * github.com/bradrydzewski/togo * github.com/containerd/containerd * github.com/docker/cli * github.com/docker/docker * github.com/docker/docker-credential-helpers * github.com/franela/goblin * github.com/google/go-github/v39 * github.com/joho/godotenv * github.com/lib/pq * github.com/moby/moby * github.com/prometheus/client_golang * github.com/tevino/abool * github.com/woodpecker-ci/togo * github.com/xanzy/go-gitlab * github.com/xeipuuv/gojsonschema * github.com/mattn/go-sqlite3
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
// Copyright 2021 The go-github AUTHORS. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package github
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// GetHookConfig returns the webhook configuration for a GitHub App.
|
|
// The underlying transport must be authenticated as an app.
|
|
//
|
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#get-a-webhook-configuration-for-an-app
|
|
func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) {
|
|
req, err := s.client.NewRequest("GET", "app/hook/config", nil)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
config := new(HookConfig)
|
|
resp, err := s.client.Do(ctx, req, &config)
|
|
if err != nil {
|
|
return nil, resp, err
|
|
}
|
|
|
|
return config, resp, nil
|
|
}
|
|
|
|
// UpdateHookConfig updates the webhook configuration for a GitHub App.
|
|
// The underlying transport must be authenticated as an app.
|
|
//
|
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#update-a-webhook-configuration-for-an-app
|
|
func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) {
|
|
req, err := s.client.NewRequest("PATCH", "app/hook/config", config)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
c := new(HookConfig)
|
|
resp, err := s.client.Do(ctx, req, c)
|
|
if err != nil {
|
|
return nil, resp, err
|
|
}
|
|
|
|
return c, resp, nil
|
|
}
|