Upgrade go-github to v39 (#17437)
parent
849356deaf
commit
812a9daab9
@ -0,0 +1,48 @@ |
|||||||
|
// 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 |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,73 @@ |
|||||||
|
// 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" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
// ListHookDeliveries lists webhook deliveries for a webhook configured in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#list-deliveries-for-an-organization-webhook
|
||||||
|
func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries", org, id) |
||||||
|
u, err := addOptions(u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
deliveries := []*HookDelivery{} |
||||||
|
resp, err := s.client.Do(ctx, req, &deliveries) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return deliveries, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// GetHookDelivery returns a delivery for a webhook configured in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook
|
||||||
|
func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) |
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
h := new(HookDelivery) |
||||||
|
resp, err := s.client.Do(ctx, req, h) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return h, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#redeliver-a-delivery-for-an-organization-webhook
|
||||||
|
func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) |
||||||
|
req, err := s.client.NewRequest("POST", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
h := new(HookDelivery) |
||||||
|
resp, err := s.client.Do(ctx, req, h) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return h, resp, nil |
||||||
|
} |
@ -0,0 +1,149 @@ |
|||||||
|
// 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" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
// List the packages for an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-an-organization
|
||||||
|
func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages", org) |
||||||
|
u, err := addOptions(u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var packages []*Package |
||||||
|
resp, err := s.client.Do(ctx, req, &packages) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return packages, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// Get a package by name from an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-an-organization
|
||||||
|
func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) |
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var pack *Package |
||||||
|
resp, err := s.client.Do(ctx, req, &pack) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return pack, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// Delete a package from an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-an-organization
|
||||||
|
func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) |
||||||
|
req, err := s.client.NewRequest("DELETE", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil) |
||||||
|
} |
||||||
|
|
||||||
|
// Restore a package to an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-an-organization
|
||||||
|
func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName) |
||||||
|
req, err := s.client.NewRequest("POST", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil) |
||||||
|
} |
||||||
|
|
||||||
|
// Get all versions of a package in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-all-package-versions-for-a-package-owned-by-an-organization
|
||||||
|
func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName) |
||||||
|
u, err := addOptions(u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var versions []*PackageVersion |
||||||
|
resp, err := s.client.Do(ctx, req, &versions) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return versions, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// Get a specific version of a package in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-an-organization
|
||||||
|
func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) |
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var version *PackageVersion |
||||||
|
resp, err := s.client.Do(ctx, req, &version) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return version, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// Delete a package version from an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-package-version-for-an-organization
|
||||||
|
func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) |
||||||
|
req, err := s.client.NewRequest("DELETE", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil) |
||||||
|
} |
||||||
|
|
||||||
|
// Restore a package version to an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-package-version-for-an-organization
|
||||||
|
func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { |
||||||
|
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID) |
||||||
|
req, err := s.client.NewRequest("POST", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil) |
||||||
|
} |
@ -0,0 +1,102 @@ |
|||||||
|
// 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" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
// AutolinkOptions specifies parameters for RepositoriesService.AddAutolink method.
|
||||||
|
type AutolinkOptions struct { |
||||||
|
KeyPrefix *string `json:"key_prefix,omitempty"` |
||||||
|
URLTemplate *string `json:"url_template,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// Autolink represents autolinks to external resources like JIRA issues and Zendesk tickets.
|
||||||
|
type Autolink struct { |
||||||
|
ID *int64 `json:"id,omitempty"` |
||||||
|
KeyPrefix *string `json:"key_prefix,omitempty"` |
||||||
|
URLTemplate *string `json:"url_template,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
// ListAutolinks returns a list of autolinks configured for the given repository.
|
||||||
|
// Information about autolinks are only available to repository administrators.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-all-autolinks-of-a-repository
|
||||||
|
func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) |
||||||
|
u, err := addOptions(u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var autolinks []*Autolink |
||||||
|
resp, err := s.client.Do(ctx, req, &autolinks) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return autolinks, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// AddAutolink creates an autolink reference for a repository.
|
||||||
|
// Users with admin access to the repository can create an autolink.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#create-an-autolink-reference-for-a-repository
|
||||||
|
func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) |
||||||
|
req, err := s.client.NewRequest("POST", u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
al := new(Autolink) |
||||||
|
resp, err := s.client.Do(ctx, req, al) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
return al, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// GetAutolink returns a single autolink reference by ID that was configured for the given repository.
|
||||||
|
// Information about autolinks are only available to repository administrators.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-an-autolink-reference-of-a-repository
|
||||||
|
func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
var autolink *Autolink |
||||||
|
resp, err := s.client.Do(ctx, req, &autolink) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return autolink, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository.
|
||||||
|
// Information about autolinks are only available to repository administrators.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#delete-an-autolink-reference-from-a-repository
|
||||||
|
func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) |
||||||
|
req, err := s.client.NewRequest("DELETE", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, err |
||||||
|
} |
||||||
|
return s.client.Do(ctx, req, nil) |
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
// 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" |
||||||
|
"encoding/json" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
// HookDelivery represents the data that is received from GitHub's Webhook Delivery API
|
||||||
|
//
|
||||||
|
// GitHub API docs:
|
||||||
|
// - https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook
|
||||||
|
// - https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook
|
||||||
|
type HookDelivery struct { |
||||||
|
ID *int64 `json:"id"` |
||||||
|
GUID *string `json:"guid"` |
||||||
|
DeliveredAt *Timestamp `json:"delivered_at"` |
||||||
|
Redelivery *bool `json:"redelivery"` |
||||||
|
Duration *float64 `json:"duration"` |
||||||
|
Status *string `json:"status"` |
||||||
|
StatusCode *int `json:"status_code"` |
||||||
|
Event *string `json:"event"` |
||||||
|
Action *string `json:"action"` |
||||||
|
InstallationID *string `json:"installation_id"` |
||||||
|
RepositoryID *int64 `json:"repository_id"` |
||||||
|
|
||||||
|
// Request is populated by GetHookDelivery.
|
||||||
|
Request *HookRequest `json:"request,omitempty"` |
||||||
|
// Response is populated by GetHookDelivery.
|
||||||
|
Response *HookResponse `json:"response,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
func (d HookDelivery) String() string { |
||||||
|
return Stringify(d) |
||||||
|
} |
||||||
|
|
||||||
|
// HookRequest is a part of HookDelivery that contains
|
||||||
|
// the HTTP headers and the JSON payload of the webhook request.
|
||||||
|
type HookRequest struct { |
||||||
|
Headers map[string]string `json:"headers,omitempty"` |
||||||
|
RawPayload *json.RawMessage `json:"payload,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
func (r HookRequest) String() string { |
||||||
|
return Stringify(r) |
||||||
|
} |
||||||
|
|
||||||
|
// HookResponse is a part of HookDelivery that contains
|
||||||
|
// the HTTP headers and the response body served by the webhook endpoint.
|
||||||
|
type HookResponse struct { |
||||||
|
Headers map[string]string `json:"headers,omitempty"` |
||||||
|
RawPayload *json.RawMessage `json:"payload,omitempty"` |
||||||
|
} |
||||||
|
|
||||||
|
func (r HookResponse) String() string { |
||||||
|
return Stringify(r) |
||||||
|
} |
||||||
|
|
||||||
|
// ListHookDeliveries lists webhook deliveries for a webhook configured in a repository.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook
|
||||||
|
func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries", owner, repo, id) |
||||||
|
u, err := addOptions(u, opts) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
deliveries := []*HookDelivery{} |
||||||
|
resp, err := s.client.Do(ctx, req, &deliveries) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return deliveries, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// GetHookDelivery returns a delivery for a webhook configured in a repository.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook
|
||||||
|
func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { |
||||||
|
u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) |
||||||
|
req, err := s.client.NewRequest("GET", u, nil) |
||||||
|
if err != nil { |
||||||
|
return nil, nil, err |
||||||
|
} |
||||||
|
|
||||||
|
h := new(HookDelivery) |
||||||
|
resp, err := s.client.Do(ctx, req, h) |
||||||
|
if err != nil { |
||||||
|
return nil, resp, err |
||||||
|
} |
||||||
|
|
||||||
|
return h, resp, nil |
||||||
|
} |
||||||
|
|
||||||
|
// ParseRequestPayload parses the request payload. For recognized event types,
|
||||||
|
// a value of the corresponding struct type will be returned.
|
||||||
|
func (d *HookDelivery) ParseRequestPayload() (interface{}, error) { |
||||||
|
eType, ok := eventTypeMapping[*d.Event] |
||||||
|
if !ok { |
||||||
|
return nil, fmt.Errorf("unsupported event type %q", *d.Event) |
||||||
|
} |
||||||
|
|
||||||
|
e := &Event{Type: &eType, RawPayload: d.Request.RawPayload} |
||||||
|
return e.ParsePayload() |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue