1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Switch from govendor to go modules. (#587)

Thanks to @BenoitKnecht for leading the way on this.
This commit is contained in:
Tom Limoncelli
2020-01-18 14:40:28 -05:00
committed by GitHub
parent 31188c3a70
commit 16d0043cce
1554 changed files with 400867 additions and 98222 deletions

View File

@ -19,7 +19,8 @@ type UsersService service
// User represents a GitHub user.
type User struct {
Login *string `json:"login,omitempty"`
ID *int `json:"id,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
AvatarURL *string `json:"avatar_url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
GravatarID *string `json:"gravatar_id,omitempty"`
@ -99,7 +100,7 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response,
// GetByID fetches a user.
//
// Note: GetByID uses the undocumented GitHub API endpoint /user/:id.
func (s *UsersService) GetByID(ctx context.Context, id int) (*User, *Response, error) {
func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) {
u := fmt.Sprintf("user/%d", id)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
@ -134,12 +135,65 @@ func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response,
return uResp, resp, nil
}
// HovercardOptions specifies optional parameters to the UsersService.GetHovercard
// method.
type HovercardOptions struct {
// SubjectType specifies the additional information to be received about the hovercard.
// Possible values are: organization, repository, issue, pull_request. (Required when using subject_id.)
SubjectType string `url:"subject_type"`
// SubjectID specifies the ID for the SubjectType. (Required when using subject_type.)
SubjectID string `url:"subject_id"`
}
// Hovercard represents hovercard information about a user.
type Hovercard struct {
Contexts []*UserContext `json:"contexts,omitempty"`
}
// UserContext represents the contextual information about user.
type UserContext struct {
Message *string `json:"message,omitempty"`
Octicon *string `json:"octicon,omitempty"`
}
// GetHovercard fetches contextual information about user. It requires authentication
// via Basic Auth or via OAuth with the repo scope.
//
// GitHub API docs: https://developer.github.com/v3/users/#get-contextual-information-about-a-user
func (s *UsersService) GetHovercard(ctx context.Context, user string, opt *HovercardOptions) (*Hovercard, *Response, error) {
u := fmt.Sprintf("users/%v/hovercard", user)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeHovercardPreview)
hc := new(Hovercard)
resp, err := s.client.Do(ctx, req, hc)
if err != nil {
return nil, resp, err
}
return hc, resp, nil
}
// UserListOptions specifies optional parameters to the UsersService.ListAll
// method.
type UserListOptions struct {
// ID of the last user seen
Since int `url:"since,omitempty"`
Since int64 `url:"since,omitempty"`
// Note: Pagination is powered exclusively by the Since parameter,
// ListOptions.Page has no effect.
// ListOptions.PerPage controls an undocumented GitHub API parameter.
ListOptions
}
@ -199,7 +253,7 @@ func (s *UsersService) ListInvitations(ctx context.Context, opt *ListOptions) ([
// authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation
func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int) (*Response, error) {
func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) {
u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
req, err := s.client.NewRequest("PATCH", u, nil)
if err != nil {
@ -216,7 +270,7 @@ func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int) (
// authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/repos/invitations/#decline-a-repository-invitation
func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int) (*Response, error) {
func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) {
u := fmt.Sprintf("user/repository_invitations/%v", invitationID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {