mirror of
https://github.com/documize/community.git
synced 2025-07-21 06:09:42 +02:00
go dep
Migrated from plain /vendor to go dep
This commit is contained in:
parent
0262763c95
commit
fd693f4ff4
957 changed files with 36866 additions and 177595 deletions
33
vendor/github.com/google/go-github/github/repos_invitations.go
generated
vendored
33
vendor/github.com/google/go-github/github/repos_invitations.go
generated
vendored
|
@ -5,11 +5,14 @@
|
|||
|
||||
package github
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// RepositoryInvitation represents an invitation to collaborate on a repo.
|
||||
type RepositoryInvitation struct {
|
||||
ID *int `json:"id,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Invitee *User `json:"invitee,omitempty"`
|
||||
Inviter *User `json:"inviter,omitempty"`
|
||||
|
@ -25,8 +28,8 @@ type RepositoryInvitation struct {
|
|||
// ListInvitations lists all currently-open repository invitations.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository
|
||||
func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
|
||||
u := fmt.Sprintf("repositories/%v/invitations", repoID)
|
||||
func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opt *ListOptions) ([]*RepositoryInvitation, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo)
|
||||
u, err := addOptions(u, opt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -41,19 +44,19 @@ func (s *RepositoriesService) ListInvitations(repoID int, opt *ListOptions) ([]*
|
|||
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||
|
||||
invites := []*RepositoryInvitation{}
|
||||
resp, err := s.client.Do(req, &invites)
|
||||
resp, err := s.client.Do(ctx, req, &invites)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return invites, resp, err
|
||||
return invites, resp, nil
|
||||
}
|
||||
|
||||
// DeleteInvitation deletes a repository invitation.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
|
||||
func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Response, error) {
|
||||
u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
|
||||
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)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -62,7 +65,7 @@ func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Respo
|
|||
// TODO: remove custom Accept header when this API fully launches.
|
||||
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||
|
||||
return s.client.Do(req, nil)
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// UpdateInvitation updates the permissions associated with a repository
|
||||
|
@ -72,11 +75,11 @@ func (s *RepositoriesService) DeleteInvitation(repoID, invitationID int) (*Respo
|
|||
// on the repository. Possible values are: "read", "write", "admin".
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
|
||||
func (s *RepositoriesService) UpdateInvitation(repoID, invitationID int, permissions string) (*RepositoryInvitation, *Response, error) {
|
||||
func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) {
|
||||
opts := &struct {
|
||||
Permissions string `json:"permissions"`
|
||||
}{Permissions: permissions}
|
||||
u := fmt.Sprintf("repositories/%v/invitations/%v", repoID, invitationID)
|
||||
u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID)
|
||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
@ -86,6 +89,10 @@ func (s *RepositoriesService) UpdateInvitation(repoID, invitationID int, permiss
|
|||
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
|
||||
|
||||
invite := &RepositoryInvitation{}
|
||||
resp, err := s.client.Do(req, invite)
|
||||
return invite, resp, err
|
||||
resp, err := s.client.Do(ctx, req, invite)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return invite, resp, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue