go-github v32 -> v33
This commit is contained in:
parent
afd677cd36
commit
aac578ff11
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
git.rootprojects.org/root/go-gitver/v2 v2.0.2
|
||||||
git.rootprojects.org/root/vfscopy v1.0.0
|
git.rootprojects.org/root/vfscopy v1.0.0
|
||||||
github.com/go-chi/chi v4.1.2+incompatible
|
github.com/go-chi/chi v4.1.2+incompatible
|
||||||
github.com/google/go-github/v32 v32.1.0
|
github.com/google/go-github/v33 v33.0.0
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
|
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
|
||||||
)
|
)
|
||||||
|
|
5
go.sum
5
go.sum
|
@ -5,8 +5,8 @@ git.rootprojects.org/root/vfscopy v1.0.0/go.mod h1:fYHopt0phBfgOfuOJbLnseemp9tsP
|
||||||
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
|
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
|
||||||
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II=
|
github.com/google/go-github/v33 v33.0.0 h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM=
|
||||||
github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
|
github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg=
|
||||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
|
@ -32,7 +32,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"git.rootprojects.org/root/gitdeploy/internal/webhooks"
|
"git.rootprojects.org/root/gitdeploy/internal/webhooks"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/google/go-github/v32/github"
|
"github.com/google/go-github/v33/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
// TODO nix this dependency in favor of a lightweight X-Hub-Signature
|
// TODO nix this dependency in favor of a lightweight X-Hub-Signature
|
||||||
// and JSON-to-Go-struct approach
|
// and JSON-to-Go-struct approach
|
||||||
"github.com/google/go-github/v32/github"
|
"github.com/google/go-github/v33/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
// Copyright 2020 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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Workflow represents a repository action workflow.
|
|
||||||
type Workflow struct {
|
|
||||||
ID *int64 `json:"id,omitempty"`
|
|
||||||
NodeID *string `json:"node_id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Path *string `json:"path,omitempty"`
|
|
||||||
State *string `json:"state,omitempty"`
|
|
||||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
|
||||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
|
||||||
URL *string `json:"url,omitempty"`
|
|
||||||
HTMLURL *string `json:"html_url,omitempty"`
|
|
||||||
BadgeURL *string `json:"badge_url,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Workflows represents a slice of repository action workflows.
|
|
||||||
type Workflows struct {
|
|
||||||
TotalCount *int `json:"total_count,omitempty"`
|
|
||||||
Workflows []*Workflow `json:"workflows,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// WorkflowUsage represents a usage of a specific workflow.
|
|
||||||
type WorkflowUsage struct {
|
|
||||||
Billable *WorkflowEnvironment `json:"billable,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// WorkflowEnvironment represents different runner environments available for a workflow.
|
|
||||||
type WorkflowEnvironment struct {
|
|
||||||
Ubuntu *WorkflowBill `json:"UBUNTU,omitempty"`
|
|
||||||
MacOS *WorkflowBill `json:"MACOS,omitempty"`
|
|
||||||
Windows *WorkflowBill `json:"WINDOWS,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// WorkflowBill specifies billable time for a specific environment in a workflow.
|
|
||||||
type WorkflowBill struct {
|
|
||||||
TotalMS *int64 `json:"total_ms,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListWorkflows lists all workflows in a repository.
|
|
||||||
//
|
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflows/#list-repository-workflows
|
|
||||||
func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) {
|
|
||||||
u := fmt.Sprintf("repos/%s/%s/actions/workflows", 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
|
|
||||||
}
|
|
||||||
|
|
||||||
workflows := new(Workflows)
|
|
||||||
resp, err := s.client.Do(ctx, req, &workflows)
|
|
||||||
if err != nil {
|
|
||||||
return nil, resp, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return workflows, resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetWorkflowByID gets a specific workflow by ID.
|
|
||||||
//
|
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflows/#get-a-workflow
|
|
||||||
func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) {
|
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowID)
|
|
||||||
|
|
||||||
return s.getWorkflow(ctx, u)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetWorkflowByFileName gets a specific workflow by file name.
|
|
||||||
//
|
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflows/#get-a-workflow
|
|
||||||
func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) {
|
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowFileName)
|
|
||||||
|
|
||||||
return s.getWorkflow(ctx, u)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow, *Response, error) {
|
|
||||||
req, err := s.client.NewRequest("GET", url, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
workflow := new(Workflow)
|
|
||||||
resp, err := s.client.Do(ctx, req, workflow)
|
|
||||||
if err != nil {
|
|
||||||
return nil, resp, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return workflow, resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds.
|
|
||||||
//
|
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflows/#get-workflow-usage
|
|
||||||
func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) {
|
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowID)
|
|
||||||
|
|
||||||
return s.getWorkflowUsage(ctx, u)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds.
|
|
||||||
//
|
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflows/#get-workflow-usage
|
|
||||||
func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) {
|
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowFileName)
|
|
||||||
|
|
||||||
return s.getWorkflowUsage(ctx, u)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*WorkflowUsage, *Response, error) {
|
|
||||||
req, err := s.client.NewRequest("GET", url, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
workflowUsage := new(WorkflowUsage)
|
|
||||||
resp, err := s.client.Do(ctx, req, workflowUsage)
|
|
||||||
if err != nil {
|
|
||||||
return nil, resp, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return workflowUsage, resp, nil
|
|
||||||
}
|
|
|
@ -8,5 +8,5 @@ package github
|
||||||
// ActionsService handles communication with the actions related
|
// ActionsService handles communication with the actions related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/
|
||||||
type ActionsService service
|
type ActionsService service
|
|
@ -16,7 +16,7 @@ import (
|
||||||
// data between jobs in a workflow and provide storage for data
|
// data between jobs in a workflow and provide storage for data
|
||||||
// once a workflow is complete.
|
// once a workflow is complete.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/artifacts/
|
||||||
type Artifact struct {
|
type Artifact struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
NodeID *string `json:"node_id,omitempty"`
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
|
@ -30,7 +30,7 @@ type Artifact struct {
|
||||||
|
|
||||||
// ArtifactList represents a list of GitHub artifacts.
|
// ArtifactList represents a list of GitHub artifacts.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/artifacts/
|
||||||
type ArtifactList struct {
|
type ArtifactList struct {
|
||||||
TotalCount *int64 `json:"total_count,omitempty"`
|
TotalCount *int64 `json:"total_count,omitempty"`
|
||||||
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
Artifacts []*Artifact `json:"artifacts,omitempty"`
|
||||||
|
@ -38,7 +38,7 @@ type ArtifactList struct {
|
||||||
|
|
||||||
// ListArtifacts lists all artifacts that belong to a repository.
|
// ListArtifacts lists all artifacts that belong to a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/#list-artifacts-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-artifacts-for-a-repository
|
||||||
func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListOptions) (*ArtifactList, *Response, error) {
|
func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListOptions) (*ArtifactList, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/artifacts", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/artifacts", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -62,7 +62,7 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run.
|
// ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-run-artifacts
|
||||||
func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) {
|
func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/artifacts", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/artifacts", owner, repo, runID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -86,7 +86,7 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re
|
||||||
|
|
||||||
// GetArtifact gets a specific artifact for a workflow run.
|
// GetArtifact gets a specific artifact for a workflow run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/#get-an-artifact
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-artifact
|
||||||
func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) {
|
func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID)
|
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID)
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar
|
||||||
|
|
||||||
// DownloadArtifact gets a redirect URL to download an archive for a repository.
|
// DownloadArtifact gets a redirect URL to download an archive for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/#download-an-artifact
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/artifacts/#download-an-artifact
|
||||||
func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, followRedirects bool) (*url.URL, *Response, error) {
|
func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, followRedirects bool) (*url.URL, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID)
|
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID)
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ func (s *ActionsService) getDownloadArtifactFromURL(ctx context.Context, u strin
|
||||||
|
|
||||||
// DeleteArtifact deletes a workflow run artifact.
|
// DeleteArtifact deletes a workflow run artifact.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/artifacts/#delete-an-artifact
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-an-artifact
|
||||||
func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) {
|
func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID)
|
u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID)
|
||||||
|
|
|
@ -18,9 +18,15 @@ type RunnerApplicationDownload struct {
|
||||||
Filename *string `json:"filename,omitempty"`
|
Filename *string `json:"filename,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled.
|
||||||
|
type ActionsEnabledOnOrgRepos struct {
|
||||||
|
TotalCount int `json:"total_count"`
|
||||||
|
Repositories []*Repository `json:"repositories"`
|
||||||
|
}
|
||||||
|
|
||||||
// ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run.
|
// ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#list-runner-applications-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-runner-applications-for-a-repository
|
||||||
func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) {
|
func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -45,7 +51,7 @@ type RegistrationToken struct {
|
||||||
|
|
||||||
// CreateRegistrationToken creates a token that can be used to add a self-hosted runner.
|
// CreateRegistrationToken creates a token that can be used to add a self-hosted runner.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#create-a-registration-token-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-registration-token-for-a-repository
|
||||||
func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) {
|
func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo)
|
||||||
|
|
||||||
|
@ -69,6 +75,15 @@ type Runner struct {
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
OS *string `json:"os,omitempty"`
|
OS *string `json:"os,omitempty"`
|
||||||
Status *string `json:"status,omitempty"`
|
Status *string `json:"status,omitempty"`
|
||||||
|
Busy *bool `json:"busy,omitempty"`
|
||||||
|
Labels []*RunnerLabels `json:"labels,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunnerLabels represents a collection of labels attached to each runner.
|
||||||
|
type RunnerLabels struct {
|
||||||
|
ID *int64 `json:"id,omitempty"`
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
Type *string `json:"type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runners represents a collection of self-hosted runners for a repository.
|
// Runners represents a collection of self-hosted runners for a repository.
|
||||||
|
@ -79,7 +94,7 @@ type Runners struct {
|
||||||
|
|
||||||
// ListRunners lists all the self-hosted runners for a repository.
|
// ListRunners lists all the self-hosted runners for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#list-self-hosted-runners-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-self-hosted-runners-for-a-repository
|
||||||
func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*Runners, *Response, error) {
|
func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*Runners, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -103,7 +118,7 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op
|
||||||
|
|
||||||
// GetRunner gets a specific self-hosted runner for a repository using its runner ID.
|
// GetRunner gets a specific self-hosted runner for a repository using its runner ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#get-a-self-hosted-runner-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-self-hosted-runner-for-a-repository
|
||||||
func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) {
|
func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -128,7 +143,7 @@ type RemoveToken struct {
|
||||||
|
|
||||||
// CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository.
|
// CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#create-a-remove-token-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-remove-token-for-a-repository
|
||||||
func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) {
|
func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo)
|
||||||
|
|
||||||
|
@ -148,7 +163,7 @@ func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id.
|
// RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#delete-a-self-hosted-runner-from-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-self-hosted-runner-from-a-repository
|
||||||
func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) {
|
func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID)
|
||||||
|
|
||||||
|
@ -162,7 +177,7 @@ func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, r
|
||||||
|
|
||||||
// ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run.
|
// ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#list-runner-applications-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-runner-applications-for-an-organization
|
||||||
func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) {
|
func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner)
|
u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -181,7 +196,7 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.
|
||||||
|
|
||||||
// CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization.
|
// CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#create-a-registration-token-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-registration-token-for-an-organization
|
||||||
func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) {
|
func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner)
|
u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner)
|
||||||
|
|
||||||
|
@ -201,7 +216,7 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context
|
||||||
|
|
||||||
// ListOrganizationRunners lists all the self-hosted runners for an organization.
|
// ListOrganizationRunners lists all the self-hosted runners for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#list-self-hosted-runners-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-self-hosted-runners-for-an-organization
|
||||||
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) {
|
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners", owner)
|
u := fmt.Sprintf("orgs/%v/actions/runners", owner)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -223,9 +238,33 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri
|
||||||
return runners, resp, nil
|
return runners, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-selected-repositories-enabled-for-github-actions-in-an-organization
|
||||||
|
func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) {
|
||||||
|
u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner)
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
repos := &ActionsEnabledOnOrgRepos{}
|
||||||
|
resp, err := s.client.Do(ctx, req, repos)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return repos, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID.
|
// GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#get-a-self-hosted-runner-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-self-hosted-runner-for-an-organization
|
||||||
func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) {
|
func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -244,7 +283,7 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string
|
||||||
|
|
||||||
// CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization.
|
// CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#create-a-remove-token-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-remove-token-for-an-organization
|
||||||
func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) {
|
func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner)
|
u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner)
|
||||||
|
|
||||||
|
@ -264,7 +303,7 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owne
|
||||||
|
|
||||||
// RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id.
|
// RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/self-hosted-runners/#delete-a-self-hosted-runner-from-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-self-hosted-runner-from-an-organization
|
||||||
func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) {
|
func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
||||||
|
|
|
@ -18,7 +18,7 @@ type PublicKey struct {
|
||||||
|
|
||||||
// GetRepoPublicKey gets a public key that should be used for secret encryption.
|
// GetRepoPublicKey gets a public key that should be used for secret encryption.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#get-a-repository-public-key
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-repository-public-key
|
||||||
func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) {
|
func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -37,7 +37,7 @@ func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// GetOrgPublicKey gets a public key that should be used for secret encryption.
|
// GetOrgPublicKey gets a public key that should be used for secret encryption.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#get-an-organization-public-key
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-organization-public-key
|
||||||
func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) {
|
func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -72,7 +72,7 @@ type Secrets struct {
|
||||||
// ListRepoSecrets lists all secrets available in a repository
|
// ListRepoSecrets lists all secrets available in a repository
|
||||||
// without revealing their encrypted values.
|
// without revealing their encrypted values.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#list-repository-secrets
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-repository-secrets
|
||||||
func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) {
|
func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -96,7 +96,7 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// GetRepoSecret gets a single repository secret without revealing its encrypted value.
|
// GetRepoSecret gets a single repository secret without revealing its encrypted value.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#get-a-repository-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-repository-secret
|
||||||
func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) {
|
func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name)
|
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -131,7 +131,7 @@ type EncryptedSecret struct {
|
||||||
|
|
||||||
// CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value.
|
// CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#create-or-update-a-repository-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-or-update-a-repository-secret
|
||||||
func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) {
|
func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name)
|
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name)
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, re
|
||||||
|
|
||||||
// DeleteRepoSecret deletes a secret in a repository using the secret name.
|
// DeleteRepoSecret deletes a secret in a repository using the secret name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#delete-a-repository-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-a-repository-secret
|
||||||
func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) {
|
func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name)
|
u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name)
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name
|
||||||
// ListOrgSecrets lists all secrets available in an organization
|
// ListOrgSecrets lists all secrets available in an organization
|
||||||
// without revealing their encrypted values.
|
// without revealing their encrypted values.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#list-organization-secrets
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-organization-secrets
|
||||||
func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) {
|
func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets", org)
|
u := fmt.Sprintf("orgs/%v/actions/secrets", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -184,7 +184,7 @@ func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *L
|
||||||
|
|
||||||
// GetOrgSecret gets a single organization secret without revealing its encrypted value.
|
// GetOrgSecret gets a single organization secret without revealing its encrypted value.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#get-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-an-organization-secret
|
||||||
func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) {
|
func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -203,7 +203,7 @@ func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*S
|
||||||
|
|
||||||
// CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value.
|
// CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#create-or-update-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-or-update-an-organization-secret
|
||||||
func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) {
|
func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name)
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ type SelectedReposList struct {
|
||||||
|
|
||||||
// ListSelectedReposForOrgSecret lists all repositories that have access to a secret.
|
// ListSelectedReposForOrgSecret lists all repositories that have access to a secret.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#list-selected-repositories-for-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-selected-repositories-for-an-organization-secret
|
||||||
func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string) (*SelectedReposList, *Response, error) {
|
func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string) (*SelectedReposList, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -242,7 +242,7 @@ func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org,
|
||||||
|
|
||||||
// SetSelectedReposForOrgSecret sets the repositories that have access to a secret.
|
// SetSelectedReposForOrgSecret sets the repositories that have access to a secret.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#set-selected-repositories-for-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#set-selected-repositories-for-an-organization-secret
|
||||||
func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) {
|
func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name)
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org,
|
||||||
|
|
||||||
// AddSelectedRepoToOrgSecret adds a repository to an organization secret.
|
// AddSelectedRepoToOrgSecret adds a repository to an organization secret.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#add-selected-repository-to-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#add-selected-repository-to-an-organization-secret
|
||||||
func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) {
|
func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
||||||
|
@ -273,7 +273,7 @@ func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, na
|
||||||
|
|
||||||
// RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret.
|
// RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#remove-selected-repository-from-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#remove-selected-repository-from-an-organization-secret
|
||||||
func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) {
|
func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -286,7 +286,7 @@ func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, or
|
||||||
|
|
||||||
// DeleteOrgSecret deletes a secret in an organization using the secret name.
|
// DeleteOrgSecret deletes a secret in an organization using the secret name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/secrets/#delete-an-organization-secret
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-an-organization-secret
|
||||||
func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) {
|
func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name)
|
u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name)
|
||||||
|
|
|
@ -60,7 +60,7 @@ type ListWorkflowJobsOptions struct {
|
||||||
|
|
||||||
// ListWorkflowJobs lists all jobs for a workflow run.
|
// ListWorkflowJobs lists all jobs for a workflow run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-jobs/#list-jobs-for-a-workflow-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-jobs-for-a-workflow-run
|
||||||
func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) {
|
func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID)
|
u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -84,7 +84,7 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// GetWorkflowJobByID gets a specific job in a workflow run by ID.
|
// GetWorkflowJobByID gets a specific job in a workflow run by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-jobs/#get-a-job-for-a-workflow-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-job-for-a-workflow-run
|
||||||
func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) {
|
func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID)
|
u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID)
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job.
|
// GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-jobs/#download-job-logs-for-a-workflow-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#download-job-logs-for-a-workflow-run
|
||||||
func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, followRedirects bool) (*url.URL, *Response, error) {
|
func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, followRedirects bool) (*url.URL, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID)
|
u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID)
|
||||||
|
|
|
@ -96,7 +96,7 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string,
|
||||||
|
|
||||||
// ListWorkflowRunsByID lists all workflow runs by workflow ID.
|
// ListWorkflowRunsByID lists all workflow runs by workflow ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs
|
||||||
func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID)
|
u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID)
|
||||||
return s.listWorkflowRuns(ctx, u, opts)
|
return s.listWorkflowRuns(ctx, u, opts)
|
||||||
|
@ -104,7 +104,7 @@ func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo s
|
||||||
|
|
||||||
// ListWorkflowRunsByFileName lists all workflow runs by workflow file name.
|
// ListWorkflowRunsByFileName lists all workflow runs by workflow file name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs
|
||||||
func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName)
|
u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName)
|
||||||
return s.listWorkflowRuns(ctx, u, opts)
|
return s.listWorkflowRuns(ctx, u, opts)
|
||||||
|
@ -112,7 +112,7 @@ func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner,
|
||||||
|
|
||||||
// ListRepositoryWorkflowRuns lists all workflow runs for a repository.
|
// ListRepositoryWorkflowRuns lists all workflow runs for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-workflow-runs-for-a-repository
|
||||||
func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -136,7 +136,7 @@ func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner,
|
||||||
|
|
||||||
// GetWorkflowRunByID gets a specific workflow run by ID.
|
// GetWorkflowRunByID gets a specific workflow run by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#get-a-workflow-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow-run
|
||||||
func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) {
|
func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID)
|
||||||
|
|
||||||
|
@ -154,9 +154,9 @@ func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo str
|
||||||
return run, resp, nil
|
return run, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RerunWorkflow re-runs a workflow by ID.
|
// RerunWorkflowByID re-runs a workflow by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#re-run-a-workflow
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#re-run-a-workflow
|
||||||
func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID)
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// CancelWorkflowRunByID cancels a workflow run by ID.
|
// CancelWorkflowRunByID cancels a workflow run by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#cancel-a-workflow-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#cancel-a-workflow-run
|
||||||
func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID)
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run.
|
// GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#download-workflow-run-logs
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#download-workflow-run-logs
|
||||||
func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, followRedirects bool) (*url.URL, *Response, error) {
|
func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, followRedirects bool) (*url.URL, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID)
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// DeleteWorkflowRunLogs deletes all logs for a workflow run.
|
// DeleteWorkflowRunLogs deletes all logs for a workflow run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#delete-workflow-run-logs
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#delete-workflow-run-logs
|
||||||
func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID)
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds.
|
// GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/actions/workflow-runs/#get-workflow-run-usage
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-run-usage
|
||||||
func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) {
|
func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID)
|
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID)
|
||||||
|
|
227
vendor/github.com/google/go-github/v33/github/actions_workflows.go
generated
vendored
Normal file
227
vendor/github.com/google/go-github/v33/github/actions_workflows.go
generated
vendored
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
// Copyright 2020 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Workflow represents a repository action workflow.
|
||||||
|
type Workflow struct {
|
||||||
|
ID *int64 `json:"id,omitempty"`
|
||||||
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
Path *string `json:"path,omitempty"`
|
||||||
|
State *string `json:"state,omitempty"`
|
||||||
|
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||||
|
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
HTMLURL *string `json:"html_url,omitempty"`
|
||||||
|
BadgeURL *string `json:"badge_url,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workflows represents a slice of repository action workflows.
|
||||||
|
type Workflows struct {
|
||||||
|
TotalCount *int `json:"total_count,omitempty"`
|
||||||
|
Workflows []*Workflow `json:"workflows,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WorkflowUsage represents a usage of a specific workflow.
|
||||||
|
type WorkflowUsage struct {
|
||||||
|
Billable *WorkflowEnvironment `json:"billable,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WorkflowEnvironment represents different runner environments available for a workflow.
|
||||||
|
type WorkflowEnvironment struct {
|
||||||
|
Ubuntu *WorkflowBill `json:"UBUNTU,omitempty"`
|
||||||
|
MacOS *WorkflowBill `json:"MACOS,omitempty"`
|
||||||
|
Windows *WorkflowBill `json:"WINDOWS,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WorkflowBill specifies billable time for a specific environment in a workflow.
|
||||||
|
type WorkflowBill struct {
|
||||||
|
TotalMS *int64 `json:"total_ms,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateWorkflowDispatchEventRequest represents a request to create a workflow dispatch event.
|
||||||
|
type CreateWorkflowDispatchEventRequest struct {
|
||||||
|
// Ref represents the reference of the workflow run.
|
||||||
|
// The reference can be a branch, tag, or a commit SHA.
|
||||||
|
// Ref is required when creating a workflow dispatch event.
|
||||||
|
Ref string `json:"ref"`
|
||||||
|
// Inputs represents input keys and values configured in the workflow file.
|
||||||
|
// The maximum number of properties is 10.
|
||||||
|
// Default: Any default properties configured in the workflow file will be used when `inputs` are omitted.
|
||||||
|
Inputs map[string]interface{} `json:"inputs,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListWorkflows lists all workflows in a repository.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-repository-workflows
|
||||||
|
func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%s/%s/actions/workflows", 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
|
||||||
|
}
|
||||||
|
|
||||||
|
workflows := new(Workflows)
|
||||||
|
resp, err := s.client.Do(ctx, req, &workflows)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return workflows, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflowByID gets a specific workflow by ID.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow
|
||||||
|
func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowID)
|
||||||
|
|
||||||
|
return s.getWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflowByFileName gets a specific workflow by file name.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-workflow
|
||||||
|
func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowFileName)
|
||||||
|
|
||||||
|
return s.getWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow, *Response, error) {
|
||||||
|
req, err := s.client.NewRequest("GET", url, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow := new(Workflow)
|
||||||
|
resp, err := s.client.Do(ctx, req, workflow)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return workflow, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-usage
|
||||||
|
func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowID)
|
||||||
|
|
||||||
|
return s.getWorkflowUsage(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-workflow-usage
|
||||||
|
func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowFileName)
|
||||||
|
|
||||||
|
return s.getWorkflowUsage(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*WorkflowUsage, *Response, error) {
|
||||||
|
req, err := s.client.NewRequest("GET", url, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
workflowUsage := new(WorkflowUsage)
|
||||||
|
resp, err := s.client.Do(ctx, req, workflowUsage)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return workflowUsage, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateWorkflowDispatchEventByID manually triggers a GitHub Actions workflow run.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-workflow-dispatch-event
|
||||||
|
func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID)
|
||||||
|
|
||||||
|
return s.createWorkflowDispatchEvent(ctx, u, &event)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#create-a-workflow-dispatch-event
|
||||||
|
func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName)
|
||||||
|
|
||||||
|
return s.createWorkflowDispatchEvent(ctx, u, &event)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*Response, error) {
|
||||||
|
req, err := s.client.NewRequest("POST", url, event)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableWorkflowByID enables a workflow and sets the state of the workflow to "active".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#enable-a-workflow
|
||||||
|
func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowID)
|
||||||
|
return s.enableWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableWorkflowByFileName enables a workflow and sets the state of the workflow to "active".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#enable-a-workflow
|
||||||
|
func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowFileName)
|
||||||
|
return s.enableWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ActionsService) enableWorkflow(ctx context.Context, url string) (*Response, error) {
|
||||||
|
req, err := s.client.NewRequest("PUT", url, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DisableWorkflowByID disables a workflow and sets the state of the workflow to "disabled_manually".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#disable-a-workflow
|
||||||
|
func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowID)
|
||||||
|
return s.enableWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DisableWorkflowByFileName disables a workflow and sets the state of the workflow to "disabled_manually".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#disable-a-workflow
|
||||||
|
func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowFileName)
|
||||||
|
return s.enableWorkflow(ctx, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ActionsService) disableWorkflow(ctx context.Context, url string) (*Response, error) {
|
||||||
|
req, err := s.client.NewRequest("PUT", url, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.client.Do(ctx, req, nil)
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ import "context"
|
||||||
// ActivityService handles communication with the activity related
|
// ActivityService handles communication with the activity related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/
|
||||||
type ActivityService service
|
type ActivityService service
|
||||||
|
|
||||||
// FeedLink represents a link to a related resource.
|
// FeedLink represents a link to a related resource.
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ListEvents drinks from the firehose of all public events across GitHub.
|
// ListEvents drinks from the firehose of all public events across GitHub.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events
|
||||||
func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
u, err := addOptions("events", opts)
|
u, err := addOptions("events", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -35,7 +35,7 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]
|
||||||
|
|
||||||
// ListRepositoryEvents lists events for a repository.
|
// ListRepositoryEvents lists events for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-repository-events
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repository-events
|
||||||
func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -59,7 +59,7 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// ListIssueEventsForRepository lists issue events for a repository.
|
// ListIssueEventsForRepository lists issue events for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-issue-events-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events-for-a-repository
|
||||||
func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -83,7 +83,7 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne
|
||||||
|
|
||||||
// ListEventsForRepoNetwork lists public events for a network of repositories.
|
// ListEventsForRepoNetwork lists public events for a network of repositories.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-for-a-network-of-repositories
|
||||||
func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
|
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -107,7 +107,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r
|
||||||
|
|
||||||
// ListEventsForOrganization lists public events for an organization.
|
// ListEventsForOrganization lists public events for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-organization-events
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-organization-events
|
||||||
func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/events", org)
|
u := fmt.Sprintf("orgs/%v/events", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -132,8 +132,8 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str
|
||||||
// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is
|
// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is
|
||||||
// true, only public events will be returned.
|
// true, only public events will be returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-events-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-for-a-user
|
||||||
func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if publicOnly {
|
if publicOnly {
|
||||||
|
@ -163,8 +163,8 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st
|
||||||
// ListEventsReceivedByUser lists the events received by a user. If publicOnly is
|
// ListEventsReceivedByUser lists the events received by a user. If publicOnly is
|
||||||
// true, only public events will be returned.
|
// true, only public events will be returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-received-by-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-events-received-by-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-received-by-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-public-events-received-by-a-user
|
||||||
func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if publicOnly {
|
if publicOnly {
|
||||||
|
@ -194,7 +194,7 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str
|
||||||
// ListUserEventsForOrganization provides the user’s organization dashboard. You
|
// ListUserEventsForOrganization provides the user’s organization dashboard. You
|
||||||
// must be authenticated as the user to view this.
|
// must be authenticated as the user to view this.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-organization-events-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-organization-events-for-the-authenticated-user
|
||||||
func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) {
|
func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) {
|
||||||
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
|
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -19,7 +19,7 @@ type Notification struct {
|
||||||
|
|
||||||
// Reason identifies the event that triggered the notification.
|
// Reason identifies the event that triggered the notification.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#notification-reasons
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity#notification-reasons
|
||||||
Reason *string `json:"reason,omitempty"`
|
Reason *string `json:"reason,omitempty"`
|
||||||
|
|
||||||
Unread *bool `json:"unread,omitempty"`
|
Unread *bool `json:"unread,omitempty"`
|
||||||
|
@ -49,7 +49,7 @@ type NotificationListOptions struct {
|
||||||
|
|
||||||
// ListNotifications lists all notifications for the authenticated user.
|
// ListNotifications lists all notifications for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-notifications-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-notifications-for-the-authenticated-user
|
||||||
func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) {
|
func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) {
|
||||||
u := fmt.Sprintf("notifications")
|
u := fmt.Sprintf("notifications")
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -74,7 +74,7 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat
|
||||||
// ListRepositoryNotifications lists all notifications in a given repository
|
// ListRepositoryNotifications lists all notifications in a given repository
|
||||||
// for the authenticated user.
|
// for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-repository-notifications-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repository-notifications-for-the-authenticated-user
|
||||||
func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) {
|
func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -102,7 +102,7 @@ type markReadOptions struct {
|
||||||
|
|
||||||
// MarkNotificationsRead marks all notifications up to lastRead as read.
|
// MarkNotificationsRead marks all notifications up to lastRead as read.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-as-read
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity#mark-as-read
|
||||||
func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) {
|
func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) {
|
||||||
opts := &markReadOptions{
|
opts := &markReadOptions{
|
||||||
LastReadAt: lastRead,
|
LastReadAt: lastRead,
|
||||||
|
@ -118,7 +118,7 @@ func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead ti
|
||||||
// MarkRepositoryNotificationsRead marks all notifications up to lastRead in
|
// MarkRepositoryNotificationsRead marks all notifications up to lastRead in
|
||||||
// the specified repository as read.
|
// the specified repository as read.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-repository-notifications-as-read
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#mark-repository-notifications-as-read
|
||||||
func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) {
|
func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) {
|
||||||
opts := &markReadOptions{
|
opts := &markReadOptions{
|
||||||
LastReadAt: lastRead,
|
LastReadAt: lastRead,
|
||||||
|
@ -134,7 +134,7 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, o
|
||||||
|
|
||||||
// GetThread gets the specified notification thread.
|
// GetThread gets the specified notification thread.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-thread
|
||||||
func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) {
|
func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) {
|
||||||
u := fmt.Sprintf("notifications/threads/%v", id)
|
u := fmt.Sprintf("notifications/threads/%v", id)
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notificati
|
||||||
|
|
||||||
// MarkThreadRead marks the specified thread as read.
|
// MarkThreadRead marks the specified thread as read.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#mark-a-thread-as-read
|
||||||
func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) {
|
func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) {
|
||||||
u := fmt.Sprintf("notifications/threads/%v", id)
|
u := fmt.Sprintf("notifications/threads/%v", id)
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Respo
|
||||||
// GetThreadSubscription checks to see if the authenticated user is subscribed
|
// GetThreadSubscription checks to see if the authenticated user is subscribed
|
||||||
// to a thread.
|
// to a thread.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-thread-subscription-for-the-authenticated-user
|
||||||
func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) {
|
func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) {
|
||||||
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string)
|
||||||
// SetThreadSubscription sets the subscription for the specified thread for the
|
// SetThreadSubscription sets the subscription for the specified thread for the
|
||||||
// authenticated user.
|
// authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#set-a-thread-subscription
|
||||||
func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) {
|
func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) {
|
||||||
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string,
|
||||||
// DeleteThreadSubscription deletes the subscription for the specified thread
|
// DeleteThreadSubscription deletes the subscription for the specified thread
|
||||||
// for the authenticated user.
|
// for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#delete-a-thread-subscription
|
||||||
func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) {
|
func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) {
|
||||||
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
u := fmt.Sprintf("notifications/threads/%v/subscription", id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -25,7 +25,7 @@ type Stargazer struct {
|
||||||
|
|
||||||
// ListStargazers lists people who have starred the specified repo.
|
// ListStargazers lists people who have starred the specified repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-stargazers
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-stargazers
|
||||||
func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) {
|
func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -67,8 +67,8 @@ type ActivityListStarredOptions struct {
|
||||||
// ListStarred lists all the repos starred by a user. Passing the empty string
|
// ListStarred lists all the repos starred by a user. Passing the empty string
|
||||||
// will list the starred repositories for the authenticated user.
|
// will list the starred repositories for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-starred-by-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-starred-by-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-starred-by-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-starred-by-a-user
|
||||||
func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
|
func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -101,7 +101,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac
|
||||||
|
|
||||||
// IsStarred checks if a repository is starred by authenticated user.
|
// IsStarred checks if a repository is starred by authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#check-if-a-repository-is-starred-by-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#check-if-a-repository-is-starred-by-the-authenticated-user
|
||||||
func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) {
|
func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -115,7 +115,7 @@ func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bo
|
||||||
|
|
||||||
// Star a repository as the authenticated user.
|
// Star a repository as the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#star-a-repository-for-the-authenticated-user
|
||||||
func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
||||||
|
@ -127,7 +127,7 @@ func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Respon
|
||||||
|
|
||||||
// Unstar a repository as the authenticated user.
|
// Unstar a repository as the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#unstar-a-repository-for-the-authenticated-user
|
||||||
func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
u := fmt.Sprintf("user/starred/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -27,7 +27,7 @@ type Subscription struct {
|
||||||
|
|
||||||
// ListWatchers lists watchers of a particular repo.
|
// ListWatchers lists watchers of a particular repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-watchers
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-watchers
|
||||||
func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) {
|
func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -52,8 +52,8 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string,
|
||||||
// ListWatched lists the repositories the specified user is watching. Passing
|
// ListWatched lists the repositories the specified user is watching. Passing
|
||||||
// the empty string will fetch watched repos for the authenticated user.
|
// the empty string will fetch watched repos for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-repositories-watched-by-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-watched-by-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#list-repositories-watched-by-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-repositories-watched-by-a-user
|
||||||
func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *ListOptions) ([]*Repository, *Response, error) {
|
func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *ListOptions) ([]*Repository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -84,7 +84,7 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li
|
||||||
// repository for the authenticated user. If the authenticated user is not
|
// repository for the authenticated user. If the authenticated user is not
|
||||||
// watching the repository, a nil Subscription is returned.
|
// watching the repository, a nil Subscription is returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#get-a-repository-subscription
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#get-a-repository-subscription
|
||||||
func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) {
|
func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner,
|
||||||
// To ignore notifications made within a repository, set subscription.Ignored to true.
|
// To ignore notifications made within a repository, set subscription.Ignored to true.
|
||||||
// To stop watching a repository, use DeleteRepositorySubscription.
|
// To stop watching a repository, use DeleteRepositorySubscription.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#set-a-repository-subscription
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#set-a-repository-subscription
|
||||||
func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) {
|
func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner,
|
||||||
// This is used to stop watching a repository. To control whether or not to
|
// This is used to stop watching a repository. To control whether or not to
|
||||||
// receive notifications from a repository, use SetRepositorySubscription.
|
// receive notifications from a repository, use SetRepositorySubscription.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#delete-a-repository-subscription
|
||||||
func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// GitHub API. These API routes are normally only accessible for GitHub
|
// GitHub API. These API routes are normally only accessible for GitHub
|
||||||
// Enterprise installations.
|
// Enterprise installations.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/enterprise/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/
|
||||||
type AdminService service
|
type AdminService service
|
||||||
|
|
||||||
// TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group.
|
// TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group.
|
||||||
|
@ -82,7 +82,7 @@ func (m Enterprise) String() string {
|
||||||
|
|
||||||
// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.
|
// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/ldap/#update-ldap-mapping-for-a-user
|
||||||
func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) {
|
func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) {
|
||||||
u := fmt.Sprintf("admin/ldap/users/%v/mapping", user)
|
u := fmt.Sprintf("admin/ldap/users/%v/mapping", user)
|
||||||
req, err := s.client.NewRequest("PATCH", u, mapping)
|
req, err := s.client.NewRequest("PATCH", u, mapping)
|
||||||
|
@ -101,7 +101,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m
|
||||||
|
|
||||||
// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.
|
// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise/ldap/#update-ldap-mapping-for-a-team
|
||||||
func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
|
func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
|
||||||
u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team)
|
u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team)
|
||||||
req, err := s.client.NewRequest("PATCH", u, mapping)
|
req, err := s.client.NewRequest("PATCH", u, mapping)
|
|
@ -153,7 +153,7 @@ func (s RepoStats) String() string {
|
||||||
// Please note that this is only available to site administrators,
|
// Please note that this is only available to site administrators,
|
||||||
// otherwise it will error with a 404 not found (instead of 401 or 403).
|
// otherwise it will error with a 404 not found (instead of 401 or 403).
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/enterprise-admin/admin_stats/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/admin_stats/
|
||||||
func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
|
func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
|
||||||
u := fmt.Sprintf("enterprise/stats/all")
|
u := fmt.Sprintf("enterprise/stats/all")
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// AppsService provides access to the installation related functions
|
// AppsService provides access to the installation related functions
|
||||||
// in the GitHub API.
|
// in the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/
|
||||||
type AppsService service
|
type AppsService service
|
||||||
|
|
||||||
// App represents a GitHub App.
|
// App represents a GitHub App.
|
||||||
|
@ -55,7 +55,7 @@ type InstallationTokenOptions struct {
|
||||||
// InstallationPermissions lists the repository and organization permissions for an installation.
|
// InstallationPermissions lists the repository and organization permissions for an installation.
|
||||||
//
|
//
|
||||||
// Permission names taken from:
|
// Permission names taken from:
|
||||||
// https://developer.github.com/v3/apps/permissions/
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/permissions/
|
||||||
// https://developer.github.com/enterprise/v3/apps/permissions/
|
// https://developer.github.com/enterprise/v3/apps/permissions/
|
||||||
type InstallationPermissions struct {
|
type InstallationPermissions struct {
|
||||||
Administration *string `json:"administration,omitempty"`
|
Administration *string `json:"administration,omitempty"`
|
||||||
|
@ -90,6 +90,7 @@ type InstallationPermissions struct {
|
||||||
// Installation represents a GitHub Apps installation.
|
// Installation represents a GitHub Apps installation.
|
||||||
type Installation struct {
|
type Installation struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
AppID *int64 `json:"app_id,omitempty"`
|
AppID *int64 `json:"app_id,omitempty"`
|
||||||
TargetID *int64 `json:"target_id,omitempty"`
|
TargetID *int64 `json:"target_id,omitempty"`
|
||||||
Account *User `json:"account,omitempty"`
|
Account *User `json:"account,omitempty"`
|
||||||
|
@ -112,6 +113,13 @@ type Attachment struct {
|
||||||
Body *string `json:"body,omitempty"`
|
Body *string `json:"body,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContentReference represents a reference to a URL in an issue or pull request.
|
||||||
|
type ContentReference struct {
|
||||||
|
ID *int64 `json:"id,omitempty"`
|
||||||
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
|
Reference *string `json:"reference,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
func (i Installation) String() string {
|
func (i Installation) String() string {
|
||||||
return Stringify(i)
|
return Stringify(i)
|
||||||
}
|
}
|
||||||
|
@ -123,8 +131,8 @@ func (i Installation) String() string {
|
||||||
// You can find this on the settings page for your GitHub App
|
// You can find this on the settings page for your GitHub App
|
||||||
// (e.g., https://github.com/settings/apps/:app_slug).
|
// (e.g., https://github.com/settings/apps/:app_slug).
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-the-authenticated-app
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-an-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-app
|
||||||
func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) {
|
func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if appSlug != "" {
|
if appSlug != "" {
|
||||||
|
@ -138,9 +146,6 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
app := new(App)
|
app := new(App)
|
||||||
resp, err := s.client.Do(ctx, req, app)
|
resp, err := s.client.Do(ctx, req, app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -152,7 +157,7 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response,
|
||||||
|
|
||||||
// ListInstallations lists the installations that the current GitHub App has.
|
// ListInstallations lists the installations that the current GitHub App has.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#list-installations-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-installations-for-the-authenticated-app
|
||||||
func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) {
|
func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) {
|
||||||
u, err := addOptions("app/installations", opts)
|
u, err := addOptions("app/installations", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -164,9 +169,6 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
var i []*Installation
|
var i []*Installation
|
||||||
resp, err := s.client.Do(ctx, req, &i)
|
resp, err := s.client.Do(ctx, req, &i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -178,14 +180,14 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions)
|
||||||
|
|
||||||
// GetInstallation returns the specified installation.
|
// GetInstallation returns the specified installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-an-installation-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-installation-for-the-authenticated-app
|
||||||
func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) {
|
func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) {
|
||||||
return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id))
|
return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListUserInstallations lists installations that are accessible to the authenticated user.
|
// ListUserInstallations lists installations that are accessible to the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-app-installations-accessible-to-the-user-access-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-app-installations-accessible-to-the-user-access-token
|
||||||
func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) {
|
func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) {
|
||||||
u, err := addOptions("user/installations", opts)
|
u, err := addOptions("user/installations", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -197,9 +199,6 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
var i struct {
|
var i struct {
|
||||||
Installations []*Installation `json:"installations"`
|
Installations []*Installation `json:"installations"`
|
||||||
}
|
}
|
||||||
|
@ -213,7 +212,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio
|
||||||
|
|
||||||
// SuspendInstallation suspends the specified installation.
|
// SuspendInstallation suspends the specified installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#suspend-an-app-installation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#suspend-an-app-installation
|
||||||
func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) {
|
func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("app/installations/%v/suspended", id)
|
u := fmt.Sprintf("app/installations/%v/suspended", id)
|
||||||
|
|
||||||
|
@ -227,7 +226,7 @@ func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Respo
|
||||||
|
|
||||||
// UnsuspendInstallation unsuspends the specified installation.
|
// UnsuspendInstallation unsuspends the specified installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#unsuspend-an-app-installation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#unsuspend-an-app-installation
|
||||||
func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) {
|
func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("app/installations/%v/suspended", id)
|
u := fmt.Sprintf("app/installations/%v/suspended", id)
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Res
|
||||||
|
|
||||||
// DeleteInstallation deletes the specified installation.
|
// DeleteInstallation deletes the specified installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#delete-an-installation-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-installation-for-the-authenticated-app
|
||||||
func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) {
|
func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("app/installations/%v", id)
|
u := fmt.Sprintf("app/installations/%v", id)
|
||||||
|
|
||||||
|
@ -250,15 +249,12 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
return s.client.Do(ctx, req, nil)
|
return s.client.Do(ctx, req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateInstallationToken creates a new installation token.
|
// CreateInstallationToken creates a new installation token.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#create-an-installation-access-token-for-an-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-an-installation-access-token-for-an-app
|
||||||
func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) {
|
func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) {
|
||||||
u := fmt.Sprintf("app/installations/%v/access_tokens", id)
|
u := fmt.Sprintf("app/installations/%v/access_tokens", id)
|
||||||
|
|
||||||
|
@ -267,9 +263,6 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
t := new(InstallationToken)
|
t := new(InstallationToken)
|
||||||
resp, err := s.client.Do(ctx, req, t)
|
resp, err := s.client.Do(ctx, req, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -281,7 +274,7 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt
|
||||||
|
|
||||||
// CreateAttachment creates a new attachment on user comment containing a url.
|
// CreateAttachment creates a new attachment on user comment containing a url.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#create-a-content-attachment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-a-content-attachment
|
||||||
func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) {
|
func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) {
|
||||||
u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID)
|
u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID)
|
||||||
payload := &Attachment{Title: String(title), Body: String(body)}
|
payload := &Attachment{Title: String(title), Body: String(body)}
|
||||||
|
@ -291,7 +284,7 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept headers when APIs fully launch.
|
// TODO: remove custom Accept headers when APIs fully launch.
|
||||||
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
req.Header.Set("Accept", mediaTypeContentAttachmentsPreview)
|
||||||
|
|
||||||
m := &Attachment{}
|
m := &Attachment{}
|
||||||
resp, err := s.client.Do(ctx, req, m)
|
resp, err := s.client.Do(ctx, req, m)
|
||||||
|
@ -304,14 +297,14 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i
|
||||||
|
|
||||||
// FindOrganizationInstallation finds the organization's installation information.
|
// FindOrganizationInstallation finds the organization's installation information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-an-organization-installation-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-an-organization-installation-for-the-authenticated-app
|
||||||
func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) {
|
func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) {
|
||||||
return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org))
|
return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org))
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindRepositoryInstallation finds the repository's installation information.
|
// FindRepositoryInstallation finds the repository's installation information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-a-repository-installation-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-a-repository-installation-for-the-authenticated-app
|
||||||
func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) {
|
func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) {
|
||||||
return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo))
|
return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo))
|
||||||
}
|
}
|
||||||
|
@ -325,7 +318,7 @@ func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int
|
||||||
|
|
||||||
// FindUserInstallation finds the user's installation information.
|
// FindUserInstallation finds the user's installation information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#get-a-user-installation-for-the-authenticated-app
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#get-a-user-installation-for-the-authenticated-app
|
||||||
func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) {
|
func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) {
|
||||||
return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user))
|
return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user))
|
||||||
}
|
}
|
||||||
|
@ -336,9 +329,6 @@ func (s *AppsService) getInstallation(ctx context.Context, url string) (*Install
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
i := new(Installation)
|
i := new(Installation)
|
||||||
resp, err := s.client.Do(ctx, req, i)
|
resp, err := s.client.Do(ctx, req, i)
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ListRepos lists the repositories that are accessible to the authenticated installation.
|
// ListRepos lists the repositories that are accessible to the authenticated installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-app-installation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-repositories-accessible-to-the-app-installation
|
||||||
func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) ([]*Repository, *Response, error) {
|
func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) ([]*Repository, *Response, error) {
|
||||||
u, err := addOptions("installation/repositories", opts)
|
u, err := addOptions("installation/repositories", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,9 +24,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) ([]*Repo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
var r struct {
|
var r struct {
|
||||||
Repositories []*Repository `json:"repositories"`
|
Repositories []*Repository `json:"repositories"`
|
||||||
}
|
}
|
||||||
|
@ -41,7 +38,7 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) ([]*Repo
|
||||||
// ListUserRepos lists repositories that are accessible
|
// ListUserRepos lists repositories that are accessible
|
||||||
// to the authenticated user for an installation.
|
// to the authenticated user for an installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-access-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-repositories-accessible-to-the-user-access-token
|
||||||
func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) ([]*Repository, *Response, error) {
|
func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("user/installations/%v/repositories", id)
|
u := fmt.Sprintf("user/installations/%v/repositories", id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -54,9 +51,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
var r struct {
|
var r struct {
|
||||||
Repositories []*Repository `json:"repositories"`
|
Repositories []*Repository `json:"repositories"`
|
||||||
}
|
}
|
||||||
|
@ -70,14 +64,13 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
|
||||||
|
|
||||||
// AddRepository adds a single repository to an installation.
|
// AddRepository adds a single repository to an installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#add-a-repository-to-an-app-installation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#add-a-repository-to-an-app-installation
|
||||||
func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) {
|
func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID)
|
u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
r := new(Repository)
|
r := new(Repository)
|
||||||
resp, err := s.client.Do(ctx, req, r)
|
resp, err := s.client.Do(ctx, req, r)
|
||||||
|
@ -90,21 +83,20 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (
|
||||||
|
|
||||||
// RemoveRepository removes a single repository from an installation.
|
// RemoveRepository removes a single repository from an installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#remove-a-repository-from-an-app-installation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#remove-a-repository-from-an-app-installation
|
||||||
func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) {
|
func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID)
|
u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
return s.client.Do(ctx, req, nil)
|
return s.client.Do(ctx, req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RevokeInstallationToken revokes an installation token.
|
// RevokeInstallationToken revokes an installation token.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/installations/#revoke-an-installation-access-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#revoke-an-installation-access-token
|
||||||
func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) {
|
func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) {
|
||||||
u := "installation/token"
|
u := "installation/token"
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -34,7 +34,7 @@ type AppConfig struct {
|
||||||
// CompleteAppManifest completes the App manifest handshake flow for the given
|
// CompleteAppManifest completes the App manifest handshake flow for the given
|
||||||
// code.
|
// code.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/#create-a-github-app-from-a-manifest
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#create-a-github-app-from-a-manifest
|
||||||
func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) {
|
func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) {
|
||||||
u := fmt.Sprintf("app-manifests/%s/conversions", code)
|
u := fmt.Sprintf("app-manifests/%s/conversions", code)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// MarketplaceService handles communication with the marketplace related
|
// MarketplaceService handles communication with the marketplace related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#marketplace
|
||||||
type MarketplaceService struct {
|
type MarketplaceService struct {
|
||||||
client *Client
|
client *Client
|
||||||
// Stubbed controls whether endpoints that return stubbed data are used
|
// Stubbed controls whether endpoints that return stubbed data are used
|
||||||
|
@ -21,7 +21,7 @@ type MarketplaceService struct {
|
||||||
// for testing your GitHub Apps. Stubbed data is hard-coded and will not
|
// for testing your GitHub Apps. Stubbed data is hard-coded and will not
|
||||||
// change based on actual subscriptions.
|
// change based on actual subscriptions.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#testing-with-stubbed-endpoints
|
||||||
Stubbed bool
|
Stubbed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ type MarketplacePlanAccount struct {
|
||||||
|
|
||||||
// ListPlans lists all plans for your Marketplace listing.
|
// ListPlans lists all plans for your Marketplace listing.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-plans-for-your-marketplace-listing
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#list-plans
|
||||||
func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ([]*MarketplacePlan, *Response, error) {
|
func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ([]*MarketplacePlan, *Response, error) {
|
||||||
uri := s.marketplaceURI("plans")
|
uri := s.marketplaceURI("plans")
|
||||||
u, err := addOptions(uri, opts)
|
u, err := addOptions(uri, opts)
|
||||||
|
@ -102,7 +102,7 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) (
|
||||||
|
|
||||||
// ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan.
|
// ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-all-github-accounts-user-or-organization-on-a-specific-plan
|
||||||
func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
|
func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
|
||||||
uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID))
|
uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID))
|
||||||
u, err := addOptions(uri, opts)
|
u, err := addOptions(uri, opts)
|
||||||
|
@ -126,7 +126,7 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID
|
||||||
|
|
||||||
// ListPlanAccountsForAccount lists all GitHub accounts (user or organization) associated with an account.
|
// ListPlanAccountsForAccount lists all GitHub accounts (user or organization) associated with an account.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#check-if-a-github-account-is-associated-with-any-marketplace-listing
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#check-if-a-github-account-is-associated-with-any-marketplace-listing
|
||||||
func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
|
func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) {
|
||||||
uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID))
|
uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID))
|
||||||
u, err := addOptions(uri, opts)
|
u, err := addOptions(uri, opts)
|
||||||
|
@ -150,8 +150,8 @@ func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, acc
|
||||||
|
|
||||||
// ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user.
|
// ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-subscriptions-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-subscriptions-for-the-authenticated-user-stubbed
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/marketplace/#list-subscriptions-for-the-authenticated-user-stubbed
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#list-subscriptions-for-the-authenticated-user
|
||||||
func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opts *ListOptions) ([]*MarketplacePurchase, *Response, error) {
|
func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opts *ListOptions) ([]*MarketplacePurchase, *Response, error) {
|
||||||
uri := "user/marketplace_purchases"
|
uri := "user/marketplace_purchases"
|
||||||
if s.Stubbed {
|
if s.Stubbed {
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// Scope models a GitHub authorization scope.
|
// Scope models a GitHub authorization scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/oauth/#scopes
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth/#scopes
|
||||||
type Scope string
|
type Scope string
|
||||||
|
|
||||||
// This is the set of scopes for GitHub API V3
|
// This is the set of scopes for GitHub API V3
|
||||||
|
@ -50,7 +50,7 @@ const (
|
||||||
// This service requires HTTP Basic Authentication; it cannot be accessed using
|
// This service requires HTTP Basic Authentication; it cannot be accessed using
|
||||||
// an OAuth token.
|
// an OAuth token.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth_authorizations/
|
||||||
type AuthorizationsService service
|
type AuthorizationsService service
|
||||||
|
|
||||||
// Authorization represents an individual GitHub authorization.
|
// Authorization represents an individual GitHub authorization.
|
||||||
|
@ -121,7 +121,7 @@ func (a AuthorizationRequest) String() string {
|
||||||
// fields. That is, you may provide only one of "Scopes", or "AddScopes", or
|
// fields. That is, you may provide only one of "Scopes", or "AddScopes", or
|
||||||
// "RemoveScopes".
|
// "RemoveScopes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/oauth_authorizations/#update-an-existing-authorization
|
||||||
type AuthorizationUpdateRequest struct {
|
type AuthorizationUpdateRequest struct {
|
||||||
Scopes []string `json:"scopes,omitempty"`
|
Scopes []string `json:"scopes,omitempty"`
|
||||||
AddScopes []string `json:"add_scopes,omitempty"`
|
AddScopes []string `json:"add_scopes,omitempty"`
|
||||||
|
@ -143,7 +143,7 @@ func (a AuthorizationUpdateRequest) String() string {
|
||||||
//
|
//
|
||||||
// The returned Authorization.User field will be populated.
|
// The returned Authorization.User field will be populated.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/oauth_applications/#check-a-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#check-a-token
|
||||||
func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) {
|
func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) {
|
||||||
u := fmt.Sprintf("applications/%v/token", clientID)
|
u := fmt.Sprintf("applications/%v/token", clientID)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken
|
||||||
//
|
//
|
||||||
// The returned Authorization.User field will be populated.
|
// The returned Authorization.User field will be populated.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/oauth_applications/#reset-a-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#reset-a-token
|
||||||
func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) {
|
func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) {
|
||||||
u := fmt.Sprintf("applications/%v/token", clientID)
|
u := fmt.Sprintf("applications/%v/token", clientID)
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken
|
||||||
// username is the OAuth application clientID, and the password is its
|
// username is the OAuth application clientID, and the password is its
|
||||||
// clientSecret. Invalid tokens will return a 404 Not Found.
|
// clientSecret. Invalid tokens will return a 404 Not Found.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-token
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-app-token
|
||||||
func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) {
|
func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) {
|
||||||
u := fmt.Sprintf("applications/%v/token", clientID)
|
u := fmt.Sprintf("applications/%v/token", clientID)
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke
|
||||||
// grant will also delete all OAuth tokens associated with the application for
|
// grant will also delete all OAuth tokens associated with the application for
|
||||||
// the user.
|
// the user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-authorization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/#delete-an-app-authorization
|
||||||
func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) {
|
func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) {
|
||||||
u := fmt.Sprintf("applications/%v/grant", clientID)
|
u := fmt.Sprintf("applications/%v/grant", clientID)
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// ChecksService provides access to the Checks API in the
|
// ChecksService provides access to the Checks API in the
|
||||||
// GitHub API.
|
// GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/
|
||||||
type ChecksService service
|
type ChecksService service
|
||||||
|
|
||||||
// CheckRun represents a GitHub check run on a repository associated with a GitHub app.
|
// CheckRun represents a GitHub check run on a repository associated with a GitHub app.
|
||||||
|
@ -96,7 +96,7 @@ func (c CheckSuite) String() string {
|
||||||
|
|
||||||
// GetCheckRun gets a check-run for a repository.
|
// GetCheckRun gets a check-run for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#get-a-check-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#get-a-check-run
|
||||||
func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) {
|
func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -104,8 +104,6 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
checkRun := new(CheckRun)
|
checkRun := new(CheckRun)
|
||||||
resp, err := s.client.Do(ctx, req, checkRun)
|
resp, err := s.client.Do(ctx, req, checkRun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -117,7 +115,7 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che
|
||||||
|
|
||||||
// GetCheckSuite gets a single check suite.
|
// GetCheckSuite gets a single check suite.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#get-a-check-suite
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#get-a-check-suite
|
||||||
func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) {
|
func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID)
|
u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -125,8 +123,6 @@ func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, c
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
checkSuite := new(CheckSuite)
|
checkSuite := new(CheckSuite)
|
||||||
resp, err := s.client.Do(ctx, req, checkSuite)
|
resp, err := s.client.Do(ctx, req, checkSuite)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -159,7 +155,7 @@ type CheckRunAction struct {
|
||||||
|
|
||||||
// CreateCheckRun creates a check run for repository.
|
// CreateCheckRun creates a check run for repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#create-a-check-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#create-a-check-run
|
||||||
func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) {
|
func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -167,8 +163,6 @@ func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
checkRun := new(CheckRun)
|
checkRun := new(CheckRun)
|
||||||
resp, err := s.client.Do(ctx, req, checkRun)
|
resp, err := s.client.Do(ctx, req, checkRun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -181,7 +175,6 @@ func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string,
|
||||||
// UpdateCheckRunOptions sets up parameters needed to update a CheckRun.
|
// UpdateCheckRunOptions sets up parameters needed to update a CheckRun.
|
||||||
type UpdateCheckRunOptions struct {
|
type UpdateCheckRunOptions struct {
|
||||||
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
|
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
|
||||||
HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.)
|
|
||||||
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
|
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
|
||||||
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
|
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
|
||||||
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
|
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
|
||||||
|
@ -193,7 +186,7 @@ type UpdateCheckRunOptions struct {
|
||||||
|
|
||||||
// UpdateCheckRun updates a check run for a specific commit in a repository.
|
// UpdateCheckRun updates a check run for a specific commit in a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#update-a-check-run
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#update-a-check-run
|
||||||
func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) {
|
func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
@ -201,8 +194,6 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
checkRun := new(CheckRun)
|
checkRun := new(CheckRun)
|
||||||
resp, err := s.client.Do(ctx, req, checkRun)
|
resp, err := s.client.Do(ctx, req, checkRun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -214,7 +205,7 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// ListCheckRunAnnotations lists the annotations for a check run.
|
// ListCheckRunAnnotations lists the annotations for a check run.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-run-annotations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-run-annotations
|
||||||
func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) {
|
func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID)
|
u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -227,8 +218,6 @@ func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
var checkRunAnnotations []*CheckRunAnnotation
|
var checkRunAnnotations []*CheckRunAnnotation
|
||||||
resp, err := s.client.Do(ctx, req, &checkRunAnnotations)
|
resp, err := s.client.Do(ctx, req, &checkRunAnnotations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -255,7 +244,7 @@ type ListCheckRunsResults struct {
|
||||||
|
|
||||||
// ListCheckRunsForRef lists check runs for a specific ref.
|
// ListCheckRunsForRef lists check runs for a specific ref.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-git-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-runs-for-a-git-reference
|
||||||
func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, refURLEscape(ref))
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -268,8 +257,6 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
var checkRunResults *ListCheckRunsResults
|
var checkRunResults *ListCheckRunsResults
|
||||||
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -281,7 +268,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re
|
||||||
|
|
||||||
// ListCheckRunsCheckSuite lists check runs for a check suite.
|
// ListCheckRunsCheckSuite lists check runs for a check suite.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-runs-in-a-check-suite
|
||||||
func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID)
|
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -294,8 +281,6 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
var checkRunResults *ListCheckRunsResults
|
var checkRunResults *ListCheckRunsResults
|
||||||
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
resp, err := s.client.Do(ctx, req, &checkRunResults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -321,7 +306,7 @@ type ListCheckSuiteResults struct {
|
||||||
|
|
||||||
// ListCheckSuitesForRef lists check suite for a specific ref.
|
// ListCheckSuitesForRef lists check suite for a specific ref.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-git-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#list-check-suites-for-a-git-reference
|
||||||
func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) {
|
func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, refURLEscape(ref))
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -334,8 +319,6 @@ func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
var checkSuiteResults *ListCheckSuiteResults
|
var checkSuiteResults *ListCheckSuiteResults
|
||||||
resp, err := s.client.Do(ctx, req, &checkSuiteResults)
|
resp, err := s.client.Do(ctx, req, &checkSuiteResults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -369,7 +352,7 @@ type PreferenceList struct {
|
||||||
|
|
||||||
// SetCheckSuitePreferences changes the default automatic flow when creating check suites.
|
// SetCheckSuitePreferences changes the default automatic flow when creating check suites.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#update-repository-preferences-for-check-suites
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#update-repository-preferences-for-check-suites
|
||||||
func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) {
|
func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo)
|
||||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
@ -377,8 +360,6 @@ func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, rep
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
var checkSuitePrefResults *CheckSuitePreferenceResults
|
var checkSuitePrefResults *CheckSuitePreferenceResults
|
||||||
resp, err := s.client.Do(ctx, req, &checkSuitePrefResults)
|
resp, err := s.client.Do(ctx, req, &checkSuitePrefResults)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -396,7 +377,7 @@ type CreateCheckSuiteOptions struct {
|
||||||
|
|
||||||
// CreateCheckSuite manually creates a check suite for a repository.
|
// CreateCheckSuite manually creates a check suite for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#create-a-check-suite
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#create-a-check-suite
|
||||||
func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) {
|
func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -404,8 +385,6 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
checkSuite := new(CheckSuite)
|
checkSuite := new(CheckSuite)
|
||||||
resp, err := s.client.Do(ctx, req, checkSuite)
|
resp, err := s.client.Do(ctx, req, checkSuite)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -417,7 +396,7 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository.
|
// ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/checks/suites/#rerequest-a-check-suite
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/checks/#rerequest-a-check-suite
|
||||||
func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) {
|
func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID)
|
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID)
|
||||||
|
|
||||||
|
@ -426,8 +405,6 @@ func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo str
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
|
|
||||||
|
|
||||||
resp, err := s.client.Do(ctx, req, nil)
|
resp, err := s.client.Do(ctx, req, nil)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// CodeScanningService handles communication with the code scanning related
|
// CodeScanningService handles communication with the code scanning related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/code-scanning/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/
|
||||||
type CodeScanningService service
|
type CodeScanningService service
|
||||||
|
|
||||||
type Alert struct {
|
type Alert struct {
|
||||||
|
@ -69,7 +69,7 @@ type AlertListOptions struct {
|
||||||
// You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events
|
// You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events
|
||||||
// read permission to use this endpoint.
|
// read permission to use this endpoint.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/code-scanning/#list-code-scanning-alerts-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/#list-code-scanning-alerts-for-a-repository
|
||||||
func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) {
|
func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -98,7 +98,7 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo
|
||||||
//
|
//
|
||||||
// The security alert_id is the number at the end of the security alert's URL.
|
// The security alert_id is the number at the end of the security alert's URL.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/code-scanning/#get-a-code-scanning-alert
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/#get-a-code-scanning-alert
|
||||||
func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) {
|
func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id)
|
||||||
|
|
|
@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
import "github.com/google/go-github/v32/github" // with go modules enabled (GO111MODULE=on or outside GOPATH)
|
import "github.com/google/go-github/v33/github" // with go modules enabled (GO111MODULE=on or outside GOPATH)
|
||||||
import "github.com/google/go-github/github" // with go modules disabled
|
import "github.com/google/go-github/github" // with go modules disabled
|
||||||
|
|
||||||
Construct a new GitHub client, then use the various services on the client to
|
Construct a new GitHub client, then use the various services on the client to
|
||||||
|
@ -29,7 +29,7 @@ Some API methods have optional parameters that can be passed. For example:
|
||||||
|
|
||||||
The services of a client divide the API into logical chunks and correspond to
|
The services of a client divide the API into logical chunks and correspond to
|
||||||
the structure of the GitHub API documentation at
|
the structure of the GitHub API documentation at
|
||||||
https://developer.github.com/v3/.
|
https://docs.github.com/en/free-pro-team@latest/rest/reference/.
|
||||||
|
|
||||||
NOTE: Using the https://godoc.org/context package, one can easily
|
NOTE: Using the https://godoc.org/context package, one can easily
|
||||||
pass cancelation signals and deadlines to various services of the client for
|
pass cancelation signals and deadlines to various services of the client for
|
||||||
|
@ -112,7 +112,7 @@ To detect an API rate limit error, you can check if its type is *github.RateLimi
|
||||||
}
|
}
|
||||||
|
|
||||||
Learn more about GitHub rate limiting at
|
Learn more about GitHub rate limiting at
|
||||||
https://developer.github.com/v3/#rate-limiting.
|
https://docs.github.com/en/free-pro-team@latest/rest/reference/#rate-limiting.
|
||||||
|
|
||||||
Accepted Status
|
Accepted Status
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ instead designed to work with a caching http.Transport. We recommend using
|
||||||
https://github.com/gregjones/httpcache for that.
|
https://github.com/gregjones/httpcache for that.
|
||||||
|
|
||||||
Learn more about GitHub conditional requests at
|
Learn more about GitHub conditional requests at
|
||||||
https://developer.github.com/v3/#conditional-requests.
|
https://docs.github.com/en/free-pro-team@latest/rest/reference/#conditional-requests.
|
||||||
|
|
||||||
Creating and Updating Resources
|
Creating and Updating Resources
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright 2020 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
|
||||||
|
|
||||||
|
// EnterpriseService provides access to the enterprise related functions
|
||||||
|
// in the GitHub API.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/
|
||||||
|
type EnterpriseService service
|
55
vendor/github.com/google/go-github/v33/github/enterprise_actions_runners.go
generated
vendored
Normal file
55
vendor/github.com/google/go-github/v33/github/enterprise_actions_runners.go
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
// Copyright 2020 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateRegistrationToken creates a token that can be used to add a self-hosted runner.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/#create-a-registration-token-for-an-enterprise
|
||||||
|
func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterprise string) (*RegistrationToken, *Response, error) {
|
||||||
|
u := fmt.Sprintf("enterprises/%v/actions/runners/registration-token", enterprise)
|
||||||
|
|
||||||
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
registrationToken := new(RegistrationToken)
|
||||||
|
resp, err := s.client.Do(ctx, req, registrationToken)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return registrationToken, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRunners lists all the self-hosted runners for a enterprise.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/enterprise-admin/#list-self-hosted-runners-for-an-enterprise
|
||||||
|
func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListOptions) (*Runners, *Response, error) {
|
||||||
|
u := fmt.Sprintf("enterprises/%v/actions/runners", enterprise)
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
runners := &Runners{}
|
||||||
|
resp, err := s.client.Do(ctx, req, &runners)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return runners, resp, nil
|
||||||
|
}
|
|
@ -36,6 +36,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
|
||||||
payload = &CheckSuiteEvent{}
|
payload = &CheckSuiteEvent{}
|
||||||
case "CommitCommentEvent":
|
case "CommitCommentEvent":
|
||||||
payload = &CommitCommentEvent{}
|
payload = &CommitCommentEvent{}
|
||||||
|
case "ContentReferenceEvent":
|
||||||
|
payload = &ContentReferenceEvent{}
|
||||||
case "CreateEvent":
|
case "CreateEvent":
|
||||||
payload = &CreateEvent{}
|
payload = &CreateEvent{}
|
||||||
case "DeleteEvent":
|
case "DeleteEvent":
|
||||||
|
@ -118,6 +120,10 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
|
||||||
payload = &UserEvent{}
|
payload = &UserEvent{}
|
||||||
case "WatchEvent":
|
case "WatchEvent":
|
||||||
payload = &WatchEvent{}
|
payload = &WatchEvent{}
|
||||||
|
case "WorkflowDispatchEvent":
|
||||||
|
payload = &WorkflowDispatchEvent{}
|
||||||
|
case "WorkflowRunEvent":
|
||||||
|
payload = &WorkflowRunEvent{}
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(*e.RawPayload, &payload)
|
err = json.Unmarshal(*e.RawPayload, &payload)
|
||||||
return payload, err
|
return payload, err
|
|
@ -18,7 +18,7 @@ type RequestedAction struct {
|
||||||
// CheckRunEvent is triggered when a check run is "created", "updated", or "rerequested".
|
// CheckRunEvent is triggered when a check run is "created", "updated", or "rerequested".
|
||||||
// The Webhook event name is "check_run".
|
// The Webhook event name is "check_run".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#checkrunevent
|
||||||
type CheckRunEvent struct {
|
type CheckRunEvent struct {
|
||||||
CheckRun *CheckRun `json:"check_run,omitempty"`
|
CheckRun *CheckRun `json:"check_run,omitempty"`
|
||||||
// The action performed. Possible values are: "created", "updated", "rerequested" or "requested_action".
|
// The action performed. Possible values are: "created", "updated", "rerequested" or "requested_action".
|
||||||
|
@ -37,7 +37,7 @@ type CheckRunEvent struct {
|
||||||
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested".
|
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested".
|
||||||
// The Webhook event name is "check_suite".
|
// The Webhook event name is "check_suite".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#checksuiteevent
|
||||||
type CheckSuiteEvent struct {
|
type CheckSuiteEvent struct {
|
||||||
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
|
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
|
||||||
// The action performed. Possible values are: "completed", "requested" or "rerequested".
|
// The action performed. Possible values are: "completed", "requested" or "rerequested".
|
||||||
|
@ -53,7 +53,7 @@ type CheckSuiteEvent struct {
|
||||||
// CommitCommentEvent is triggered when a commit comment is created.
|
// CommitCommentEvent is triggered when a commit comment is created.
|
||||||
// The Webhook event name is "commit_comment".
|
// The Webhook event name is "commit_comment".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#commitcommentevent
|
||||||
type CommitCommentEvent struct {
|
type CommitCommentEvent struct {
|
||||||
Comment *RepositoryComment `json:"comment,omitempty"`
|
Comment *RepositoryComment `json:"comment,omitempty"`
|
||||||
|
|
||||||
|
@ -64,6 +64,20 @@ type CommitCommentEvent struct {
|
||||||
Installation *Installation `json:"installation,omitempty"`
|
Installation *Installation `json:"installation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContentReferenceEvent is triggered when the body or comment of an issue or
|
||||||
|
// pull request includes a URL that matches a configured content reference
|
||||||
|
// domain.
|
||||||
|
// The Webhook event name is "content_reference".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#content_reference
|
||||||
|
type ContentReferenceEvent struct {
|
||||||
|
Action *string `json:"action,omitempty"`
|
||||||
|
ContentReference *ContentReference `json:"content_reference,omitempty"`
|
||||||
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
Sender *User `json:"sender,omitempty"`
|
||||||
|
Installation *Installation `json:"installation,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateEvent represents a created repository, branch, or tag.
|
// CreateEvent represents a created repository, branch, or tag.
|
||||||
// The Webhook event name is "create".
|
// The Webhook event name is "create".
|
||||||
//
|
//
|
||||||
|
@ -71,7 +85,7 @@ type CommitCommentEvent struct {
|
||||||
// Additionally, webhooks will not receive this event for tags if more
|
// Additionally, webhooks will not receive this event for tags if more
|
||||||
// than three tags are pushed at once.
|
// than three tags are pushed at once.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#createevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#createevent
|
||||||
type CreateEvent struct {
|
type CreateEvent struct {
|
||||||
Ref *string `json:"ref,omitempty"`
|
Ref *string `json:"ref,omitempty"`
|
||||||
// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
|
// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
|
||||||
|
@ -92,7 +106,7 @@ type CreateEvent struct {
|
||||||
// Note: webhooks will not receive this event for tags if more than three tags
|
// Note: webhooks will not receive this event for tags if more than three tags
|
||||||
// are deleted at once.
|
// are deleted at once.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deleteevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deleteevent
|
||||||
type DeleteEvent struct {
|
type DeleteEvent struct {
|
||||||
Ref *string `json:"ref,omitempty"`
|
Ref *string `json:"ref,omitempty"`
|
||||||
// RefType is the object that was deleted. Possible values are: "branch", "tag".
|
// RefType is the object that was deleted. Possible values are: "branch", "tag".
|
||||||
|
@ -108,7 +122,7 @@ type DeleteEvent struct {
|
||||||
// DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
|
// DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
|
||||||
// The Webhook event name is "deploy_key".
|
// The Webhook event name is "deploy_key".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploykeyevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploykeyevent
|
||||||
type DeployKeyEvent struct {
|
type DeployKeyEvent struct {
|
||||||
// Action is the action that was performed. Possible values are:
|
// Action is the action that was performed. Possible values are:
|
||||||
// "created" or "deleted".
|
// "created" or "deleted".
|
||||||
|
@ -123,7 +137,7 @@ type DeployKeyEvent struct {
|
||||||
//
|
//
|
||||||
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploymentevent
|
||||||
type DeploymentEvent struct {
|
type DeploymentEvent struct {
|
||||||
Deployment *Deployment `json:"deployment,omitempty"`
|
Deployment *Deployment `json:"deployment,omitempty"`
|
||||||
Repo *Repository `json:"repository,omitempty"`
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
@ -138,7 +152,7 @@ type DeploymentEvent struct {
|
||||||
//
|
//
|
||||||
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#deploymentstatusevent
|
||||||
type DeploymentStatusEvent struct {
|
type DeploymentStatusEvent struct {
|
||||||
Deployment *Deployment `json:"deployment,omitempty"`
|
Deployment *Deployment `json:"deployment,omitempty"`
|
||||||
DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
|
DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
|
||||||
|
@ -152,7 +166,7 @@ type DeploymentStatusEvent struct {
|
||||||
// ForkEvent is triggered when a user forks a repository.
|
// ForkEvent is triggered when a user forks a repository.
|
||||||
// The Webhook event name is "fork".
|
// The Webhook event name is "fork".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#forkevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#forkevent
|
||||||
type ForkEvent struct {
|
type ForkEvent struct {
|
||||||
// Forkee is the created repository.
|
// Forkee is the created repository.
|
||||||
Forkee *Repository `json:"forkee,omitempty"`
|
Forkee *Repository `json:"forkee,omitempty"`
|
||||||
|
@ -166,7 +180,7 @@ type ForkEvent struct {
|
||||||
// GitHubAppAuthorizationEvent is triggered when a user's authorization for a
|
// GitHubAppAuthorizationEvent is triggered when a user's authorization for a
|
||||||
// GitHub Application is revoked.
|
// GitHub Application is revoked.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#githubappauthorizationevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#githubappauthorizationevent
|
||||||
type GitHubAppAuthorizationEvent struct {
|
type GitHubAppAuthorizationEvent struct {
|
||||||
// The action performed. Possible value is: "revoked".
|
// The action performed. Possible value is: "revoked".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -188,7 +202,7 @@ type Page struct {
|
||||||
// GollumEvent is triggered when a Wiki page is created or updated.
|
// GollumEvent is triggered when a Wiki page is created or updated.
|
||||||
// The Webhook event name is "gollum".
|
// The Webhook event name is "gollum".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#gollumevent
|
||||||
type GollumEvent struct {
|
type GollumEvent struct {
|
||||||
Pages []*Page `json:"pages,omitempty"`
|
Pages []*Page `json:"pages,omitempty"`
|
||||||
|
|
||||||
|
@ -207,6 +221,14 @@ type EditChange struct {
|
||||||
Body *struct {
|
Body *struct {
|
||||||
From *string `json:"from,omitempty"`
|
From *string `json:"from,omitempty"`
|
||||||
} `json:"body,omitempty"`
|
} `json:"body,omitempty"`
|
||||||
|
Base *struct {
|
||||||
|
Ref *struct {
|
||||||
|
From *string `json:"from,omitempty"`
|
||||||
|
} `json:"ref,omitempty"`
|
||||||
|
SHA *struct {
|
||||||
|
From *string `json:"from,omitempty"`
|
||||||
|
} `json:"sha,omitempty"`
|
||||||
|
} `json:"base,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProjectChange represents the changes when a project has been edited.
|
// ProjectChange represents the changes when a project has been edited.
|
||||||
|
@ -258,7 +280,7 @@ type TeamChange struct {
|
||||||
// InstallationEvent is triggered when a GitHub App has been installed or uninstalled.
|
// InstallationEvent is triggered when a GitHub App has been installed or uninstalled.
|
||||||
// The Webhook event name is "installation".
|
// The Webhook event name is "installation".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#installationevent
|
||||||
type InstallationEvent struct {
|
type InstallationEvent struct {
|
||||||
// The action that was performed. Can be either "created" or "deleted".
|
// The action that was performed. Can be either "created" or "deleted".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -270,7 +292,7 @@ type InstallationEvent struct {
|
||||||
// InstallationRepositoriesEvent is triggered when a repository is added or
|
// InstallationRepositoriesEvent is triggered when a repository is added or
|
||||||
// removed from an installation. The Webhook event name is "installation_repositories".
|
// removed from an installation. The Webhook event name is "installation_repositories".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#installationrepositoriesevent
|
||||||
type InstallationRepositoriesEvent struct {
|
type InstallationRepositoriesEvent struct {
|
||||||
// The action that was performed. Can be either "added" or "removed".
|
// The action that was performed. Can be either "added" or "removed".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -285,7 +307,7 @@ type InstallationRepositoriesEvent struct {
|
||||||
// or pull request.
|
// or pull request.
|
||||||
// The Webhook event name is "issue_comment".
|
// The Webhook event name is "issue_comment".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#issuecommentevent
|
||||||
type IssueCommentEvent struct {
|
type IssueCommentEvent struct {
|
||||||
// Action is the action that was performed on the comment.
|
// Action is the action that was performed on the comment.
|
||||||
// Possible values are: "created", "edited", "deleted".
|
// Possible values are: "created", "edited", "deleted".
|
||||||
|
@ -305,7 +327,7 @@ type IssueCommentEvent struct {
|
||||||
// locked, unlocked, milestoned, or demilestoned.
|
// locked, unlocked, milestoned, or demilestoned.
|
||||||
// The Webhook event name is "issues".
|
// The Webhook event name is "issues".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuesevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#issuesevent
|
||||||
type IssuesEvent struct {
|
type IssuesEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "opened",
|
// Action is the action that was performed. Possible values are: "opened",
|
||||||
// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
|
// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
|
||||||
|
@ -326,7 +348,7 @@ type IssuesEvent struct {
|
||||||
// LabelEvent is triggered when a repository's label is created, edited, or deleted.
|
// LabelEvent is triggered when a repository's label is created, edited, or deleted.
|
||||||
// The Webhook event name is "label"
|
// The Webhook event name is "label"
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#labelevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#labelevent
|
||||||
type LabelEvent struct {
|
type LabelEvent struct {
|
||||||
// Action is the action that was performed. Possible values are:
|
// Action is the action that was performed. Possible values are:
|
||||||
// "created", "edited", "deleted"
|
// "created", "edited", "deleted"
|
||||||
|
@ -344,7 +366,7 @@ type LabelEvent struct {
|
||||||
// their GitHub Marketplace plan.
|
// their GitHub Marketplace plan.
|
||||||
// Webhook event name "marketplace_purchase".
|
// Webhook event name "marketplace_purchase".
|
||||||
//
|
//
|
||||||
// Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#marketplacepurchaseevent
|
||||||
type MarketplacePurchaseEvent struct {
|
type MarketplacePurchaseEvent struct {
|
||||||
// Action is the action that was performed. Possible values are:
|
// Action is the action that was performed. Possible values are:
|
||||||
// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
|
// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
|
||||||
|
@ -361,7 +383,7 @@ type MarketplacePurchaseEvent struct {
|
||||||
// MemberEvent is triggered when a user is added as a collaborator to a repository.
|
// MemberEvent is triggered when a user is added as a collaborator to a repository.
|
||||||
// The Webhook event name is "member".
|
// The Webhook event name is "member".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#memberevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#memberevent
|
||||||
type MemberEvent struct {
|
type MemberEvent struct {
|
||||||
// Action is the action that was performed. Possible value is: "added".
|
// Action is the action that was performed. Possible value is: "added".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -379,7 +401,7 @@ type MemberEvent struct {
|
||||||
// Events of this type are not visible in timelines, they are only used to
|
// Events of this type are not visible in timelines, they are only used to
|
||||||
// trigger organization webhooks.
|
// trigger organization webhooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#membershipevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#membershipevent
|
||||||
type MembershipEvent struct {
|
type MembershipEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "added", "removed".
|
// Action is the action that was performed. Possible values are: "added", "removed".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -399,7 +421,7 @@ type MembershipEvent struct {
|
||||||
// Therefore, it must be selected for each hook that you'd like to receive meta events for.
|
// Therefore, it must be selected for each hook that you'd like to receive meta events for.
|
||||||
// The Webhook event name is "meta".
|
// The Webhook event name is "meta".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#metaevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#metaevent
|
||||||
type MetaEvent struct {
|
type MetaEvent struct {
|
||||||
// Action is the action that was performed. Possible value is: "deleted".
|
// Action is the action that was performed. Possible value is: "deleted".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -414,7 +436,7 @@ type MetaEvent struct {
|
||||||
// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
|
// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
|
||||||
// The Webhook event name is "milestone".
|
// The Webhook event name is "milestone".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#milestoneevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#milestoneevent
|
||||||
type MilestoneEvent struct {
|
type MilestoneEvent struct {
|
||||||
// Action is the action that was performed. Possible values are:
|
// Action is the action that was performed. Possible values are:
|
||||||
// "created", "closed", "opened", "edited", "deleted"
|
// "created", "closed", "opened", "edited", "deleted"
|
||||||
|
@ -434,7 +456,7 @@ type MilestoneEvent struct {
|
||||||
// Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
|
// Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
|
||||||
// Webhook event name is "organization".
|
// Webhook event name is "organization".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#organizationevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#organizationevent
|
||||||
type OrganizationEvent struct {
|
type OrganizationEvent struct {
|
||||||
// Action is the action that was performed.
|
// Action is the action that was performed.
|
||||||
// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
|
// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
|
||||||
|
@ -455,7 +477,7 @@ type OrganizationEvent struct {
|
||||||
// OrgBlockEvent is triggered when an organization blocks or unblocks a user.
|
// OrgBlockEvent is triggered when an organization blocks or unblocks a user.
|
||||||
// The Webhook event name is "org_block".
|
// The Webhook event name is "org_block".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#orgblockevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#orgblockevent
|
||||||
type OrgBlockEvent struct {
|
type OrgBlockEvent struct {
|
||||||
// Action is the action that was performed.
|
// Action is the action that was performed.
|
||||||
// Can be "blocked" or "unblocked".
|
// Can be "blocked" or "unblocked".
|
||||||
|
@ -493,7 +515,7 @@ type PackageEvent struct {
|
||||||
//
|
//
|
||||||
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
// Events of this type are not visible in timelines, they are only used to trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pagebuildevent
|
||||||
type PageBuildEvent struct {
|
type PageBuildEvent struct {
|
||||||
Build *PagesBuild `json:"build,omitempty"`
|
Build *PagesBuild `json:"build,omitempty"`
|
||||||
|
|
||||||
|
@ -520,7 +542,7 @@ type PingEvent struct {
|
||||||
// ProjectEvent is triggered when project is created, modified or deleted.
|
// ProjectEvent is triggered when project is created, modified or deleted.
|
||||||
// The webhook event name is "project".
|
// The webhook event name is "project".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectevent
|
||||||
type ProjectEvent struct {
|
type ProjectEvent struct {
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
Changes *ProjectChange `json:"changes,omitempty"`
|
Changes *ProjectChange `json:"changes,omitempty"`
|
||||||
|
@ -536,7 +558,7 @@ type ProjectEvent struct {
|
||||||
// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
|
// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
|
||||||
// The webhook event name is "project_card".
|
// The webhook event name is "project_card".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcardevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectcardevent
|
||||||
type ProjectCardEvent struct {
|
type ProjectCardEvent struct {
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
Changes *ProjectCardChange `json:"changes,omitempty"`
|
Changes *ProjectCardChange `json:"changes,omitempty"`
|
||||||
|
@ -553,7 +575,7 @@ type ProjectCardEvent struct {
|
||||||
// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
|
// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
|
||||||
// The webhook event name is "project_column".
|
// The webhook event name is "project_column".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcolumnevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#projectcolumnevent
|
||||||
type ProjectColumnEvent struct {
|
type ProjectColumnEvent struct {
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
Changes *ProjectColumnChange `json:"changes,omitempty"`
|
Changes *ProjectColumnChange `json:"changes,omitempty"`
|
||||||
|
@ -571,7 +593,7 @@ type ProjectColumnEvent struct {
|
||||||
// According to GitHub: "Without a doubt: the best GitHub event."
|
// According to GitHub: "Without a doubt: the best GitHub event."
|
||||||
// The Webhook event name is "public".
|
// The Webhook event name is "public".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#publicevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#publicevent
|
||||||
type PublicEvent struct {
|
type PublicEvent struct {
|
||||||
// The following fields are only populated by Webhook events.
|
// The following fields are only populated by Webhook events.
|
||||||
Repo *Repository `json:"repository,omitempty"`
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
@ -584,7 +606,7 @@ type PublicEvent struct {
|
||||||
// locked, unlocked, a pull request review is requested, or a review request is removed.
|
// locked, unlocked, a pull request review is requested, or a review request is removed.
|
||||||
// The Webhook event name is "pull_request".
|
// The Webhook event name is "pull_request".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestevent
|
||||||
type PullRequestEvent struct {
|
type PullRequestEvent struct {
|
||||||
// Action is the action that was performed. Possible values are:
|
// Action is the action that was performed. Possible values are:
|
||||||
// "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
|
// "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
|
||||||
|
@ -625,7 +647,7 @@ type PullRequestEvent struct {
|
||||||
// request.
|
// request.
|
||||||
// The Webhook event name is "pull_request_review".
|
// The Webhook event name is "pull_request_review".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestreviewevent
|
||||||
type PullRequestReviewEvent struct {
|
type PullRequestReviewEvent struct {
|
||||||
// Action is always "submitted".
|
// Action is always "submitted".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -646,7 +668,7 @@ type PullRequestReviewEvent struct {
|
||||||
// portion of the unified diff of a pull request.
|
// portion of the unified diff of a pull request.
|
||||||
// The Webhook event name is "pull_request_review_comment".
|
// The Webhook event name is "pull_request_review_comment".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestreviewcommentevent
|
||||||
type PullRequestReviewCommentEvent struct {
|
type PullRequestReviewCommentEvent struct {
|
||||||
// Action is the action that was performed on the comment.
|
// Action is the action that was performed on the comment.
|
||||||
// Possible values are: "created", "edited", "deleted".
|
// Possible values are: "created", "edited", "deleted".
|
||||||
|
@ -663,7 +685,7 @@ type PullRequestReviewCommentEvent struct {
|
||||||
|
|
||||||
// PushEvent represents a git push to a GitHub repository.
|
// PushEvent represents a git push to a GitHub repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pushevent
|
||||||
type PushEvent struct {
|
type PushEvent struct {
|
||||||
PushID *int64 `json:"push_id,omitempty"`
|
PushID *int64 `json:"push_id,omitempty"`
|
||||||
Head *string `json:"head,omitempty"`
|
Head *string `json:"head,omitempty"`
|
||||||
|
@ -765,7 +787,7 @@ type PushEventRepoOwner struct {
|
||||||
// edited, deleted, or prereleased.
|
// edited, deleted, or prereleased.
|
||||||
// The Webhook event name is "release".
|
// The Webhook event name is "release".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#releaseevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#releaseevent
|
||||||
type ReleaseEvent struct {
|
type ReleaseEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "published", "unpublished",
|
// Action is the action that was performed. Possible values are: "published", "unpublished",
|
||||||
// "created", "edited", "deleted", or "prereleased".
|
// "created", "edited", "deleted", or "prereleased".
|
||||||
|
@ -786,7 +808,7 @@ type ReleaseEvent struct {
|
||||||
// Events of this type are not visible in timelines, they are only used to
|
// Events of this type are not visible in timelines, they are only used to
|
||||||
// trigger organization webhooks.
|
// trigger organization webhooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositoryevent
|
||||||
type RepositoryEvent struct {
|
type RepositoryEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "created",
|
// Action is the action that was performed. Possible values are: "created",
|
||||||
// "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed",
|
// "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed",
|
||||||
|
@ -802,7 +824,7 @@ type RepositoryEvent struct {
|
||||||
|
|
||||||
// RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint.
|
// RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositorydispatchevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositorydispatchevent
|
||||||
type RepositoryDispatchEvent struct {
|
type RepositoryDispatchEvent struct {
|
||||||
// Action is the event_type that submitted with the repository dispatch payload. Value can be any string.
|
// Action is the event_type that submitted with the repository dispatch payload. Value can be any string.
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -818,7 +840,7 @@ type RepositoryDispatchEvent struct {
|
||||||
|
|
||||||
// RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved.
|
// RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryvulnerabilityalertevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#repositoryvulnerabilityalertevent
|
||||||
type RepositoryVulnerabilityAlertEvent struct {
|
type RepositoryVulnerabilityAlertEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
|
// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -843,7 +865,7 @@ type RepositoryVulnerabilityAlertEvent struct {
|
||||||
// StarEvent is triggered when a star is added or removed from a repository.
|
// StarEvent is triggered when a star is added or removed from a repository.
|
||||||
// The Webhook event name is "star".
|
// The Webhook event name is "star".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#starevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#starevent
|
||||||
type StarEvent struct {
|
type StarEvent struct {
|
||||||
// Action is the action that was performed. Possible values are: "created" or "deleted".
|
// Action is the action that was performed. Possible values are: "created" or "deleted".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -858,7 +880,7 @@ type StarEvent struct {
|
||||||
// Events of this type are not visible in timelines, they are only used to
|
// Events of this type are not visible in timelines, they are only used to
|
||||||
// trigger hooks.
|
// trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#statusevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#statusevent
|
||||||
type StatusEvent struct {
|
type StatusEvent struct {
|
||||||
SHA *string `json:"sha,omitempty"`
|
SHA *string `json:"sha,omitempty"`
|
||||||
// State is the new state. Possible values are: "pending", "success", "failure", "error".
|
// State is the new state. Possible values are: "pending", "success", "failure", "error".
|
||||||
|
@ -885,7 +907,7 @@ type StatusEvent struct {
|
||||||
// Events of this type are not visible in timelines. These events are only used
|
// Events of this type are not visible in timelines. These events are only used
|
||||||
// to trigger hooks.
|
// to trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#teamevent
|
||||||
type TeamEvent struct {
|
type TeamEvent struct {
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
Team *Team `json:"team,omitempty"`
|
Team *Team `json:"team,omitempty"`
|
||||||
|
@ -904,7 +926,7 @@ type TeamEvent struct {
|
||||||
// Events of this type are not visible in timelines. These events are only used
|
// Events of this type are not visible in timelines. These events are only used
|
||||||
// to trigger hooks.
|
// to trigger hooks.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamaddevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#teamaddevent
|
||||||
type TeamAddEvent struct {
|
type TeamAddEvent struct {
|
||||||
Team *Team `json:"team,omitempty"`
|
Team *Team `json:"team,omitempty"`
|
||||||
Repo *Repository `json:"repository,omitempty"`
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
@ -935,7 +957,7 @@ type UserEvent struct {
|
||||||
// The event’s actor is the user who starred a repository, and the event’s
|
// The event’s actor is the user who starred a repository, and the event’s
|
||||||
// repository is the repository that was starred.
|
// repository is the repository that was starred.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#watchevent
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#watchevent
|
||||||
type WatchEvent struct {
|
type WatchEvent struct {
|
||||||
// Action is the action that was performed. Possible value is: "started".
|
// Action is the action that was performed. Possible value is: "started".
|
||||||
Action *string `json:"action,omitempty"`
|
Action *string `json:"action,omitempty"`
|
||||||
|
@ -945,3 +967,30 @@ type WatchEvent struct {
|
||||||
Sender *User `json:"sender,omitempty"`
|
Sender *User `json:"sender,omitempty"`
|
||||||
Installation *Installation `json:"installation,omitempty"`
|
Installation *Installation `json:"installation,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or
|
||||||
|
// sends a POST request to the create a workflow dispatch event endpoint.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch
|
||||||
|
type WorkflowDispatchEvent struct {
|
||||||
|
Inputs json.RawMessage `json:"inputs,omitempty"`
|
||||||
|
Ref *string `json:"ref,omitempty"`
|
||||||
|
Workflow *string `json:"workflow,omitempty"`
|
||||||
|
|
||||||
|
// The following fields are only populated by Webhook events.
|
||||||
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
Org *Organization `json:"organization,omitempty"`
|
||||||
|
Sender *User `json:"sender,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
|
||||||
|
type WorkflowRunEvent struct {
|
||||||
|
Action *string `json:"action,omitempty"`
|
||||||
|
|
||||||
|
// The following fields are only populated by Webhook events.
|
||||||
|
Org *Organization `json:"organization,omitempty"`
|
||||||
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
Sender *User `json:"sender,omitempty"`
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// GistsService handles communication with the Gist related
|
// GistsService handles communication with the Gist related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/
|
||||||
type GistsService service
|
type GistsService service
|
||||||
|
|
||||||
// Gist represents a GitHub's gist.
|
// Gist represents a GitHub's gist.
|
||||||
|
@ -96,8 +96,8 @@ type GistListOptions struct {
|
||||||
// is authenticated, it will returns all gists for the authenticated
|
// is authenticated, it will returns all gists for the authenticated
|
||||||
// user.
|
// user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-gists-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gists-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-gists-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gists-for-a-user
|
||||||
func (s *GistsService) List(ctx context.Context, user string, opts *GistListOptions) ([]*Gist, *Response, error) {
|
func (s *GistsService) List(ctx context.Context, user string, opts *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -126,7 +126,7 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti
|
||||||
|
|
||||||
// ListAll lists all public gists.
|
// ListAll lists all public gists.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-public-gists
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-public-gists
|
||||||
func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) {
|
func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
u, err := addOptions("gists/public", opts)
|
u, err := addOptions("gists/public", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -149,7 +149,7 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G
|
||||||
|
|
||||||
// ListStarred lists starred gists of authenticated user.
|
// ListStarred lists starred gists of authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-starred-gists
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-starred-gists
|
||||||
func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) {
|
func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) {
|
||||||
u, err := addOptions("gists/starred", opts)
|
u, err := addOptions("gists/starred", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -172,7 +172,7 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) (
|
||||||
|
|
||||||
// Get a single gist.
|
// Get a single gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#get-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist
|
||||||
func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) {
|
func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v", id)
|
u := fmt.Sprintf("gists/%v", id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -191,7 +191,7 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er
|
||||||
|
|
||||||
// GetRevision gets a specific revision of a gist.
|
// GetRevision gets a specific revision of a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#get-a-gist-revision
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist-revision
|
||||||
func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) {
|
func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/%v", id, sha)
|
u := fmt.Sprintf("gists/%v/%v", id, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -210,7 +210,7 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist,
|
||||||
|
|
||||||
// Create a gist for authenticated user.
|
// Create a gist for authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#create-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#create-a-gist
|
||||||
func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) {
|
func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) {
|
||||||
u := "gists"
|
u := "gists"
|
||||||
req, err := s.client.NewRequest("POST", u, gist)
|
req, err := s.client.NewRequest("POST", u, gist)
|
||||||
|
@ -229,7 +229,7 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response
|
||||||
|
|
||||||
// Edit a gist.
|
// Edit a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#update-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#update-a-gist
|
||||||
func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) {
|
func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v", id)
|
u := fmt.Sprintf("gists/%v", id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, gist)
|
req, err := s.client.NewRequest("PATCH", u, gist)
|
||||||
|
@ -248,7 +248,7 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist,
|
||||||
|
|
||||||
// ListCommits lists commits of a gist.
|
// ListCommits lists commits of a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-commits
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-commits
|
||||||
func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) {
|
func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/commits", id)
|
u := fmt.Sprintf("gists/%v/commits", id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -272,7 +272,7 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt
|
||||||
|
|
||||||
// Delete a gist.
|
// Delete a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#delete-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#delete-a-gist
|
||||||
func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) {
|
func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v", id)
|
u := fmt.Sprintf("gists/%v", id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -284,7 +284,7 @@ func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error)
|
||||||
|
|
||||||
// Star a gist on behalf of authenticated user.
|
// Star a gist on behalf of authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#star-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#star-a-gist
|
||||||
func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) {
|
func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/star", id)
|
u := fmt.Sprintf("gists/%v/star", id)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
||||||
|
@ -296,7 +296,7 @@ func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) {
|
||||||
|
|
||||||
// Unstar a gist on a behalf of authenticated user.
|
// Unstar a gist on a behalf of authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#unstar-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#unstar-a-gist
|
||||||
func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) {
|
func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/star", id)
|
u := fmt.Sprintf("gists/%v/star", id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -308,7 +308,7 @@ func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error)
|
||||||
|
|
||||||
// IsStarred checks if a gist is starred by authenticated user.
|
// IsStarred checks if a gist is starred by authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#check-if-a-gist-is-starred
|
||||||
func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) {
|
func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/star", id)
|
u := fmt.Sprintf("gists/%v/star", id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -322,7 +322,7 @@ func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Respons
|
||||||
|
|
||||||
// Fork a gist.
|
// Fork a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#fork-a-gist
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#fork-a-gist
|
||||||
func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) {
|
func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/forks", id)
|
u := fmt.Sprintf("gists/%v/forks", id)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
@ -341,7 +341,7 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e
|
||||||
|
|
||||||
// ListForks lists forks of a gist.
|
// ListForks lists forks of a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/#list-gist-forks
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-forks
|
||||||
func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) {
|
func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/forks", id)
|
u := fmt.Sprintf("gists/%v/forks", id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -26,7 +26,7 @@ func (g GistComment) String() string {
|
||||||
|
|
||||||
// ListComments lists all comments for a gist.
|
// ListComments lists all comments for a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/comments/#list-gist-comments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#list-gist-comments
|
||||||
func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) {
|
func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments", gistID)
|
u := fmt.Sprintf("gists/%v/comments", gistID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -50,7 +50,7 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li
|
||||||
|
|
||||||
// GetComment retrieves a single comment from a gist.
|
// GetComment retrieves a single comment from a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-gist-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#get-a-gist-comment
|
||||||
func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) {
|
func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -69,7 +69,7 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID
|
||||||
|
|
||||||
// CreateComment creates a comment for a gist.
|
// CreateComment creates a comment for a gist.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/comments/#create-a-gist-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#create-a-gist-comment
|
||||||
func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) {
|
func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments", gistID)
|
u := fmt.Sprintf("gists/%v/comments", gistID)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -88,7 +88,7 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment
|
||||||
|
|
||||||
// EditComment edits an existing gist comment.
|
// EditComment edits an existing gist comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/comments/#update-a-gist-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#update-a-gist-comment
|
||||||
func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) {
|
func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -107,7 +107,7 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID
|
||||||
|
|
||||||
// DeleteComment deletes a gist comment.
|
// DeleteComment deletes a gist comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-gist-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gists/#delete-a-gist-comment
|
||||||
func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) {
|
func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -8,5 +8,5 @@ package github
|
||||||
// GitService handles communication with the git data related
|
// GitService handles communication with the git data related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/
|
||||||
type GitService service
|
type GitService service
|
|
@ -23,7 +23,7 @@ type Blob struct {
|
||||||
|
|
||||||
// GetBlob fetches a blob from a repo given a SHA.
|
// GetBlob fetches a blob from a repo given a SHA.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-blob
|
||||||
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
|
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -39,7 +39,7 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha
|
||||||
// GetBlobRaw fetches a blob's contents from a repo.
|
// GetBlobRaw fetches a blob's contents from a repo.
|
||||||
// Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data.
|
// Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-blob
|
||||||
func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) {
|
func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -55,7 +55,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([
|
||||||
|
|
||||||
// CreateBlob creates a blob object.
|
// CreateBlob creates a blob object.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-blob
|
||||||
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
|
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, blob)
|
req, err := s.client.NewRequest("POST", u, blob)
|
|
@ -70,7 +70,7 @@ func (c CommitAuthor) String() string {
|
||||||
|
|
||||||
// GetCommit fetches the Commit object for a given SHA.
|
// GetCommit fetches the Commit object for a given SHA.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/commits/#get-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-commit
|
||||||
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
|
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -104,7 +104,7 @@ type createCommit struct {
|
||||||
// data if omitted. If the commit.Author is omitted, it will be filled in with
|
// data if omitted. If the commit.Author is omitted, it will be filled in with
|
||||||
// the authenticated user’s information and the current date.
|
// the authenticated user’s information and the current date.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/commits/#create-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-commit
|
||||||
func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) {
|
func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) {
|
||||||
if commit == nil {
|
if commit == nil {
|
||||||
return nil, nil, fmt.Errorf("commit must be provided")
|
return nil, nil, fmt.Errorf("commit must be provided")
|
|
@ -49,7 +49,7 @@ type updateRefRequest struct {
|
||||||
|
|
||||||
// GetRef fetches a single reference in a repository.
|
// GetRef fetches a single reference in a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-reference
|
||||||
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
|
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) {
|
||||||
ref = strings.TrimPrefix(ref, "refs/")
|
ref = strings.TrimPrefix(ref, "refs/")
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref))
|
||||||
|
@ -88,7 +88,7 @@ type ReferenceListOptions struct {
|
||||||
// ListMatchingRefs lists references in a repository that match a supplied ref.
|
// ListMatchingRefs lists references in a repository that match a supplied ref.
|
||||||
// Use an empty ref to list all references.
|
// Use an empty ref to list all references.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#list-matching-references
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#list-matching-references
|
||||||
func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) {
|
func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) {
|
||||||
var ref string
|
var ref string
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
|
@ -116,7 +116,7 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o
|
||||||
|
|
||||||
// CreateRef creates a new ref in a repository.
|
// CreateRef creates a new ref in a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-reference
|
||||||
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
|
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, &createRefRequest{
|
req, err := s.client.NewRequest("POST", u, &createRefRequest{
|
||||||
|
@ -139,7 +139,7 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r
|
||||||
|
|
||||||
// UpdateRef updates an existing ref in a repository.
|
// UpdateRef updates an existing ref in a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#update-a-reference
|
||||||
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
|
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) {
|
||||||
refPath := strings.TrimPrefix(*ref.Ref, "refs/")
|
refPath := strings.TrimPrefix(*ref.Ref, "refs/")
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath)
|
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refPath)
|
||||||
|
@ -162,7 +162,7 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r
|
||||||
|
|
||||||
// DeleteRef deletes a ref from a repository.
|
// DeleteRef deletes a ref from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#delete-a-reference
|
||||||
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
|
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) {
|
||||||
ref = strings.TrimPrefix(ref, "refs/")
|
ref = strings.TrimPrefix(ref, "refs/")
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref))
|
|
@ -35,7 +35,7 @@ type createTagRequest struct {
|
||||||
|
|
||||||
// GetTag fetches a tag from a repo given a SHA.
|
// GetTag fetches a tag from a repo given a SHA.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/tags/#get-a-tag
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-tag
|
||||||
func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) {
|
func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -50,7 +50,7 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha
|
||||||
|
|
||||||
// CreateTag creates a tag object.
|
// CreateTag creates a tag object.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/tags/#create-a-tag-object
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-tag-object
|
||||||
func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) {
|
func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo)
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) {
|
||||||
|
|
||||||
// GetTree fetches the Tree object for a given sha hash from a repository.
|
// GetTree fetches the Tree object for a given sha hash from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#get-a-tree
|
||||||
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
|
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
|
||||||
if recursive {
|
if recursive {
|
||||||
|
@ -124,7 +124,7 @@ type createTree struct {
|
||||||
// path modifying that tree are specified, it will overwrite the contents of
|
// path modifying that tree are specified, it will overwrite the contents of
|
||||||
// that tree with the new path contents and write a new tree out.
|
// that tree with the new path contents and write a new tree out.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/git/#create-a-tree
|
||||||
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
|
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
|
||||||
|
|
|
@ -1460,6 +1460,14 @@ func (c *CombinedStatus) GetTotalCount() int {
|
||||||
return *c.TotalCount
|
return *c.TotalCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (c *Comment) GetCreatedAt() time.Time {
|
||||||
|
if c == nil || c.CreatedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *c.CreatedAt
|
||||||
|
}
|
||||||
|
|
||||||
// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise.
|
// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise.
|
||||||
func (c *CommentStats) GetTotalCommitComments() int {
|
func (c *CommentStats) GetTotalCommitComments() int {
|
||||||
if c == nil || c.TotalCommitComments == nil {
|
if c == nil || c.TotalCommitComments == nil {
|
||||||
|
@ -2012,6 +2020,70 @@ func (c *CommunityHealthMetrics) GetUpdatedAt() time.Time {
|
||||||
return *c.UpdatedAt
|
return *c.UpdatedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetID returns the ID field if it's non-nil, zero value otherwise.
|
||||||
|
func (c *ContentReference) GetID() int64 {
|
||||||
|
if c == nil || c.ID == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *c.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
|
||||||
|
func (c *ContentReference) GetNodeID() string {
|
||||||
|
if c == nil || c.NodeID == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *c.NodeID
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetReference returns the Reference field if it's non-nil, zero value otherwise.
|
||||||
|
func (c *ContentReference) GetReference() string {
|
||||||
|
if c == nil || c.Reference == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *c.Reference
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAction returns the Action field if it's non-nil, zero value otherwise.
|
||||||
|
func (c *ContentReferenceEvent) GetAction() string {
|
||||||
|
if c == nil || c.Action == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *c.Action
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetContentReference returns the ContentReference field.
|
||||||
|
func (c *ContentReferenceEvent) GetContentReference() *ContentReference {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.ContentReference
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetInstallation returns the Installation field.
|
||||||
|
func (c *ContentReferenceEvent) GetInstallation() *Installation {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.Installation
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepo returns the Repo field.
|
||||||
|
func (c *ContentReferenceEvent) GetRepo() *Repository {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.Repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender returns the Sender field.
|
||||||
|
func (c *ContentReferenceEvent) GetSender() *User {
|
||||||
|
if c == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return c.Sender
|
||||||
|
}
|
||||||
|
|
||||||
// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
|
// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
|
||||||
func (c *Contributor) GetAvatarURL() string {
|
func (c *Contributor) GetAvatarURL() string {
|
||||||
if c == nil || c.AvatarURL == nil {
|
if c == nil || c.AvatarURL == nil {
|
||||||
|
@ -4156,6 +4228,14 @@ func (i *Installation) GetID() int64 {
|
||||||
return *i.ID
|
return *i.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *Installation) GetNodeID() string {
|
||||||
|
if i == nil || i.NodeID == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.NodeID
|
||||||
|
}
|
||||||
|
|
||||||
// GetPermissions returns the Permissions field.
|
// GetPermissions returns the Permissions field.
|
||||||
func (i *Installation) GetPermissions() *InstallationPermissions {
|
func (i *Installation) GetPermissions() *InstallationPermissions {
|
||||||
if i == nil {
|
if i == nil {
|
||||||
|
@ -5076,6 +5156,22 @@ func (i *IssueEvent) GetRename() *Rename {
|
||||||
return i.Rename
|
return i.Rename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRequestedReviewer returns the RequestedReviewer field.
|
||||||
|
func (i *IssueEvent) GetRequestedReviewer() *User {
|
||||||
|
if i == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return i.RequestedReviewer
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetReviewRequester returns the ReviewRequester field.
|
||||||
|
func (i *IssueEvent) GetReviewRequester() *User {
|
||||||
|
if i == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return i.ReviewRequester
|
||||||
|
}
|
||||||
|
|
||||||
// GetURL returns the URL field if it's non-nil, zero value otherwise.
|
// GetURL returns the URL field if it's non-nil, zero value otherwise.
|
||||||
func (i *IssueEvent) GetURL() string {
|
func (i *IssueEvent) GetURL() string {
|
||||||
if i == nil || i.URL == nil {
|
if i == nil || i.URL == nil {
|
||||||
|
@ -5084,12 +5180,164 @@ func (i *IssueEvent) GetURL() string {
|
||||||
return *i.URL
|
return *i.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDirection returns the Direction field if it's non-nil, zero value otherwise.
|
// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
|
||||||
func (i *IssueListCommentsOptions) GetDirection() string {
|
func (i *IssueImport) GetAssignee() string {
|
||||||
if i == nil || i.Direction == nil {
|
if i == nil || i.Assignee == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return *i.Direction
|
return *i.Assignee
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetClosed returns the Closed field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImport) GetClosed() bool {
|
||||||
|
if i == nil || i.Closed == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return *i.Closed
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImport) GetClosedAt() time.Time {
|
||||||
|
if i == nil || i.ClosedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *i.ClosedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImport) GetCreatedAt() time.Time {
|
||||||
|
if i == nil || i.CreatedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *i.CreatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImport) GetMilestone() int {
|
||||||
|
if i == nil || i.Milestone == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *i.Milestone
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImport) GetUpdatedAt() time.Time {
|
||||||
|
if i == nil || i.UpdatedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *i.UpdatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCode returns the Code field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportError) GetCode() string {
|
||||||
|
if i == nil || i.Code == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Code
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetField returns the Field field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportError) GetField() string {
|
||||||
|
if i == nil || i.Field == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Field
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLocation returns the Location field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportError) GetLocation() string {
|
||||||
|
if i == nil || i.Location == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Location
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResource returns the Resource field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportError) GetResource() string {
|
||||||
|
if i == nil || i.Resource == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Resource
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetValue returns the Value field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportError) GetValue() string {
|
||||||
|
if i == nil || i.Value == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetCreatedAt() time.Time {
|
||||||
|
if i == nil || i.CreatedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *i.CreatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDocumentationURL returns the DocumentationURL field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetDocumentationURL() string {
|
||||||
|
if i == nil || i.DocumentationURL == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.DocumentationURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetID returns the ID field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetID() int {
|
||||||
|
if i == nil || i.ID == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *i.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetImportIssuesURL returns the ImportIssuesURL field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetImportIssuesURL() string {
|
||||||
|
if i == nil || i.ImportIssuesURL == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.ImportIssuesURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMessage returns the Message field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetMessage() string {
|
||||||
|
if i == nil || i.Message == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetRepositoryURL() string {
|
||||||
|
if i == nil || i.RepositoryURL == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.RepositoryURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetStatus() string {
|
||||||
|
if i == nil || i.Status == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetUpdatedAt() time.Time {
|
||||||
|
if i == nil || i.UpdatedAt == nil {
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
return *i.UpdatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetURL returns the URL field if it's non-nil, zero value otherwise.
|
||||||
|
func (i *IssueImportResponse) GetURL() string {
|
||||||
|
if i == nil || i.URL == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *i.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSince returns the Since field if it's non-nil, zero value otherwise.
|
// GetSince returns the Since field if it's non-nil, zero value otherwise.
|
||||||
|
@ -5100,14 +5348,6 @@ func (i *IssueListCommentsOptions) GetSince() time.Time {
|
||||||
return *i.Since
|
return *i.Since
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSort returns the Sort field if it's non-nil, zero value otherwise.
|
|
||||||
func (i *IssueListCommentsOptions) GetSort() string {
|
|
||||||
if i == nil || i.Sort == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *i.Sort
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
|
// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
|
||||||
func (i *IssueRequest) GetAssignee() string {
|
func (i *IssueRequest) GetAssignee() string {
|
||||||
if i == nil || i.Assignee == nil {
|
if i == nil || i.Assignee == nil {
|
||||||
|
@ -10364,6 +10604,14 @@ func (r *Reactions) GetConfused() int {
|
||||||
return *r.Confused
|
return *r.Confused
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetEyes returns the Eyes field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *Reactions) GetEyes() int {
|
||||||
|
if r == nil || r.Eyes == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *r.Eyes
|
||||||
|
}
|
||||||
|
|
||||||
// GetHeart returns the Heart field if it's non-nil, zero value otherwise.
|
// GetHeart returns the Heart field if it's non-nil, zero value otherwise.
|
||||||
func (r *Reactions) GetHeart() int {
|
func (r *Reactions) GetHeart() int {
|
||||||
if r == nil || r.Heart == nil {
|
if r == nil || r.Heart == nil {
|
||||||
|
@ -10404,6 +10652,14 @@ func (r *Reactions) GetPlusOne() int {
|
||||||
return *r.PlusOne
|
return *r.PlusOne
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRocket returns the Rocket field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *Reactions) GetRocket() int {
|
||||||
|
if r == nil || r.Rocket == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *r.Rocket
|
||||||
|
}
|
||||||
|
|
||||||
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
||||||
func (r *Reactions) GetTotalCount() int {
|
func (r *Reactions) GetTotalCount() int {
|
||||||
if r == nil || r.TotalCount == nil {
|
if r == nil || r.TotalCount == nil {
|
||||||
|
@ -12308,6 +12564,14 @@ func (r *ReviewersRequest) GetNodeID() string {
|
||||||
return *r.NodeID
|
return *r.NodeID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetBusy returns the Busy field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *Runner) GetBusy() bool {
|
||||||
|
if r == nil || r.Busy == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return *r.Busy
|
||||||
|
}
|
||||||
|
|
||||||
// GetID returns the ID field if it's non-nil, zero value otherwise.
|
// GetID returns the ID field if it's non-nil, zero value otherwise.
|
||||||
func (r *Runner) GetID() int64 {
|
func (r *Runner) GetID() int64 {
|
||||||
if r == nil || r.ID == nil {
|
if r == nil || r.ID == nil {
|
||||||
|
@ -12372,6 +12636,30 @@ func (r *RunnerApplicationDownload) GetOS() string {
|
||||||
return *r.OS
|
return *r.OS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetID returns the ID field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *RunnerLabels) GetID() int64 {
|
||||||
|
if r == nil || r.ID == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *r.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetName returns the Name field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *RunnerLabels) GetName() string {
|
||||||
|
if r == nil || r.Name == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *r.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetType returns the Type field if it's non-nil, zero value otherwise.
|
||||||
|
func (r *RunnerLabels) GetType() string {
|
||||||
|
if r == nil || r.Type == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *r.Type
|
||||||
|
}
|
||||||
|
|
||||||
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
||||||
func (s *SelectedReposList) GetTotalCount() int {
|
func (s *SelectedReposList) GetTotalCount() int {
|
||||||
if s == nil || s.TotalCount == nil {
|
if s == nil || s.TotalCount == nil {
|
||||||
|
@ -13780,14 +14068,6 @@ func (u *UpdateCheckRunOptions) GetExternalID() string {
|
||||||
return *u.ExternalID
|
return *u.ExternalID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
|
|
||||||
func (u *UpdateCheckRunOptions) GetHeadSHA() string {
|
|
||||||
if u == nil || u.HeadSHA == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *u.HeadSHA
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOutput returns the Output field.
|
// GetOutput returns the Output field.
|
||||||
func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput {
|
func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
|
@ -14884,6 +15164,46 @@ func (w *WorkflowBill) GetTotalMS() int64 {
|
||||||
return *w.TotalMS
|
return *w.TotalMS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetOrg returns the Org field.
|
||||||
|
func (w *WorkflowDispatchEvent) GetOrg() *Organization {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Org
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRef returns the Ref field if it's non-nil, zero value otherwise.
|
||||||
|
func (w *WorkflowDispatchEvent) GetRef() string {
|
||||||
|
if w == nil || w.Ref == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *w.Ref
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepo returns the Repo field.
|
||||||
|
func (w *WorkflowDispatchEvent) GetRepo() *Repository {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender returns the Sender field.
|
||||||
|
func (w *WorkflowDispatchEvent) GetSender() *User {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Sender
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWorkflow returns the Workflow field if it's non-nil, zero value otherwise.
|
||||||
|
func (w *WorkflowDispatchEvent) GetWorkflow() string {
|
||||||
|
if w == nil || w.Workflow == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *w.Workflow
|
||||||
|
}
|
||||||
|
|
||||||
// GetMacOS returns the MacOS field.
|
// GetMacOS returns the MacOS field.
|
||||||
func (w *WorkflowEnvironment) GetMacOS() *WorkflowBill {
|
func (w *WorkflowEnvironment) GetMacOS() *WorkflowBill {
|
||||||
if w == nil {
|
if w == nil {
|
||||||
|
@ -15236,6 +15556,38 @@ func (w *WorkflowRunEnvironment) GetWindows() *WorkflowRunBill {
|
||||||
return w.Windows
|
return w.Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAction returns the Action field if it's non-nil, zero value otherwise.
|
||||||
|
func (w *WorkflowRunEvent) GetAction() string {
|
||||||
|
if w == nil || w.Action == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *w.Action
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrg returns the Org field.
|
||||||
|
func (w *WorkflowRunEvent) GetOrg() *Organization {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Org
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepo returns the Repo field.
|
||||||
|
func (w *WorkflowRunEvent) GetRepo() *Repository {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Repo
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender returns the Sender field.
|
||||||
|
func (w *WorkflowRunEvent) GetSender() *User {
|
||||||
|
if w == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return w.Sender
|
||||||
|
}
|
||||||
|
|
||||||
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
|
||||||
func (w *WorkflowRuns) GetTotalCount() int {
|
func (w *WorkflowRuns) GetTotalCount() int {
|
||||||
if w == nil || w.TotalCount == nil {
|
if w == nil || w.TotalCount == nil {
|
|
@ -43,6 +43,7 @@ const (
|
||||||
mediaTypeV3Diff = "application/vnd.github.v3.diff"
|
mediaTypeV3Diff = "application/vnd.github.v3.diff"
|
||||||
mediaTypeV3Patch = "application/vnd.github.v3.patch"
|
mediaTypeV3Patch = "application/vnd.github.v3.patch"
|
||||||
mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
|
mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
|
||||||
|
mediaTypeIssueImportAPI = "application/vnd.github.golden-comet-preview+json"
|
||||||
|
|
||||||
// Media Type values to access preview APIs
|
// Media Type values to access preview APIs
|
||||||
|
|
||||||
|
@ -67,9 +68,6 @@ const (
|
||||||
// https://developer.github.com/changes/2016-09-14-projects-api/
|
// https://developer.github.com/changes/2016-09-14-projects-api/
|
||||||
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
|
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
|
|
||||||
mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
|
|
||||||
|
|
||||||
// https://developer.github.com/changes/2017-01-05-commit-search-api/
|
// https://developer.github.com/changes/2017-01-05-commit-search-api/
|
||||||
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
|
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
|
||||||
|
|
||||||
|
@ -88,12 +86,6 @@ const (
|
||||||
// https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
|
// https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
|
||||||
mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"
|
mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/
|
|
||||||
mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json"
|
|
||||||
|
|
||||||
// https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/
|
|
||||||
mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json"
|
|
||||||
|
|
||||||
// https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/
|
// https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/
|
||||||
mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
|
mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
|
||||||
|
|
||||||
|
@ -121,10 +113,10 @@ const (
|
||||||
// https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/
|
// https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/
|
||||||
mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json"
|
mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/v3/previews/#repository-creation-permissions
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#repository-creation-permissions
|
||||||
mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
|
mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/v3/previews/#create-and-use-repository-templates
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#create-and-use-repository-templates
|
||||||
mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json"
|
mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json"
|
||||||
|
|
||||||
// https://developer.github.com/changes/2019-10-03-multi-line-comments/
|
// https://developer.github.com/changes/2019-10-03-multi-line-comments/
|
||||||
|
@ -135,6 +127,9 @@ const (
|
||||||
|
|
||||||
// https://developer.github.com/changes/2019-12-03-internal-visibility-changes/
|
// https://developer.github.com/changes/2019-12-03-internal-visibility-changes/
|
||||||
mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json"
|
mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json"
|
||||||
|
|
||||||
|
// https://developer.github.com/changes/2018-12-10-content-attachments-api/
|
||||||
|
mediaTypeContentAttachmentsPreview = "application/vnd.github.corsair-preview+json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Client manages communication with the GitHub API.
|
// A Client manages communication with the GitHub API.
|
||||||
|
@ -166,10 +161,12 @@ type Client struct {
|
||||||
Authorizations *AuthorizationsService
|
Authorizations *AuthorizationsService
|
||||||
Checks *ChecksService
|
Checks *ChecksService
|
||||||
CodeScanning *CodeScanningService
|
CodeScanning *CodeScanningService
|
||||||
|
Enterprise *EnterpriseService
|
||||||
Gists *GistsService
|
Gists *GistsService
|
||||||
Git *GitService
|
Git *GitService
|
||||||
Gitignores *GitignoresService
|
Gitignores *GitignoresService
|
||||||
Interactions *InteractionsService
|
Interactions *InteractionsService
|
||||||
|
IssueImport *IssueImportService
|
||||||
Issues *IssuesService
|
Issues *IssuesService
|
||||||
Licenses *LicensesService
|
Licenses *LicensesService
|
||||||
Marketplace *MarketplaceService
|
Marketplace *MarketplaceService
|
||||||
|
@ -273,10 +270,12 @@ func NewClient(httpClient *http.Client) *Client {
|
||||||
c.Authorizations = (*AuthorizationsService)(&c.common)
|
c.Authorizations = (*AuthorizationsService)(&c.common)
|
||||||
c.Checks = (*ChecksService)(&c.common)
|
c.Checks = (*ChecksService)(&c.common)
|
||||||
c.CodeScanning = (*CodeScanningService)(&c.common)
|
c.CodeScanning = (*CodeScanningService)(&c.common)
|
||||||
|
c.Enterprise = (*EnterpriseService)(&c.common)
|
||||||
c.Gists = (*GistsService)(&c.common)
|
c.Gists = (*GistsService)(&c.common)
|
||||||
c.Git = (*GitService)(&c.common)
|
c.Git = (*GitService)(&c.common)
|
||||||
c.Gitignores = (*GitignoresService)(&c.common)
|
c.Gitignores = (*GitignoresService)(&c.common)
|
||||||
c.Interactions = (*InteractionsService)(&c.common)
|
c.Interactions = (*InteractionsService)(&c.common)
|
||||||
|
c.IssueImport = (*IssueImportService)(&c.common)
|
||||||
c.Issues = (*IssuesService)(&c.common)
|
c.Issues = (*IssuesService)(&c.common)
|
||||||
c.Licenses = (*LicensesService)(&c.common)
|
c.Licenses = (*LicensesService)(&c.common)
|
||||||
c.Marketplace = &MarketplaceService{client: c}
|
c.Marketplace = &MarketplaceService{client: c}
|
||||||
|
@ -313,7 +312,9 @@ func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*C
|
||||||
if !strings.HasSuffix(baseEndpoint.Path, "/") {
|
if !strings.HasSuffix(baseEndpoint.Path, "/") {
|
||||||
baseEndpoint.Path += "/"
|
baseEndpoint.Path += "/"
|
||||||
}
|
}
|
||||||
if !strings.HasSuffix(baseEndpoint.Path, "/api/v3/") {
|
if !strings.HasSuffix(baseEndpoint.Path, "/api/v3/") &&
|
||||||
|
!strings.HasPrefix(baseEndpoint.Host, "api.") &&
|
||||||
|
!strings.Contains(baseEndpoint.Host, ".api.") {
|
||||||
baseEndpoint.Path += "api/v3/"
|
baseEndpoint.Path += "api/v3/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +325,9 @@ func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*C
|
||||||
if !strings.HasSuffix(uploadEndpoint.Path, "/") {
|
if !strings.HasSuffix(uploadEndpoint.Path, "/") {
|
||||||
uploadEndpoint.Path += "/"
|
uploadEndpoint.Path += "/"
|
||||||
}
|
}
|
||||||
if !strings.HasSuffix(uploadEndpoint.Path, "/api/uploads/") {
|
if !strings.HasSuffix(uploadEndpoint.Path, "/api/uploads/") &&
|
||||||
|
!strings.HasPrefix(uploadEndpoint.Host, "api.") &&
|
||||||
|
!strings.Contains(uploadEndpoint.Host, ".api.") {
|
||||||
uploadEndpoint.Path += "api/uploads/"
|
uploadEndpoint.Path += "api/uploads/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,6 +557,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
response := newResponse(resp)
|
response := newResponse(resp)
|
||||||
|
@ -630,7 +634,7 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat
|
||||||
/*
|
/*
|
||||||
An ErrorResponse reports one or more errors caused by an API request.
|
An ErrorResponse reports one or more errors caused by an API request.
|
||||||
|
|
||||||
GitHub API docs: https://developer.github.com/v3/#client-errors
|
GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors
|
||||||
*/
|
*/
|
||||||
type ErrorResponse struct {
|
type ErrorResponse struct {
|
||||||
Response *http.Response // HTTP response that caused this error
|
Response *http.Response // HTTP response that caused this error
|
||||||
|
@ -645,7 +649,7 @@ type ErrorResponse struct {
|
||||||
} `json:"block,omitempty"`
|
} `json:"block,omitempty"`
|
||||||
// Most errors will also include a documentation_url field pointing
|
// Most errors will also include a documentation_url field pointing
|
||||||
// to some content that might help you resolve the error, see
|
// to some content that might help you resolve the error, see
|
||||||
// https://developer.github.com/v3/#client-errors
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors
|
||||||
DocumentationURL string `json:"documentation_url,omitempty"`
|
DocumentationURL string `json:"documentation_url,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,7 +696,7 @@ func (*AcceptedError) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
|
// AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the
|
||||||
// "documentation_url" field value equal to "https://developer.github.com/v3/#abuse-rate-limits".
|
// "documentation_url" field value equal to "https://docs.github.com/en/free-pro-team@latest/rest/reference/#abuse-rate-limits".
|
||||||
type AbuseRateLimitError struct {
|
type AbuseRateLimitError struct {
|
||||||
Response *http.Response // HTTP response that caused this error
|
Response *http.Response // HTTP response that caused this error
|
||||||
Message string `json:"message"` // error message
|
Message string `json:"message"` // error message
|
||||||
|
@ -743,7 +747,7 @@ GitHub error responses structure are often undocumented and inconsistent.
|
||||||
Sometimes error is just a simple string (Issue #540).
|
Sometimes error is just a simple string (Issue #540).
|
||||||
In such cases, Message represents an error message as a workaround.
|
In such cases, Message represents an error message as a workaround.
|
||||||
|
|
||||||
GitHub API docs: https://developer.github.com/v3/#client-errors
|
GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#client-errors
|
||||||
*/
|
*/
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Resource string `json:"resource"` // resource on which the error occurred
|
Resource string `json:"resource"` // resource on which the error occurred
|
||||||
|
@ -799,7 +803,7 @@ func CheckResponse(r *http.Response) error {
|
||||||
Response: errorResponse.Response,
|
Response: errorResponse.Response,
|
||||||
Message: errorResponse.Message,
|
Message: errorResponse.Message,
|
||||||
}
|
}
|
||||||
case r.StatusCode == http.StatusForbidden && strings.HasSuffix(errorResponse.DocumentationURL, "/v3/#abuse-rate-limits"):
|
case r.StatusCode == http.StatusForbidden && strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits"):
|
||||||
abuseRateLimitError := &AbuseRateLimitError{
|
abuseRateLimitError := &AbuseRateLimitError{
|
||||||
Response: errorResponse.Response,
|
Response: errorResponse.Response,
|
||||||
Message: errorResponse.Message,
|
Message: errorResponse.Message,
|
||||||
|
@ -859,14 +863,14 @@ type RateLimits struct {
|
||||||
// requests are limited to 60 per hour. Authenticated requests are
|
// requests are limited to 60 per hour. Authenticated requests are
|
||||||
// limited to 5,000 per hour.
|
// limited to 5,000 per hour.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/#rate-limiting
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#rate-limiting
|
||||||
Core *Rate `json:"core"`
|
Core *Rate `json:"core"`
|
||||||
|
|
||||||
// The rate limit for search API requests. Unauthenticated requests
|
// The rate limit for search API requests. Unauthenticated requests
|
||||||
// are limited to 10 requests per minutes. Authenticated requests are
|
// are limited to 10 requests per minutes. Authenticated requests are
|
||||||
// limited to 30 per minute.
|
// limited to 30 per minute.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#rate-limit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#rate-limit
|
||||||
Search *Rate `json:"search"`
|
Search *Rate `json:"search"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +957,7 @@ that need to use a higher rate limit associated with your OAuth application.
|
||||||
This will add the client id and secret as a base64-encoded string in the format
|
This will add the client id and secret as a base64-encoded string in the format
|
||||||
ClientID:ClientSecret and apply it as an "Authorization": "Basic" header.
|
ClientID:ClientSecret and apply it as an "Authorization": "Basic" header.
|
||||||
|
|
||||||
See https://developer.github.com/v3/#unauthenticated-rate-limited-requests for
|
See https://docs.github.com/en/free-pro-team@latest/rest/reference/#unauthenticated-rate-limited-requests for
|
||||||
more information.
|
more information.
|
||||||
*/
|
*/
|
||||||
type UnauthenticatedRateLimitedTransport struct {
|
type UnauthenticatedRateLimitedTransport struct {
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// GitignoresService provides access to the gitignore related functions in the
|
// GitignoresService provides access to the gitignore related functions in the
|
||||||
// GitHub API.
|
// GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gitignore/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/
|
||||||
type GitignoresService service
|
type GitignoresService service
|
||||||
|
|
||||||
// Gitignore represents a .gitignore file as returned by the GitHub API.
|
// Gitignore represents a .gitignore file as returned by the GitHub API.
|
||||||
|
@ -28,7 +28,7 @@ func (g Gitignore) String() string {
|
||||||
|
|
||||||
// List all available Gitignore templates.
|
// List all available Gitignore templates.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gitignore/#listing-available-templates
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/#listing-available-templates
|
||||||
func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) {
|
func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) {
|
||||||
req, err := s.client.NewRequest("GET", "gitignore/templates", nil)
|
req, err := s.client.NewRequest("GET", "gitignore/templates", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -46,7 +46,7 @@ func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, erro
|
||||||
|
|
||||||
// Get a Gitignore by name.
|
// Get a Gitignore by name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/gitignore/#get-a-gitignore-template
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/gitignore/#get-a-gitignore-template
|
||||||
func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) {
|
func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) {
|
||||||
u := fmt.Sprintf("gitignore/templates/%v", name)
|
u := fmt.Sprintf("gitignore/templates/%v", name)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
|
@ -8,7 +8,7 @@ package github
|
||||||
// InteractionsService handles communication with the repository and organization related
|
// InteractionsService handles communication with the repository and organization related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/
|
||||||
type InteractionsService service
|
type InteractionsService service
|
||||||
|
|
||||||
// InteractionRestriction represents the interaction restrictions for repository and organization.
|
// InteractionRestriction represents the interaction restrictions for repository and organization.
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// GetRestrictionsForOrg fetches the interaction restrictions for an organization.
|
// GetRestrictionsForOrg fetches the interaction restrictions for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#get-interaction-restrictions-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#get-interaction-restrictions-for-an-organization
|
||||||
func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) {
|
func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -39,7 +39,7 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz
|
||||||
// in public repositories for the given organization.
|
// in public repositories for the given organization.
|
||||||
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
|
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#set-interaction-restrictions-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#set-interaction-restrictions-for-an-organization
|
||||||
func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) {
|
func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga
|
||||||
|
|
||||||
// RemoveRestrictionsFromOrg removes the interaction restrictions for an organization.
|
// RemoveRestrictionsFromOrg removes the interaction restrictions for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#remove-interaction-restrictions-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#remove-interaction-restrictions-for-an-organization
|
||||||
func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) {
|
func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// GetRestrictionsForRepo fetches the interaction restrictions for a repository.
|
// GetRestrictionsForRepo fetches the interaction restrictions for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#get-interaction-restrictions-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#get-interaction-restrictions-for-a-repository
|
||||||
func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) {
|
func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -39,7 +39,7 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner,
|
||||||
// for the given repository.
|
// for the given repository.
|
||||||
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
|
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#set-interaction-restrictions-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#set-interaction-restrictions-for-a-repository
|
||||||
func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) {
|
func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own
|
||||||
|
|
||||||
// RemoveRestrictionsFromRepo removes the interaction restrictions for a repository.
|
// RemoveRestrictionsFromRepo removes the interaction restrictions for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#remove-interaction-restrictions-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/interactions/#remove-interaction-restrictions-for-a-repository
|
||||||
func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -0,0 +1,152 @@
|
||||||
|
// Copyright 2020 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 (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IssueImportService handles communication with the issue import related
|
||||||
|
// methods of the Issue Import GitHub API.
|
||||||
|
type IssueImportService service
|
||||||
|
|
||||||
|
// IssueImportRequest represents a request to create an issue.
|
||||||
|
//
|
||||||
|
// https://gist.github.com/jonmagic/5282384165e0f86ef105#supported-issue-and-comment-fields
|
||||||
|
type IssueImportRequest struct {
|
||||||
|
IssueImport IssueImport `json:"issue"`
|
||||||
|
Comments []*Comment `json:"comments,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IssueImport represents body of issue to import.
|
||||||
|
type IssueImport struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Body string `json:"body"`
|
||||||
|
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||||
|
ClosedAt *time.Time `json:"closed_at,omitempty"`
|
||||||
|
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||||
|
Assignee *string `json:"assignee,omitempty"`
|
||||||
|
Milestone *int `json:"milestone,omitempty"`
|
||||||
|
Closed *bool `json:"closed,omitempty"`
|
||||||
|
Labels []string `json:"labels,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comment represents comments of issue to import.
|
||||||
|
type Comment struct {
|
||||||
|
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||||
|
Body string `json:"body"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IssueImportResponse represents the response of an issue import create request.
|
||||||
|
//
|
||||||
|
// https://gist.github.com/jonmagic/5282384165e0f86ef105#import-issue-response
|
||||||
|
type IssueImportResponse struct {
|
||||||
|
ID *int `json:"id,omitempty"`
|
||||||
|
Status *string `json:"status,omitempty"`
|
||||||
|
URL *string `json:"url,omitempty"`
|
||||||
|
ImportIssuesURL *string `json:"import_issues_url,omitempty"`
|
||||||
|
RepositoryURL *string `json:"repository_url,omitempty"`
|
||||||
|
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||||
|
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||||
|
Message *string `json:"message,omitempty"`
|
||||||
|
DocumentationURL *string `json:"documentation_url,omitempty"`
|
||||||
|
Errors []*IssueImportError `json:"errors,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IssueImportError represents errors of an issue import create request.
|
||||||
|
type IssueImportError struct {
|
||||||
|
Location *string `json:"location,omitempty"`
|
||||||
|
Resource *string `json:"resource,omitempty"`
|
||||||
|
Field *string `json:"field,omitempty"`
|
||||||
|
Value *string `json:"value,omitempty"`
|
||||||
|
Code *string `json:"code,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new imported issue on the specified repository.
|
||||||
|
//
|
||||||
|
// https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import
|
||||||
|
func (s *IssueImportService) Create(ctx context.Context, owner, repo string, issue *IssueImportRequest) (*IssueImportResponse, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/import/issues", owner, repo)
|
||||||
|
req, err := s.client.NewRequest("POST", u, issue)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept headers when APIs fully launch.
|
||||||
|
req.Header.Set("Accept", mediaTypeIssueImportAPI)
|
||||||
|
|
||||||
|
i := new(IssueImportResponse)
|
||||||
|
resp, err := s.client.Do(ctx, req, i)
|
||||||
|
if err != nil {
|
||||||
|
aerr, ok := err.(*AcceptedError)
|
||||||
|
if ok {
|
||||||
|
decErr := json.Unmarshal(aerr.Raw, i)
|
||||||
|
if decErr != nil {
|
||||||
|
err = decErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return i, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return i, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckStatus checks the status of an imported issue.
|
||||||
|
//
|
||||||
|
// https://gist.github.com/jonmagic/5282384165e0f86ef105#import-status-request
|
||||||
|
func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string, issueID int64) (*IssueImportResponse, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/import/issues/%v", owner, repo, issueID)
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept headers when APIs fully launch.
|
||||||
|
req.Header.Set("Accept", mediaTypeIssueImportAPI)
|
||||||
|
|
||||||
|
i := new(IssueImportResponse)
|
||||||
|
resp, err := s.client.Do(ctx, req, i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return i, resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckStatusSince checks the status of multiple imported issues since a given date.
|
||||||
|
//
|
||||||
|
// https://gist.github.com/jonmagic/5282384165e0f86ef105#check-status-of-multiple-issues
|
||||||
|
func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo string, since time.Time) ([]*IssueImportResponse, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/import/issues?since=%v", owner, repo, since.Format("2006-01-02"))
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove custom Accept headers when APIs fully launch.
|
||||||
|
req.Header.Set("Accept", mediaTypeIssueImportAPI)
|
||||||
|
|
||||||
|
var b bytes.Buffer
|
||||||
|
resp, err := s.client.Do(ctx, req, &b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var i []*IssueImportResponse
|
||||||
|
err = json.Unmarshal(b.Bytes(), &i)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return i, resp, nil
|
||||||
|
}
|
|
@ -8,14 +8,13 @@ package github
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IssuesService handles communication with the issue related
|
// IssuesService handles communication with the issue related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/
|
||||||
type IssuesService service
|
type IssuesService service
|
||||||
|
|
||||||
// Issue represents a GitHub issue on a repository.
|
// Issue represents a GitHub issue on a repository.
|
||||||
|
@ -55,7 +54,7 @@ type Issue struct {
|
||||||
NodeID *string `json:"node_id,omitempty"`
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
|
|
||||||
// TextMatches is only populated from search results that request text matches
|
// TextMatches is only populated from search results that request text matches
|
||||||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
// See: search.go and https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#text-match-metadata
|
||||||
TextMatches []*TextMatch `json:"text_matches,omitempty"`
|
TextMatches []*TextMatch `json:"text_matches,omitempty"`
|
||||||
|
|
||||||
// ActiveLockReason is populated only when LockReason is provided while locking the issue.
|
// ActiveLockReason is populated only when LockReason is provided while locking the issue.
|
||||||
|
@ -129,8 +128,8 @@ type PullRequestLinks struct {
|
||||||
// organization repositories; if false, list only owned and member
|
// organization repositories; if false, list only owned and member
|
||||||
// repositories.
|
// repositories.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#list-issues-assigned-to-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-user-account-issues-assigned-to-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#list-user-account-issues-assigned-to-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issues-assigned-to-the-authenticated-user
|
||||||
func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) {
|
func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if all {
|
if all {
|
||||||
|
@ -144,7 +143,7 @@ func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptio
|
||||||
// ListByOrg fetches the issues in the specified organization for the
|
// ListByOrg fetches the issues in the specified organization for the
|
||||||
// authenticated user.
|
// authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#list-organization-issues-assigned-to-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-organization-issues-assigned-to-the-authenticated-user
|
||||||
func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) {
|
func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/issues", org)
|
u := fmt.Sprintf("orgs/%v/issues", org)
|
||||||
return s.listIssues(ctx, u, opts)
|
return s.listIssues(ctx, u, opts)
|
||||||
|
@ -161,9 +160,8 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept headers when APIs fully launch.
|
// TODO: remove custom Accept header when this API fully launch.
|
||||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLockReasonPreview}
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
var issues []*Issue
|
var issues []*Issue
|
||||||
resp, err := s.client.Do(ctx, req, &issues)
|
resp, err := s.client.Do(ctx, req, &issues)
|
||||||
|
@ -216,7 +214,7 @@ type IssueListByRepoOptions struct {
|
||||||
|
|
||||||
// ListByRepo lists the issues for the specified repository.
|
// ListByRepo lists the issues for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#list-repository-issues
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-repository-issues
|
||||||
func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
|
func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -229,9 +227,8 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept headers when APIs fully launch.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeIntegrationPreview}
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
var issues []*Issue
|
var issues []*Issue
|
||||||
resp, err := s.client.Do(ctx, req, &issues)
|
resp, err := s.client.Do(ctx, req, &issues)
|
||||||
|
@ -244,7 +241,7 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
|
||||||
|
|
||||||
// Get a single issue.
|
// Get a single issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#get-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue
|
||||||
func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) {
|
func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -252,9 +249,8 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept headers when APIs fully launch.
|
// TODO: remove custom Accept header when this API fully launch.
|
||||||
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLockReasonPreview}
|
req.Header.Set("Accept", mediaTypeReactionsPreview)
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
issue := new(Issue)
|
issue := new(Issue)
|
||||||
resp, err := s.client.Do(ctx, req, issue)
|
resp, err := s.client.Do(ctx, req, issue)
|
||||||
|
@ -267,7 +263,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
|
||||||
|
|
||||||
// Create a new issue on the specified repository.
|
// Create a new issue on the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#create-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-an-issue
|
||||||
func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) {
|
func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, issue)
|
req, err := s.client.NewRequest("POST", u, issue)
|
||||||
|
@ -286,7 +282,7 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i
|
||||||
|
|
||||||
// Edit an issue.
|
// Edit an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#update-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-an-issue
|
||||||
func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
|
func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("PATCH", u, issue)
|
req, err := s.client.NewRequest("PATCH", u, issue)
|
||||||
|
@ -314,7 +310,7 @@ type LockIssueOptions struct {
|
||||||
|
|
||||||
// Lock an issue's conversation.
|
// Lock an issue's conversation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#lock-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#lock-an-issue
|
||||||
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) {
|
func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -322,16 +318,12 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts != nil {
|
|
||||||
req.Header.Set("Accept", mediaTypeLockReasonPreview)
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.client.Do(ctx, req, nil)
|
return s.client.Do(ctx, req, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlock an issue's conversation.
|
// Unlock an issue's conversation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/#unlock-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#unlock-an-issue
|
||||||
func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// ListAssignees fetches all available assignees (owners and collaborators) to
|
// ListAssignees fetches all available assignees (owners and collaborators) to
|
||||||
// which issues may be assigned.
|
// which issues may be assigned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#list-assignees
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-assignees
|
||||||
func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) {
|
func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -36,7 +36,7 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o
|
||||||
|
|
||||||
// IsAssignee checks if a user is an assignee for the specified repository.
|
// IsAssignee checks if a user is an assignee for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#check-if-a-user-can-be-assigned
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#check-if-a-user-can-be-assigned
|
||||||
func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
|
func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -50,7 +50,7 @@ func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string
|
||||||
|
|
||||||
// AddAssignees adds the provided GitHub users as assignees to the issue.
|
// AddAssignees adds the provided GitHub users as assignees to the issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#add-assignees-to-an-issue
|
||||||
func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
||||||
users := &struct {
|
users := &struct {
|
||||||
Assignees []string `json:"assignees,omitempty"`
|
Assignees []string `json:"assignees,omitempty"`
|
||||||
|
@ -68,7 +68,7 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu
|
||||||
|
|
||||||
// RemoveAssignees removes the provided GitHub users as assignees from the issue.
|
// RemoveAssignees removes the provided GitHub users as assignees from the issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-assignees-from-an-issue
|
||||||
func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) {
|
||||||
users := &struct {
|
users := &struct {
|
||||||
Assignees []string `json:"assignees,omitempty"`
|
Assignees []string `json:"assignees,omitempty"`
|
|
@ -35,12 +35,6 @@ func (i IssueComment) String() string {
|
||||||
// IssueListCommentsOptions specifies the optional parameters to the
|
// IssueListCommentsOptions specifies the optional parameters to the
|
||||||
// IssuesService.ListComments method.
|
// IssuesService.ListComments method.
|
||||||
type IssueListCommentsOptions struct {
|
type IssueListCommentsOptions struct {
|
||||||
// Sort specifies how to sort comments. Possible values are: created, updated.
|
|
||||||
Sort *string `url:"sort,omitempty"`
|
|
||||||
|
|
||||||
// Direction in which to sort comments. Possible values are: asc, desc.
|
|
||||||
Direction *string `url:"direction,omitempty"`
|
|
||||||
|
|
||||||
// Since filters comments by time.
|
// Since filters comments by time.
|
||||||
Since *time.Time `url:"since,omitempty"`
|
Since *time.Time `url:"since,omitempty"`
|
||||||
|
|
||||||
|
@ -50,8 +44,8 @@ type IssueListCommentsOptions struct {
|
||||||
// ListComments lists all comments on the specified issue. Specifying an issue
|
// ListComments lists all comments on the specified issue. Specifying an issue
|
||||||
// number of 0 will return all comments on all issues for the repository.
|
// number of 0 will return all comments on all issues for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#list-issue-comments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-comments
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#list-issue-comments-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-comments-for-a-repository
|
||||||
func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
|
func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if number == 0 {
|
if number == 0 {
|
||||||
|
@ -83,7 +77,7 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str
|
||||||
|
|
||||||
// GetComment fetches the specified issue comment.
|
// GetComment fetches the specified issue comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#get-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue-comment
|
||||||
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) {
|
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||||
|
|
||||||
|
@ -106,7 +100,7 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin
|
||||||
|
|
||||||
// CreateComment creates a new comment on the specified issue.
|
// CreateComment creates a new comment on the specified issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#create-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-an-issue-comment
|
||||||
func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) {
|
func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -125,7 +119,7 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st
|
||||||
// EditComment updates an issue comment.
|
// EditComment updates an issue comment.
|
||||||
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#update-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-an-issue-comment
|
||||||
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
|
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -143,7 +137,7 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri
|
||||||
|
|
||||||
// DeleteComment deletes an issue comment.
|
// DeleteComment deletes an issue comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-an-issue-comment
|
||||||
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -8,7 +8,6 @@ package github
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,6 +65,10 @@ type IssueEvent struct {
|
||||||
// review_dismissed
|
// review_dismissed
|
||||||
// The review was dismissed and `DismissedReview` will be populated below.
|
// The review was dismissed and `DismissedReview` will be populated below.
|
||||||
//
|
//
|
||||||
|
// review_requested, review_request_removed
|
||||||
|
// The Actor requested or removed the request for a review.
|
||||||
|
// RequestedReviewer and ReviewRequester will be populated below.
|
||||||
|
//
|
||||||
Event *string `json:"event,omitempty"`
|
Event *string `json:"event,omitempty"`
|
||||||
|
|
||||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||||
|
@ -81,6 +84,8 @@ type IssueEvent struct {
|
||||||
LockReason *string `json:"lock_reason,omitempty"`
|
LockReason *string `json:"lock_reason,omitempty"`
|
||||||
ProjectCard *ProjectCard `json:"project_card,omitempty"`
|
ProjectCard *ProjectCard `json:"project_card,omitempty"`
|
||||||
DismissedReview *DismissedReview `json:"dismissed_review,omitempty"`
|
DismissedReview *DismissedReview `json:"dismissed_review,omitempty"`
|
||||||
|
RequestedReviewer *User `json:"requested_reviewer,omitempty"`
|
||||||
|
ReviewRequester *User `json:"review_requester,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DismissedReview represents details for 'dismissed_review' events.
|
// DismissedReview represents details for 'dismissed_review' events.
|
||||||
|
@ -95,7 +100,7 @@ type DismissedReview struct {
|
||||||
|
|
||||||
// ListIssueEvents lists events for the specified issue.
|
// ListIssueEvents lists events for the specified issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-issue-events
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events
|
||||||
func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -108,8 +113,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptHeaders := []string{mediaTypeLockReasonPreview, mediaTypeProjectCardDetailsPreview}
|
req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview)
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
var events []*IssueEvent
|
var events []*IssueEvent
|
||||||
resp, err := s.client.Do(ctx, req, &events)
|
resp, err := s.client.Do(ctx, req, &events)
|
||||||
|
@ -122,7 +126,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// ListRepositoryEvents lists events for the specified repository.
|
// ListRepositoryEvents lists events for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#list-issue-events-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-issue-events-for-a-repository
|
||||||
func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -146,7 +150,7 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st
|
||||||
|
|
||||||
// GetEvent returns the specified issue event.
|
// GetEvent returns the specified issue event.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/events/#get-an-issue-event
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-an-issue-event
|
||||||
func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) {
|
func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id)
|
||||||
|
|
|
@ -27,7 +27,7 @@ func (l Label) String() string {
|
||||||
|
|
||||||
// ListLabels lists all labels for a repository.
|
// ListLabels lists all labels for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-a-repository
|
||||||
func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) {
|
func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -51,7 +51,7 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin
|
||||||
|
|
||||||
// GetLabel gets a single label.
|
// GetLabel gets a single label.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#get-a-label
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-a-label
|
||||||
func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) {
|
func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -70,7 +70,7 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string,
|
||||||
|
|
||||||
// CreateLabel creates a new label on the specified repository.
|
// CreateLabel creates a new label on the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#create-a-label
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-a-label
|
||||||
func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) {
|
func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/labels", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, label)
|
req, err := s.client.NewRequest("POST", u, label)
|
||||||
|
@ -89,7 +89,7 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri
|
||||||
|
|
||||||
// EditLabel edits a label.
|
// EditLabel edits a label.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#update-a-label
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-a-label
|
||||||
func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) {
|
func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
||||||
req, err := s.client.NewRequest("PATCH", u, label)
|
req, err := s.client.NewRequest("PATCH", u, label)
|
||||||
|
@ -108,7 +108,7 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string
|
||||||
|
|
||||||
// DeleteLabel deletes a label.
|
// DeleteLabel deletes a label.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#delete-a-label
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-a-label
|
||||||
func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) {
|
func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -120,7 +120,7 @@ func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo stri
|
||||||
|
|
||||||
// ListLabelsByIssue lists all labels for an issue.
|
// ListLabelsByIssue lists all labels for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-for-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-an-issue
|
||||||
func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) {
|
func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -144,7 +144,7 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep
|
||||||
|
|
||||||
// AddLabelsToIssue adds labels to an issue.
|
// AddLabelsToIssue adds labels to an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#add-labels-to-an-issue
|
||||||
func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("POST", u, labels)
|
req, err := s.client.NewRequest("POST", u, labels)
|
||||||
|
@ -163,7 +163,7 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo
|
||||||
|
|
||||||
// RemoveLabelForIssue removes a label for an issue.
|
// RemoveLabelForIssue removes a label for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-a-label-from-an-issue
|
||||||
func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) {
|
func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -176,7 +176,7 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, r
|
||||||
|
|
||||||
// ReplaceLabelsForIssue replaces all labels for an issue.
|
// ReplaceLabelsForIssue replaces all labels for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#set-labels-for-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#set-labels-for-an-issue
|
||||||
func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("PUT", u, labels)
|
req, err := s.client.NewRequest("PUT", u, labels)
|
||||||
|
@ -195,7 +195,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string,
|
||||||
|
|
||||||
// RemoveLabelsForIssue removes all labels for an issue.
|
// RemoveLabelsForIssue removes all labels for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#remove-all-labels-from-an-issue
|
||||||
func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -208,7 +208,7 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string,
|
||||||
|
|
||||||
// ListLabelsForMilestone lists labels for every issue in a milestone.
|
// ListLabelsForMilestone lists labels for every issue in a milestone.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-for-issues-in-a-milestone
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-labels-for-issues-in-a-milestone
|
||||||
func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) {
|
func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -55,7 +55,7 @@ type MilestoneListOptions struct {
|
||||||
|
|
||||||
// ListMilestones lists all milestones for a repository.
|
// ListMilestones lists all milestones for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-milestones
|
||||||
func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) {
|
func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -79,7 +79,7 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s
|
||||||
|
|
||||||
// GetMilestone gets a single milestone.
|
// GetMilestone gets a single milestone.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-milestone
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#get-a-milestone
|
||||||
func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) {
|
func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -98,7 +98,7 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str
|
||||||
|
|
||||||
// CreateMilestone creates a new milestone on the specified repository.
|
// CreateMilestone creates a new milestone on the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#create-a-milestone
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#create-a-milestone
|
||||||
func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) {
|
func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, milestone)
|
req, err := s.client.NewRequest("POST", u, milestone)
|
||||||
|
@ -117,7 +117,7 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo
|
||||||
|
|
||||||
// EditMilestone edits a milestone.
|
// EditMilestone edits a milestone.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#update-a-milestone
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#update-a-milestone
|
||||||
func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) {
|
func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("PATCH", u, milestone)
|
req, err := s.client.NewRequest("PATCH", u, milestone)
|
||||||
|
@ -136,7 +136,7 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st
|
||||||
|
|
||||||
// DeleteMilestone deletes a milestone.
|
// DeleteMilestone deletes a milestone.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/milestones/#delete-a-milestone
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#delete-a-milestone
|
||||||
func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// Timeline represents an event that occurred around an Issue or Pull Request.
|
// Timeline represents an event that occurred around an Issue or Pull Request.
|
||||||
//
|
//
|
||||||
// It is similar to an IssueEvent but may contain more information.
|
// It is similar to an IssueEvent but may contain more information.
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/timeline/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/timeline/
|
||||||
type Timeline struct {
|
type Timeline struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
URL *string `json:"url,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
|
@ -131,7 +131,7 @@ type Source struct {
|
||||||
|
|
||||||
// ListIssueTimeline lists events for the specified issue.
|
// ListIssueTimeline lists events for the specified issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-timeline-events-for-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/issues/#list-timeline-events-for-an-issue
|
||||||
func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) {
|
func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// LicensesService handles communication with the license related
|
// LicensesService handles communication with the license related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/licenses/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/
|
||||||
type LicensesService service
|
type LicensesService service
|
||||||
|
|
||||||
// RepositoryLicense represents the license for a repository.
|
// RepositoryLicense represents the license for a repository.
|
||||||
|
@ -60,7 +60,7 @@ func (l License) String() string {
|
||||||
|
|
||||||
// List popular open source licenses.
|
// List popular open source licenses.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/licenses/#list-all-licenses
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#list-all-licenses
|
||||||
func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) {
|
func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) {
|
||||||
req, err := s.client.NewRequest("GET", "licenses", nil)
|
req, err := s.client.NewRequest("GET", "licenses", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -78,7 +78,7 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro
|
||||||
|
|
||||||
// Get extended metadata for one license.
|
// Get extended metadata for one license.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/licenses/#get-a-license
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-license
|
||||||
func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) {
|
func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) {
|
||||||
u := fmt.Sprintf("licenses/%s", licenseName)
|
u := fmt.Sprintf("licenses/%s", licenseName)
|
||||||
|
|
|
@ -44,6 +44,7 @@ var (
|
||||||
"check_run": "CheckRunEvent",
|
"check_run": "CheckRunEvent",
|
||||||
"check_suite": "CheckSuiteEvent",
|
"check_suite": "CheckSuiteEvent",
|
||||||
"commit_comment": "CommitCommentEvent",
|
"commit_comment": "CommitCommentEvent",
|
||||||
|
"content_reference": "ContentReferenceEvent",
|
||||||
"create": "CreateEvent",
|
"create": "CreateEvent",
|
||||||
"delete": "DeleteEvent",
|
"delete": "DeleteEvent",
|
||||||
"deploy_key": "DeployKeyEvent",
|
"deploy_key": "DeployKeyEvent",
|
||||||
|
@ -85,6 +86,8 @@ var (
|
||||||
"team_add": "TeamAddEvent",
|
"team_add": "TeamAddEvent",
|
||||||
"user": "UserEvent",
|
"user": "UserEvent",
|
||||||
"watch": "WatchEvent",
|
"watch": "WatchEvent",
|
||||||
|
"workflow_dispatch": "WorkflowDispatchEvent",
|
||||||
|
"workflow_run": "WorkflowRunEvent",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -215,14 +218,14 @@ func ValidateSignature(signature string, payload, secretToken []byte) error {
|
||||||
|
|
||||||
// WebHookType returns the event type of webhook request r.
|
// WebHookType returns the event type of webhook request r.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers
|
||||||
func WebHookType(r *http.Request) string {
|
func WebHookType(r *http.Request) string {
|
||||||
return r.Header.Get(eventTypeHeader)
|
return r.Header.Get(eventTypeHeader)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeliveryID returns the unique delivery ID of webhook request r.
|
// DeliveryID returns the unique delivery ID of webhook request r.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers
|
||||||
func DeliveryID(r *http.Request) string {
|
func DeliveryID(r *http.Request) string {
|
||||||
return r.Header.Get(deliveryIDHeader)
|
return r.Header.Get(deliveryIDHeader)
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ import (
|
||||||
// MigrationService provides access to the migration related functions
|
// MigrationService provides access to the migration related functions
|
||||||
// in the GitHub API.
|
// in the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migration/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/
|
||||||
type MigrationService service
|
type MigrationService service
|
||||||
|
|
||||||
// Migration represents a GitHub migration (archival).
|
// Migration represents a GitHub migration (archival).
|
||||||
|
@ -74,7 +74,7 @@ type startMigration struct {
|
||||||
// StartMigration starts the generation of a migration archive.
|
// StartMigration starts the generation of a migration archive.
|
||||||
// repos is a slice of repository names to migrate.
|
// repos is a slice of repository names to migrate.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#start-an-organization-migration
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-an-organization-migration
|
||||||
func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) {
|
func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations", org)
|
u := fmt.Sprintf("orgs/%v/migrations", org)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos
|
||||||
|
|
||||||
// ListMigrations lists the most recent migrations.
|
// ListMigrations lists the most recent migrations.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#list-organization-migrations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#list-organization-migrations
|
||||||
func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) {
|
func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations", org)
|
u := fmt.Sprintf("orgs/%v/migrations", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -131,7 +131,7 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts
|
||||||
// MigrationStatus gets the status of a specific migration archive.
|
// MigrationStatus gets the status of a specific migration archive.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#get-an-organization-migration-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-an-organization-migration-status
|
||||||
func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) {
|
func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations/%v", org, id)
|
u := fmt.Sprintf("orgs/%v/migrations/%v", org, id)
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i
|
||||||
// MigrationArchiveURL fetches a migration archive URL.
|
// MigrationArchiveURL fetches a migration archive URL.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#download-an-organization-migration-archive
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#download-an-organization-migration-archive
|
||||||
func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) {
|
func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
|
u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string,
|
||||||
// DeleteMigration deletes a previous migration archive.
|
// DeleteMigration deletes a previous migration archive.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#delete-an-organization-migration-archive
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#delete-an-organization-migration-archive
|
||||||
func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) {
|
func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
|
u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id)
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i
|
||||||
// You should unlock each migrated repository and delete them when the migration
|
// You should unlock each migrated repository and delete them when the migration
|
||||||
// is complete and you no longer need the source data.
|
// is complete and you no longer need the source data.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/orgs/#unlock-an-organization-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#unlock-an-organization-repository
|
||||||
func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) {
|
func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo)
|
u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo)
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (i Import) String() string {
|
||||||
|
|
||||||
// SourceImportAuthor identifies an author imported from a source repository.
|
// SourceImportAuthor identifies an author imported from a source repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/source_imports/#get-commit-authors
|
||||||
type SourceImportAuthor struct {
|
type SourceImportAuthor struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
RemoteID *string `json:"remote_id,omitempty"`
|
RemoteID *string `json:"remote_id,omitempty"`
|
||||||
|
@ -132,7 +132,7 @@ func (a SourceImportAuthor) String() string {
|
||||||
|
|
||||||
// LargeFile identifies a file larger than 100MB found during a repository import.
|
// LargeFile identifies a file larger than 100MB found during a repository import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-large-files
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migration/source_imports/#get-large-files
|
||||||
type LargeFile struct {
|
type LargeFile struct {
|
||||||
RefName *string `json:"ref_name,omitempty"`
|
RefName *string `json:"ref_name,omitempty"`
|
||||||
Path *string `json:"path,omitempty"`
|
Path *string `json:"path,omitempty"`
|
||||||
|
@ -146,7 +146,7 @@ func (f LargeFile) String() string {
|
||||||
|
|
||||||
// StartImport initiates a repository import.
|
// StartImport initiates a repository import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#start-an-import
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-an-import
|
||||||
func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
||||||
req, err := s.client.NewRequest("PUT", u, in)
|
req, err := s.client.NewRequest("PUT", u, in)
|
||||||
|
@ -165,7 +165,7 @@ func (s *MigrationService) StartImport(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// ImportProgress queries for the status and progress of an ongoing repository import.
|
// ImportProgress queries for the status and progress of an ongoing repository import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#get-an-import-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-an-import-status
|
||||||
func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) {
|
func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -184,7 +184,7 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// UpdateImport initiates a repository import.
|
// UpdateImport initiates a repository import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#update-an-import
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#update-an-import
|
||||||
func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
||||||
req, err := s.client.NewRequest("PATCH", u, in)
|
req, err := s.client.NewRequest("PATCH", u, in)
|
||||||
|
@ -213,7 +213,7 @@ func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string,
|
||||||
// This method and MapCommitAuthor allow you to provide correct Git author
|
// This method and MapCommitAuthor allow you to provide correct Git author
|
||||||
// information.
|
// information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#get-commit-authors
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-commit-authors
|
||||||
func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) {
|
func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -234,7 +234,7 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string
|
||||||
// application can continue updating authors any time before you push new
|
// application can continue updating authors any time before you push new
|
||||||
// commits to the repository.
|
// commits to the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#map-a-commit-author
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#map-a-commit-author
|
||||||
func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) {
|
func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, author)
|
req, err := s.client.NewRequest("PATCH", u, author)
|
||||||
|
@ -255,7 +255,7 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri
|
||||||
// files larger than 100MB. Only the UseLFS field on the provided Import is
|
// files larger than 100MB. Only the UseLFS field on the provided Import is
|
||||||
// used.
|
// used.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#update-git-lfs-preference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#update-git-lfs-preference
|
||||||
func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo)
|
||||||
req, err := s.client.NewRequest("PATCH", u, in)
|
req, err := s.client.NewRequest("PATCH", u, in)
|
||||||
|
@ -274,7 +274,7 @@ func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// LargeFiles lists files larger than 100MB found during the import.
|
// LargeFiles lists files larger than 100MB found during the import.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#get-large-files
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-large-files
|
||||||
func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) {
|
func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -293,7 +293,7 @@ func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) (
|
||||||
|
|
||||||
// CancelImport stops an import for a repository.
|
// CancelImport stops an import for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/source_imports/#cancel-an-import
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#cancel-an-import
|
||||||
func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/import", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -67,7 +67,7 @@ type startUserMigration struct {
|
||||||
// StartUserMigration starts the generation of a migration archive.
|
// StartUserMigration starts the generation of a migration archive.
|
||||||
// repos is a slice of repository names to migrate.
|
// repos is a slice of repository names to migrate.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#start-a-user-migration
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#start-a-user-migration
|
||||||
func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) {
|
func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) {
|
||||||
u := "user/migrations"
|
u := "user/migrations"
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin
|
||||||
|
|
||||||
// ListUserMigrations lists the most recent migrations.
|
// ListUserMigrations lists the most recent migrations.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#list-user-migrations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#list-user-migrations
|
||||||
func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) {
|
func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) {
|
||||||
u := "user/migrations"
|
u := "user/migrations"
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigra
|
||||||
// UserMigrationStatus gets the status of a specific migration archive.
|
// UserMigrationStatus gets the status of a specific migration archive.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-a-user-migration-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#get-a-user-migration-status
|
||||||
func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) {
|
func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) {
|
||||||
u := fmt.Sprintf("user/migrations/%v", id)
|
u := fmt.Sprintf("user/migrations/%v", id)
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*
|
||||||
// UserMigrationArchiveURL gets the URL for a specific migration archive.
|
// UserMigrationArchiveURL gets the URL for a specific migration archive.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#download-a-user-migration-archive
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#download-a-user-migration-archive
|
||||||
func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) {
|
func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) {
|
||||||
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64
|
||||||
// DeleteUserMigration will delete a previous migration archive.
|
// DeleteUserMigration will delete a previous migration archive.
|
||||||
// id is the migration ID.
|
// id is the migration ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#delete-a-user-migration-archive
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#delete-a-user-migration-archive
|
||||||
func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) {
|
func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
url := fmt.Sprintf("user/migrations/%v/archive", id)
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*
|
||||||
// You should unlock each migrated repository and delete them when the migration
|
// You should unlock each migrated repository and delete them when the migration
|
||||||
// is complete and you no longer need the source data.
|
// is complete and you no longer need the source data.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/migrations/users/#unlock-a-user-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/migrations/#unlock-a-user-repository
|
||||||
func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) {
|
func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) {
|
||||||
url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo)
|
url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo)
|
||||||
|
|
|
@ -39,7 +39,7 @@ type markdownRequest struct {
|
||||||
|
|
||||||
// Markdown renders an arbitrary Markdown document.
|
// Markdown renders an arbitrary Markdown document.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/markdown/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/markdown/
|
||||||
func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) {
|
func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) {
|
||||||
request := &markdownRequest{Text: String(text)}
|
request := &markdownRequest{Text: String(text)}
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
|
@ -67,7 +67,7 @@ func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOption
|
||||||
|
|
||||||
// ListEmojis returns the emojis available to use on GitHub.
|
// ListEmojis returns the emojis available to use on GitHub.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/emojis/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/emojis/
|
||||||
func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
|
func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
|
||||||
req, err := c.NewRequest("GET", "emojis", nil)
|
req, err := c.NewRequest("GET", "emojis", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -97,7 +97,7 @@ func (c *CodeOfConduct) String() string {
|
||||||
|
|
||||||
// ListCodesOfConduct returns all codes of conduct.
|
// ListCodesOfConduct returns all codes of conduct.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/codes_of_conduct/#list-all-codes-of-conduct
|
||||||
func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) {
|
func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) {
|
||||||
req, err := c.NewRequest("GET", "codes_of_conduct", nil)
|
req, err := c.NewRequest("GET", "codes_of_conduct", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -118,7 +118,7 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res
|
||||||
|
|
||||||
// GetCodeOfConduct returns an individual code of conduct.
|
// GetCodeOfConduct returns an individual code of conduct.
|
||||||
//
|
//
|
||||||
// https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/codes_of_conduct/#get-an-individual-code-of-conduct
|
||||||
func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) {
|
func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) {
|
||||||
u := fmt.Sprintf("codes_of_conduct/%s", key)
|
u := fmt.Sprintf("codes_of_conduct/%s", key)
|
||||||
req, err := c.NewRequest("GET", u, nil)
|
req, err := c.NewRequest("GET", u, nil)
|
||||||
|
@ -168,7 +168,7 @@ type APIMeta struct {
|
||||||
// this endpoint on your organization’s GitHub Enterprise installation, this
|
// this endpoint on your organization’s GitHub Enterprise installation, this
|
||||||
// endpoint provides information about that installation.
|
// endpoint provides information about that installation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/meta/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/meta/
|
||||||
func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) {
|
func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) {
|
||||||
req, err := c.NewRequest("GET", "meta", nil)
|
req, err := c.NewRequest("GET", "meta", nil)
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// OrganizationsService provides access to the organization related functions
|
// OrganizationsService provides access to the organization related functions
|
||||||
// in the GitHub API.
|
// in the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/
|
||||||
type OrganizationsService service
|
type OrganizationsService service
|
||||||
|
|
||||||
// Organization represents a GitHub organization account.
|
// Organization represents a GitHub organization account.
|
||||||
|
@ -125,7 +125,7 @@ type OrganizationsListOptions struct {
|
||||||
// listing the next set of organizations, use the ID of the last-returned organization
|
// listing the next set of organizations, use the ID of the last-returned organization
|
||||||
// as the opts.Since parameter for the next call.
|
// as the opts.Since parameter for the next call.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#list-organizations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations
|
||||||
func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) {
|
func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) {
|
||||||
u, err := addOptions("organizations", opts)
|
u, err := addOptions("organizations", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -148,8 +148,8 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL
|
||||||
// List the organizations for a user. Passing the empty string will list
|
// List the organizations for a user. Passing the empty string will list
|
||||||
// organizations for the authenticated user.
|
// organizations for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#oauth-scope-requirements
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#list-organizations-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organizations-for-a-user
|
||||||
func (s *OrganizationsService) List(ctx context.Context, user string, opts *ListOptions) ([]*Organization, *Response, error) {
|
func (s *OrganizationsService) List(ctx context.Context, user string, opts *ListOptions) ([]*Organization, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -178,7 +178,7 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List
|
||||||
|
|
||||||
// Get fetches an organization by name.
|
// Get fetches an organization by name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#get-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization
|
||||||
func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) {
|
func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v", org)
|
u := fmt.Sprintf("orgs/%v", org)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -219,7 +219,7 @@ func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organiza
|
||||||
|
|
||||||
// Edit an organization.
|
// Edit an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#members_can_create_repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization
|
||||||
func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) {
|
func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v", name)
|
u := fmt.Sprintf("orgs/%v", name)
|
||||||
req, err := s.client.NewRequest("PATCH", u, org)
|
req, err := s.client.NewRequest("PATCH", u, org)
|
||||||
|
@ -241,7 +241,7 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ
|
||||||
|
|
||||||
// ListInstallations lists installations for an organization.
|
// ListInstallations lists installations for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/#list-app-installations-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-app-installations-for-an-organization
|
||||||
func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) {
|
func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/installations", org)
|
u := fmt.Sprintf("orgs/%v/installations", org)
|
||||||
|
|
||||||
|
@ -255,9 +255,6 @@ func (s *OrganizationsService) ListInstallations(ctx context.Context, org string
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
req.Header.Set("Accept", mediaTypeIntegrationPreview)
|
|
||||||
|
|
||||||
result := new(OrganizationInstallations)
|
result := new(OrganizationInstallations)
|
||||||
resp, err := s.client.Do(ctx, req, result)
|
resp, err := s.client.Do(ctx, req, result)
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ListHooks lists all Hooks for the specified organization.
|
// ListHooks lists all Hooks for the specified organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#list-organization-webhooks
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-webhooks
|
||||||
func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) {
|
func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks", org)
|
u := fmt.Sprintf("orgs/%v/hooks", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -36,7 +36,7 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *
|
||||||
|
|
||||||
// GetHook returns a single specified Hook.
|
// GetHook returns a single specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#get-an-organization-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization-webhook
|
||||||
func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) {
|
func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -54,7 +54,7 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64
|
||||||
// Note that only a subset of the hook fields are used and hook must
|
// Note that only a subset of the hook fields are used and hook must
|
||||||
// not be nil.
|
// not be nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#create-an-organization-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#create-an-organization-webhook
|
||||||
func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) {
|
func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks", org)
|
u := fmt.Sprintf("orgs/%v/hooks", org)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook
|
||||||
|
|
||||||
// EditHook updates a specified Hook.
|
// EditHook updates a specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#update-an-organization-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization-webhook
|
||||||
func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) {
|
func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, hook)
|
req, err := s.client.NewRequest("PATCH", u, hook)
|
||||||
|
@ -95,7 +95,7 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6
|
||||||
|
|
||||||
// PingHook triggers a 'ping' event to be sent to the Hook.
|
// PingHook triggers a 'ping' event to be sent to the Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#ping-an-organization-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#ping-an-organization-webhook
|
||||||
func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) {
|
func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id)
|
u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
@ -107,7 +107,7 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int6
|
||||||
|
|
||||||
// DeleteHook deletes a specified Hook.
|
// DeleteHook deletes a specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/hooks/#delete-an-organization-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#delete-an-organization-webhook
|
||||||
func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) {
|
func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
u := fmt.Sprintf("orgs/%v/hooks/%d", org, id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -71,8 +71,8 @@ type ListMembersOptions struct {
|
||||||
// user is an owner of the organization, this will return both concealed and
|
// user is an owner of the organization, this will return both concealed and
|
||||||
// public members, otherwise it will only return public members.
|
// public members, otherwise it will only return public members.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-members
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-members
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-public-organization-members
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-public-organization-members
|
||||||
func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts *ListMembersOptions) ([]*User, *Response, error) {
|
func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts *ListMembersOptions) ([]*User, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if opts != nil && opts.PublicOnly {
|
if opts != nil && opts.PublicOnly {
|
||||||
|
@ -101,7 +101,7 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts
|
||||||
|
|
||||||
// IsMember checks if a user is a member of an organization.
|
// IsMember checks if a user is a member of an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-organization-membership-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-organization-membership-for-a-user
|
||||||
func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) {
|
func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/members/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/members/%v", org, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -116,7 +116,7 @@ func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (
|
||||||
|
|
||||||
// IsPublicMember checks if a user is a public member of an organization.
|
// IsPublicMember checks if a user is a public member of an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#check-public-organization-membership-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-public-organization-membership-for-a-user
|
||||||
func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) {
|
func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -131,7 +131,7 @@ func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user str
|
||||||
|
|
||||||
// RemoveMember removes a user from all teams of an organization.
|
// RemoveMember removes a user from all teams of an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-an-organization-member
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-an-organization-member
|
||||||
func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) {
|
func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/members/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/members/%v", org, user)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -145,7 +145,7 @@ func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user strin
|
||||||
// PublicizeMembership publicizes a user's membership in an organization. (A
|
// PublicizeMembership publicizes a user's membership in an organization. (A
|
||||||
// user cannot publicize the membership for another user.)
|
// user cannot publicize the membership for another user.)
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#set-public-organization-membership-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#set-public-organization-membership-for-the-authenticated-user
|
||||||
func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) {
|
func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
||||||
|
@ -158,7 +158,7 @@ func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, use
|
||||||
|
|
||||||
// ConcealMembership conceals a user's membership in an organization.
|
// ConcealMembership conceals a user's membership in an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-public-organization-membership-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-public-organization-membership-for-the-authenticated-user
|
||||||
func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) {
|
func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/public_members/%v", org, user)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -181,7 +181,7 @@ type ListOrgMembershipsOptions struct {
|
||||||
|
|
||||||
// ListOrgMemberships lists the organization memberships for the authenticated user.
|
// ListOrgMemberships lists the organization memberships for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-memberships-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-memberships-for-the-authenticated-user
|
||||||
func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) {
|
func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) {
|
||||||
u := "user/memberships/orgs"
|
u := "user/memberships/orgs"
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -207,8 +207,8 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis
|
||||||
// Passing an empty string for user will get the membership for the
|
// Passing an empty string for user will get the membership for the
|
||||||
// authenticated user.
|
// authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#get-an-organization-membership-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-an-organization-membership-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#get-organization-membership-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#get-organization-membership-for-a-user
|
||||||
func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) {
|
func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -235,8 +235,8 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s
|
||||||
// Passing an empty string for user will edit the membership for the
|
// Passing an empty string for user will edit the membership for the
|
||||||
// authenticated user.
|
// authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#update-an-organization-membership-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#update-an-organization-membership-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#set-organization-membership-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#set-organization-membership-for-a-user
|
||||||
func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) {
|
func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) {
|
||||||
var u, method string
|
var u, method string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -264,7 +264,7 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org
|
||||||
// RemoveOrgMembership removes user from the specified organization. If the
|
// RemoveOrgMembership removes user from the specified organization. If the
|
||||||
// user has been invited to the organization, this will cancel their invitation.
|
// user has been invited to the organization, this will cancel their invitation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#remove-organization-membership-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-organization-membership-for-a-user
|
||||||
func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) {
|
func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/memberships/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/memberships/%v", org, user)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -277,7 +277,7 @@ func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, or
|
||||||
|
|
||||||
// ListPendingOrgInvitations returns a list of pending invitations.
|
// ListPendingOrgInvitations returns a list of pending invitations.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-pending-organization-invitations
|
||||||
func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) {
|
func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/invitations", org)
|
u := fmt.Sprintf("orgs/%v/invitations", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -322,7 +322,7 @@ type CreateOrgInvitationOptions struct {
|
||||||
// In order to create invitations in an organization,
|
// In order to create invitations in an organization,
|
||||||
// the authenticated user must be an organization owner.
|
// the authenticated user must be an organization owner.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#create-an-organization-invitation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#create-an-organization-invitation
|
||||||
func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) {
|
func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/invitations", org)
|
u := fmt.Sprintf("orgs/%v/invitations", org)
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org stri
|
||||||
// ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization,
|
// ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization,
|
||||||
// the authenticated user must be an organization owner.
|
// the authenticated user must be an organization owner.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-invitation-teams
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-organization-invitation-teams
|
||||||
func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID)
|
u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -27,7 +27,7 @@ type ListOutsideCollaboratorsOptions struct {
|
||||||
// Warning: The API may change without advance notice during the preview period.
|
// Warning: The API may change without advance notice during the preview period.
|
||||||
// Preview features are not supported for production use.
|
// Preview features are not supported for production use.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-outside-collaborators-for-an-organization
|
||||||
func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) {
|
func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/outside_collaborators", org)
|
u := fmt.Sprintf("orgs/%v/outside_collaborators", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -52,7 +52,7 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org
|
||||||
// RemoveOutsideCollaborator removes a user from the list of outside collaborators;
|
// RemoveOutsideCollaborator removes a user from the list of outside collaborators;
|
||||||
// consequently, removing them from all the organization's repositories.
|
// consequently, removing them from all the organization's repositories.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#remove-outside-collaborator-from-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#remove-outside-collaborator-from-an-organization
|
||||||
func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
|
func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -69,7 +69,7 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or
|
||||||
// Responses for converting a non-member or the last owner to an outside collaborator
|
// Responses for converting a non-member or the last owner to an outside collaborator
|
||||||
// are listed in GitHub API docs.
|
// are listed in GitHub API docs.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/outside_collaborators/#convert-an-organization-member-to-outside-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#convert-an-organization-member-to-outside-collaborator
|
||||||
func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
|
func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user)
|
||||||
req, err := s.client.NewRequest("PUT", u, nil)
|
req, err := s.client.NewRequest("PUT", u, nil)
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ListProjects lists the projects for an organization.
|
// ListProjects lists the projects for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#list-organization-projects
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-organization-projects
|
||||||
func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opts *ProjectListOptions) ([]*Project, *Response, error) {
|
func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opts *ProjectListOptions) ([]*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/projects", org)
|
u := fmt.Sprintf("orgs/%v/projects", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -39,7 +39,7 @@ func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt
|
||||||
|
|
||||||
// CreateProject creates a GitHub Project for the specified organization.
|
// CreateProject creates a GitHub Project for the specified organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#create-an-organization-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-an-organization-project
|
||||||
func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opts *ProjectOptions) (*Project, *Response, error) {
|
func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opts *ProjectOptions) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/projects", org)
|
u := fmt.Sprintf("orgs/%v/projects", org)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
// ListBlockedUsers lists all the users blocked by an organization.
|
// ListBlockedUsers lists all the users blocked by an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#list-users-blocked-by-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#list-users-blocked-by-an-organization
|
||||||
func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) {
|
func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/blocks", org)
|
u := fmt.Sprintf("orgs/%v/blocks", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -39,7 +39,7 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string,
|
||||||
|
|
||||||
// IsBlocked reports whether specified user is blocked from an organization.
|
// IsBlocked reports whether specified user is blocked from an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#check-if-a-user-is-blocked-by-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#check-if-a-user-is-blocked-by-an-organization
|
||||||
func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) {
|
func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s
|
||||||
|
|
||||||
// BlockUser blocks specified user from an organization.
|
// BlockUser blocks specified user from an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#block-a-user-from-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#block-a-user-from-an-organization
|
||||||
func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) {
|
func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s
|
||||||
|
|
||||||
// UnblockUser unblocks specified user from an organization.
|
// UnblockUser unblocks specified user from an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/orgs/blocking/#unblock-a-user-from-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/orgs/#unblock-a-user-from-an-organization
|
||||||
func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) {
|
func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
u := fmt.Sprintf("orgs/%v/blocks/%v", org, user)
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// ProjectsService provides access to the projects functions in the
|
// ProjectsService provides access to the projects functions in the
|
||||||
// GitHub API.
|
// GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/
|
||||||
type ProjectsService service
|
type ProjectsService service
|
||||||
|
|
||||||
// Project represents a GitHub Project.
|
// Project represents a GitHub Project.
|
||||||
|
@ -41,7 +41,7 @@ func (p Project) String() string {
|
||||||
|
|
||||||
// GetProject gets a GitHub Project for a repo.
|
// GetProject gets a GitHub Project for a repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#get-a-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project
|
||||||
func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) {
|
func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v", id)
|
u := fmt.Sprintf("projects/%v", id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -88,7 +88,7 @@ type ProjectOptions struct {
|
||||||
|
|
||||||
// UpdateProject updates a repository project.
|
// UpdateProject updates a repository project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#update-a-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-a-project
|
||||||
func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *ProjectOptions) (*Project, *Response, error) {
|
func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *ProjectOptions) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v", id)
|
u := fmt.Sprintf("projects/%v", id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
@ -110,7 +110,7 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *Pro
|
||||||
|
|
||||||
// DeleteProject deletes a GitHub Project from a repository.
|
// DeleteProject deletes a GitHub Project from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project
|
||||||
func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) {
|
func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v", id)
|
u := fmt.Sprintf("projects/%v", id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -126,7 +126,7 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Respons
|
||||||
|
|
||||||
// ProjectColumn represents a column of a GitHub Project.
|
// ProjectColumn represents a column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/projects/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/projects/
|
||||||
type ProjectColumn struct {
|
type ProjectColumn struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
|
@ -140,7 +140,7 @@ type ProjectColumn struct {
|
||||||
|
|
||||||
// ListProjectColumns lists the columns of a GitHub Project for a repo.
|
// ListProjectColumns lists the columns of a GitHub Project for a repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#list-project-columns
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-columns
|
||||||
func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opts *ListOptions) ([]*ProjectColumn, *Response, error) {
|
func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opts *ListOptions) ([]*ProjectColumn, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/columns", projectID)
|
u := fmt.Sprintf("projects/%v/columns", projectID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -167,7 +167,7 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6
|
||||||
|
|
||||||
// GetProjectColumn gets a column of a GitHub Project for a repo.
|
// GetProjectColumn gets a column of a GitHub Project for a repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#get-a-project-column
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project-column
|
||||||
func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) {
|
func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v", id)
|
u := fmt.Sprintf("projects/columns/%v", id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -197,7 +197,7 @@ type ProjectColumnOptions struct {
|
||||||
|
|
||||||
// CreateProjectColumn creates a column for the specified (by number) project.
|
// CreateProjectColumn creates a column for the specified (by number) project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#create-a-project-column
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-project-column
|
||||||
func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
|
func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/columns", projectID)
|
u := fmt.Sprintf("projects/%v/columns", projectID)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -219,7 +219,7 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int
|
||||||
|
|
||||||
// UpdateProjectColumn updates a column of a GitHub Project.
|
// UpdateProjectColumn updates a column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#update-a-project-column
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-an-existing-project-column
|
||||||
func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
|
func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v", columnID)
|
u := fmt.Sprintf("projects/columns/%v", columnID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
@ -241,7 +241,7 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6
|
||||||
|
|
||||||
// DeleteProjectColumn deletes a column from a GitHub Project.
|
// DeleteProjectColumn deletes a column from a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project-column
|
||||||
func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) {
|
func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v", columnID)
|
u := fmt.Sprintf("projects/columns/%v", columnID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -265,7 +265,7 @@ type ProjectColumnMoveOptions struct {
|
||||||
|
|
||||||
// MoveProjectColumn moves a column within a GitHub Project.
|
// MoveProjectColumn moves a column within a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/columns/#move-a-project-column
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#move-a-project-column
|
||||||
func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnMoveOptions) (*Response, error) {
|
func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnMoveOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v/moves", columnID)
|
u := fmt.Sprintf("projects/columns/%v/moves", columnID)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -281,7 +281,7 @@ func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64,
|
||||||
|
|
||||||
// ProjectCard represents a card in a column of a GitHub Project.
|
// ProjectCard represents a card in a column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/cards/#get-a-project-card
|
||||||
type ProjectCard struct {
|
type ProjectCard struct {
|
||||||
URL *string `json:"url,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
ColumnURL *string `json:"column_url,omitempty"`
|
ColumnURL *string `json:"column_url,omitempty"`
|
||||||
|
@ -316,7 +316,7 @@ type ProjectCardListOptions struct {
|
||||||
|
|
||||||
// ListProjectCards lists the cards in a column of a GitHub Project.
|
// ListProjectCards lists the cards in a column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-cards
|
||||||
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opts *ProjectCardListOptions) ([]*ProjectCard, *Response, error) {
|
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opts *ProjectCardListOptions) ([]*ProjectCard, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v/cards", columnID)
|
u := fmt.Sprintf("projects/columns/%v/cards", columnID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -343,7 +343,7 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64,
|
||||||
|
|
||||||
// GetProjectCard gets a card in a column of a GitHub Project.
|
// GetProjectCard gets a card in a column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#get-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-a-project-card
|
||||||
func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) {
|
func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -381,7 +381,7 @@ type ProjectCardOptions struct {
|
||||||
|
|
||||||
// CreateProjectCard creates a card in the specified column of a GitHub Project.
|
// CreateProjectCard creates a card in the specified column of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#create-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-project-card
|
||||||
func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) {
|
func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/%v/cards", columnID)
|
u := fmt.Sprintf("projects/columns/%v/cards", columnID)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -403,7 +403,7 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64,
|
||||||
|
|
||||||
// UpdateProjectCard updates a card of a GitHub Project.
|
// UpdateProjectCard updates a card of a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#update-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#update-an-existing-project-card
|
||||||
func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) {
|
func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||||
|
@ -425,7 +425,7 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o
|
||||||
|
|
||||||
// DeleteProjectCard deletes a card from a GitHub Project.
|
// DeleteProjectCard deletes a card from a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#delete-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#delete-a-project-card
|
||||||
func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) {
|
func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
u := fmt.Sprintf("projects/columns/cards/%v", cardID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -453,7 +453,7 @@ type ProjectCardMoveOptions struct {
|
||||||
|
|
||||||
// MoveProjectCard moves a card within a GitHub Project.
|
// MoveProjectCard moves a card within a GitHub Project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/cards/#move-a-project-card
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#move-a-project-card
|
||||||
func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opts *ProjectCardMoveOptions) (*Response, error) {
|
func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opts *ProjectCardMoveOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID)
|
u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
||||||
|
@ -483,7 +483,7 @@ type ProjectCollaboratorOptions struct {
|
||||||
// AddProjectCollaborator adds a collaborator to an organization project and sets
|
// AddProjectCollaborator adds a collaborator to an organization project and sets
|
||||||
// their permission level. You must be an organization owner or a project admin to add a collaborator.
|
// their permission level. You must be an organization owner or a project admin to add a collaborator.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#add-project-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#add-project-collaborator
|
||||||
func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opts *ProjectCollaboratorOptions) (*Response, error) {
|
func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opts *ProjectCollaboratorOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
|
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -500,7 +500,7 @@ func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64,
|
||||||
// RemoveProjectCollaborator removes a collaborator from an organization project.
|
// RemoveProjectCollaborator removes a collaborator from an organization project.
|
||||||
// You must be an organization owner or a project admin to remove a collaborator.
|
// You must be an organization owner or a project admin to remove a collaborator.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#remove-project-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#remove-user-as-a-collaborator
|
||||||
func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) {
|
func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
|
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -536,7 +536,7 @@ type ListCollaboratorOptions struct {
|
||||||
// with access through default organization permissions, and organization owners. You must be an
|
// with access through default organization permissions, and organization owners. You must be an
|
||||||
// organization owner or a project admin to list collaborators.
|
// organization owner or a project admin to list collaborators.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#list-project-collaborators
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-project-collaborators
|
||||||
func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opts *ListCollaboratorOptions) ([]*User, *Response, error) {
|
func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opts *ListCollaboratorOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/collaborators", id)
|
u := fmt.Sprintf("projects/%v/collaborators", id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -574,7 +574,7 @@ type ProjectPermissionLevel struct {
|
||||||
// project. Possible values for the permission key: "admin", "write", "read", "none".
|
// project. Possible values for the permission key: "admin", "write", "read", "none".
|
||||||
// You must be an organization owner or a project admin to review a user's permission level.
|
// You must be an organization owner or a project admin to review a user's permission level.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#get-project-permission-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#get-project-permission-for-a-user
|
||||||
func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) {
|
func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) {
|
||||||
u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username)
|
u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
|
@ -9,14 +9,13 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PullRequestsService handles communication with the pull request related
|
// PullRequestsService handles communication with the pull request related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/
|
||||||
type PullRequestsService service
|
type PullRequestsService service
|
||||||
|
|
||||||
// PullRequest represents a GitHub pull request on a repository.
|
// PullRequest represents a GitHub pull request on a repository.
|
||||||
|
@ -65,7 +64,7 @@ type PullRequest struct {
|
||||||
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
|
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
|
||||||
|
|
||||||
// RequestedTeams is populated as part of the PullRequestEvent.
|
// RequestedTeams is populated as part of the PullRequestEvent.
|
||||||
// See, https://developer.github.com/v3/activity/events/types/#pullrequestevent for an example.
|
// See, https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/types/#pullrequestevent for an example.
|
||||||
RequestedTeams []*Team `json:"requested_teams,omitempty"`
|
RequestedTeams []*Team `json:"requested_teams,omitempty"`
|
||||||
|
|
||||||
Links *PRLinks `json:"_links,omitempty"`
|
Links *PRLinks `json:"_links,omitempty"`
|
||||||
|
@ -81,12 +80,12 @@ func (p PullRequest) String() string {
|
||||||
return Stringify(p)
|
return Stringify(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRLink represents a single link object from Github pull request _links.
|
// PRLink represents a single link object from GitHub pull request _links.
|
||||||
type PRLink struct {
|
type PRLink struct {
|
||||||
HRef *string `json:"href,omitempty"`
|
HRef *string `json:"href,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRLinks represents the "_links" object in a Github pull request.
|
// PRLinks represents the "_links" object in a GitHub pull request.
|
||||||
type PRLinks struct {
|
type PRLinks struct {
|
||||||
Self *PRLink `json:"self,omitempty"`
|
Self *PRLink `json:"self,omitempty"`
|
||||||
HTML *PRLink `json:"html,omitempty"`
|
HTML *PRLink `json:"html,omitempty"`
|
||||||
|
@ -135,7 +134,7 @@ type PullRequestListOptions struct {
|
||||||
|
|
||||||
// List the pull requests for the specified repository.
|
// List the pull requests for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-pull-requests
|
||||||
func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
|
func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -148,10 +147,6 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
acceptHeaders := []string{mediaTypeLockReasonPreview}
|
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
var pulls []*PullRequest
|
var pulls []*PullRequest
|
||||||
resp, err := s.client.Do(ctx, req, &pulls)
|
resp, err := s.client.Do(ctx, req, &pulls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -165,7 +160,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin
|
||||||
//
|
//
|
||||||
// The results will include open and closed pull requests.
|
// The results will include open and closed pull requests.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#list-pull-requests-associated-with-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-pull-requests-associated-with-a-commit
|
||||||
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
|
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -179,8 +174,7 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
// TODO: remove custom Accept header when this API fully launches.
|
||||||
acceptHeaders := []string{mediaTypeListPullsOrBranchesForCommitPreview, mediaTypeLockReasonPreview}
|
req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview)
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
var pulls []*PullRequest
|
var pulls []*PullRequest
|
||||||
resp, err := s.client.Do(ctx, req, &pulls)
|
resp, err := s.client.Do(ctx, req, &pulls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -192,7 +186,7 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow
|
||||||
|
|
||||||
// Get a single pull request.
|
// Get a single pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#get-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-pull-request
|
||||||
func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) {
|
func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -200,10 +194,6 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
acceptHeaders := []string{mediaTypeLockReasonPreview}
|
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
pull := new(PullRequest)
|
pull := new(PullRequest)
|
||||||
resp, err := s.client.Do(ctx, req, pull)
|
resp, err := s.client.Do(ctx, req, pull)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -215,7 +205,7 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string
|
||||||
|
|
||||||
// GetRaw gets a single pull request in raw (diff or patch) format.
|
// GetRaw gets a single pull request in raw (diff or patch) format.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#get-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-pull-request
|
||||||
func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) {
|
func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -254,7 +244,7 @@ type NewPullRequest struct {
|
||||||
|
|
||||||
// Create a new pull request on the specified repository.
|
// Create a new pull request on the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#create-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-pull-request
|
||||||
func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) {
|
func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, pull)
|
req, err := s.client.NewRequest("POST", u, pull)
|
||||||
|
@ -293,7 +283,7 @@ type PullRequestBranchUpdateResponse struct {
|
||||||
// A follow up request, after a delay of a second or so, should result
|
// A follow up request, after a delay of a second or so, should result
|
||||||
// in a successful request.
|
// in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request-branch
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-pull-request-branch
|
||||||
func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) {
|
func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number)
|
||||||
|
|
||||||
|
@ -328,7 +318,7 @@ type pullRequestUpdate struct {
|
||||||
// The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify.
|
// The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify.
|
||||||
// Base.Ref updates the base branch of the pull request.
|
// Base.Ref updates the base branch of the pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#update-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-pull-request
|
||||||
func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) {
|
func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) {
|
||||||
if pull == nil {
|
if pull == nil {
|
||||||
return nil, nil, fmt.Errorf("pull must be provided")
|
return nil, nil, fmt.Errorf("pull must be provided")
|
||||||
|
@ -354,10 +344,6 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when this API fully launches.
|
|
||||||
acceptHeaders := []string{mediaTypeLockReasonPreview}
|
|
||||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
|
||||||
|
|
||||||
p := new(PullRequest)
|
p := new(PullRequest)
|
||||||
resp, err := s.client.Do(ctx, req, p)
|
resp, err := s.client.Do(ctx, req, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -369,7 +355,7 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin
|
||||||
|
|
||||||
// ListCommits lists the commits in a pull request.
|
// ListCommits lists the commits in a pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-commits-on-a-pull-request
|
||||||
func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) {
|
func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -393,7 +379,7 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep
|
||||||
|
|
||||||
// ListFiles lists the files in a pull request.
|
// ListFiles lists the files in a pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#list-pull-requests-files
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-pull-requests-files
|
||||||
func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) {
|
func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -417,7 +403,7 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo
|
||||||
|
|
||||||
// IsMerged checks if a pull request has been merged.
|
// IsMerged checks if a pull request has been merged.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#check-if-a-pull-request-has-been-merged
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#check-if-a-pull-request-has-been-merged
|
||||||
func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) {
|
func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -456,7 +442,7 @@ type pullRequestMergeRequest struct {
|
||||||
// Merge a pull request.
|
// Merge a pull request.
|
||||||
// commitMessage is an extra detail to append to automatic commit message.
|
// commitMessage is an extra detail to append to automatic commit message.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/#merge-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#merge-a-pull-request
|
||||||
func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
|
func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number)
|
||||||
|
|
|
@ -66,8 +66,8 @@ type PullRequestListCommentsOptions struct {
|
||||||
// pull request number of 0 will return all comments on all pull requests for
|
// pull request number of 0 will return all comments on all pull requests for
|
||||||
// the repository.
|
// the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-review-comments-on-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-review-comments-on-a-pull-request
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#list-review-comments-in-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-review-comments-in-a-repository
|
||||||
func (s *PullRequestsService) ListComments(ctx context.Context, owner string, repo string, number int, opts *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) ListComments(ctx context.Context, owner string, repo string, number int, opts *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if number == 0 {
|
if number == 0 {
|
||||||
|
@ -100,7 +100,7 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner string, re
|
||||||
|
|
||||||
// GetComment fetches the specified pull request comment.
|
// GetComment fetches the specified pull request comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#get-a-review-comment-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-review-comment-for-a-pull-request
|
||||||
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*PullRequestComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -123,7 +123,7 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner string, repo
|
||||||
|
|
||||||
// CreateComment creates a new comment on the specified pull request.
|
// CreateComment creates a new comment on the specified pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#create-a-review-comment-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-comment-for-a-pull-request
|
||||||
func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -145,7 +145,7 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner string, r
|
||||||
|
|
||||||
// CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment.
|
// CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#create-a-review-comment-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-comment-for-a-pull-request
|
||||||
func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner string, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) {
|
||||||
comment := &struct {
|
comment := &struct {
|
||||||
Body string `json:"body,omitempty"`
|
Body string `json:"body,omitempty"`
|
||||||
|
@ -172,7 +172,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner
|
||||||
// EditComment updates a pull request comment.
|
// EditComment updates a pull request comment.
|
||||||
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
// A non-nil comment.Body must be provided. Other comment fields should be left nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#update-a-review-comment-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-review-comment-for-a-pull-request
|
||||||
func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -191,7 +191,7 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner string, rep
|
||||||
|
|
||||||
// DeleteComment deletes a pull request comment.
|
// DeleteComment deletes a pull request comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/comments/#delete-a-review-comment-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#delete-a-review-comment-for-a-pull-request
|
||||||
func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
func (s *PullRequestsService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -25,7 +25,7 @@ type Reviewers struct {
|
||||||
|
|
||||||
// RequestReviewers creates a review request for the provided reviewers for the specified pull request.
|
// RequestReviewers creates a review request for the provided reviewers for the specified pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#request-reviewers-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#request-reviewers-for-a-pull-request
|
||||||
func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) {
|
func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
|
u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("POST", u, &reviewers)
|
req, err := s.client.NewRequest("POST", u, &reviewers)
|
||||||
|
@ -44,7 +44,7 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// ListReviewers lists reviewers whose reviews have been requested on the specified pull request.
|
// ListReviewers lists reviewers whose reviews have been requested on the specified pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#list-requested-reviewers-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-requested-reviewers-for-a-pull-request
|
||||||
func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) {
|
func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -68,7 +68,7 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// RemoveReviewers removes the review request for the provided reviewers for the specified pull request.
|
// RemoveReviewers removes the review request for the provided reviewers for the specified pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/review_requests/#remove-requested-reviewers-from-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#remove-requested-reviewers-from-a-pull-request
|
||||||
func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) {
|
func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
|
u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number)
|
||||||
req, err := s.client.NewRequest("DELETE", u, &reviewers)
|
req, err := s.client.NewRequest("DELETE", u, &reviewers)
|
|
@ -64,7 +64,7 @@ func (r PullRequestReviewRequest) String() string {
|
||||||
return Stringify(r)
|
return Stringify(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r PullRequestReviewRequest) isComfortFadePreview() (bool, error) {
|
func (r *PullRequestReviewRequest) isComfortFadePreview() (bool, error) {
|
||||||
var isCF *bool
|
var isCF *bool
|
||||||
for _, comment := range r.Comments {
|
for _, comment := range r.Comments {
|
||||||
if comment == nil {
|
if comment == nil {
|
||||||
|
@ -105,7 +105,7 @@ func (r PullRequestReviewDismissalRequest) String() string {
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-reviews-for-a-pull-request
|
||||||
func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -133,7 +133,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-review-for-a-pull-request
|
||||||
func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string,
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#delete-a-pending-review-for-a-pull-request
|
||||||
func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID)
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-comments-for-a-pull-request-review
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-comments-for-a-pull-request-review
|
||||||
func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) {
|
func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -209,7 +209,7 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#create-a-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-for-a-pull-request
|
||||||
//
|
//
|
||||||
// In order to use multi-line comments, you must use the "comfort fade" preview.
|
// In order to use multi-line comments, you must use the "comfort fade" preview.
|
||||||
// This replaces the use of the "Position" field in comments with 4 new fields:
|
// This replaces the use of the "Position" field in comments with 4 new fields:
|
||||||
|
@ -270,7 +270,7 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// UpdateReview updates the review summary on the specified pull request.
|
// UpdateReview updates the review summary on the specified pull request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#update-a-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#update-a-review-for-a-pull-request
|
||||||
func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) {
|
||||||
opts := &struct {
|
opts := &struct {
|
||||||
Body string `json:"body"`
|
Body string `json:"body"`
|
||||||
|
@ -297,7 +297,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#submit-a-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#submit-a-review-for-a-pull-request
|
||||||
func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID)
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri
|
||||||
// returned error format and remove this comment once it's fixed.
|
// returned error format and remove this comment once it's fixed.
|
||||||
// Read more about it here - https://github.com/google/go-github/issues/540
|
// Read more about it here - https://github.com/google/go-github/issues/540
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#dismiss-a-review-for-a-pull-request
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#dismiss-a-review-for-a-pull-request
|
||||||
func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
|
func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID)
|
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID)
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
// ReactionsService provides access to the reactions-related functions in the
|
// ReactionsService provides access to the reactions-related functions in the
|
||||||
// GitHub API.
|
// GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/
|
||||||
type ReactionsService service
|
type ReactionsService service
|
||||||
|
|
||||||
// Reaction represents a GitHub reaction.
|
// Reaction represents a GitHub reaction.
|
||||||
|
@ -25,7 +25,7 @@ type Reaction struct {
|
||||||
NodeID *string `json:"node_id,omitempty"`
|
NodeID *string `json:"node_id,omitempty"`
|
||||||
// Content is the type of reaction.
|
// Content is the type of reaction.
|
||||||
// Possible values are:
|
// Possible values are:
|
||||||
// "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
Content *string `json:"content,omitempty"`
|
Content *string `json:"content,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ type Reactions struct {
|
||||||
Confused *int `json:"confused,omitempty"`
|
Confused *int `json:"confused,omitempty"`
|
||||||
Heart *int `json:"heart,omitempty"`
|
Heart *int `json:"heart,omitempty"`
|
||||||
Hooray *int `json:"hooray,omitempty"`
|
Hooray *int `json:"hooray,omitempty"`
|
||||||
|
Rocket *int `json:"rocket,omitempty"`
|
||||||
|
Eyes *int `json:"eyes,omitempty"`
|
||||||
URL *string `json:"url,omitempty"`
|
URL *string `json:"url,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ type ListCommentReactionOptions struct {
|
||||||
|
|
||||||
// ListCommentReactions lists the reactions for a commit comment.
|
// ListCommentReactions lists the reactions for a commit comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-commit-comment
|
||||||
func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -86,9 +88,9 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
|
||||||
// CreateCommentReaction creates a reaction for a commit comment.
|
// CreateCommentReaction creates a reaction for a commit comment.
|
||||||
// Note that if you have already created a reaction of type content, the
|
// Note that if you have already created a reaction of type content, the
|
||||||
// previously created reaction will be returned with Status: 200 OK.
|
// previously created reaction will be returned with Status: 200 OK.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-commit-comment
|
||||||
func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id)
|
||||||
|
|
||||||
|
@ -112,7 +114,7 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep
|
||||||
|
|
||||||
// DeleteCommentReaction deletes the reaction for a commit comment.
|
// DeleteCommentReaction deletes the reaction for a commit comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction
|
||||||
func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -121,7 +123,7 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep
|
||||||
|
|
||||||
// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID.
|
// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-commit-comment-reaction
|
||||||
func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID
|
||||||
|
|
||||||
// ListIssueReactions lists the reactions for an issue.
|
// ListIssueReactions lists the reactions for an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue
|
||||||
func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -158,9 +160,9 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
|
||||||
// CreateIssueReaction creates a reaction for an issue.
|
// CreateIssueReaction creates a reaction for an issue.
|
||||||
// Note that if you have already created a reaction of type content, the
|
// Note that if you have already created a reaction of type content, the
|
||||||
// previously created reaction will be returned with Status: 200 OK.
|
// previously created reaction will be returned with Status: 200 OK.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue
|
||||||
func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
|
u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number)
|
||||||
|
|
||||||
|
@ -184,7 +186,7 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// DeleteIssueReaction deletes the reaction to an issue.
|
// DeleteIssueReaction deletes the reaction to an issue.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction
|
||||||
func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID)
|
url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID)
|
||||||
|
|
||||||
|
@ -193,7 +195,7 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// DeleteIssueReactionByID deletes the reaction to an issue by repository ID.
|
// DeleteIssueReactionByID deletes the reaction to an issue by repository ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-reaction
|
||||||
func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID)
|
url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID)
|
||||||
|
|
||||||
|
@ -202,7 +204,7 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID,
|
||||||
|
|
||||||
// ListIssueCommentReactions lists the reactions for an issue comment.
|
// ListIssueCommentReactions lists the reactions for an issue comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-an-issue-comment
|
||||||
func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -230,9 +232,9 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
|
||||||
// CreateIssueCommentReaction creates a reaction for an issue comment.
|
// CreateIssueCommentReaction creates a reaction for an issue comment.
|
||||||
// Note that if you have already created a reaction of type content, the
|
// Note that if you have already created a reaction of type content, the
|
||||||
// previously created reaction will be returned with Status: 200 OK.
|
// previously created reaction will be returned with Status: 200 OK.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-an-issue-comment
|
||||||
func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id)
|
||||||
|
|
||||||
|
@ -256,7 +258,7 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner
|
||||||
|
|
||||||
// DeleteIssueCommentReaction deletes the reaction to an issue comment.
|
// DeleteIssueCommentReaction deletes the reaction to an issue comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction
|
||||||
func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -265,7 +267,7 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner
|
||||||
|
|
||||||
// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID.
|
// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-an-issue-comment-reaction
|
||||||
func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -274,7 +276,7 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r
|
||||||
|
|
||||||
// ListPullRequestCommentReactions lists the reactions for a pull request review comment.
|
// ListPullRequestCommentReactions lists the reactions for a pull request review comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-pull-request-review-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-pull-request-review-comment
|
||||||
func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -302,9 +304,9 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
|
||||||
// CreatePullRequestCommentReaction creates a reaction for a pull request review comment.
|
// CreatePullRequestCommentReaction creates a reaction for a pull request review comment.
|
||||||
// Note that if you have already created a reaction of type content, the
|
// Note that if you have already created a reaction of type content, the
|
||||||
// previously created reaction will be returned with Status: 200 OK.
|
// previously created reaction will be returned with Status: 200 OK.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-pull-request-review-comment
|
||||||
func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id)
|
||||||
|
|
||||||
|
@ -328,7 +330,7 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
|
||||||
|
|
||||||
// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment.
|
// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction
|
||||||
func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -337,7 +339,7 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context,
|
||||||
|
|
||||||
// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID.
|
// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-a-pull-request-comment-reaction
|
||||||
func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID)
|
||||||
|
|
||||||
|
@ -346,7 +348,7 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont
|
||||||
|
|
||||||
// ListTeamDiscussionReactions lists the reactions for a team discussion.
|
// ListTeamDiscussionReactions lists the reactions for a team discussion.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion-legacy
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-legacy
|
||||||
func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber)
|
u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -371,9 +373,9 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTeamDiscussionReaction creates a reaction for a team discussion.
|
// CreateTeamDiscussionReaction creates a reaction for a team discussion.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion-legacy
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-legacy
|
||||||
func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber)
|
u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber)
|
||||||
|
|
||||||
|
@ -396,7 +398,7 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea
|
||||||
|
|
||||||
// DeleteTeamDiscussionReaction deletes the reaction to a team discussion.
|
// DeleteTeamDiscussionReaction deletes the reaction to a team discussion.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction
|
||||||
func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID)
|
url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID)
|
||||||
|
|
||||||
|
@ -405,7 +407,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org
|
||||||
|
|
||||||
// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID.
|
// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-reaction
|
||||||
func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID)
|
url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID)
|
||||||
|
|
||||||
|
@ -414,7 +416,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont
|
||||||
|
|
||||||
// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment.
|
// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion-comment-legacy
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#list-reactions-for-a-team-discussion-comment-legacy
|
||||||
func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber)
|
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -438,9 +440,9 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment.
|
// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment.
|
||||||
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
|
// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion-comment-legacy
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#create-reaction-for-a-team-discussion-comment-legacy
|
||||||
func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) {
|
func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) {
|
||||||
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber)
|
u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber)
|
||||||
|
|
||||||
|
@ -463,7 +465,7 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte
|
||||||
|
|
||||||
// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment.
|
// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction
|
||||||
func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID)
|
url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID)
|
||||||
|
|
||||||
|
@ -472,7 +474,7 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte
|
||||||
|
|
||||||
// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID.
|
// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions/#delete-team-discussion-comment-reaction
|
||||||
func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) {
|
func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) {
|
||||||
url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID)
|
url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// RepositoriesService handles communication with the repository related
|
// RepositoriesService handles communication with the repository related
|
||||||
// methods of the GitHub API.
|
// methods of the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/
|
||||||
type RepositoriesService service
|
type RepositoriesService service
|
||||||
|
|
||||||
// Repository represents a GitHub repository.
|
// Repository represents a GitHub repository.
|
||||||
|
@ -119,7 +119,7 @@ type Repository struct {
|
||||||
TeamsURL *string `json:"teams_url,omitempty"`
|
TeamsURL *string `json:"teams_url,omitempty"`
|
||||||
|
|
||||||
// TextMatches is only populated from search results that request text matches
|
// TextMatches is only populated from search results that request text matches
|
||||||
// See: search.go and https://developer.github.com/v3/search/#text-match-metadata
|
// See: search.go and https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#text-match-metadata
|
||||||
TextMatches []*TextMatch `json:"text_matches,omitempty"`
|
TextMatches []*TextMatch `json:"text_matches,omitempty"`
|
||||||
|
|
||||||
// Visibility is only used for Create and Edit endpoints. The visibility field
|
// Visibility is only used for Create and Edit endpoints. The visibility field
|
||||||
|
@ -182,8 +182,8 @@ type RepositoryListOptions struct {
|
||||||
// List the repositories for a user. Passing the empty string will list
|
// List the repositories for a user. Passing the empty string will list
|
||||||
// repositories for the authenticated user.
|
// repositories for the authenticated user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repositories-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repositories-for-the-authenticated-user
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repositories-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repositories-for-a-user
|
||||||
func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error) {
|
func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if user != "" {
|
if user != "" {
|
||||||
|
@ -234,7 +234,7 @@ type RepositoryListByOrgOptions struct {
|
||||||
|
|
||||||
// ListByOrg lists the repositories for an organization.
|
// ListByOrg lists the repositories for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-organization-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-organization-repositories
|
||||||
func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
|
func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/repos", org)
|
u := fmt.Sprintf("orgs/%v/repos", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -269,7 +269,7 @@ type RepositoryListAllOptions struct {
|
||||||
|
|
||||||
// ListAll lists all GitHub repositories in the order that they were created.
|
// ListAll lists all GitHub repositories in the order that they were created.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-public-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-public-repositories
|
||||||
func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) {
|
func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) {
|
||||||
u, err := addOptions("repositories", opts)
|
u, err := addOptions("repositories", opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -327,8 +327,13 @@ type createRepoRequest struct {
|
||||||
// Note that only a subset of the repo fields are used and repo must
|
// Note that only a subset of the repo fields are used and repo must
|
||||||
// not be nil.
|
// not be nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#create-a-repository-for-the-authenticated-user
|
// Also note that this method will return the response without actually
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#create-an-organization-repository
|
// waiting for GitHub to finish creating the repository and letting the
|
||||||
|
// changes propagate throughout its servers. You may set up a loop with
|
||||||
|
// exponential back-off to verify repository's creation.
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-for-the-authenticated-user
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-an-organization-repository
|
||||||
func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) {
|
func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) {
|
||||||
var u string
|
var u string
|
||||||
if org != "" {
|
if org != "" {
|
||||||
|
@ -385,7 +390,7 @@ type TemplateRepoRequest struct {
|
||||||
|
|
||||||
// CreateFromTemplate generates a repository from a template.
|
// CreateFromTemplate generates a repository from a template.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#create-a-repository-using-a-template
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-using-a-template
|
||||||
func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) {
|
func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo)
|
u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo)
|
||||||
|
|
||||||
|
@ -406,7 +411,7 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw
|
||||||
|
|
||||||
// Get fetches a repository.
|
// Get fetches a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#get-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository
|
||||||
func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) {
|
func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -415,7 +420,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove custom Accept header when the license support fully launches
|
// TODO: remove custom Accept header when the license support fully launches
|
||||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
// https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license
|
||||||
acceptHeaders := []string{
|
acceptHeaders := []string{
|
||||||
mediaTypeCodesOfConductPreview,
|
mediaTypeCodesOfConductPreview,
|
||||||
mediaTypeTopicsPreview,
|
mediaTypeTopicsPreview,
|
||||||
|
@ -435,7 +440,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
|
||||||
|
|
||||||
// GetCodeOfConduct gets the contents of a repository's code of conduct.
|
// GetCodeOfConduct gets the contents of a repository's code of conduct.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#get-the-code-of-conduct-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/codes-of-conduct/#get-the-code-of-conduct-for-a-repository
|
||||||
func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) {
|
func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/community/code_of_conduct", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/community/code_of_conduct", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -476,7 +481,7 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor
|
||||||
|
|
||||||
// Edit updates a repository.
|
// Edit updates a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#update-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository
|
||||||
func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) {
|
func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("PATCH", u, repository)
|
req, err := s.client.NewRequest("PATCH", u, repository)
|
||||||
|
@ -497,7 +502,7 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo
|
||||||
|
|
||||||
// Delete a repository.
|
// Delete a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#delete-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository
|
||||||
func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -542,7 +547,7 @@ type ListContributorsOptions struct {
|
||||||
|
|
||||||
// GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository.
|
// GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#check-if-vulnerability-alerts-are-enabled-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#check-if-vulnerability-alerts-are-enabled-for-a-repository
|
||||||
func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) {
|
func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
||||||
|
|
||||||
|
@ -562,7 +567,7 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner,
|
||||||
|
|
||||||
// EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository.
|
// EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#enable-vulnerability-alerts
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#enable-vulnerability-alerts
|
||||||
func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) {
|
func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
||||||
|
|
||||||
|
@ -579,7 +584,7 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own
|
||||||
|
|
||||||
// DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository.
|
// DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#disable-vulnerability-alerts
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#disable-vulnerability-alerts
|
||||||
func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) {
|
func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository)
|
||||||
|
|
||||||
|
@ -596,7 +601,7 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow
|
||||||
|
|
||||||
// EnableAutomatedSecurityFixes enables the automated security fixes for a repository.
|
// EnableAutomatedSecurityFixes enables the automated security fixes for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#enable-automated-security-fixes
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#enable-automated-security-fixes
|
||||||
func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) {
|
func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository)
|
||||||
|
|
||||||
|
@ -613,7 +618,7 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context,
|
||||||
|
|
||||||
// DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository.
|
// DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#disable-automated-security-fixes
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#disable-automated-security-fixes
|
||||||
func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) {
|
func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository)
|
||||||
|
|
||||||
|
@ -630,7 +635,7 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context,
|
||||||
|
|
||||||
// ListContributors lists contributors for a repository.
|
// ListContributors lists contributors for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repository-contributors
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-contributors
|
||||||
func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) {
|
func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
|
u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -661,7 +666,7 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string
|
||||||
// "Python": 7769
|
// "Python": 7769
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repository-languages
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-languages
|
||||||
func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) {
|
func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/languages", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/languages", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -680,7 +685,7 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r
|
||||||
|
|
||||||
// ListTeams lists the teams for the specified repository.
|
// ListTeams lists the teams for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repository-teams
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-teams
|
||||||
func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/teams", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -712,7 +717,7 @@ type RepositoryTag struct {
|
||||||
|
|
||||||
// ListTags lists tags for the specified repository.
|
// ListTags lists tags for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#list-repository-tags
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-tags
|
||||||
func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) {
|
func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/tags", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -900,7 +905,7 @@ type SignaturesProtectedBranch struct {
|
||||||
|
|
||||||
// ListBranches lists branches for the specified repository.
|
// ListBranches lists branches for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#list-branches
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-branches
|
||||||
func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) {
|
func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/branches", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -927,7 +932,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re
|
||||||
|
|
||||||
// GetBranch gets the specified branch for a repository.
|
// GetBranch gets the specified branch for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-a-branch
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-branch
|
||||||
func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, *Response, error) {
|
func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -949,7 +954,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch
|
||||||
|
|
||||||
// GetBranchProtection gets the protection of a given branch.
|
// GetBranchProtection gets the protection of a given branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-branch-protection
|
||||||
func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) {
|
func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -971,7 +976,7 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re
|
||||||
|
|
||||||
// GetRequiredStatusChecks gets the required status checks for a given protected branch.
|
// GetRequiredStatusChecks gets the required status checks for a given protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-status-checks-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-status-checks-protection
|
||||||
func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) {
|
func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -993,7 +998,7 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner
|
||||||
|
|
||||||
// ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch.
|
// ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-all-status-check-contexts
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-status-check-contexts
|
||||||
func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) {
|
func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1014,7 +1019,7 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte
|
||||||
|
|
||||||
// UpdateBranchProtection updates the protection of a given branch.
|
// UpdateBranchProtection updates the protection of a given branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-branch-protection
|
||||||
func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) {
|
func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("PUT", u, preq)
|
req, err := s.client.NewRequest("PUT", u, preq)
|
||||||
|
@ -1036,7 +1041,7 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner,
|
||||||
|
|
||||||
// RemoveBranchProtection removes the protection of a given branch.
|
// RemoveBranchProtection removes the protection of a given branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#delete-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-branch-protection
|
||||||
func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -1052,7 +1057,7 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner,
|
||||||
|
|
||||||
// GetSignaturesProtectedBranch gets required signatures of protected branch.
|
// GetSignaturesProtectedBranch gets required signatures of protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-commit-signature-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-commit-signature-protection
|
||||||
func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
|
func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1075,7 +1080,7 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context,
|
||||||
// RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch.
|
// RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch.
|
||||||
// It requires admin access and branch protection to be enabled.
|
// It requires admin access and branch protection to be enabled.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#create-commit-signature-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-commit-signature-protection
|
||||||
func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
|
func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
@ -1097,7 +1102,7 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con
|
||||||
|
|
||||||
// OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch.
|
// OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#delete-commit-signature-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-commit-signature-protection
|
||||||
func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -1113,7 +1118,7 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co
|
||||||
|
|
||||||
// UpdateRequiredStatusChecks updates the required status checks for a given protected branch.
|
// UpdateRequiredStatusChecks updates the required status checks for a given protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-status-check-potection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-status-check-protection
|
||||||
func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) {
|
func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("PATCH", u, sreq)
|
req, err := s.client.NewRequest("PATCH", u, sreq)
|
||||||
|
@ -1132,7 +1137,7 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow
|
||||||
|
|
||||||
// License gets the contents of a repository's license if one is detected.
|
// License gets the contents of a repository's license if one is detected.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-license-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-the-license-for-a-repository
|
||||||
func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) {
|
func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/license", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/license", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1151,7 +1156,7 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (
|
||||||
|
|
||||||
// GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch.
|
// GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-pull-request-review-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-pull-request-review-protection
|
||||||
func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
|
func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1174,7 +1179,7 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex
|
||||||
// UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch.
|
// UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch.
|
||||||
// It requires admin access and branch protection to be enabled.
|
// It requires admin access and branch protection to be enabled.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-pull-request-review-protection
|
||||||
func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) {
|
func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("PATCH", u, patch)
|
req, err := s.client.NewRequest("PATCH", u, patch)
|
||||||
|
@ -1197,7 +1202,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con
|
||||||
// DisableDismissalRestrictions disables dismissal restrictions of a protected branch.
|
// DisableDismissalRestrictions disables dismissal restrictions of a protected branch.
|
||||||
// It requires admin access and branch protection to be enabled.
|
// It requires admin access and branch protection to be enabled.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-pull-request-review-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-pull-request-review-protection
|
||||||
func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
|
func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
||||||
|
|
||||||
|
@ -1224,7 +1229,7 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context,
|
||||||
|
|
||||||
// RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch.
|
// RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#delete-pull-request-review-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-pull-request-review-protection
|
||||||
func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -1240,7 +1245,7 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con
|
||||||
|
|
||||||
// GetAdminEnforcement gets admin enforcement information of a protected branch.
|
// GetAdminEnforcement gets admin enforcement information of a protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-admin-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-admin-branch-protection
|
||||||
func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
|
func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1263,7 +1268,7 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re
|
||||||
// AddAdminEnforcement adds admin enforcement to a protected branch.
|
// AddAdminEnforcement adds admin enforcement to a protected branch.
|
||||||
// It requires admin access and branch protection to be enabled.
|
// It requires admin access and branch protection to be enabled.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#set-admin-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#set-admin-branch-protection
|
||||||
func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
|
func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
@ -1285,7 +1290,7 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re
|
||||||
|
|
||||||
// RemoveAdminEnforcement removes admin enforcement from a protected branch.
|
// RemoveAdminEnforcement removes admin enforcement from a protected branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#delete-admin-branch-protection
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-admin-branch-protection
|
||||||
func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -1306,7 +1311,7 @@ type repositoryTopics struct {
|
||||||
|
|
||||||
// ListAllTopics lists topics for a repository.
|
// ListAllTopics lists topics for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#get-all-repository-topics
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-repository-topics
|
||||||
func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) {
|
func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1328,7 +1333,7 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// ReplaceAllTopics replaces topics for a repository.
|
// ReplaceAllTopics replaces topics for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#replace-all-repository-topics
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#replace-all-repository-topics
|
||||||
func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) {
|
func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/topics", owner, repo)
|
||||||
t := &repositoryTopics{
|
t := &repositoryTopics{
|
||||||
|
@ -1354,10 +1359,10 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo
|
||||||
return t.Names, resp, nil
|
return t.Names, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListApps lists the Github apps that have push access to a given protected branch.
|
// ListApps lists the GitHub apps that have push access to a given protected branch.
|
||||||
// It requires the Github apps to have `write` access to the `content` permission.
|
// It requires the GitHub apps to have `write` access to the `content` permission.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#list-apps-with-access-to-the-protected-branch
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-apps-with-access-to-the-protected-branch
|
||||||
func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) {
|
func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -1376,11 +1381,11 @@ func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch
|
||||||
|
|
||||||
// ReplaceAppRestrictions replaces the apps that have push access to a given protected branch.
|
// ReplaceAppRestrictions replaces the apps that have push access to a given protected branch.
|
||||||
// It removes all apps that previously had push access and grants push access to the new list of apps.
|
// It removes all apps that previously had push access and grants push access to the new list of apps.
|
||||||
// It requires the Github apps to have `write` access to the `content` permission.
|
// It requires the GitHub apps to have `write` access to the `content` permission.
|
||||||
//
|
//
|
||||||
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#set-app-access-restrictions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#set-app-access-restrictions
|
||||||
func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("PUT", u, slug)
|
req, err := s.client.NewRequest("PUT", u, slug)
|
||||||
|
@ -1398,11 +1403,11 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddAppRestrictions grants the specified apps push access to a given protected branch.
|
// AddAppRestrictions grants the specified apps push access to a given protected branch.
|
||||||
// It requires the Github apps to have `write` access to the `content` permission.
|
// It requires the GitHub apps to have `write` access to the `content` permission.
|
||||||
//
|
//
|
||||||
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#add-app-access-restrictions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#add-app-access-restrictions
|
||||||
func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("POST", u, slug)
|
req, err := s.client.NewRequest("POST", u, slug)
|
||||||
|
@ -1420,11 +1425,11 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAppRestrictions removes the ability of an app to push to this branch.
|
// RemoveAppRestrictions removes the ability of an app to push to this branch.
|
||||||
// It requires the Github apps to have `write` access to the `content` permission.
|
// It requires the GitHub apps to have `write` access to the `content` permission.
|
||||||
//
|
//
|
||||||
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
// Note: The list of users, apps, and teams in total is limited to 100 items.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-app-access-restrictions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#remove-app-access-restrictions
|
||||||
func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, slug []string) ([]*App, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch)
|
||||||
req, err := s.client.NewRequest("DELETE", u, slug)
|
req, err := s.client.NewRequest("DELETE", u, slug)
|
||||||
|
@ -1455,7 +1460,7 @@ type TransferRequest struct {
|
||||||
// A follow up request, after a delay of a second or so, should result
|
// A follow up request, after a delay of a second or so, should result
|
||||||
// in a successful request.
|
// in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#transfer-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#transfer-a-repository
|
||||||
func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) {
|
func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo)
|
||||||
|
|
||||||
|
@ -1484,7 +1489,7 @@ type DispatchRequestOptions struct {
|
||||||
|
|
||||||
// Dispatch triggers a repository_dispatch event in a GitHub Actions workflow.
|
// Dispatch triggers a repository_dispatch event in a GitHub Actions workflow.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-dispatch-event
|
||||||
func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) {
|
func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo)
|
||||||
|
|
|
@ -27,7 +27,7 @@ type ListCollaboratorsOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CollaboratorInvitation represents an invitation created when adding a collaborator.
|
// CollaboratorInvitation represents an invitation created when adding a collaborator.
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#response-when-a-new-invitation-is-created
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/collaborators/#response-when-a-new-invitation-is-created
|
||||||
type CollaboratorInvitation struct {
|
type CollaboratorInvitation struct {
|
||||||
ID *int64 `json:"id,omitempty"`
|
ID *int64 `json:"id,omitempty"`
|
||||||
Repo *Repository `json:"repository,omitempty"`
|
Repo *Repository `json:"repository,omitempty"`
|
||||||
|
@ -41,7 +41,7 @@ type CollaboratorInvitation struct {
|
||||||
|
|
||||||
// ListCollaborators lists the GitHub users that have access to the repository.
|
// ListCollaborators lists the GitHub users that have access to the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#list-repository-collaborators
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-collaborators
|
||||||
func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) {
|
func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -68,7 +68,7 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo
|
||||||
// Note: This will return false if the user is not a collaborator OR the user
|
// Note: This will return false if the user is not a collaborator OR the user
|
||||||
// is not a GitHub user.
|
// is not a GitHub user.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-repository-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#check-if-a-user-is-a-repository-collaborator
|
||||||
func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
|
func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -91,7 +91,7 @@ type RepositoryPermissionLevel struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository.
|
// GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository.
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#get-repository-permissions-for-a-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-permissions-for-a-user
|
||||||
func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) {
|
func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -125,7 +125,7 @@ type RepositoryAddCollaboratorOptions struct {
|
||||||
// AddCollaborator sends an invitation to the specified GitHub user
|
// AddCollaborator sends an invitation to the specified GitHub user
|
||||||
// to become a collaborator to the given repo.
|
// to become a collaborator to the given repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#add-a-repository-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#add-a-repository-collaborator
|
||||||
func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) {
|
func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -143,7 +143,7 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo,
|
||||||
// RemoveCollaborator removes the specified GitHub user as collaborator from the given repo.
|
// RemoveCollaborator removes the specified GitHub user as collaborator from the given repo.
|
||||||
// Note: Does not return error if a valid user that is not a collaborator is removed.
|
// Note: Does not return error if a valid user that is not a collaborator is removed.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/collaborators/#remove-a-repository-collaborator
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#remove-a-repository-collaborator
|
||||||
func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) {
|
func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -36,7 +36,7 @@ func (r RepositoryComment) String() string {
|
||||||
|
|
||||||
// ListComments lists all the comments for the repository.
|
// ListComments lists all the comments for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-comments-for-a-repository
|
||||||
func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/comments", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -63,7 +63,7 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// ListCommitComments lists all the comments for a given commit SHA.
|
// ListCommitComments lists all the comments for a given commit SHA.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#list-commit-comments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-comments
|
||||||
func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -91,7 +91,7 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep
|
||||||
// CreateComment creates a comment for the given commit.
|
// CreateComment creates a comment for the given commit.
|
||||||
// Note: GitHub allows for comments to be created for non-existing files and positions.
|
// Note: GitHub allows for comments to be created for non-existing files and positions.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#create-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-commit-comment
|
||||||
func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -110,7 +110,7 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh
|
||||||
|
|
||||||
// GetComment gets a single comment from a repository.
|
// GetComment gets a single comment from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit-comment
|
||||||
func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -132,7 +132,7 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// UpdateComment updates the body of a single comment.
|
// UpdateComment updates the body of a single comment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-commit-comment
|
||||||
func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -151,7 +151,7 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// DeleteComment deletes a single comment from a repository.
|
// DeleteComment deletes a single comment from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-commit-comment
|
||||||
func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -123,7 +123,7 @@ type BranchCommit struct {
|
||||||
|
|
||||||
// ListCommits lists the commits of a repository.
|
// ListCommits lists the commits of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#list-commits
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commits
|
||||||
func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) {
|
func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/commits", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -147,8 +147,8 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// GetCommit fetches the specified commit, including all details about it.
|
// GetCommit fetches the specified commit, including all details about it.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-single-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-single-commit
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit
|
||||||
func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string) (*RepositoryCommit, *Response, error) {
|
func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string) (*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st
|
||||||
|
|
||||||
// GetCommitRaw fetches the specified commit in raw (diff or patch) format.
|
// GetCommitRaw fetches the specified commit in raw (diff or patch) format.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit
|
||||||
func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) {
|
func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -197,7 +197,7 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re
|
||||||
// GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is
|
// GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is
|
||||||
// supplied and no new commits have occurred, a 304 Unmodified response is returned.
|
// supplied and no new commits have occurred, a 304 Unmodified response is returned.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-a-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit
|
||||||
func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) {
|
func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref))
|
||||||
|
|
||||||
|
@ -221,9 +221,8 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompareCommits compares a range of commits with each other.
|
// CompareCommits compares a range of commits with each other.
|
||||||
// todo: support media formats - https://github.com/google/go-github/issues/6
|
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#compare-two-commits
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#compare-two-commits
|
||||||
func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) {
|
func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)
|
u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)
|
||||||
|
|
||||||
|
@ -241,10 +240,42 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st
|
||||||
return comp, resp, nil
|
return comp, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CompareCommitsRaw compares a range of commits with each other in raw (diff or patch) format.
|
||||||
|
//
|
||||||
|
// Both "base" and "head" must be branch names in "repo".
|
||||||
|
// To compare branches across other repositories in the same network as "repo",
|
||||||
|
// use the format "<USERNAME>:branch".
|
||||||
|
//
|
||||||
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#compare-two-commits
|
||||||
|
func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error) {
|
||||||
|
u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)
|
||||||
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch opts.Type {
|
||||||
|
case Diff:
|
||||||
|
req.Header.Set("Accept", mediaTypeV3Diff)
|
||||||
|
case Patch:
|
||||||
|
req.Header.Set("Accept", mediaTypeV3Patch)
|
||||||
|
default:
|
||||||
|
return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
resp, err := s.client.Do(ctx, req, &buf)
|
||||||
|
if err != nil {
|
||||||
|
return "", resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.String(), resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD,
|
// ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD,
|
||||||
// or latest commit for the branch.
|
// or latest commit for the branch.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-branches-for-head-commit
|
||||||
func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) {
|
func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha)
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha)
|
||||||
|
|
|
@ -38,7 +38,7 @@ type CommunityHealthMetrics struct {
|
||||||
|
|
||||||
// GetCommunityHealthMetrics retrieves all the community health metrics for a repository.
|
// GetCommunityHealthMetrics retrieves all the community health metrics for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/community/#get-community-profile-metrics
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-community-profile-metrics
|
||||||
func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) {
|
func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
|
@ -4,7 +4,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Repository contents API methods.
|
// Repository contents API methods.
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/contents/
|
||||||
|
|
||||||
package github
|
package github
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RepositoryContent represents a file or directory in a github repository.
|
// RepositoryContent represents a file or directory in a github repository.
|
||||||
|
@ -94,7 +95,7 @@ func (r *RepositoryContent) GetContent() (string, error) {
|
||||||
|
|
||||||
// GetReadme gets the Readme file for the repository.
|
// GetReadme gets the Readme file for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-a-repository-readme
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository-readme
|
||||||
func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) {
|
func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/readme", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/readme", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -117,26 +118,30 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string,
|
||||||
// specified file. This function will work with files of any size, as opposed
|
// specified file. This function will work with files of any size, as opposed
|
||||||
// to GetContents which is limited to 1 Mb files. It is the caller's
|
// to GetContents which is limited to 1 Mb files. It is the caller's
|
||||||
// responsibility to close the ReadCloser.
|
// responsibility to close the ReadCloser.
|
||||||
func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, error) {
|
//
|
||||||
|
// It is possible for the download to result in a failed response when the
|
||||||
|
// returned error is nil. Callers should check the returned Response status
|
||||||
|
// code to verify the content is from a successful response.
|
||||||
|
func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *Response, error) {
|
||||||
dir := path.Dir(filepath)
|
dir := path.Dir(filepath)
|
||||||
filename := path.Base(filepath)
|
filename := path.Base(filepath)
|
||||||
_, dirContents, _, err := s.GetContents(ctx, owner, repo, dir, opts)
|
_, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, resp, err
|
||||||
}
|
}
|
||||||
for _, contents := range dirContents {
|
for _, contents := range dirContents {
|
||||||
if *contents.Name == filename {
|
if *contents.Name == filename {
|
||||||
if contents.DownloadURL == nil || *contents.DownloadURL == "" {
|
if contents.DownloadURL == nil || *contents.DownloadURL == "" {
|
||||||
return nil, fmt.Errorf("No download link found for %s", filepath)
|
return nil, resp, fmt.Errorf("No download link found for %s", filepath)
|
||||||
}
|
}
|
||||||
resp, err := s.client.client.Get(*contents.DownloadURL)
|
dlResp, err := s.client.client.Get(*contents.DownloadURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, &Response{Response: dlResp}, err
|
||||||
}
|
}
|
||||||
return resp.Body, nil
|
return dlResp.Body, &Response{Response: dlResp}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("No file named %s found in %s", filename, dir)
|
return nil, resp, fmt.Errorf("No file named %s found in %s", filename, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContents can return either the metadata and content of a single file
|
// GetContents can return either the metadata and content of a single file
|
||||||
|
@ -146,9 +151,9 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo,
|
||||||
// as possible, both result types will be returned but only one will contain a
|
// as possible, both result types will be returned but only one will contain a
|
||||||
// value and the other will be nil.
|
// value and the other will be nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-repository-content
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-content
|
||||||
func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) {
|
func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) {
|
||||||
escapedPath := (&url.URL{Path: path}).String()
|
escapedPath := (&url.URL{Path: strings.TrimSuffix(path, "/")}).String()
|
||||||
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath)
|
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath)
|
||||||
u, err = addOptions(u, opts)
|
u, err = addOptions(u, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -177,7 +182,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path
|
||||||
// CreateFile creates a new file in a repository at the given path and returns
|
// CreateFile creates a new file in a repository at the given path and returns
|
||||||
// the commit and file metadata.
|
// the commit and file metadata.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#create-or-update-file-contents
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-or-update-file-contents
|
||||||
func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -195,7 +200,7 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path
|
||||||
// UpdateFile updates a file in a repository at the given path and returns the
|
// UpdateFile updates a file in a repository at the given path and returns the
|
||||||
// commit and file metadata. Requires the blob SHA of the file being updated.
|
// commit and file metadata. Requires the blob SHA of the file being updated.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#create-or-update-file-contents
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-or-update-file-contents
|
||||||
func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -213,7 +218,7 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path
|
||||||
// DeleteFile deletes a file from a repository and returns the commit.
|
// DeleteFile deletes a file from a repository and returns the commit.
|
||||||
// Requires the blob SHA of the file to be deleted.
|
// Requires the blob SHA of the file to be deleted.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#delete-a-file
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-file
|
||||||
func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path)
|
||||||
req, err := s.client.NewRequest("DELETE", u, opts)
|
req, err := s.client.NewRequest("DELETE", u, opts)
|
||||||
|
@ -243,7 +248,7 @@ const (
|
||||||
// repository. The archiveFormat can be specified by either the github.Tarball
|
// repository. The archiveFormat can be specified by either the github.Tarball
|
||||||
// or github.Zipball constant.
|
// or github.Zipball constant.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-archive-link
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/contents/#get-archive-link
|
||||||
func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) {
|
func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat)
|
u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat)
|
||||||
if opts != nil && opts.Ref != "" {
|
if opts != nil && opts.Ref != "" {
|
|
@ -63,7 +63,7 @@ type DeploymentsListOptions struct {
|
||||||
|
|
||||||
// ListDeployments lists the deployments of a repository.
|
// ListDeployments lists the deployments of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deployments
|
||||||
func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) {
|
func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -87,7 +87,7 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s
|
||||||
|
|
||||||
// GetDeployment returns a single deployment of a repository.
|
// GetDeployment returns a single deployment of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-deployment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deployment
|
||||||
func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) {
|
func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// CreateDeployment creates a new deployment for a repository.
|
// CreateDeployment creates a new deployment for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deployment
|
||||||
func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) {
|
func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo)
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// DeleteDeployment deletes an existing deployment for a repository.
|
// DeleteDeployment deletes an existing deployment for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#delete-a-deployment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-deployment
|
||||||
func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -175,7 +175,7 @@ type DeploymentStatusRequest struct {
|
||||||
|
|
||||||
// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
|
// ListDeploymentStatuses lists the statuses of a given deployment of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deployment-statuses
|
||||||
func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) {
|
func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -203,7 +203,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner,
|
||||||
|
|
||||||
// GetDeploymentStatus returns a single deployment status of a repository.
|
// GetDeploymentStatus returns a single deployment status of a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-deployment-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deployment-status
|
||||||
func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) {
|
func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID)
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re
|
||||||
|
|
||||||
// CreateDeploymentStatus creates a new status for a deployment.
|
// CreateDeploymentStatus creates a new status for a deployment.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deployment-status
|
||||||
func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) {
|
func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment)
|
||||||
|
|
|
@ -24,7 +24,7 @@ type RepositoryListForksOptions struct {
|
||||||
|
|
||||||
// ListForks lists the forks of the specified repository.
|
// ListForks lists the forks of the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/forks/#list-forks
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-forks
|
||||||
func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) {
|
func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -65,7 +65,7 @@ type RepositoryCreateForkOptions struct {
|
||||||
// A follow up request, after a delay of a second or so, should result
|
// A follow up request, after a delay of a second or so, should result
|
||||||
// in a successful request.
|
// in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-fork
|
||||||
func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) {
|
func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -104,7 +104,7 @@ type createHookRequest struct {
|
||||||
// Note that only a subset of the hook fields are used and hook must
|
// Note that only a subset of the hook fields are used and hook must
|
||||||
// not be nil.
|
// not be nil.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#create-a-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-repository-webhook
|
||||||
func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {
|
func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// ListHooks lists all Hooks for the specified repository.
|
// ListHooks lists all Hooks for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#list-repository-webhooks
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-webhooks
|
||||||
func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) {
|
func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -155,7 +155,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// GetHook returns a single specified Hook.
|
// GetHook returns a single specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-a-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-repository-webhook
|
||||||
func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) {
|
func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -173,7 +173,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i
|
||||||
|
|
||||||
// EditHook updates a specified Hook.
|
// EditHook updates a specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#update-a-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository-webhook
|
||||||
func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) {
|
func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("PATCH", u, hook)
|
req, err := s.client.NewRequest("PATCH", u, hook)
|
||||||
|
@ -191,7 +191,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// DeleteHook deletes a specified Hook.
|
// DeleteHook deletes a specified Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository-webhook
|
||||||
func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -203,7 +203,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// PingHook triggers a 'ping' event to be sent to the Hook.
|
// PingHook triggers a 'ping' event to be sent to the Hook.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#ping-a-repository-webhook
|
||||||
func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
||||||
|
@ -215,7 +215,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string,
|
||||||
|
|
||||||
// TestHook triggers a test Hook by github.
|
// TestHook triggers a test Hook by github.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-the-push-repository-webhook
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#test-the-push-repository-webhook
|
||||||
func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
|
@ -27,7 +27,7 @@ type RepositoryInvitation struct {
|
||||||
|
|
||||||
// ListInvitations lists all currently-open repository invitations.
|
// ListInvitations lists all currently-open repository invitations.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-repository-invitations
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-repository-invitations
|
||||||
func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) {
|
func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -51,7 +51,7 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s
|
||||||
|
|
||||||
// DeleteInvitation deletes a repository invitation.
|
// DeleteInvitation deletes a repository invitation.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-repository-invitation
|
||||||
func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID)
|
u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -68,7 +68,7 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo
|
||||||
// permissions represents the permissions that the associated user will have
|
// permissions represents the permissions that the associated user will have
|
||||||
// on the repository. Possible values are: "read", "write", "admin".
|
// on the repository. Possible values are: "read", "write", "admin".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-repository-invitation
|
||||||
func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) {
|
func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) {
|
||||||
opts := &struct {
|
opts := &struct {
|
||||||
Permissions string `json:"permissions"`
|
Permissions string `json:"permissions"`
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
// ListKeys lists the deploy keys for a repository.
|
// ListKeys lists the deploy keys for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#list-deploy-keys
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-deploy-keys
|
||||||
func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) {
|
func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -38,7 +38,7 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s
|
||||||
|
|
||||||
// GetKey fetches a single deploy key.
|
// GetKey fetches a single deploy key.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#get-a-deploy-key
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-deploy-key
|
||||||
func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) {
|
func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str
|
||||||
|
|
||||||
// CreateKey adds a deploy key for a repository.
|
// CreateKey adds a deploy key for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#create-a-deploy-key
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-deploy-key
|
||||||
func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) {
|
func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/keys", owner, repo)
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo
|
||||||
|
|
||||||
// DeleteKey deletes a deploy key.
|
// DeleteKey deletes a deploy key.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/keys/#delete-a-deploy-key
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-deploy-key
|
||||||
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id)
|
||||||
|
|
|
@ -20,7 +20,7 @@ type RepositoryMergeRequest struct {
|
||||||
|
|
||||||
// Merge a branch in the specified repository.
|
// Merge a branch in the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/merging/#merge-a-branch
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#merge-a-branch
|
||||||
func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) {
|
func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/merges", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/merges", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, request)
|
req, err := s.client.NewRequest("POST", u, request)
|
|
@ -51,7 +51,7 @@ type createPagesRequest struct {
|
||||||
|
|
||||||
// EnablePages enables GitHub Pages for the named repo.
|
// EnablePages enables GitHub Pages for the named repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#create-a-github-pages-site
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-github-pages-site
|
||||||
func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) {
|
func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ type PagesUpdate struct {
|
||||||
|
|
||||||
// UpdatePages updates GitHub Pages for the named repo.
|
// UpdatePages updates GitHub Pages for the named repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#update-information-about-a-github-pages-site
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-information-about-a-github-pages-site
|
||||||
func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) {
|
func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// DisablePages disables GitHub Pages for the named repo.
|
// DisablePages disables GitHub Pages for the named repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#delete-a-github-pages-site
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-github-pages-site
|
||||||
func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) {
|
func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -122,7 +122,7 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// GetPagesInfo fetches information about a GitHub Pages site.
|
// GetPagesInfo fetches information about a GitHub Pages site.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-a-github-pages-site
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-github-pages-site
|
||||||
func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) {
|
func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -141,7 +141,7 @@ func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// ListPagesBuilds lists the builds for a GitHub Pages site.
|
// ListPagesBuilds lists the builds for a GitHub Pages site.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#list-github-pages-builds
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-github-pages-builds
|
||||||
func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) {
|
func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -165,7 +165,7 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s
|
||||||
|
|
||||||
// GetLatestPagesBuild fetches the latest build information for a GitHub pages site.
|
// GetLatestPagesBuild fetches the latest build information for a GitHub pages site.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-latest-pages-build
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-latest-pages-build
|
||||||
func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
|
func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -184,7 +184,7 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re
|
||||||
|
|
||||||
// GetPageBuild fetches the specific build information for a GitHub pages site.
|
// GetPageBuild fetches the specific build information for a GitHub pages site.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#get-github-pages-build
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-github-pages-build
|
||||||
func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) {
|
func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id)
|
u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -203,7 +203,7 @@ func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit.
|
// RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/pages/#request-a-github-pages-build
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#request-a-github-pages-build
|
||||||
func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
|
func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, nil)
|
req, err := s.client.NewRequest("POST", u, nil)
|
|
@ -21,7 +21,7 @@ type ProjectListOptions struct {
|
||||||
|
|
||||||
// ListProjects lists the projects for a repo.
|
// ListProjects lists the projects for a repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#list-repository-projects
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#list-repository-projects
|
||||||
func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opts *ProjectListOptions) ([]*Project, *Response, error) {
|
func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opts *ProjectListOptions) ([]*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -48,7 +48,7 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// CreateProject creates a GitHub Project for the specified repository.
|
// CreateProject creates a GitHub Project for the specified repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/projects/#create-a-repository-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/projects/#create-a-repository-project
|
||||||
func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opts *ProjectOptions) (*Project, *Response, error) {
|
func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opts *ProjectOptions) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/projects", owner, repo)
|
||||||
req, err := s.client.NewRequest("POST", u, opts)
|
req, err := s.client.NewRequest("POST", u, opts)
|
|
@ -68,7 +68,7 @@ func (r ReleaseAsset) String() string {
|
||||||
|
|
||||||
// ListReleases lists the releases for a repository.
|
// ListReleases lists the releases for a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-releases
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-releases
|
||||||
func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -91,7 +91,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri
|
||||||
|
|
||||||
// GetRelease fetches a single release.
|
// GetRelease fetches a single release.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release
|
||||||
func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
||||||
return s.getSingleRelease(ctx, u)
|
return s.getSingleRelease(ctx, u)
|
||||||
|
@ -99,7 +99,7 @@ func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string
|
||||||
|
|
||||||
// GetLatestRelease fetches the latest published release for the repository.
|
// GetLatestRelease fetches the latest published release for the repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-the-latest-release
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-latest-release
|
||||||
func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo)
|
||||||
return s.getSingleRelease(ctx, u)
|
return s.getSingleRelease(ctx, u)
|
||||||
|
@ -107,7 +107,7 @@ func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// GetReleaseByTag fetches a release with the specified tag.
|
// GetReleaseByTag fetches a release with the specified tag.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-by-tag-name
|
||||||
func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag)
|
u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag)
|
||||||
return s.getSingleRelease(ctx, u)
|
return s.getSingleRelease(ctx, u)
|
||||||
|
@ -147,7 +147,7 @@ type repositoryReleaseRequest struct {
|
||||||
// Note that only a subset of the release fields are used.
|
// Note that only a subset of the release fields are used.
|
||||||
// See RepositoryRelease for more information.
|
// See RepositoryRelease for more information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#create-a-release
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-release
|
||||||
func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str
|
||||||
// Note that only a subset of the release fields are used.
|
// Note that only a subset of the release fields are used.
|
||||||
// See RepositoryRelease for more information.
|
// See RepositoryRelease for more information.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#update-a-release
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-release
|
||||||
func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
|
func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin
|
||||||
|
|
||||||
// DeleteRelease delete a single release from a repository.
|
// DeleteRelease delete a single release from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-release
|
||||||
func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str
|
||||||
|
|
||||||
// ListReleaseAssets lists the release's assets.
|
// ListReleaseAssets lists the release's assets.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-release-assets
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-release-assets
|
||||||
func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) {
|
func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -242,7 +242,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// GetReleaseAsset fetches a single release asset.
|
// GetReleaseAsset fetches a single release asset.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release-asset
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-asset
|
||||||
func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) {
|
func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s
|
||||||
// exist, but it's possible to pass any http.Client. If nil is passed the
|
// exist, but it's possible to pass any http.Client. If nil is passed the
|
||||||
// redirectURL will be returned instead.
|
// redirectURL will be returned instead.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-release-asset
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-release-asset
|
||||||
func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) {
|
func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f
|
||||||
|
|
||||||
// EditReleaseAsset edits a repository release asset.
|
// EditReleaseAsset edits a repository release asset.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#update-a-release-asset
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#update-a-release-asset
|
||||||
func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) {
|
func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// DeleteReleaseAsset delete a single release asset from a repository.
|
// DeleteReleaseAsset delete a single release asset from a repository.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release-asset
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#delete-a-release-asset
|
||||||
func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep
|
||||||
// UploadReleaseAsset creates an asset by uploading a file into a release repository.
|
// UploadReleaseAsset creates an asset by uploading a file into a release repository.
|
||||||
// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly.
|
// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/releases/#upload-a-release-asset
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#upload-a-release-asset
|
||||||
func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) {
|
func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -45,7 +45,7 @@ func (w WeeklyStats) String() string {
|
||||||
// it is now computing the requested statistics. A follow up request, after a
|
// it is now computing the requested statistics. A follow up request, after a
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statistics/#get-all-contributor-commit-activity
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-all-contributor-commit-activity
|
||||||
func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) {
|
func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -84,7 +84,7 @@ func (w WeeklyCommitActivity) String() string {
|
||||||
// it is now computing the requested statistics. A follow up request, after a
|
// it is now computing the requested statistics. A follow up request, after a
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statistics/#get-the-last-year-of-commit-activity
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-last-year-of-commit-activity
|
||||||
func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) {
|
func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -111,7 +111,7 @@ func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, rep
|
||||||
// it is now computing the requested statistics. A follow up request, after a
|
// it is now computing the requested statistics. A follow up request, after a
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-activity
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-weekly-commit-activity
|
||||||
func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) {
|
func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -164,7 +164,7 @@ func (r RepositoryParticipation) String() string {
|
||||||
// it is now computing the requested statistics. A follow up request, after a
|
// it is now computing the requested statistics. A follow up request, after a
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-weekly-commit-count
|
||||||
func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) {
|
func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -197,7 +197,7 @@ type PunchCard struct {
|
||||||
// it is now computing the requested statistics. A follow up request, after a
|
// it is now computing the requested statistics. A follow up request, after a
|
||||||
// delay of a second or so, should result in a successful request.
|
// delay of a second or so, should result in a successful request.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statistics/#get-the-hourly-commit-count-for-each-day
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-hourly-commit-count-for-each-day
|
||||||
func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) {
|
func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
|
@ -43,7 +43,7 @@ func (r RepoStatus) String() string {
|
||||||
// ListStatuses lists the statuses of a repository at the specified
|
// ListStatuses lists the statuses of a repository at the specified
|
||||||
// reference. ref can be a SHA, a branch name, or a tag name.
|
// reference. ref can be a SHA, a branch name, or a tag name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statuses/#list-commit-statuses-for-a-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-commit-statuses-for-a-reference
|
||||||
func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) {
|
func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, refURLEscape(ref))
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -68,7 +68,7 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref
|
||||||
// CreateStatus creates a new status for a repository at the specified
|
// CreateStatus creates a new status for a repository at the specified
|
||||||
// reference. Ref can be a SHA, a branch name, or a tag name.
|
// reference. Ref can be a SHA, a branch name, or a tag name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statuses/#create-a-commit-status
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#create-a-commit-status
|
||||||
func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) {
|
func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref))
|
||||||
req, err := s.client.NewRequest("POST", u, status)
|
req, err := s.client.NewRequest("POST", u, status)
|
||||||
|
@ -107,7 +107,7 @@ func (s CombinedStatus) String() string {
|
||||||
// GetCombinedStatus returns the combined status of a repository at the specified
|
// GetCombinedStatus returns the combined status of a repository at the specified
|
||||||
// reference. ref can be a SHA, a branch name, or a tag name.
|
// reference. ref can be a SHA, a branch name, or a tag name.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-reference
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-the-combined-status-for-a-specific-reference
|
||||||
func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) {
|
func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, refURLEscape(ref))
|
u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, refURLEscape(ref))
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -54,7 +54,7 @@ type TrafficBreakdownOptions struct {
|
||||||
|
|
||||||
// ListTrafficReferrers list the top 10 referrers over the last 14 days.
|
// ListTrafficReferrers list the top 10 referrers over the last 14 days.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#get-top-referral-sources
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-top-referral-sources
|
||||||
func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) {
|
func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo)
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, r
|
||||||
|
|
||||||
// ListTrafficPaths list the top 10 popular content over the last 14 days.
|
// ListTrafficPaths list the top 10 popular content over the last 14 days.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#get-top-referral-paths
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-top-referral-paths
|
||||||
func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) {
|
func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo)
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.
|
// ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#get-page-views
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-page-views
|
||||||
func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) {
|
func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -118,7 +118,7 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo
|
||||||
|
|
||||||
// ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days.
|
// ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/repos/traffic/#get-repository-clones
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-repository-clones
|
||||||
func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) {
|
func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) {
|
||||||
u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo)
|
u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
|
@ -29,7 +29,7 @@ import (
|
||||||
// For example, querying with "language:c++" and "leveldb", then query should be
|
// For example, querying with "language:c++" and "leveldb", then query should be
|
||||||
// "language:c++ leveldb" but not "language:c+++leveldb".
|
// "language:c++ leveldb" but not "language:c+++leveldb".
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/
|
||||||
type SearchService service
|
type SearchService service
|
||||||
|
|
||||||
// SearchOptions specifies optional parameters to the SearchService methods.
|
// SearchOptions specifies optional parameters to the SearchService methods.
|
||||||
|
@ -69,7 +69,7 @@ type RepositoriesSearchResult struct {
|
||||||
|
|
||||||
// Repositories searches repositories via various criteria.
|
// Repositories searches repositories via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-repositories
|
||||||
func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) {
|
func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) {
|
||||||
result := new(RepositoriesSearchResult)
|
result := new(RepositoriesSearchResult)
|
||||||
resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -100,7 +100,7 @@ type TopicResult struct {
|
||||||
// Please see https://help.github.com/en/articles/searching-topics for more
|
// Please see https://help.github.com/en/articles/searching-topics for more
|
||||||
// information about search qualifiers.
|
// information about search qualifiers.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-topics
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-topics
|
||||||
func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) {
|
func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) {
|
||||||
result := new(TopicsSearchResult)
|
result := new(TopicsSearchResult)
|
||||||
resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -131,7 +131,7 @@ type CommitResult struct {
|
||||||
|
|
||||||
// Commits searches commits via various criteria.
|
// Commits searches commits via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-commits
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-commits
|
||||||
func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) {
|
func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) {
|
||||||
result := new(CommitsSearchResult)
|
result := new(CommitsSearchResult)
|
||||||
resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -147,7 +147,7 @@ type IssuesSearchResult struct {
|
||||||
|
|
||||||
// Issues searches issues via various criteria.
|
// Issues searches issues via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-issues-and-pull-requests
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-issues-and-pull-requests
|
||||||
func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) {
|
func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) {
|
||||||
result := new(IssuesSearchResult)
|
result := new(IssuesSearchResult)
|
||||||
resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -163,7 +163,7 @@ type UsersSearchResult struct {
|
||||||
|
|
||||||
// Users searches users via various criteria.
|
// Users searches users via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-users
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-users
|
||||||
func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) {
|
func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) {
|
||||||
result := new(UsersSearchResult)
|
result := new(UsersSearchResult)
|
||||||
resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -212,7 +212,7 @@ func (c CodeResult) String() string {
|
||||||
|
|
||||||
// Code searches code via various criteria.
|
// Code searches code via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-code
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-code
|
||||||
func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) {
|
func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) {
|
||||||
result := new(CodeSearchResult)
|
result := new(CodeSearchResult)
|
||||||
resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result)
|
resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result)
|
||||||
|
@ -243,7 +243,7 @@ func (l LabelResult) String() string {
|
||||||
|
|
||||||
// Labels searches labels in the repository with ID repoID via various criteria.
|
// Labels searches labels in the repository with ID repoID via various criteria.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/search/#search-labels
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#search-labels
|
||||||
func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) {
|
func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) {
|
||||||
result := new(LabelsSearchResult)
|
result := new(LabelsSearchResult)
|
||||||
resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result)
|
resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result)
|
|
@ -16,7 +16,7 @@ import (
|
||||||
// TeamsService provides access to the team-related functions
|
// TeamsService provides access to the team-related functions
|
||||||
// in the GitHub API.
|
// in the GitHub API.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/
|
||||||
type TeamsService service
|
type TeamsService service
|
||||||
|
|
||||||
// Team represents a team within a GitHub organization. Teams are used to
|
// Team represents a team within a GitHub organization. Teams are used to
|
||||||
|
@ -75,7 +75,7 @@ func (i Invitation) String() string {
|
||||||
|
|
||||||
// ListTeams lists all of the teams for an organization.
|
// ListTeams lists all of the teams for an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-teams
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-teams
|
||||||
func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams", org)
|
u := fmt.Sprintf("orgs/%v/teams", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -99,7 +99,7 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti
|
||||||
|
|
||||||
// GetTeamByID fetches a team, given a specified organization ID, by ID.
|
// GetTeamByID fetches a team, given a specified organization ID, by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#get-a-team-by-name
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-team-by-name
|
||||||
func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) {
|
func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -118,7 +118,7 @@ func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*T
|
||||||
|
|
||||||
// GetTeamBySlug fetches a team, given a specified organization name, by slug.
|
// GetTeamBySlug fetches a team, given a specified organization name, by slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#get-a-team-by-name
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-team-by-name
|
||||||
func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) {
|
func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -168,7 +168,7 @@ func (s NewTeam) String() string {
|
||||||
|
|
||||||
// CreateTeam creates a new team within an organization.
|
// CreateTeam creates a new team within an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#create-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-team
|
||||||
func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) {
|
func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams", org)
|
u := fmt.Sprintf("orgs/%v/teams", org)
|
||||||
req, err := s.client.NewRequest("POST", u, team)
|
req, err := s.client.NewRequest("POST", u, team)
|
||||||
|
@ -214,7 +214,7 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent {
|
||||||
|
|
||||||
// EditTeamByID edits a team, given an organization ID, selected by ID.
|
// EditTeamByID edits a team, given an organization ID, selected by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#update-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-team
|
||||||
func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) {
|
func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te
|
||||||
|
|
||||||
// EditTeamBySlug edits a team, given an organization name, by slug.
|
// EditTeamBySlug edits a team, given an organization name, by slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#update-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-team
|
||||||
func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) {
|
func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea
|
||||||
|
|
||||||
// DeleteTeamByID deletes a team referenced by ID.
|
// DeleteTeamByID deletes a team referenced by ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#delete-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-team
|
||||||
func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) {
|
func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -281,7 +281,7 @@ func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64)
|
||||||
|
|
||||||
// DeleteTeamBySlug deletes a team reference by slug.
|
// DeleteTeamBySlug deletes a team reference by slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#delete-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-team
|
||||||
func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) {
|
func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v", org, slug)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -294,7 +294,7 @@ func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (
|
||||||
|
|
||||||
// ListChildTeamsByParentID lists child teams for a parent team given parent ID.
|
// ListChildTeamsByParentID lists child teams for a parent team given parent ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-child-teams
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-child-teams
|
||||||
func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/teams", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/teams", orgID, teamID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -318,7 +318,7 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team
|
||||||
|
|
||||||
// ListChildTeamsByParentSlug lists child teams for a parent team given parent slug.
|
// ListChildTeamsByParentSlug lists child teams for a parent team given parent slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-child-teams
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-child-teams
|
||||||
func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/teams", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/teams", org, slug)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -342,7 +342,7 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug
|
||||||
|
|
||||||
// ListTeamReposByID lists the repositories given a team ID that the specified team has access to.
|
// ListTeamReposByID lists the repositories given a team ID that the specified team has access to.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-repositories
|
||||||
func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) {
|
func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/repos", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/repos", orgID, teamID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -370,7 +370,7 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6
|
||||||
|
|
||||||
// ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to.
|
// ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-repositories
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-repositories
|
||||||
func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) {
|
func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/repos", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/repos", org, slug)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -400,7 +400,7 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string
|
||||||
// repository is managed by team, a Repository is returned which includes the
|
// repository is managed by team, a Repository is returned which includes the
|
||||||
// permissions team has for that repo.
|
// permissions team has for that repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#check-team-permissions-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-repository
|
||||||
func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) {
|
func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -424,7 +424,7 @@ func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64,
|
||||||
// repository is managed by team, a Repository is returned which includes the
|
// repository is managed by team, a Repository is returned which includes the
|
||||||
// permissions team has for that repo.
|
// permissions team has for that repo.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#check-team-permissions-for-a-repository
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-repository
|
||||||
func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) {
|
func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -463,7 +463,7 @@ type TeamAddTeamRepoOptions struct {
|
||||||
// The specified repository must be owned by the organization to which the team
|
// The specified repository must be owned by the organization to which the team
|
||||||
// belongs, or a direct fork of a repository owned by the organization.
|
// belongs, or a direct fork of a repository owned by the organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-repository-permissions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-repository-permissions
|
||||||
func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) {
|
func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -478,7 +478,7 @@ func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64,
|
||||||
// The specified repository must be owned by the organization to which the team
|
// The specified repository must be owned by the organization to which the team
|
||||||
// belongs, or a direct fork of a repository owned by the organization.
|
// belongs, or a direct fork of a repository owned by the organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-repository-permissions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-repository-permissions
|
||||||
func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) {
|
func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -493,7 +493,7 @@ func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner,
|
||||||
// team given the team ID. Note that this does not delete the repository, it
|
// team given the team ID. Note that this does not delete the repository, it
|
||||||
// just removes it from the team.
|
// just removes it from the team.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#remove-a-repository-from-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-repository-from-a-team
|
||||||
func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) {
|
func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -508,7 +508,7 @@ func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int
|
||||||
// team given the team slug. Note that this does not delete the repository, it
|
// team given the team slug. Note that this does not delete the repository, it
|
||||||
// just removes it from the team.
|
// just removes it from the team.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#remove-a-repository-from-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-repository-from-a-team
|
||||||
func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) {
|
func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -520,7 +520,7 @@ func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owne
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListUserTeams lists a user's teams
|
// ListUserTeams lists a user's teams
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-teams-for-the-authenticated-user
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-teams-for-the-authenticated-user
|
||||||
func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) {
|
func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) {
|
||||||
u := "user/teams"
|
u := "user/teams"
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -544,7 +544,7 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]
|
||||||
|
|
||||||
// ListTeamProjectsByID lists the organization projects for a team given the team ID.
|
// ListTeamProjectsByID lists the organization projects for a team given the team ID.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-projects
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-projects
|
||||||
func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*Project, *Response, error) {
|
func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID)
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i
|
||||||
|
|
||||||
// ListTeamProjectsBySlug lists the organization projects for a team given the team slug.
|
// ListTeamProjectsBySlug lists the organization projects for a team given the team slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-projects
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-team-projects
|
||||||
func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*Project, *Response, error) {
|
func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug)
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str
|
||||||
// ReviewTeamProjectsByID checks whether a team, given its ID, has read, write, or admin
|
// ReviewTeamProjectsByID checks whether a team, given its ID, has read, write, or admin
|
||||||
// permissions for an organization project.
|
// permissions for an organization project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#check-team-permissions-for-a-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-project
|
||||||
func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*Project, *Response, error) {
|
func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -617,7 +617,7 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID
|
||||||
// ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin
|
// ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin
|
||||||
// permissions for an organization project.
|
// permissions for an organization project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#check-team-permissions-for-a-project
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#check-team-permissions-for-a-project
|
||||||
func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*Project, *Response, error) {
|
func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*Project, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -654,7 +654,7 @@ type TeamProjectOptions struct {
|
||||||
// To add a project to a team or update the team's permission on a project, the
|
// To add a project to a team or update the team's permission on a project, the
|
||||||
// authenticated user must have admin permissions for the project.
|
// authenticated user must have admin permissions for the project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-project-permissions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-project-permissions
|
||||||
func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) {
|
func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -673,7 +673,7 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr
|
||||||
// To add a project to a team or update the team's permission on a project, the
|
// To add a project to a team or update the team's permission on a project, the
|
||||||
// authenticated user must have admin permissions for the project.
|
// authenticated user must have admin permissions for the project.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-project-permissions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#add-or-update-team-project-permissions
|
||||||
func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) {
|
func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
||||||
req, err := s.client.NewRequest("PUT", u, opts)
|
req, err := s.client.NewRequest("PUT", u, opts)
|
||||||
|
@ -695,7 +695,7 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin
|
||||||
// or project.
|
// or project.
|
||||||
// Note: This endpoint removes the project from the team, but does not delete it.
|
// Note: This endpoint removes the project from the team, but does not delete it.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#remove-a-project-from-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-project-from-a-team
|
||||||
func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) {
|
func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -717,7 +717,7 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID,
|
||||||
// or project.
|
// or project.
|
||||||
// Note: This endpoint removes the project from the team, but does not delete it.
|
// Note: This endpoint removes the project from the team, but does not delete it.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/#remove-a-project-from-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#remove-a-project-from-a-team
|
||||||
func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) {
|
func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -746,7 +746,7 @@ type IDPGroup struct {
|
||||||
|
|
||||||
// ListIDPGroupsInOrganization lists IDP groups available in an organization.
|
// ListIDPGroupsInOrganization lists IDP groups available in an organization.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#list-idp-groups-for-an-organization
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-an-organization
|
||||||
func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListCursorOptions) (*IDPGroupList, *Response, error) {
|
func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListCursorOptions) (*IDPGroupList, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/team-sync/groups", org)
|
u := fmt.Sprintf("orgs/%v/team-sync/groups", org)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -770,7 +770,7 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri
|
||||||
// ListIDPGroupsForTeamByID lists IDP groups connected to a team on GitHub
|
// ListIDPGroupsForTeamByID lists IDP groups connected to a team on GitHub
|
||||||
// given organization and team IDs.
|
// given organization and team IDs.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#list-idp-groups-for-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-a-team
|
||||||
func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) {
|
func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID)
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, team
|
||||||
// ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub
|
// ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub
|
||||||
// given organization name and team slug.
|
// given organization name and team slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#list-idp-groups-for-a-team
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-idp-groups-for-a-team
|
||||||
func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) {
|
func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug)
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug
|
||||||
// CreateOrUpdateIDPGroupConnectionsByID creates, updates, or removes a connection
|
// CreateOrUpdateIDPGroupConnectionsByID creates, updates, or removes a connection
|
||||||
// between a team and an IDP group given organization and team IDs.
|
// between a team and an IDP group given organization and team IDs.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#create-or-update-idp-group-connections
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-or-update-idp-group-connections
|
||||||
func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) {
|
func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID)
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context
|
||||||
// CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection
|
// CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection
|
||||||
// between a team and an IDP group given organization name and team slug.
|
// between a team and an IDP group given organization name and team slug.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/team_sync/#create-or-update-idp-group-connections
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-or-update-idp-group-connections
|
||||||
func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) {
|
func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug)
|
||||||
|
|
|
@ -43,7 +43,7 @@ type DiscussionCommentListOptions struct {
|
||||||
// ListCommentsByID lists all comments on a team discussion by team ID.
|
// ListCommentsByID lists all comments on a team discussion by team ID.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#list-discussion-comments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussion-comments
|
||||||
func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) {
|
func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber)
|
||||||
u, err := addOptions(u, options)
|
u, err := addOptions(u, options)
|
||||||
|
@ -68,7 +68,7 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64
|
||||||
// ListCommentsBySlug lists all comments on a team discussion by team slug.
|
// ListCommentsBySlug lists all comments on a team discussion by team slug.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#list-discussion-comments
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussion-comments
|
||||||
func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) {
|
func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber)
|
||||||
u, err := addOptions(u, options)
|
u, err := addOptions(u, options)
|
||||||
|
@ -93,7 +93,7 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string,
|
||||||
// GetCommentByID gets a specific comment on a team discussion by team ID.
|
// GetCommentByID gets a specific comment on a team discussion by team ID.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#get-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion-comment
|
||||||
func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -113,7 +113,7 @@ func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64,
|
||||||
// GetCommentBySlug gets a specific comment on a team discussion by team slug.
|
// GetCommentBySlug gets a specific comment on a team discussion by team slug.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#get-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion-comment
|
||||||
func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d
|
||||||
// CreateCommentByID creates a new comment on a team discussion by team ID.
|
// CreateCommentByID creates a new comment on a team discussion by team ID.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#create-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion-comment
|
||||||
func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discsusionNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discsusionNumber)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -154,7 +154,7 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6
|
||||||
// CreateCommentBySlug creates a new comment on a team discussion by team slug.
|
// CreateCommentBySlug creates a new comment on a team discussion by team slug.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#create-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion-comment
|
||||||
func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discsusionNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discsusionNumber)
|
||||||
req, err := s.client.NewRequest("POST", u, comment)
|
req, err := s.client.NewRequest("POST", u, comment)
|
||||||
|
@ -175,7 +175,7 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
// User is allowed to edit body of a comment only.
|
// User is allowed to edit body of a comment only.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#update-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion-comment
|
||||||
func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -196,7 +196,7 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64,
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
// User is allowed to edit body of a comment only.
|
// User is allowed to edit body of a comment only.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#update-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion-comment
|
||||||
func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
||||||
req, err := s.client.NewRequest("PATCH", u, comment)
|
req, err := s.client.NewRequest("PATCH", u, comment)
|
||||||
|
@ -216,7 +216,7 @@ func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string,
|
||||||
// DeleteCommentByID deletes a comment on a team discussion by team ID.
|
// DeleteCommentByID deletes a comment on a team discussion by team ID.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#delete-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion-comment
|
||||||
func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) {
|
func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -230,7 +230,7 @@ func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int6
|
||||||
// DeleteCommentBySlug deletes a comment on a team discussion by team slug.
|
// DeleteCommentBySlug deletes a comment on a team discussion by team slug.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussion_comments/#delete-a-discussion-comment
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion-comment
|
||||||
func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) {
|
func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
|
@ -49,7 +49,7 @@ type DiscussionListOptions struct {
|
||||||
// ListDiscussionsByID lists all discussions on team's page given Organization and Team ID.
|
// ListDiscussionsByID lists all discussions on team's page given Organization and Team ID.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#list-discussions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussions
|
||||||
func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -74,7 +74,7 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in
|
||||||
// ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug.
|
// ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#list-discussions
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#list-discussions
|
||||||
func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug)
|
||||||
u, err := addOptions(u, opts)
|
u, err := addOptions(u, opts)
|
||||||
|
@ -99,7 +99,7 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri
|
||||||
// GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID.
|
// GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#get-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion
|
||||||
func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -119,7 +119,7 @@ func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int6
|
||||||
// GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug.
|
// GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug.
|
||||||
// Authenticated user must grant read:discussion scope.
|
// Authenticated user must grant read:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#get-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#get-a-discussion
|
||||||
func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest("GET", u, nil)
|
||||||
|
@ -139,7 +139,7 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string
|
||||||
// CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID.
|
// CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#create-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion
|
||||||
func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID)
|
||||||
req, err := s.client.NewRequest("POST", u, discussion)
|
req, err := s.client.NewRequest("POST", u, discussion)
|
||||||
|
@ -159,7 +159,7 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i
|
||||||
// CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug.
|
// CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#create-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#create-a-discussion
|
||||||
func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug)
|
||||||
req, err := s.client.NewRequest("POST", u, discussion)
|
req, err := s.client.NewRequest("POST", u, discussion)
|
||||||
|
@ -180,7 +180,7 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
// User is allowed to change Title and Body of a discussion only.
|
// User is allowed to change Title and Body of a discussion only.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#update-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion
|
||||||
func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
||||||
req, err := s.client.NewRequest("PATCH", u, discussion)
|
req, err := s.client.NewRequest("PATCH", u, discussion)
|
||||||
|
@ -201,7 +201,7 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
// User is allowed to change Title and Body of a discussion only.
|
// User is allowed to change Title and Body of a discussion only.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#update-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#update-a-discussion
|
||||||
func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
||||||
req, err := s.client.NewRequest("PATCH", u, discussion)
|
req, err := s.client.NewRequest("PATCH", u, discussion)
|
||||||
|
@ -221,7 +221,7 @@ func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug strin
|
||||||
// DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID.
|
// DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#delete-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion
|
||||||
func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) {
|
func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) {
|
||||||
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||||
|
@ -235,7 +235,7 @@ func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID i
|
||||||
// DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug.
|
// DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug.
|
||||||
// Authenticated user must grant write:discussion scope.
|
// Authenticated user must grant write:discussion scope.
|
||||||
//
|
//
|
||||||
// GitHub API docs: https://developer.github.com/v3/teams/discussions/#delete-a-discussion
|
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/teams/#delete-a-discussion
|
||||||
func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) {
|
func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) {
|
||||||
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest("DELETE", u, nil)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue