mirror of
https://github.com/documize/community.git
synced 2025-07-20 21:59:42 +02:00
Moved from Dep to Go Modules
We have finally dropped go dep and moved over to go mod ! During the move, some dependencies have been bumped.
This commit is contained in:
parent
2c164a135a
commit
b826852137
164 changed files with 18268 additions and 10658 deletions
118
vendor/github.com/google/go-github/github/repos.go
generated
vendored
118
vendor/github.com/google/go-github/github/repos.go
generated
vendored
|
@ -7,7 +7,6 @@ package github
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -21,6 +20,7 @@ type RepositoriesService service
|
|||
// Repository represents a GitHub repository.
|
||||
type Repository struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Owner *User `json:"owner,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FullName *string `json:"full_name,omitempty"`
|
||||
|
@ -179,7 +179,7 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opt *Reposi
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
|
@ -217,7 +217,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *Re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept headers when APIs fully launch.
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
var repos []*Repository
|
||||
|
@ -298,7 +298,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
|
|||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
acceptHeaders := []string{mediaTypeLicensesPreview, mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
|
||||
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
|
||||
|
||||
repository := new(Repository)
|
||||
|
@ -342,10 +342,6 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
// TODO: remove custom Accept header when the license support fully launches
|
||||
// https://developer.github.com/v3/licenses/#get-a-repositorys-license
|
||||
req.Header.Set("Accept", mediaTypeLicensesPreview)
|
||||
|
||||
repository := new(Repository)
|
||||
resp, err := s.client.Do(ctx, req, repository)
|
||||
if err != nil {
|
||||
|
@ -558,6 +554,12 @@ type RequiredStatusChecks struct {
|
|||
Contexts []string `json:"contexts"`
|
||||
}
|
||||
|
||||
// RequiredStatusChecksRequest represents a request to edit a protected branch's status checks.
|
||||
type RequiredStatusChecksRequest struct {
|
||||
Strict *bool `json:"strict,omitempty"`
|
||||
Contexts []string `json:"contexts,omitempty"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcement represents the pull request reviews enforcement of a protected branch.
|
||||
type PullRequestReviewsEnforcement struct {
|
||||
// Specifies which users and teams can dismiss pull request reviews.
|
||||
|
@ -566,45 +568,26 @@ type PullRequestReviewsEnforcement struct {
|
|||
DismissStaleReviews bool `json:"dismiss_stale_reviews"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1-6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcementRequest represents request to set the pull request review
|
||||
// enforcement of a protected branch. It is separate from PullRequestReviewsEnforcement above
|
||||
// because the request structure is different from the response structure.
|
||||
type PullRequestReviewsEnforcementRequest struct {
|
||||
// Specifies which users and teams should be allowed to dismiss pull request reviews. Can be nil to disable the restrictions.
|
||||
DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
|
||||
// Specifies which users and teams should be allowed to dismiss pull request reviews.
|
||||
// User and team dismissal restrictions are only available for
|
||||
// organization-owned repositories. Must be nil for personal repositories.
|
||||
DismissalRestrictionsRequest *DismissalRestrictionsRequest `json:"dismissal_restrictions,omitempty"`
|
||||
// Specifies if approved reviews can be dismissed automatically, when a new commit is pushed. (Required)
|
||||
DismissStaleReviews bool `json:"dismiss_stale_reviews"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews"`
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
// Converts nil value of PullRequestReviewsEnforcementRequest.DismissalRestrictionsRequest to empty array
|
||||
func (req PullRequestReviewsEnforcementRequest) MarshalJSON() ([]byte, error) {
|
||||
if req.DismissalRestrictionsRequest == nil {
|
||||
newReq := struct {
|
||||
R []interface{} `json:"dismissal_restrictions"`
|
||||
D bool `json:"dismiss_stale_reviews"`
|
||||
O bool `json:"require_code_owner_reviews"`
|
||||
}{
|
||||
R: []interface{}{},
|
||||
D: req.DismissStaleReviews,
|
||||
O: req.RequireCodeOwnerReviews,
|
||||
}
|
||||
return json.Marshal(newReq)
|
||||
}
|
||||
newReq := struct {
|
||||
R *DismissalRestrictionsRequest `json:"dismissal_restrictions"`
|
||||
D bool `json:"dismiss_stale_reviews"`
|
||||
O bool `json:"require_code_owner_reviews"`
|
||||
}{
|
||||
R: req.DismissalRestrictionsRequest,
|
||||
D: req.DismissStaleReviews,
|
||||
O: req.RequireCodeOwnerReviews,
|
||||
}
|
||||
return json.Marshal(newReq)
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1-6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// PullRequestReviewsEnforcementUpdate represents request to patch the pull request review
|
||||
|
@ -617,6 +600,9 @@ type PullRequestReviewsEnforcementUpdate struct {
|
|||
DismissStaleReviews *bool `json:"dismiss_stale_reviews,omitempty"`
|
||||
// RequireCodeOwnerReviews specifies if an approved review is required in pull requests including files with a designated code owner.
|
||||
RequireCodeOwnerReviews bool `json:"require_code_owner_reviews,omitempty"`
|
||||
// RequiredApprovingReviewCount specifies the number of approvals required before the pull request can be merged.
|
||||
// Valid values are 1 - 6.
|
||||
RequiredApprovingReviewCount int `json:"required_approving_review_count"`
|
||||
}
|
||||
|
||||
// AdminEnforcement represents the configuration to enforce required status checks for repository administrators.
|
||||
|
@ -657,11 +643,12 @@ type DismissalRestrictions struct {
|
|||
// restriction to allows only specific users or teams to dimiss pull request reviews. It is
|
||||
// separate from DismissalRestrictions above because the request structure is
|
||||
// different from the response structure.
|
||||
// Note: Both Users and Teams must be nil, or both must be non-nil.
|
||||
type DismissalRestrictionsRequest struct {
|
||||
// The list of user logins who can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
|
||||
Users []string `json:"users"`
|
||||
// The list of team slugs which can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
|
||||
Teams []string `json:"teams"`
|
||||
// The list of user logins who can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.)
|
||||
Users *[]string `json:"users,omitempty"`
|
||||
// The list of team slugs which can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.)
|
||||
Teams *[]string `json:"teams,omitempty"`
|
||||
}
|
||||
|
||||
// ListBranches lists branches for the specified repository.
|
||||
|
@ -680,7 +667,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
var branches []*Branch
|
||||
resp, err := s.client.Do(ctx, req, &branches)
|
||||
|
@ -702,7 +689,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
b := new(Branch)
|
||||
resp, err := s.client.Do(ctx, req, b)
|
||||
|
@ -724,7 +711,7 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(Protection)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -746,7 +733,7 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(RequiredStatusChecks)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -768,7 +755,7 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
resp, err = s.client.Do(ctx, req, &contexts)
|
||||
if err != nil {
|
||||
|
@ -789,7 +776,7 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
p := new(Protection)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
|
@ -811,11 +798,30 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// UpdateRequiredStatusChecks updates the required status checks for a given protected branch.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch
|
||||
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)
|
||||
req, err := s.client.NewRequest("PATCH", u, sreq)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sc := new(RequiredStatusChecks)
|
||||
resp, err := s.client.Do(ctx, req, sc)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return sc, resp, nil
|
||||
}
|
||||
|
||||
// License gets the contents of a repository's license if one is detected.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license
|
||||
|
@ -846,7 +852,7 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -869,7 +875,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -897,7 +903,7 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(PullRequestReviewsEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -919,7 +925,7 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
@ -935,7 +941,7 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(AdminEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -958,7 +964,7 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
r := new(AdminEnforcement)
|
||||
resp, err := s.client.Do(ctx, req, r)
|
||||
|
@ -980,7 +986,7 @@ func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner,
|
|||
}
|
||||
|
||||
// TODO: remove custom Accept header when this API fully launches
|
||||
req.Header.Set("Accept", mediaTypeProtectedBranchesPreview)
|
||||
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
@ -1043,7 +1049,7 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo
|
|||
// TransferRequest represents a request to transfer a repository.
|
||||
type TransferRequest struct {
|
||||
NewOwner string `json:"new_owner"`
|
||||
TeamID []int64 `json:"team_id,omitempty"`
|
||||
TeamID []int64 `json:"team_ids,omitempty"`
|
||||
}
|
||||
|
||||
// Transfer transfers a repository from one account or organization to another.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue