From de3d136a17c6e551b33302da89befc71657b9940 Mon Sep 17 00:00:00 2001 From: Kshitij Saraogi Date: Sat, 23 Dec 2017 15:49:04 +0530 Subject: [PATCH] Migrate IDs to int64 type In this commit, the complete migration of all the struct IDs(which refer to GitHub IDs) from platform dependent `int` type to the signed `int64` takes place. A helper function "Int64" is also implemented to assist the migration of unit tests. Refer #597 --- github/activity_events_test.go | 6 +- github/activity_star_test.go | 6 +- github/activity_watching_test.go | 6 +- github/admin.go | 6 +- github/admin_test.go | 4 +- github/apps.go | 6 +- github/apps_installation.go | 8 +- github/apps_installation_test.go | 6 +- github/apps_marketplace.go | 8 +- github/apps_marketplace_test.go | 12 +- github/apps_test.go | 8 +- github/authorizations.go | 14 +- github/authorizations_test.go | 22 +- github/event_types.go | 16 +- github/gists_comments.go | 8 +- github/gists_comments_test.go | 12 +- github/gists_test.go | 4 +- github/github-accessors.go | 532 +++++++++++----------- github/github.go | 4 + github/issues.go | 2 +- github/issues_assignees_test.go | 2 +- github/issues_comments.go | 2 +- github/issues_comments_test.go | 10 +- github/issues_events.go | 4 +- github/issues_events_test.go | 6 +- github/issues_labels.go | 2 +- github/issues_labels_test.go | 4 +- github/issues_milestones.go | 2 +- github/issues_timeline.go | 4 +- github/issues_timeline_test.go | 2 +- github/migrations.go | 10 +- github/migrations_source_import.go | 4 +- github/migrations_source_import_test.go | 6 +- github/migrations_test.go | 4 +- github/orgs.go | 4 +- github/orgs_hooks_test.go | 6 +- github/orgs_members_test.go | 8 +- github/orgs_outside_collaborators_test.go | 2 +- github/orgs_projects_test.go | 4 +- github/orgs_teams.go | 34 +- github/orgs_teams_test.go | 26 +- github/orgs_test.go | 12 +- github/projects.go | 42 +- github/projects_test.go | 20 +- github/pulls.go | 2 +- github/pulls_comments.go | 4 +- github/pulls_comments_test.go | 10 +- github/pulls_reviewers_test.go | 4 +- github/pulls_reviews.go | 12 +- github/pulls_reviews_test.go | 18 +- github/pulls_test.go | 4 +- github/reactions.go | 18 +- github/reactions_test.go | 16 +- github/repos.go | 14 +- github/repos_collaborators_test.go | 4 +- github/repos_comments.go | 8 +- github/repos_comments_test.go | 10 +- github/repos_deployments.go | 12 +- github/repos_deployments_test.go | 8 +- github/repos_forks_test.go | 4 +- github/repos_hooks.go | 12 +- github/repos_hooks_test.go | 8 +- github/repos_invitations.go | 6 +- github/repos_invitations_test.go | 4 +- github/repos_keys.go | 2 +- github/repos_keys_test.go | 8 +- github/repos_pages.go | 2 +- github/repos_projects_test.go | 4 +- github/repos_releases.go | 22 +- github/repos_releases_test.go | 20 +- github/repos_stats_test.go | 2 +- github/repos_statuses.go | 2 +- github/repos_statuses_test.go | 6 +- github/repos_test.go | 48 +- github/search_test.go | 4 +- github/strings_test.go | 36 +- github/users.go | 10 +- github/users_followers_test.go | 8 +- github/users_gpg_keys.go | 8 +- github/users_gpg_keys_test.go | 8 +- github/users_keys.go | 6 +- github/users_keys_test.go | 8 +- github/users_test.go | 14 +- 83 files changed, 655 insertions(+), 651 deletions(-) diff --git a/github/activity_events_test.go b/github/activity_events_test.go index dc92a98394c..0b01c4a02f2 100644 --- a/github/activity_events_test.go +++ b/github/activity_events_test.go @@ -88,7 +88,7 @@ func TestActivityService_ListIssueEventsForRepository(t *testing.T) { t.Errorf("Activities.ListIssueEventsForRepository returned error: %v", err) } - want := []*IssueEvent{{ID: Int(1)}, {ID: Int(2)}} + want := []*IssueEvent{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(events, want) { t.Errorf("Activities.ListIssueEventsForRepository returned %+v, want %+v", events, want) } @@ -301,7 +301,7 @@ func TestActivityService_EventParsePayload_typed(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PushEvent{PushID: Int(1)} + want := &PushEvent{PushID: Int64(1)} got, err := event.ParsePayload() if err != nil { t.Fatalf("ParsePayload returned unexpected error: %v", err) @@ -338,7 +338,7 @@ func TestActivityService_EventParsePayload_installation(t *testing.T) { t.Fatalf("Unmarshal Event returned error: %v", err) } - want := &PullRequestEvent{Installation: &Installation{ID: Int(1)}} + want := &PullRequestEvent{Installation: &Installation{ID: Int64(1)}} got, err := event.ParsePayload() if err != nil { t.Fatalf("ParsePayload returned unexpected error: %v", err) diff --git a/github/activity_star_test.go b/github/activity_star_test.go index 16ae695b3f5..80523f8ec3d 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -33,7 +33,7 @@ func TestActivityService_ListStargazers(t *testing.T) { t.Errorf("Activity.ListStargazers returned error: %v", err) } - want := []*Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Int(1)}}} + want := []*Stargazer{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, User: &User{ID: Int64(1)}}} if !reflect.DeepEqual(stargazers, want) { t.Errorf("Activity.ListStargazers returned %+v, want %+v", stargazers, want) } @@ -54,7 +54,7 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(1)}}} + want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int64(1)}}} if !reflect.DeepEqual(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } @@ -81,7 +81,7 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) { t.Errorf("Activity.ListStarred returned error: %v", err) } - want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int(2)}}} + want := []*StarredRepository{{StarredAt: &Timestamp{time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)}, Repository: &Repository{ID: Int64(2)}}} if !reflect.DeepEqual(repos, want) { t.Errorf("Activity.ListStarred returned %+v, want %+v", repos, want) } diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index d3d0d9697de..b017d8d59e5 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -32,7 +32,7 @@ func TestActivityService_ListWatchers(t *testing.T) { t.Errorf("Activity.ListWatchers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(watchers, want) { t.Errorf("Activity.ListWatchers returned %+v, want %+v", watchers, want) } @@ -55,7 +55,7 @@ func TestActivityService_ListWatched_authenticatedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } @@ -78,7 +78,7 @@ func TestActivityService_ListWatched_specifiedUser(t *testing.T) { t.Errorf("Activity.ListWatched returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(watched, want) { t.Errorf("Activity.ListWatched returned %+v, want %+v", watched, want) } diff --git a/github/admin.go b/github/admin.go index d0f055bcfa2..2d96733a1c7 100644 --- a/github/admin.go +++ b/github/admin.go @@ -19,7 +19,7 @@ type AdminService service // TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. type TeamLDAPMapping struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` LDAPDN *string `json:"ldap_dn,omitempty"` URL *string `json:"url,omitempty"` Name *string `json:"name,omitempty"` @@ -38,7 +38,7 @@ func (m TeamLDAPMapping) String() string { // UserLDAPMapping represents the mapping between a GitHub user and an LDAP user. type UserLDAPMapping struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` LDAPDN *string `json:"ldap_dn,omitempty"` Login *string `json:"login,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` @@ -84,7 +84,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // 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 -func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int, 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) req, err := s.client.NewRequest("PATCH", u, mapping) if err != nil { diff --git a/github/admin_test.go b/github/admin_test.go index 0e693a736a0..8979686f124 100644 --- a/github/admin_test.go +++ b/github/admin_test.go @@ -39,7 +39,7 @@ func TestAdminService_UpdateUserLDAPMapping(t *testing.T) { } want := &UserLDAPMapping{ - ID: Int(1), + ID: Int64(1), LDAPDN: String("uid=asdf,ou=users,dc=github,dc=com"), } if !reflect.DeepEqual(mapping, want) { @@ -72,7 +72,7 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { } want := &TeamLDAPMapping{ - ID: Int(1), + ID: Int64(1), LDAPDN: String("cn=Enterprise Ops,ou=teams,dc=github,dc=com"), } if !reflect.DeepEqual(mapping, want) { diff --git a/github/apps.go b/github/apps.go index a83ea7c2ecb..740642e62f6 100644 --- a/github/apps.go +++ b/github/apps.go @@ -19,7 +19,7 @@ type AppsService service // App represents a GitHub App. type App struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` @@ -97,7 +97,7 @@ func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) ( // GetInstallation returns the specified installation. // // GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation -func (s *AppsService) GetInstallation(ctx context.Context, id int) (*Installation, *Response, error) { +func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { u := fmt.Sprintf("app/installations/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -148,7 +148,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opt *ListOption // CreateInstallationToken creates a new installation token. // // GitHub API docs: https://developer.github.com/v3/apps/#create-a-new-installation-token -func (s *AppsService) CreateInstallationToken(ctx context.Context, id int) (*InstallationToken, *Response, error) { +func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*InstallationToken, *Response, error) { u := fmt.Sprintf("installations/%v/access_tokens", id) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/apps_installation.go b/github/apps_installation.go index 184fa0548ca..af85cb87f19 100644 --- a/github/apps_installation.go +++ b/github/apps_installation.go @@ -12,7 +12,7 @@ import ( // Installation represents a GitHub Apps installation. type Installation struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Account *User `json:"account,omitempty"` AccessTokensURL *string `json:"access_tokens_url,omitempty"` RepositoriesURL *string `json:"repositories_url,omitempty"` @@ -55,7 +55,7 @@ func (s *AppsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repos // to the authenticated user for an installation. // // GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation -func (s *AppsService) ListUserRepos(ctx context.Context, id int, opt *ListOptions) ([]*Repository, *Response, error) { +func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opt *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories", id) u, err := addOptions(u, opt) if err != nil { @@ -84,7 +84,7 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int, opt *ListOption // AddRepository adds a single repository to an installation. // // GitHub API docs: https://developer.github.com/v3/apps/installations/#add-repository-to-installation -func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int) (*Repository, *Response, error) { +func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("PUT", u, nil) if err != nil { @@ -103,7 +103,7 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int) (*R // RemoveRepository removes a single repository from an installation. // // GitHub docs: https://developer.github.com/v3/apps/installations/#remove-repository-from-installation -func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int) (*Response, error) { +func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { u := fmt.Sprintf("apps/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go index f3950ebc1d0..01358c00e7a 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -33,7 +33,7 @@ func TestAppsService_ListRepos(t *testing.T) { t.Errorf("Apps.ListRepos returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repositories, want) { t.Errorf("Apps.ListRepos returned %+v, want %+v", repositories, want) } @@ -59,7 +59,7 @@ func TestAppsService_ListUserRepos(t *testing.T) { t.Errorf("Apps.ListUserRepos returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repositories, want) { t.Errorf("Apps.ListUserRepos returned %+v, want %+v", repositories, want) } @@ -79,7 +79,7 @@ func TestAppsService_AddRepository(t *testing.T) { t.Errorf("Apps.AddRepository returned error: %v", err) } - want := &Repository{ID: Int(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} + want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} if !reflect.DeepEqual(repo, want) { t.Errorf("AddRepository returned %+v, want %+v", repo, want) } diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index d3e689a146d..089cdbf7ee1 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -29,7 +29,7 @@ type MarketplaceService struct { type MarketplacePlan struct { URL *string `json:"url,omitempty"` AccountsURL *string `json:"accounts_url,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"` @@ -52,7 +52,7 @@ type MarketplacePurchase struct { type MarketplacePlanAccount struct { URL *string `json:"url,omitempty"` Type *string `json:"type,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Login *string `json:"login,omitempty"` Email *string `json:"email,omitempty"` OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"` @@ -89,7 +89,7 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([ // 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 -func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { +func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID)) u, err := addOptions(uri, opt) if err != nil { @@ -116,7 +116,7 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID // 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 -func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { +func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, accountID int64, opt *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) u, err := addOptions(uri, opt) if err != nil { diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index 59c6b318222..91f133a3b79 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -34,7 +34,7 @@ func TestMarketplaceService_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans returned error: %v", err) } - want := []*MarketplacePlan{{ID: Int(1)}} + want := []*MarketplacePlan{{ID: Int64(1)}} if !reflect.DeepEqual(plans, want) { t.Errorf("Marketplace.ListPlans returned %+v, want %+v", plans, want) } @@ -57,7 +57,7 @@ func TestMarketplaceService_Stubbed_ListPlans(t *testing.T) { t.Errorf("Marketplace.ListPlans (Stubbed) returned error: %v", err) } - want := []*MarketplacePlan{{ID: Int(1)}} + want := []*MarketplacePlan{{ID: Int64(1)}} if !reflect.DeepEqual(plans, want) { t.Errorf("Marketplace.ListPlans (Stubbed) returned %+v, want %+v", plans, want) } @@ -80,7 +80,7 @@ func TestMarketplaceService_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int(1)}} + want := []*MarketplacePlanAccount{{ID: Int64(1)}} if !reflect.DeepEqual(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan returned %+v, want %+v", accounts, want) } @@ -103,7 +103,7 @@ func TestMarketplaceService_Stubbed_ListPlanAccountsForPlan(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int(1)}} + want := []*MarketplacePlanAccount{{ID: Int64(1)}} if !reflect.DeepEqual(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForPlan (Stubbed) returned %+v, want %+v", accounts, want) } @@ -126,7 +126,7 @@ func TestMarketplaceService_ListPlanAccountsForAccount(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForAccount returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int(1)}} + want := []*MarketplacePlanAccount{{ID: Int64(1)}} if !reflect.DeepEqual(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForAccount returned %+v, want %+v", accounts, want) } @@ -149,7 +149,7 @@ func TestMarketplaceService_Stubbed_ListPlanAccountsForAccount(t *testing.T) { t.Errorf("Marketplace.ListPlanAccountsForAccount (Stubbed) returned error: %v", err) } - want := []*MarketplacePlanAccount{{ID: Int(1)}} + want := []*MarketplacePlanAccount{{ID: Int64(1)}} if !reflect.DeepEqual(accounts, want) { t.Errorf("Marketplace.ListPlanAccountsForAccount (Stubbed) returned %+v, want %+v", accounts, want) } diff --git a/github/apps_test.go b/github/apps_test.go index 2a080964792..f306e1a99df 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -28,7 +28,7 @@ func TestAppsService_Get_authenticatedApp(t *testing.T) { t.Errorf("Apps.Get returned error: %v", err) } - want := &App{ID: Int(1)} + want := &App{ID: Int64(1)} if !reflect.DeepEqual(app, want) { t.Errorf("Apps.Get returned %+v, want %+v", app, want) } @@ -75,7 +75,7 @@ func TestAppsService_ListInstallations(t *testing.T) { t.Errorf("Apps.ListInstallations returned error: %v", err) } - want := []*Installation{{ID: Int(1)}} + want := []*Installation{{ID: Int64(1)}} if !reflect.DeepEqual(installations, want) { t.Errorf("Apps.ListInstallations returned %+v, want %+v", installations, want) } @@ -96,7 +96,7 @@ func TestAppsService_GetInstallation(t *testing.T) { t.Errorf("Apps.GetInstallation returned error: %v", err) } - want := &Installation{ID: Int(1)} + want := &Installation{ID: Int64(1)} if !reflect.DeepEqual(installation, want) { t.Errorf("Apps.GetInstallation returned %+v, want %+v", installation, want) } @@ -122,7 +122,7 @@ func TestAppsService_ListUserInstallations(t *testing.T) { t.Errorf("Apps.ListUserInstallations returned error: %v", err) } - want := []*Installation{{ID: Int(1)}} + want := []*Installation{{ID: Int64(1)}} if !reflect.DeepEqual(installations, want) { t.Errorf("Apps.ListUserInstallations returned %+v, want %+v", installations, want) } diff --git a/github/authorizations.go b/github/authorizations.go index 638745ac1de..190205b02ac 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -54,7 +54,7 @@ type AuthorizationsService service // Authorization represents an individual GitHub authorization. type Authorization struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Scopes []Scope `json:"scopes,omitempty"` Token *string `json:"token,omitempty"` @@ -88,7 +88,7 @@ func (a AuthorizationApp) String() string { // Grant represents an OAuth application that has been granted access to an account. type Grant struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` App *AuthorizationApp `json:"app,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` @@ -160,7 +160,7 @@ func (s *AuthorizationsService) List(ctx context.Context, opt *ListOptions) ([]* // Get a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization -func (s *AuthorizationsService) Get(ctx context.Context, id int) (*Authorization, *Response, error) { +func (s *AuthorizationsService) Get(ctx context.Context, id int64) (*Authorization, *Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("GET", u, nil) @@ -234,7 +234,7 @@ func (s *AuthorizationsService) GetOrCreateForApp(ctx context.Context, clientID // Edit a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization -func (s *AuthorizationsService) Edit(ctx context.Context, id int, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) { +func (s *AuthorizationsService) Edit(ctx context.Context, id int64, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("PATCH", u, auth) @@ -254,7 +254,7 @@ func (s *AuthorizationsService) Edit(ctx context.Context, id int, auth *Authoriz // Delete a single authorization. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization -func (s *AuthorizationsService) Delete(ctx context.Context, id int) (*Response, error) { +func (s *AuthorizationsService) Delete(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("authorizations/%d", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -366,7 +366,7 @@ func (s *AuthorizationsService) ListGrants(ctx context.Context, opt *ListOptions // GetGrant gets a single OAuth application grant. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant -func (s *AuthorizationsService) GetGrant(ctx context.Context, id int) (*Grant, *Response, error) { +func (s *AuthorizationsService) GetGrant(ctx context.Context, id int64) (*Grant, *Response, error) { u := fmt.Sprintf("applications/grants/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -387,7 +387,7 @@ func (s *AuthorizationsService) GetGrant(ctx context.Context, id int) (*Grant, * // the user. // // GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant -func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int) (*Response, error) { +func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("applications/grants/%d", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/github/authorizations_test.go b/github/authorizations_test.go index fc39c199953..faf25749cdc 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -30,7 +30,7 @@ func TestAuthorizationsService_List(t *testing.T) { t.Errorf("Authorizations.List returned error: %v", err) } - want := []*Authorization{{ID: Int(1)}} + want := []*Authorization{{ID: Int64(1)}} if !reflect.DeepEqual(got, want) { t.Errorf("Authorizations.List returned %+v, want %+v", *got[0].ID, *want[0].ID) } @@ -50,7 +50,7 @@ func TestAuthorizationsService_Get(t *testing.T) { t.Errorf("Authorizations.Get returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorizations.Get returned auth %+v, want %+v", got, want) } @@ -81,7 +81,7 @@ func TestAuthorizationsService_Create(t *testing.T) { t.Errorf("Authorizations.Create returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorization.Create returned %+v, want %+v", got, want) } @@ -112,7 +112,7 @@ func TestAuthorizationsService_GetOrCreateForApp(t *testing.T) { t.Errorf("Authorizations.GetOrCreateForApp returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorization.GetOrCreateForApp returned %+v, want %+v", got, want) } @@ -144,7 +144,7 @@ func TestAuthorizationsService_GetOrCreateForApp_Fingerprint(t *testing.T) { t.Errorf("Authorizations.GetOrCreateForApp returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorization.GetOrCreateForApp returned %+v, want %+v", got, want) } @@ -175,7 +175,7 @@ func TestAuthorizationsService_Edit(t *testing.T) { t.Errorf("Authorizations.Edit returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorization.Update returned %+v, want %+v", got, want) } @@ -210,7 +210,7 @@ func TestAuthorizationsService_Check(t *testing.T) { t.Errorf("Authorizations.Check returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorizations.Check returned auth %+v, want %+v", got, want) } @@ -230,7 +230,7 @@ func TestAuthorizationsService_Reset(t *testing.T) { t.Errorf("Authorizations.Reset returned error: %v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorizations.Reset returned auth %+v, want %+v", got, want) } @@ -265,7 +265,7 @@ func TestListGrants(t *testing.T) { t.Errorf("OAuthAuthorizations.ListGrants returned error: %v", err) } - want := []*Grant{{ID: Int(1)}} + want := []*Grant{{ID: Int64(1)}} if !reflect.DeepEqual(got, want) { t.Errorf("OAuthAuthorizations.ListGrants = %+v, want %+v", got, want) } @@ -303,7 +303,7 @@ func TestGetGrant(t *testing.T) { t.Errorf("OAuthAuthorizations.GetGrant returned error: %v", err) } - want := &Grant{ID: Int(1)} + want := &Grant{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("OAuthAuthorizations.GetGrant = %+v, want %+v", got, want) } @@ -338,7 +338,7 @@ func TestAuthorizationsService_CreateImpersonation(t *testing.T) { t.Errorf("Authorizations.CreateImpersonation returned error: %+v", err) } - want := &Authorization{ID: Int(1)} + want := &Authorization{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Authorizations.CreateImpersonation returned %+v, want %+v", *got.ID, *want.ID) } diff --git a/github/event_types.go b/github/event_types.go index 976b250af30..cba19328763 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -392,7 +392,7 @@ type PageBuildEvent struct { Build *PagesBuild `json:"build,omitempty"` // The following fields are only populated by Webhook events. - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` @@ -405,7 +405,7 @@ type PingEvent struct { // Random string of GitHub zen. Zen *string `json:"zen,omitempty"` // The ID of the webhook that triggered the ping. - HookID *int `json:"hook_id,omitempty"` + HookID *int64 `json:"hook_id,omitempty"` // The webhook configuration. Hook *Hook `json:"hook,omitempty"` Installation *Installation `json:"installation,omitempty"` @@ -434,7 +434,7 @@ type ProjectEvent struct { type ProjectCardEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectCardChange `json:"changes,omitempty"` - AfterID *int `json:"after_id,omitempty"` + AfterID *int64 `json:"after_id,omitempty"` ProjectCard *ProjectCard `json:"project_card,omitempty"` // The following fields are only populated by Webhook events. @@ -451,7 +451,7 @@ type ProjectCardEvent struct { type ProjectColumnEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectColumnChange `json:"changes,omitempty"` - AfterID *int `json:"after_id,omitempty"` + AfterID *int64 `json:"after_id,omitempty"` ProjectColumn *ProjectColumn `json:"project_column,omitempty"` // The following fields are only populated by Webhook events. @@ -486,7 +486,7 @@ type PullRequestEvent struct { // the pull request was closed with unmerged commits. If the action is "closed" // and the merged key is true, the pull request was merged. Action *string `json:"action,omitempty"` - Number *int `json:"number,omitempty"` + Number *int64 `json:"number,omitempty"` PullRequest *PullRequest `json:"pull_request,omitempty"` // The following fields are only populated by Webhook events. @@ -541,7 +541,7 @@ type PullRequestReviewCommentEvent struct { // // GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent type PushEvent struct { - PushID *int `json:"push_id,omitempty"` + PushID *int64 `json:"push_id,omitempty"` Head *string `json:"head,omitempty"` Ref *string `json:"ref,omitempty"` Size *int `json:"size,omitempty"` @@ -593,7 +593,7 @@ func (p PushEventCommit) String() string { // PushEventRepository represents the repo object in a PushEvent payload. type PushEventRepository struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` FullName *string `json:"full_name,omitempty"` Owner *PushEventRepoOwner `json:"owner,omitempty"` @@ -683,7 +683,7 @@ type StatusEvent struct { Branches []*Branch `json:"branches,omitempty"` // The following fields are only populated by Webhook events. - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Context *string `json:"context,omitempty"` Commit *RepositoryCommit `json:"commit,omitempty"` diff --git a/github/gists_comments.go b/github/gists_comments.go index 2d0722375e0..d5322e3d852 100644 --- a/github/gists_comments.go +++ b/github/gists_comments.go @@ -13,7 +13,7 @@ import ( // GistComment represents a Gist comment. type GistComment struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` @@ -51,7 +51,7 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opt *Lis // GetComment retrieves a single comment from a gist. // // GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-single-comment -func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int) (*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) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -89,7 +89,7 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment // EditComment edits an existing gist comment. // // GitHub API docs: https://developer.github.com/v3/gists/comments/#edit-a-comment -func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int, 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) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { @@ -108,7 +108,7 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID // DeleteComment deletes a gist comment. // // GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-comment -func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int) (*Response, error) { +func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index 5b8026f784e..d2f5a9534c7 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -30,7 +30,7 @@ func TestGistsService_ListComments(t *testing.T) { t.Errorf("Gists.Comments returned error: %v", err) } - want := []*GistComment{{ID: Int(1)}} + want := []*GistComment{{ID: Int64(1)}} if !reflect.DeepEqual(comments, want) { t.Errorf("Gists.ListComments returned %+v, want %+v", comments, want) } @@ -58,7 +58,7 @@ func TestGistsService_GetComment(t *testing.T) { t.Errorf("Gists.GetComment returned error: %v", err) } - want := &GistComment{ID: Int(1)} + want := &GistComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Gists.GetComment returned %+v, want %+v", comment, want) } @@ -76,7 +76,7 @@ func TestGistsService_CreateComment(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - input := &GistComment{ID: Int(1), Body: String("b")} + input := &GistComment{ID: Int64(1), Body: String("b")} mux.HandleFunc("/gists/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) @@ -95,7 +95,7 @@ func TestGistsService_CreateComment(t *testing.T) { t.Errorf("Gists.CreateComment returned error: %v", err) } - want := &GistComment{ID: Int(1)} + want := &GistComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Gists.CreateComment returned %+v, want %+v", comment, want) } @@ -113,7 +113,7 @@ func TestGistsService_EditComment(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - input := &GistComment{ID: Int(1), Body: String("b")} + input := &GistComment{ID: Int64(1), Body: String("b")} mux.HandleFunc("/gists/1/comments/2", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) @@ -132,7 +132,7 @@ func TestGistsService_EditComment(t *testing.T) { t.Errorf("Gists.EditComment returned error: %v", err) } - want := &GistComment{ID: Int(1)} + want := &GistComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Gists.EditComment returned %+v, want %+v", comment, want) } diff --git a/github/gists_test.go b/github/gists_test.go index 45ff9954b6a..935b47f8c98 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -328,7 +328,7 @@ func TestGistsService_ListCommits(t *testing.T) { want := []*GistCommit{{ URL: String("https://api.github.com/gists/1/1"), Version: String("1"), - User: &User{ID: Int(1)}, + User: &User{ID: Int64(1)}, CommittedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)}, ChangeStatus: &CommitStats{ Additions: Int(180), @@ -516,7 +516,7 @@ func TestGistsService_ListForks(t *testing.T) { want := []*GistFork{{ URL: String("https://api.github.com/gists/1"), ID: String("1"), - User: &User{ID: Int(1)}, + User: &User{ID: Int64(1)}, CreatedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2013, 1, 1, 00, 00, 00, 0, time.UTC)}}} diff --git a/github/github-accessors.go b/github/github-accessors.go index cc696325dd9..d2b867ff607 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -148,12 +148,12 @@ func (a *App) GetHTMLURL() string { return *a.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *App) GetID() int { - if a == nil || a.ID == nil { - return 0 +// GetID returns the ID field. +func (a *App) GetID() *int64 { + if a == nil { + return nil } - return *a.ID + return a.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -212,12 +212,12 @@ func (a *Authorization) GetHashedToken() string { return *a.HashedToken } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Authorization) GetID() int { - if a == nil || a.ID == nil { - return 0 +// GetID returns the ID field. +func (a *Authorization) GetID() *int64 { + if a == nil { + return nil } - return *a.ID + return a.ID } // GetNote returns the Note field if it's non-nil, zero value otherwise. @@ -1148,12 +1148,12 @@ func (c *Contributor) GetHTMLURL() string { return *c.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetID() int { - if c == nil || c.ID == nil { - return 0 +// GetID returns the ID field. +func (c *Contributor) GetID() *int64 { + if c == nil { + return nil } - return *c.ID + return c.ID } // GetLogin returns the Login field if it's non-nil, zero value otherwise. @@ -1388,12 +1388,12 @@ func (d *Deployment) GetEnvironment() string { return *d.Environment } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *Deployment) GetID() int { - if d == nil || d.ID == nil { - return 0 +// GetID returns the ID field. +func (d *Deployment) GetID() *int64 { + if d == nil { + return nil } - return *d.ID + return d.ID } // GetRef returns the Ref field if it's non-nil, zero value otherwise. @@ -1588,12 +1588,12 @@ func (d *DeploymentStatus) GetDescription() string { return *d.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetID() int { - if d == nil || d.ID == nil { - return 0 +// GetID returns the ID field. +func (d *DeploymentStatus) GetID() *int64 { + if d == nil { + return nil } - return *d.ID + return d.ID } // GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. @@ -1988,12 +1988,12 @@ func (g *GistComment) GetCreatedAt() time.Time { return *g.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistComment) GetID() int { - if g == nil || g.ID == nil { - return 0 +// GetID returns the ID field. +func (g *GistComment) GetID() *int64 { + if g == nil { + return nil } - return *g.ID + return g.ID } // GetURL returns the URL field if it's non-nil, zero value otherwise. @@ -2292,12 +2292,12 @@ func (g *GPGKey) GetExpiresAt() time.Time { return *g.ExpiresAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetID() int { - if g == nil || g.ID == nil { - return 0 +// GetID returns the ID field. +func (g *GPGKey) GetID() *int64 { + if g == nil { + return nil } - return *g.ID + return g.ID } // GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. @@ -2308,12 +2308,12 @@ func (g *GPGKey) GetKeyID() string { return *g.KeyID } -// GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetPrimaryKeyID() int { - if g == nil || g.PrimaryKeyID == nil { - return 0 +// GetPrimaryKeyID returns the PrimaryKeyID field. +func (g *GPGKey) GetPrimaryKeyID() *int64 { + if g == nil { + return nil } - return *g.PrimaryKeyID + return g.PrimaryKeyID } // GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise. @@ -2340,12 +2340,12 @@ func (g *Grant) GetCreatedAt() Timestamp { return *g.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Grant) GetID() int { - if g == nil || g.ID == nil { - return 0 +// GetID returns the ID field. +func (g *Grant) GetID() *int64 { + if g == nil { + return nil } - return *g.ID + return g.ID } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. @@ -2380,12 +2380,12 @@ func (h *Hook) GetCreatedAt() time.Time { return *h.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *Hook) GetID() int { - if h == nil || h.ID == nil { - return 0 +// GetID returns the ID field. +func (h *Hook) GetID() *int64 { + if h == nil { + return nil } - return *h.ID + return h.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -2636,12 +2636,12 @@ func (i *Installation) GetHTMLURL() string { return *i.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Installation) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetID returns the ID field. +func (i *Installation) GetID() *int64 { + if i == nil { + return nil } - return *i.ID + return i.ID } // GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. @@ -2740,12 +2740,12 @@ func (i *Invitation) GetEmail() string { return *i.Email } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetID returns the ID field. +func (i *Invitation) GetID() *int64 { + if i == nil { + return nil } - return *i.ID + return i.ID } // GetInviter returns the Inviter field. @@ -2844,12 +2844,12 @@ func (i *Issue) GetHTMLURL() string { return *i.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Issue) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetID returns the ID field. +func (i *Issue) GetID() *int64 { + if i == nil { + return nil } - return *i.ID + return i.ID } // GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. @@ -2980,12 +2980,12 @@ func (i *IssueComment) GetHTMLURL() string { return *i.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetID returns the ID field. +func (i *IssueComment) GetID() *int64 { + if i == nil { + return nil } - return *i.ID + return i.ID } // GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. @@ -3132,12 +3132,12 @@ func (i *IssueEvent) GetEvent() string { return *i.Event } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetID returns the ID field. +func (i *IssueEvent) GetID() *int64 { + if i == nil { + return nil } - return *i.ID + return i.ID } // GetIssue returns the Issue field. @@ -3340,12 +3340,12 @@ func (i *IssueStats) GetTotalIssues() int { return *i.TotalIssues } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (k *Key) GetID() int { - if k == nil || k.ID == nil { - return 0 +// GetID returns the ID field. +func (k *Key) GetID() *int64 { + if k == nil { + return nil } - return *k.ID + return k.ID } // GetKey returns the Key field if it's non-nil, zero value otherwise. @@ -3388,12 +3388,12 @@ func (l *Label) GetColor() string { return *l.Color } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *Label) GetID() int { - if l == nil || l.ID == nil { - return 0 +// GetID returns the ID field. +func (l *Label) GetID() *int64 { + if l == nil { + return nil } - return *l.ID + return l.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -3612,12 +3612,12 @@ func (m *MarketplacePlan) GetDescription() string { return *m.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetID() int { - if m == nil || m.ID == nil { - return 0 +// GetID returns the ID field. +func (m *MarketplacePlan) GetID() *int64 { + if m == nil { + return nil } - return *m.ID + return m.ID } // GetMonthlyPriceInCents returns the MonthlyPriceInCents field if it's non-nil, zero value otherwise. @@ -3676,12 +3676,12 @@ func (m *MarketplacePlanAccount) GetEmail() string { return *m.Email } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetID() int { - if m == nil || m.ID == nil { - return 0 +// GetID returns the ID field. +func (m *MarketplacePlanAccount) GetID() *int64 { + if m == nil { + return nil } - return *m.ID + return m.ID } // GetLogin returns the Login field if it's non-nil, zero value otherwise. @@ -4020,12 +4020,12 @@ func (m *Migration) GetGUID() string { return *m.GUID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Migration) GetID() int { - if m == nil || m.ID == nil { - return 0 +// GetID returns the ID field. +func (m *Migration) GetID() *int64 { + if m == nil { + return nil } - return *m.ID + return m.ID } // GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. @@ -4116,12 +4116,12 @@ func (m *Milestone) GetHTMLURL() string { return *m.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Milestone) GetID() int { - if m == nil || m.ID == nil { - return 0 +// GetID returns the ID field. +func (m *Milestone) GetID() *int64 { + if m == nil { + return nil } - return *m.ID + return m.ID } // GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. @@ -4324,12 +4324,12 @@ func (n *NewTeam) GetLDAPDN() string { return *n.LDAPDN } -// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetParentTeamID() int { - if n == nil || n.ParentTeamID == nil { - return 0 +// GetParentTeamID returns the ParentTeamID field. +func (n *NewTeam) GetParentTeamID() *int64 { + if n == nil { + return nil } - return *n.ParentTeamID + return n.ParentTeamID } // GetPermission returns the Permission field if it's non-nil, zero value otherwise. @@ -4556,12 +4556,12 @@ func (o *Organization) GetHTMLURL() string { return *o.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (o *Organization) GetID() int { - if o == nil || o.ID == nil { - return 0 +// GetID returns the ID field. +func (o *Organization) GetID() *int64 { + if o == nil { + return nil } - return *o.ID + return o.ID } // GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. @@ -4868,12 +4868,12 @@ func (p *PageBuildEvent) GetBuild() *PagesBuild { return p.Build } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PageBuildEvent) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *PageBuildEvent) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetInstallation returns the Installation field. @@ -5028,12 +5028,12 @@ func (p *PingEvent) GetHook() *Hook { return p.Hook } -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetHookID() int { - if p == nil || p.HookID == nil { - return 0 +// GetHookID returns the HookID field. +func (p *PingEvent) GetHookID() *int64 { + if p == nil { + return nil } - return *p.HookID + return p.HookID } // GetInstallation returns the Installation field. @@ -5108,12 +5108,12 @@ func (p *Project) GetCreator() *User { return p.Creator } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *Project) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *Project) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -5156,12 +5156,12 @@ func (p *Project) GetURL() string { return *p.URL } -// GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnID() int { - if p == nil || p.ColumnID == nil { - return 0 +// GetColumnID returns the ColumnID field. +func (p *ProjectCard) GetColumnID() *int64 { + if p == nil { + return nil } - return *p.ColumnID + return p.ColumnID } // GetColumnURL returns the ColumnURL field if it's non-nil, zero value otherwise. @@ -5196,12 +5196,12 @@ func (p *ProjectCard) GetCreator() *User { return p.Creator } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *ProjectCard) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetNote returns the Note field if it's non-nil, zero value otherwise. @@ -5236,12 +5236,12 @@ func (p *ProjectCardEvent) GetAction() string { return *p.Action } -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectCardEvent) GetAfterID() int { - if p == nil || p.AfterID == nil { - return 0 +// GetAfterID returns the AfterID field. +func (p *ProjectCardEvent) GetAfterID() *int64 { + if p == nil { + return nil } - return *p.AfterID + return p.AfterID } // GetChanges returns the Changes field. @@ -5300,12 +5300,12 @@ func (p *ProjectColumn) GetCreatedAt() Timestamp { return *p.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *ProjectColumn) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -5340,12 +5340,12 @@ func (p *ProjectColumnEvent) GetAction() string { return *p.Action } -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectColumnEvent) GetAfterID() int { - if p == nil || p.AfterID == nil { - return 0 +// GetAfterID returns the AfterID field. +func (p *ProjectColumnEvent) GetAfterID() *int64 { + if p == nil { + return nil } - return *p.AfterID + return p.AfterID } // GetChanges returns the Changes field. @@ -5644,12 +5644,12 @@ func (p *PullRequest) GetHTMLURL() string { return *p.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *PullRequest) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. @@ -5876,20 +5876,20 @@ func (p *PullRequestComment) GetHTMLURL() string { return *p.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *PullRequestComment) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } -// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetInReplyTo() int { - if p == nil || p.InReplyTo == nil { - return 0 +// GetInReplyTo returns the InReplyTo field. +func (p *PullRequestComment) GetInReplyTo() *int64 { + if p == nil { + return nil } - return *p.InReplyTo + return p.InReplyTo } // GetOriginalCommitID returns the OriginalCommitID field if it's non-nil, zero value otherwise. @@ -5988,12 +5988,12 @@ func (p *PullRequestEvent) GetInstallation() *Installation { return p.Installation } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetNumber returns the Number field. +func (p *PullRequestEvent) GetNumber() *int64 { + if p == nil { + return nil } - return *p.Number + return p.Number } // GetPullRequest returns the PullRequest field. @@ -6101,7 +6101,7 @@ func (p *PullRequestReview) GetHTMLURL() string { } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetID() int { +func (p *PullRequestReview) GetID() int64 { if p == nil || p.ID == nil { return 0 } @@ -6460,12 +6460,12 @@ func (p *PushEvent) GetPusher() *User { return p.Pusher } -// GetPushID returns the PushID field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetPushID() int { - if p == nil || p.PushID == nil { - return 0 +// GetPushID returns the PushID field. +func (p *PushEvent) GetPushID() *int64 { + if p == nil { + return nil } - return *p.PushID + return p.PushID } // GetRef returns the Ref field if it's non-nil, zero value otherwise. @@ -6708,12 +6708,12 @@ func (p *PushEventRepository) GetHTMLURL() string { return *p.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetID() int { - if p == nil || p.ID == nil { - return 0 +// GetID returns the ID field. +func (p *PushEventRepository) GetID() *int64 { + if p == nil { + return nil } - return *p.ID + return p.ID } // GetLanguage returns the Language field if it's non-nil, zero value otherwise. @@ -6868,12 +6868,12 @@ func (r *Reaction) GetContent() string { return *r.Content } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Reaction) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *Reaction) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetUser returns the User field. @@ -7004,12 +7004,12 @@ func (r *ReleaseAsset) GetDownloadCount() int { return *r.DownloadCount } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *ReleaseAsset) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetLabel returns the Label field if it's non-nil, zero value otherwise. @@ -7460,12 +7460,12 @@ func (r *Repository) GetHTMLURL() string { return *r.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Repository) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *Repository) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetIssueCommentURL returns the IssueCommentURL field if it's non-nil, zero value otherwise. @@ -7756,12 +7756,12 @@ func (r *Repository) GetTagsURL() string { return *r.TagsURL } -// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. -func (r *Repository) GetTeamID() int { - if r == nil || r.TeamID == nil { - return 0 +// GetTeamID returns the TeamID field. +func (r *Repository) GetTeamID() *int64 { + if r == nil { + return nil } - return *r.TeamID + return r.TeamID } // GetTeamsURL returns the TeamsURL field if it's non-nil, zero value otherwise. @@ -7836,12 +7836,12 @@ func (r *RepositoryComment) GetHTMLURL() string { return *r.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *RepositoryComment) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetPath returns the Path field if it's non-nil, zero value otherwise. @@ -8140,12 +8140,12 @@ func (r *RepositoryInvitation) GetHTMLURL() string { return *r.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *RepositoryInvitation) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetInvitee returns the Invitee field. @@ -8372,12 +8372,12 @@ func (r *RepositoryRelease) GetHTMLURL() string { return *r.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *RepositoryRelease) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. @@ -8564,12 +8564,12 @@ func (r *RepoStatus) GetDescription() string { return *r.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetID() int { - if r == nil || r.ID == nil { - return 0 +// GetID returns the ID field. +func (r *RepoStatus) GetID() *int64 { + if r == nil { + return nil } - return *r.ID + return r.ID } // GetState returns the State field if it's non-nil, zero value otherwise. @@ -8652,12 +8652,12 @@ func (s *Source) GetActor() *User { return s.Actor } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *Source) GetID() int { - if s == nil || s.ID == nil { - return 0 +// GetID returns the ID field. +func (s *Source) GetID() *int64 { + if s == nil { + return nil } - return *s.ID + return s.ID } // GetURL returns the URL field if it's non-nil, zero value otherwise. @@ -8676,12 +8676,12 @@ func (s *SourceImportAuthor) GetEmail() string { return *s.Email } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetID() int { - if s == nil || s.ID == nil { - return 0 +// GetID returns the ID field. +func (s *SourceImportAuthor) GetID() *int64 { + if s == nil { + return nil } - return *s.ID + return s.ID } // GetImportURL returns the ImportURL field if it's non-nil, zero value otherwise. @@ -8788,12 +8788,12 @@ func (s *StatusEvent) GetDescription() string { return *s.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetID() int { - if s == nil || s.ID == nil { - return 0 +// GetID returns the ID field. +func (s *StatusEvent) GetID() *int64 { + if s == nil { + return nil } - return *s.ID + return s.ID } // GetInstallation returns the Installation field. @@ -8980,12 +8980,12 @@ func (t *Team) GetDescription() string { return *t.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Team) GetID() int { - if t == nil || t.ID == nil { - return 0 +// GetID returns the ID field. +func (t *Team) GetID() *int64 { + if t == nil { + return nil } - return *t.ID + return t.ID } // GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. @@ -9188,12 +9188,12 @@ func (t *TeamLDAPMapping) GetDescription() string { return *t.Description } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetID() int { - if t == nil || t.ID == nil { - return 0 +// GetID returns the ID field. +func (t *TeamLDAPMapping) GetID() *int64 { + if t == nil { + return nil } - return *t.ID + return t.ID } // GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. @@ -9340,12 +9340,12 @@ func (t *Timeline) GetEvent() string { return *t.Event } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Timeline) GetID() int { - if t == nil || t.ID == nil { - return 0 +// GetID returns the ID field. +func (t *Timeline) GetID() *int64 { + if t == nil { + return nil } - return *t.ID + return t.ID } // GetLabel returns the Label field. @@ -9700,12 +9700,12 @@ func (u *User) GetHTMLURL() string { return *u.HTMLURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (u *User) GetID() int { - if u == nil || u.ID == nil { - return 0 +// GetID returns the ID field. +func (u *User) GetID() *int64 { + if u == nil { + return nil } - return *u.ID + return u.ID } // GetLocation returns the Location field if it's non-nil, zero value otherwise. @@ -9940,12 +9940,12 @@ func (u *UserLDAPMapping) GetGravatarID() string { return *u.GravatarID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (u *UserLDAPMapping) GetID() int { - if u == nil || u.ID == nil { - return 0 +// GetID returns the ID field. +func (u *UserLDAPMapping) GetID() *int64 { + if u == nil { + return nil } - return *u.ID + return u.ID } // GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. diff --git a/github/github.go b/github/github.go index b53e33d3f4a..96210cd93e7 100644 --- a/github/github.go +++ b/github/github.go @@ -968,6 +968,10 @@ func Bool(v bool) *bool { return &v } // to store v and returns a pointer to it. func Int(v int) *int { return &v } +// Int64 is a helper routine that allocates a new int64 value +// to store v and returns a pointer to it. +func Int64(v int64) *int64 { return &v } + // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. func String(v string) *string { return &v } diff --git a/github/issues.go b/github/issues.go index 9b7a9d68790..6e9307f55b5 100644 --- a/github/issues.go +++ b/github/issues.go @@ -25,7 +25,7 @@ type IssuesService service // this is an issue, and if PullRequestLinks is not nil, this is a pull request. // The IsPullRequest helper method can be used to check that. type Issue struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Locked *bool `json:"locked,omitempty"` diff --git a/github/issues_assignees_test.go b/github/issues_assignees_test.go index b73cb60dee0..bb2bf4ff035 100644 --- a/github/issues_assignees_test.go +++ b/github/issues_assignees_test.go @@ -30,7 +30,7 @@ func TestIssuesService_ListAssignees(t *testing.T) { t.Errorf("Issues.ListAssignees returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(assignees, want) { t.Errorf("Issues.ListAssignees returned %+v, want %+v", assignees, want) } diff --git a/github/issues_comments.go b/github/issues_comments.go index fd72657cd4d..70047453add 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -13,7 +13,7 @@ import ( // IssueComment represents a comment left on an issue. type IssueComment struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` Reactions *Reactions `json:"reactions,omitempty"` diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index 6ed42240dca..6911a798539 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -42,7 +42,7 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Int(1)}} + want := []*IssueComment{{ID: Int64(1)}} if !reflect.DeepEqual(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -63,7 +63,7 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) { t.Errorf("Issues.ListComments returned error: %v", err) } - want := []*IssueComment{{ID: Int(1)}} + want := []*IssueComment{{ID: Int64(1)}} if !reflect.DeepEqual(comments, want) { t.Errorf("Issues.ListComments returned %+v, want %+v", comments, want) } @@ -92,7 +92,7 @@ func TestIssuesService_GetComment(t *testing.T) { t.Errorf("Issues.GetComment returned error: %v", err) } - want := &IssueComment{ID: Int(1)} + want := &IssueComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Issues.GetComment returned %+v, want %+v", comment, want) } @@ -129,7 +129,7 @@ func TestIssuesService_CreateComment(t *testing.T) { t.Errorf("Issues.CreateComment returned error: %v", err) } - want := &IssueComment{ID: Int(1)} + want := &IssueComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Issues.CreateComment returned %+v, want %+v", comment, want) } @@ -166,7 +166,7 @@ func TestIssuesService_EditComment(t *testing.T) { t.Errorf("Issues.EditComment returned error: %v", err) } - want := &IssueComment{ID: Int(1)} + want := &IssueComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Issues.EditComment returned %+v, want %+v", comment, want) } diff --git a/github/issues_events.go b/github/issues_events.go index 93e5d66fb4a..55e6d431b30 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -13,7 +13,7 @@ import ( // IssueEvent represents an event that occurred around an Issue or Pull Request. type IssueEvent struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` // The User that generated this event. @@ -123,7 +123,7 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st // GetEvent returns the specified issue event. // // GitHub API docs: https://developer.github.com/v3/issues/events/#get-a-single-event -func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/issues_events_test.go b/github/issues_events_test.go index c0133dd45ae..fe21ecbe8bd 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -32,7 +32,7 @@ func TestIssuesService_ListIssueEvents(t *testing.T) { t.Errorf("Issues.ListIssueEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Int(1)}} + want := []*IssueEvent{{ID: Int64(1)}} if !reflect.DeepEqual(events, want) { t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want) } @@ -57,7 +57,7 @@ func TestIssuesService_ListRepositoryEvents(t *testing.T) { t.Errorf("Issues.ListRepositoryEvents returned error: %v", err) } - want := []*IssueEvent{{ID: Int(1)}} + want := []*IssueEvent{{ID: Int64(1)}} if !reflect.DeepEqual(events, want) { t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want) } @@ -77,7 +77,7 @@ func TestIssuesService_GetEvent(t *testing.T) { t.Errorf("Issues.GetEvent returned error: %v", err) } - want := &IssueEvent{ID: Int(1)} + want := &IssueEvent{ID: Int64(1)} if !reflect.DeepEqual(event, want) { t.Errorf("Issues.GetEvent returned %+v, want %+v", event, want) } diff --git a/github/issues_labels.go b/github/issues_labels.go index b0e34c40f20..c7ee2f5fbd1 100644 --- a/github/issues_labels.go +++ b/github/issues_labels.go @@ -12,7 +12,7 @@ import ( // Label represents a GitHub label on an Issue type Label struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Name *string `json:"name,omitempty"` Color *string `json:"color,omitempty"` diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index 56c20e552fd..6331cc44c35 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -185,8 +185,8 @@ func TestIssuesService_ListLabelsByIssue(t *testing.T) { } want := []*Label{ - {Name: String("a"), ID: Int(1)}, - {Name: String("b"), ID: Int(2)}, + {Name: String("a"), ID: Int64(1)}, + {Name: String("b"), ID: Int64(2)}, } if !reflect.DeepEqual(labels, want) { t.Errorf("Issues.ListLabelsByIssue returned %+v, want %+v", labels, want) diff --git a/github/issues_milestones.go b/github/issues_milestones.go index e6e882d1443..7e9f65bab85 100644 --- a/github/issues_milestones.go +++ b/github/issues_milestones.go @@ -16,7 +16,7 @@ type Milestone struct { URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` LabelsURL *string `json:"labels_url,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Title *string `json:"title,omitempty"` diff --git a/github/issues_timeline.go b/github/issues_timeline.go index bc0b1089903..9cfda832026 100644 --- a/github/issues_timeline.go +++ b/github/issues_timeline.go @@ -16,7 +16,7 @@ import ( // It is similar to an IssueEvent but may contain more information. // GitHub API docs: https://developer.github.com/v3/issues/timeline/ type Timeline struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` CommitURL *string `json:"commit_url,omitempty"` @@ -120,7 +120,7 @@ type Timeline struct { // Source represents a reference's source. type Source struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Actor *User `json:"actor,omitempty"` } diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go index 7dc1e856c2c..93f62368cec 100644 --- a/github/issues_timeline_test.go +++ b/github/issues_timeline_test.go @@ -33,7 +33,7 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) { t.Errorf("Issues.ListIssueTimeline returned error: %v", err) } - want := []*Timeline{{ID: Int(1)}} + want := []*Timeline{{ID: Int64(1)}} if !reflect.DeepEqual(events, want) { t.Errorf("Issues.ListIssueTimeline = %+v, want %+v", events, want) } diff --git a/github/migrations.go b/github/migrations.go index 6793269cd39..90cc1fae85f 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -21,7 +21,7 @@ type MigrationService service // Migration represents a GitHub migration (archival). type Migration struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` GUID *string `json:"guid,omitempty"` // State is the current state of a migration. // Possible values are: @@ -128,7 +128,7 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string) ([]*M // id is the migration ID. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#get-the-status-of-a-migration -func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) @@ -152,7 +152,7 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i // id is the migration ID. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#download-a-migration-archive -func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int) (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) req, err := s.client.NewRequest("GET", u, nil) @@ -189,7 +189,7 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, // id is the migration ID. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#delete-a-migration-archive -func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) @@ -209,7 +209,7 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i // is complete and you no longer need the source data. // // GitHub API docs: https://developer.github.com/v3/migration/migrations/#unlock-a-repository -func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int, 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) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/migrations_source_import.go b/github/migrations_source_import.go index aa45a5a3645..fd45e780065 100644 --- a/github/migrations_source_import.go +++ b/github/migrations_source_import.go @@ -117,7 +117,7 @@ func (i Import) String() string { // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#get-commit-authors type SourceImportAuthor struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` RemoteID *string `json:"remote_id,omitempty"` RemoteName *string `json:"remote_name,omitempty"` Email *string `json:"email,omitempty"` @@ -247,7 +247,7 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // commits to the repository. // // GitHub API docs: https://developer.github.com/v3/migration/source_imports/#map-a-commit-author -func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int, 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) req, err := s.client.NewRequest("PATCH", u, author) if err != nil { diff --git a/github/migrations_source_import_test.go b/github/migrations_source_import_test.go index f06270f3785..e9e9be062be 100644 --- a/github/migrations_source_import_test.go +++ b/github/migrations_source_import_test.go @@ -119,8 +119,8 @@ func TestMigrationService_CommitAuthors(t *testing.T) { t.Errorf("CommitAuthors returned error: %v", err) } want := []*SourceImportAuthor{ - {ID: Int(1), Name: String("a")}, - {ID: Int(2), Name: String("b")}, + {ID: Int64(1), Name: String("a")}, + {ID: Int64(2), Name: String("b")}, } if !reflect.DeepEqual(got, want) { t.Errorf("CommitAuthors = %+v, want %+v", got, want) @@ -150,7 +150,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { if err != nil { t.Errorf("MapCommitAuthor returned error: %v", err) } - want := &SourceImportAuthor{ID: Int(1)} + want := &SourceImportAuthor{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("MapCommitAuthor = %+v, want %+v", got, want) } diff --git a/github/migrations_test.go b/github/migrations_test.go index 8f0cd2760bd..687f89a353b 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -159,7 +159,7 @@ var migrationJSON = []byte(`{ }`) var wantMigration = &Migration{ - ID: Int(79), + ID: Int64(79), GUID: String("0b989ba4-242f-11e5-81e1-c7b6966d2516"), State: String("pending"), LockRepositories: Bool(true), @@ -169,7 +169,7 @@ var wantMigration = &Migration{ UpdatedAt: String("2015-07-06T15:33:38-07:00"), Repositories: []*Repository{ { - ID: Int(1296269), + ID: Int64(1296269), Name: String("Hello-World"), FullName: String("octocat/Hello-World"), Description: String("This your first repo!"), diff --git a/github/orgs.go b/github/orgs.go index e6947c96cfa..60864a6b966 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -20,7 +20,7 @@ type OrganizationsService service // Organization represents a GitHub organization account. type Organization struct { Login *string `json:"login,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` Name *string `json:"name,omitempty"` @@ -157,7 +157,7 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati // GetByID fetches an organization. // // Note: GetByID uses the undocumented GitHub API endpoint /organizations/:id. -func (s *OrganizationsService) GetByID(ctx context.Context, id int) (*Organization, *Response, error) { +func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { u := fmt.Sprintf("organizations/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/github/orgs_hooks_test.go b/github/orgs_hooks_test.go index 465aabbce24..1adfef2b3a1 100644 --- a/github/orgs_hooks_test.go +++ b/github/orgs_hooks_test.go @@ -31,7 +31,7 @@ func TestOrganizationsService_ListHooks(t *testing.T) { t.Errorf("Organizations.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Int(1)}, {ID: Int(2)}} + want := []*Hook{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(hooks, want) { t.Errorf("Organizations.ListHooks returned %+v, want %+v", hooks, want) } @@ -59,7 +59,7 @@ func TestOrganizationsService_GetHook(t *testing.T) { t.Errorf("Organizations.GetHook returned error: %v", err) } - want := &Hook{ID: Int(1)} + want := &Hook{ID: Int64(1)} if !reflect.DeepEqual(hook, want) { t.Errorf("Organizations.GetHook returned %+v, want %+v", hook, want) } @@ -96,7 +96,7 @@ func TestOrganizationsService_EditHook(t *testing.T) { t.Errorf("Organizations.EditHook returned error: %v", err) } - want := &Hook{ID: Int(1)} + want := &Hook{ID: Int64(1)} if !reflect.DeepEqual(hook, want) { t.Errorf("Organizations.EditHook returned %+v, want %+v", hook, want) } diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index 8ca5e3bd7a1..7b5cba85f05 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -40,7 +40,7 @@ func TestOrganizationsService_ListMembers(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -69,7 +69,7 @@ func TestOrganizationsService_ListMembers_public(t *testing.T) { t.Errorf("Organizations.ListMembers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(members, want) { t.Errorf("Organizations.ListMembers returned %+v, want %+v", members, want) } @@ -414,14 +414,14 @@ func TestOrganizationsService_ListPendingOrgInvitations(t *testing.T) { createdAt := time.Date(2017, 01, 21, 0, 0, 0, 0, time.UTC) want := []*Invitation{ { - ID: Int(1), + ID: Int64(1), Login: String("monalisa"), Email: String("octocat@github.com"), Role: String("direct_member"), CreatedAt: &createdAt, Inviter: &User{ Login: String("other_user"), - ID: Int(1), + ID: Int64(1), AvatarURL: String("https://github.com/images/error/other_user_happy.gif"), GravatarID: String(""), URL: String("https://api.github.com/users/other_user"), diff --git a/github/orgs_outside_collaborators_test.go b/github/orgs_outside_collaborators_test.go index 816db7156f7..2d653252ccf 100644 --- a/github/orgs_outside_collaborators_test.go +++ b/github/orgs_outside_collaborators_test.go @@ -35,7 +35,7 @@ func TestOrganizationsService_ListOutsideCollaborators(t *testing.T) { t.Errorf("Organizations.ListOutsideCollaborators returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(members, want) { t.Errorf("Organizations.ListOutsideCollaborators returned %+v, want %+v", members, want) } diff --git a/github/orgs_projects_test.go b/github/orgs_projects_test.go index b829a9cf385..97a7002f970 100644 --- a/github/orgs_projects_test.go +++ b/github/orgs_projects_test.go @@ -31,7 +31,7 @@ func TestOrganizationsService_ListProjects(t *testing.T) { t.Errorf("Organizations.ListProjects returned error: %v", err) } - want := []*Project{{ID: Int(1)}} + want := []*Project{{ID: Int64(1)}} if !reflect.DeepEqual(projects, want) { t.Errorf("Organizations.ListProjects returned %+v, want %+v", projects, want) } @@ -61,7 +61,7 @@ func TestOrganizationsService_CreateProject(t *testing.T) { t.Errorf("Organizations.CreateProject returned error: %v", err) } - want := &Project{ID: Int(1)} + want := &Project{ID: Int64(1)} if !reflect.DeepEqual(project, want) { t.Errorf("Organizations.CreateProject returned %+v, want %+v", project, want) } diff --git a/github/orgs_teams.go b/github/orgs_teams.go index 8a209d93f1a..c145710881a 100644 --- a/github/orgs_teams.go +++ b/github/orgs_teams.go @@ -15,7 +15,7 @@ import ( // Team represents a team within a GitHub organization. Teams are used to // manage access to an organization's repositories. type Team struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` URL *string `json:"url,omitempty"` @@ -49,7 +49,7 @@ func (t Team) String() string { // Invitation represents a team member's invitation status. type Invitation struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Login *string `json:"login,omitempty"` Email *string `json:"email,omitempty"` // Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'. @@ -92,7 +92,7 @@ func (s *OrganizationsService) ListTeams(ctx context.Context, org string, opt *L // GetTeam fetches a team by ID. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team -func (s *OrganizationsService) GetTeam(ctx context.Context, team int) (*Team, *Response, error) { +func (s *OrganizationsService) GetTeam(ctx context.Context, team int64) (*Team, *Response, error) { u := fmt.Sprintf("teams/%v", team) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -117,7 +117,7 @@ type NewTeam struct { Description *string `json:"description,omitempty"` Maintainers []string `json:"maintainers,omitempty"` RepoNames []string `json:"repo_names,omitempty"` - ParentTeamID *int `json:"parent_team_id,omitempty"` + ParentTeamID *int64 `json:"parent_team_id,omitempty"` // Deprecated: Permission is deprecated when creating or editing a team in an org // using the new GitHub permission model. It no longer identifies the @@ -167,7 +167,7 @@ func (s *OrganizationsService) CreateTeam(ctx context.Context, org string, team // EditTeam edits a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#edit-team -func (s *OrganizationsService) EditTeam(ctx context.Context, id int, team *NewTeam) (*Team, *Response, error) { +func (s *OrganizationsService) EditTeam(ctx context.Context, id int64, team *NewTeam) (*Team, *Response, error) { u := fmt.Sprintf("teams/%v", id) req, err := s.client.NewRequest("PATCH", u, team) if err != nil { @@ -189,7 +189,7 @@ func (s *OrganizationsService) EditTeam(ctx context.Context, id int, team *NewTe // DeleteTeam deletes a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#delete-team -func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int) (*Response, error) { +func (s *OrganizationsService) DeleteTeam(ctx context.Context, team int64) (*Response, error) { u := fmt.Sprintf("teams/%v", team) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -214,7 +214,7 @@ type OrganizationListTeamMembersOptions struct { // ListChildTeams lists child teams for a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-child-teams -func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int, opt *ListOptions) ([]*Team, *Response, error) { +func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int64, opt *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("teams/%v/teams", teamID) u, err := addOptions(u, opt) if err != nil { @@ -241,7 +241,7 @@ func (s *OrganizationsService) ListChildTeams(ctx context.Context, teamID int, o // team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-members -func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) { +func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int64, opt *OrganizationListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("teams/%v/members", team) u, err := addOptions(u, opt) if err != nil { @@ -270,7 +270,7 @@ func (s *OrganizationsService) ListTeamMembers(ctx context.Context, team int, op // // Deprecated: This API has been marked as deprecated in the Github API docs, // OrganizationsService.GetTeamMembership method should be used instead. -func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int, user string) (bool, *Response, error) { +func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int64, user string) (bool, *Response, error) { u := fmt.Sprintf("teams/%v/members/%v", team, user) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -285,7 +285,7 @@ func (s *OrganizationsService) IsTeamMember(ctx context.Context, team int, user // ListTeamRepos lists the repositories that the specified team has access to. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-team-repos -func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int, opt *ListOptions) ([]*Repository, *Response, error) { +func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int64, opt *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("teams/%v/repos", team) u, err := addOptions(u, opt) if err != nil { @@ -315,7 +315,7 @@ func (s *OrganizationsService) ListTeamRepos(ctx context.Context, team int, opt // permissions team has for that repo. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#check-if-a-team-manages-a-repository -func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int, owner string, repo string) (*Repository, *Response, error) { +func (s *OrganizationsService) IsTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -352,7 +352,7 @@ type OrganizationAddTeamRepoOptions struct { // belongs, or a direct fork of a repository owned by the organization. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-repo -func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int, owner string, repo string, opt *OrganizationAddTeamRepoOptions) (*Response, error) { +func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int64, owner string, repo string, opt *OrganizationAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) req, err := s.client.NewRequest("PUT", u, opt) if err != nil { @@ -367,7 +367,7 @@ func (s *OrganizationsService) AddTeamRepo(ctx context.Context, team int, owner // from the team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-repo -func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int, owner string, repo string) (*Response, error) { +func (s *OrganizationsService) RemoveTeamRepo(ctx context.Context, team int64, owner string, repo string) (*Response, error) { u := fmt.Sprintf("teams/%v/repos/%v/%v", team, owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -406,7 +406,7 @@ func (s *OrganizationsService) ListUserTeams(ctx context.Context, opt *ListOptio // GetTeamMembership returns the membership status for a user in a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#get-team-membership -func (s *OrganizationsService) GetTeamMembership(ctx context.Context, team int, user string) (*Membership, *Response, error) { +func (s *OrganizationsService) GetTeamMembership(ctx context.Context, team int64, user string) (*Membership, *Response, error) { u := fmt.Sprintf("teams/%v/memberships/%v", team, user) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -456,7 +456,7 @@ type OrganizationAddTeamMembershipOptions struct { // added as a member of the team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#add-team-membership -func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int, user string, opt *OrganizationAddTeamMembershipOptions) (*Membership, *Response, error) { +func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *OrganizationAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("teams/%v/memberships/%v", team, user) req, err := s.client.NewRequest("PUT", u, opt) if err != nil { @@ -475,7 +475,7 @@ func (s *OrganizationsService) AddTeamMembership(ctx context.Context, team int, // RemoveTeamMembership removes a user from a team. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#remove-team-membership -func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team int, user string) (*Response, error) { +func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team int64, user string) (*Response, error) { u := fmt.Sprintf("teams/%v/memberships/%v", team, user) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -490,7 +490,7 @@ func (s *OrganizationsService) RemoveTeamMembership(ctx context.Context, team in // Preview features are not supported for production use. // // GitHub API docs: https://developer.github.com/v3/orgs/teams/#list-pending-team-invitations -func (s *OrganizationsService) ListPendingTeamInvitations(ctx context.Context, team int, opt *ListOptions) ([]*Invitation, *Response, error) { +func (s *OrganizationsService) ListPendingTeamInvitations(ctx context.Context, team int64, opt *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("teams/%v/invitations", team) u, err := addOptions(u, opt) if err != nil { diff --git a/github/orgs_teams_test.go b/github/orgs_teams_test.go index 7e0832e74ee..ead8024e77a 100644 --- a/github/orgs_teams_test.go +++ b/github/orgs_teams_test.go @@ -33,7 +33,7 @@ func TestOrganizationsService_ListTeams(t *testing.T) { t.Errorf("Organizations.ListTeams returned error: %v", err) } - want := []*Team{{ID: Int(1)}} + want := []*Team{{ID: Int64(1)}} if !reflect.DeepEqual(teams, want) { t.Errorf("Organizations.ListTeams returned %+v, want %+v", teams, want) } @@ -62,7 +62,7 @@ func TestOrganizationsService_GetTeam(t *testing.T) { t.Errorf("Organizations.GetTeam returned error: %v", err) } - want := &Team{ID: Int(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), LDAPDN: String("cn=n,ou=groups,dc=example,dc=com")} + want := &Team{ID: Int64(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), LDAPDN: String("cn=n,ou=groups,dc=example,dc=com")} if !reflect.DeepEqual(team, want) { t.Errorf("Organizations.GetTeam returned %+v, want %+v", team, want) } @@ -84,8 +84,8 @@ func TestOrganizationService_GetTeam_nestedTeams(t *testing.T) { t.Errorf("Organizations.GetTeam returned error: %v", err) } - want := &Team{ID: Int(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), - Parent: &Team{ID: Int(2), Name: String("n"), Description: String("d")}, + want := &Team{ID: Int64(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p"), + Parent: &Team{ID: Int64(2), Name: String("n"), Description: String("d")}, } if !reflect.DeepEqual(team, want) { t.Errorf("Organizations.GetTeam returned %+v, want %+v", team, want) @@ -116,7 +116,7 @@ func TestOrganizationsService_CreateTeam(t *testing.T) { t.Errorf("Organizations.CreateTeam returned error: %v", err) } - want := &Team{ID: Int(1)} + want := &Team{ID: Int64(1)} if !reflect.DeepEqual(team, want) { t.Errorf("Organizations.CreateTeam returned %+v, want %+v", team, want) } @@ -154,7 +154,7 @@ func TestOrganizationsService_EditTeam(t *testing.T) { t.Errorf("Organizations.EditTeam returned error: %v", err) } - want := &Team{ID: Int(1)} + want := &Team{ID: Int64(1)} if !reflect.DeepEqual(team, want) { t.Errorf("Organizations.EditTeam returned %+v, want %+v", team, want) } @@ -192,7 +192,7 @@ func TestOrganizationsService_ListChildTeams(t *testing.T) { t.Errorf("Organizations.ListTeams returned error: %v", err) } - want := []*Team{{ID: Int(2)}} + want := []*Team{{ID: Int64(2)}} if !reflect.DeepEqual(teams, want) { t.Errorf("Organizations.ListTeams returned %+v, want %+v", teams, want) } @@ -215,7 +215,7 @@ func TestOrganizationsService_ListTeamMembers(t *testing.T) { t.Errorf("Organizations.ListTeamMembers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(members, want) { t.Errorf("Organizations.ListTeamMembers returned %+v, want %+v", members, want) } @@ -349,7 +349,7 @@ func TestOrganizationsService_ListTeamRepos(t *testing.T) { t.Errorf("Organizations.ListTeamRepos returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(members, want) { t.Errorf("Organizations.ListTeamRepos returned %+v, want %+v", members, want) } @@ -371,7 +371,7 @@ func TestOrganizationsService_IsTeamRepo_true(t *testing.T) { t.Errorf("Organizations.IsTeamRepo returned error: %v", err) } - want := &Repository{ID: Int(1)} + want := &Repository{ID: Int64(1)} if !reflect.DeepEqual(repo, want) { t.Errorf("Organizations.IsTeamRepo returned %+v, want %+v", repo, want) } @@ -579,7 +579,7 @@ func TestOrganizationsService_ListUserTeams(t *testing.T) { t.Errorf("Organizations.ListUserTeams returned error: %v", err) } - want := []*Team{{ID: Int(1)}} + want := []*Team{{ID: Int64(1)}} if !reflect.DeepEqual(teams, want) { t.Errorf("Organizations.ListUserTeams returned %+v, want %+v", teams, want) } @@ -631,14 +631,14 @@ func TestOrganizationsService_ListPendingTeamInvitations(t *testing.T) { createdAt := time.Date(2017, 01, 21, 0, 0, 0, 0, time.UTC) want := []*Invitation{ { - ID: Int(1), + ID: Int64(1), Login: String("monalisa"), Email: String("octocat@github.com"), Role: String("direct_member"), CreatedAt: &createdAt, Inviter: &User{ Login: String("other_user"), - ID: Int(1), + ID: Int64(1), AvatarURL: String("https://github.com/images/error/other_user_happy.gif"), GravatarID: String(""), URL: String("https://api.github.com/users/other_user"), diff --git a/github/orgs_test.go b/github/orgs_test.go index 90b356ed379..41f8cf3a291 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -31,7 +31,7 @@ func TestOrganizationsService_ListAll(t *testing.T) { t.Errorf("Organizations.ListAll returned error: %v", err) } - want := []*Organization{{ID: Int(4314092)}} + want := []*Organization{{ID: Int64(4314092)}} if !reflect.DeepEqual(orgs, want) { t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want) } @@ -51,7 +51,7 @@ func TestOrganizationsService_List_authenticatedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Int(1)}, {ID: Int(2)}} + want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -73,7 +73,7 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) { t.Errorf("Organizations.List returned error: %v", err) } - want := []*Organization{{ID: Int(1)}, {ID: Int(2)}} + want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(orgs, want) { t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) } @@ -101,7 +101,7 @@ func TestOrganizationsService_Get(t *testing.T) { t.Errorf("Organizations.Get returned error: %v", err) } - want := &Organization{ID: Int(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} + want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} if !reflect.DeepEqual(org, want) { t.Errorf("Organizations.Get returned %+v, want %+v", org, want) } @@ -129,7 +129,7 @@ func TestOrganizationsService_GetByID(t *testing.T) { t.Fatalf("Organizations.GetByID returned error: %v", err) } - want := &Organization{ID: Int(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} + want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")} if !reflect.DeepEqual(org, want) { t.Errorf("Organizations.GetByID returned %+v, want %+v", org, want) } @@ -158,7 +158,7 @@ func TestOrganizationsService_Edit(t *testing.T) { t.Errorf("Organizations.Edit returned error: %v", err) } - want := &Organization{ID: Int(1)} + want := &Organization{ID: Int64(1)} if !reflect.DeepEqual(org, want) { t.Errorf("Organizations.Edit returned %+v, want %+v", org, want) } diff --git a/github/projects.go b/github/projects.go index a9b143df3dc..22061363291 100644 --- a/github/projects.go +++ b/github/projects.go @@ -18,7 +18,7 @@ type ProjectsService service // Project represents a GitHub Project. type Project struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` OwnerURL *string `json:"owner_url,omitempty"` Name *string `json:"name,omitempty"` @@ -38,7 +38,7 @@ func (p Project) String() string { // GetProject gets a GitHub Project for a repo. // // GitHub API docs: https://developer.github.com/v3/projects/#get-a-project -func (s *ProjectsService) GetProject(ctx context.Context, id int) (*Project, *Response, error) { +func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -76,7 +76,7 @@ type ProjectOptions struct { // UpdateProject updates a repository project. // // GitHub API docs: https://developer.github.com/v3/projects/#update-a-project -func (s *ProjectsService) UpdateProject(ctx context.Context, id int, opt *ProjectOptions) (*Project, *Response, error) { +func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opt *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -98,7 +98,7 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int, opt *Projec // DeleteProject deletes a GitHub Project from a repository. // // GitHub API docs: https://developer.github.com/v3/projects/#delete-a-project -func (s *ProjectsService) DeleteProject(ctx context.Context, id int) (*Response, error) { +func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -115,7 +115,7 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int) (*Response, // // GitHub API docs: https://developer.github.com/v3/repos/projects/ type ProjectColumn struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` ProjectURL *string `json:"project_url,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` @@ -125,7 +125,7 @@ type ProjectColumn struct { // ListProjectColumns lists the columns of a GitHub Project for a repo. // // GitHub API docs: https://developer.github.com/v3/projects/columns/#list-project-columns -func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int, opt *ListOptions) ([]*ProjectColumn, *Response, error) { +func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opt *ListOptions) ([]*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) u, err := addOptions(u, opt) if err != nil { @@ -152,7 +152,7 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int, // 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 -func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -182,7 +182,7 @@ type ProjectColumnOptions struct { // CreateProjectColumn creates a column for the specified (by number) project. // // GitHub API docs: https://developer.github.com/v3/projects/columns/#create-a-project-column -func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -204,7 +204,7 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int // UpdateProjectColumn updates a column of a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/columns/#update-a-project-column -func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { +func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -226,7 +226,7 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int, // DeleteProjectColumn deletes a column from a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/columns/#delete-a-project-column -func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int) (*Response, error) { +func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -250,7 +250,7 @@ type ProjectColumnMoveOptions struct { // MoveProjectColumn moves a column within a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/columns/#move-a-project-column -func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int, opt *ProjectColumnMoveOptions) (*Response, error) { +func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/%v/moves", columnID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -270,20 +270,20 @@ type ProjectCard struct { URL *string `json:"url,omitempty"` ColumnURL *string `json:"column_url,omitempty"` ContentURL *string `json:"content_url,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Note *string `json:"note,omitempty"` Creator *User `json:"creator,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` // The following fields are only populated by Webhook events. - ColumnID *int `json:"column_id,omitempty"` + ColumnID *int64 `json:"column_id,omitempty"` } // ListProjectCards lists the cards in a column of a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards -func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int, opt *ListOptions) ([]*ProjectCard, *Response, error) { +func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ListOptions) ([]*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) u, err := addOptions(u, opt) if err != nil { @@ -310,7 +310,7 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int, op // 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 -func (s *ProjectsService) GetProjectCard(ctx context.Context, columnID int) (*ProjectCard, *Response, error) { +func (s *ProjectsService) GetProjectCard(ctx context.Context, columnID int64) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", columnID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -337,7 +337,7 @@ type ProjectCardOptions struct { Note string `json:"note,omitempty"` // The ID (not Number) of the Issue to associate with this card. // Note and ContentID are mutually exclusive. - ContentID int `json:"content_id,omitempty"` + ContentID int64 `json:"content_id,omitempty"` // The type of content to associate with this card. Possible values are: "Issue". ContentType string `json:"content_type,omitempty"` } @@ -345,7 +345,7 @@ type ProjectCardOptions struct { // 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 -func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { +func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { @@ -367,7 +367,7 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int, o // UpdateProjectCard updates a card of a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/cards/#update-a-project-card -func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { +func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opt *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("PATCH", u, opt) if err != nil { @@ -389,7 +389,7 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int, opt // DeleteProjectCard deletes a card from a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/cards/#delete-a-project-card -func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int) (*Response, error) { +func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -411,13 +411,13 @@ type ProjectCardMoveOptions struct { // ColumnID is the ID of a column in the same project. Note that ColumnID // is required when using Position "after:" when that card is in // another column; otherwise it is optional. - ColumnID int `json:"column_id,omitempty"` + ColumnID int64 `json:"column_id,omitempty"` } // MoveProjectCard moves a card within a GitHub Project. // // GitHub API docs: https://developer.github.com/v3/projects/cards/#move-a-project-card -func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int, opt *ProjectCardMoveOptions) (*Response, error) { +func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt *ProjectCardMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) req, err := s.client.NewRequest("POST", u, opt) if err != nil { diff --git a/github/projects_test.go b/github/projects_test.go index 6e28f864c98..9cb12aaa44e 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -38,7 +38,7 @@ func TestProjectsService_UpdateProject(t *testing.T) { t.Errorf("Projects.UpdateProject returned error: %v", err) } - want := &Project{ID: Int(1)} + want := &Project{ID: Int64(1)} if !reflect.DeepEqual(project, want) { t.Errorf("Projects.UpdateProject returned %+v, want %+v", project, want) } @@ -59,7 +59,7 @@ func TestProjectsService_GetProject(t *testing.T) { t.Errorf("Projects.GetProject returned error: %v", err) } - want := &Project{ID: Int(1)} + want := &Project{ID: Int64(1)} if !reflect.DeepEqual(project, want) { t.Errorf("Projects.GetProject returned %+v, want %+v", project, want) } @@ -97,7 +97,7 @@ func TestProjectsService_ListProjectColumns(t *testing.T) { t.Errorf("Projects.ListProjectColumns returned error: %v", err) } - want := []*ProjectColumn{{ID: Int(1)}} + want := []*ProjectColumn{{ID: Int64(1)}} if !reflect.DeepEqual(columns, want) { t.Errorf("Projects.ListProjectColumns returned %+v, want %+v", columns, want) } @@ -118,7 +118,7 @@ func TestProjectsService_GetProjectColumn(t *testing.T) { t.Errorf("Projects.GetProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int(1)} + want := &ProjectColumn{ID: Int64(1)} if !reflect.DeepEqual(column, want) { t.Errorf("Projects.GetProjectColumn returned %+v, want %+v", column, want) } @@ -148,7 +148,7 @@ func TestProjectsService_CreateProjectColumn(t *testing.T) { t.Errorf("Projects.CreateProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int(1)} + want := &ProjectColumn{ID: Int64(1)} if !reflect.DeepEqual(column, want) { t.Errorf("Projects.CreateProjectColumn returned %+v, want %+v", column, want) } @@ -178,7 +178,7 @@ func TestProjectsService_UpdateProjectColumn(t *testing.T) { t.Errorf("Projects.UpdateProjectColumn returned error: %v", err) } - want := &ProjectColumn{ID: Int(1)} + want := &ProjectColumn{ID: Int64(1)} if !reflect.DeepEqual(column, want) { t.Errorf("Projects.UpdateProjectColumn returned %+v, want %+v", column, want) } @@ -239,7 +239,7 @@ func TestProjectsService_ListProjectCards(t *testing.T) { t.Errorf("Projects.ListProjectCards returned error: %v", err) } - want := []*ProjectCard{{ID: Int(1)}} + want := []*ProjectCard{{ID: Int64(1)}} if !reflect.DeepEqual(cards, want) { t.Errorf("Projects.ListProjectCards returned %+v, want %+v", cards, want) } @@ -260,7 +260,7 @@ func TestProjectsService_GetProjectCard(t *testing.T) { t.Errorf("Projects.GetProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int(1)} + want := &ProjectCard{ID: Int64(1)} if !reflect.DeepEqual(card, want) { t.Errorf("Projects.GetProjectCard returned %+v, want %+v", card, want) } @@ -293,7 +293,7 @@ func TestProjectsService_CreateProjectCard(t *testing.T) { t.Errorf("Projects.CreateProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int(1)} + want := &ProjectCard{ID: Int64(1)} if !reflect.DeepEqual(card, want) { t.Errorf("Projects.CreateProjectCard returned %+v, want %+v", card, want) } @@ -326,7 +326,7 @@ func TestProjectsService_UpdateProjectCard(t *testing.T) { t.Errorf("Projects.UpdateProjectCard returned error: %v", err) } - want := &ProjectCard{ID: Int(1)} + want := &ProjectCard{ID: Int64(1)} if !reflect.DeepEqual(card, want) { t.Errorf("Projects.UpdateProjectCard returned %+v, want %+v", card, want) } diff --git a/github/pulls.go b/github/pulls.go index 5b6b5ee844f..eaed0071fc0 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -20,7 +20,7 @@ type PullRequestsService service // PullRequest represents a GitHub pull request on a repository. type PullRequest struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Title *string `json:"title,omitempty"` diff --git a/github/pulls_comments.go b/github/pulls_comments.go index bc0bc2d4a2f..ff892279e44 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -13,8 +13,8 @@ import ( // PullRequestComment represents a comment left on a pull request. type PullRequestComment struct { - ID *int `json:"id,omitempty"` - InReplyTo *int `json:"in_reply_to,omitempty"` + ID *int64 `json:"id,omitempty"` + InReplyTo *int64 `json:"in_reply_to,omitempty"` Body *string `json:"body,omitempty"` Path *string `json:"path,omitempty"` DiffHunk *string `json:"diff_hunk,omitempty"` diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 0a839aaeaba..becb30e1293 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -42,7 +42,7 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Int(1)}} + want := []*PullRequestComment{{ID: Int64(1)}} if !reflect.DeepEqual(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -63,7 +63,7 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) { t.Errorf("PullRequests.ListComments returned error: %v", err) } - want := []*PullRequestComment{{ID: Int(1)}} + want := []*PullRequestComment{{ID: Int64(1)}} if !reflect.DeepEqual(pulls, want) { t.Errorf("PullRequests.ListComments returned %+v, want %+v", pulls, want) } @@ -92,7 +92,7 @@ func TestPullRequestsService_GetComment(t *testing.T) { t.Errorf("PullRequests.GetComment returned error: %v", err) } - want := &PullRequestComment{ID: Int(1)} + want := &PullRequestComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("PullRequests.GetComment returned %+v, want %+v", comment, want) } @@ -129,7 +129,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { t.Errorf("PullRequests.CreateComment returned error: %v", err) } - want := &PullRequestComment{ID: Int(1)} + want := &PullRequestComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("PullRequests.CreateComment returned %+v, want %+v", comment, want) } @@ -166,7 +166,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { t.Errorf("PullRequests.EditComment returned error: %v", err) } - want := &PullRequestComment{ID: Int(1)} + want := &PullRequestComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("PullRequests.EditComment returned %+v, want %+v", comment, want) } diff --git a/github/pulls_reviewers_test.go b/github/pulls_reviewers_test.go index d76951e190c..48a3bf0ceea 100644 --- a/github/pulls_reviewers_test.go +++ b/github/pulls_reviewers_test.go @@ -70,12 +70,12 @@ func TestListReviewers(t *testing.T) { Users: []*User{ { Login: String("octocat"), - ID: Int(1), + ID: Int64(1), }, }, Teams: []*Team{ { - ID: Int(1), + ID: Int64(1), Name: String("Justice League"), }, }, diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 7d2acc414ee..1aceb0d4ddf 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -13,7 +13,7 @@ import ( // PullRequestReview represents a review of a pull request. type PullRequestReview struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` User *User `json:"user,omitempty"` Body *string `json:"body,omitempty"` SubmittedAt *time.Time `json:"submitted_at,omitempty"` @@ -94,7 +94,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // 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-single-review -func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) req, err := s.client.NewRequest("GET", u, nil) @@ -118,7 +118,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // 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 -func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number, reviewID int) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -142,7 +142,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // Read more about it here - https://github.com/google/go-github/issues/540 // // GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review -func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int, opt *ListOptions) ([]*PullRequestComment, *Response, error) { +func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int64, opt *ListOptions) ([]*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) u, err := addOptions(u, opt) if err != nil { @@ -194,7 +194,7 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri // 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-pull-request-review -func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number, reviewID int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) req, err := s.client.NewRequest("POST", u, review) @@ -218,7 +218,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // 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-pull-request-review -func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number, reviewID int, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) req, err := s.client.NewRequest("PUT", u, review) diff --git a/github/pulls_reviews_test.go b/github/pulls_reviews_test.go index e9dba35bd6a..58e301bd500 100644 --- a/github/pulls_reviews_test.go +++ b/github/pulls_reviews_test.go @@ -33,8 +33,8 @@ func TestPullRequestsService_ListReviews(t *testing.T) { } want := []*PullRequestReview{ - {ID: Int(1)}, - {ID: Int(2)}, + {ID: Int64(1)}, + {ID: Int64(2)}, } if !reflect.DeepEqual(reviews, want) { t.Errorf("PullRequests.ListReviews returned %+v, want %+v", reviews, want) @@ -63,7 +63,7 @@ func TestPullRequestsService_GetReview(t *testing.T) { t.Errorf("PullRequests.GetReview returned error: %v", err) } - want := &PullRequestReview{ID: Int(1)} + want := &PullRequestReview{ID: Int64(1)} if !reflect.DeepEqual(review, want) { t.Errorf("PullRequests.GetReview returned %+v, want %+v", review, want) } @@ -91,7 +91,7 @@ func TestPullRequestsService_DeletePendingReview(t *testing.T) { t.Errorf("PullRequests.DeletePendingReview returned error: %v", err) } - want := &PullRequestReview{ID: Int(1)} + want := &PullRequestReview{ID: Int64(1)} if !reflect.DeepEqual(review, want) { t.Errorf("PullRequests.DeletePendingReview returned %+v, want %+v", review, want) } @@ -120,8 +120,8 @@ func TestPullRequestsService_ListReviewComments(t *testing.T) { } want := []*PullRequestComment{ - {ID: Int(1)}, - {ID: Int(2)}, + {ID: Int64(1)}, + {ID: Int64(2)}, } if !reflect.DeepEqual(comments, want) { t.Errorf("PullRequests.ListReviewComments returned %+v, want %+v", comments, want) @@ -181,7 +181,7 @@ func TestPullRequestsService_CreateReview(t *testing.T) { t.Errorf("PullRequests.CreateReview returned error: %v", err) } - want := &PullRequestReview{ID: Int(1)} + want := &PullRequestReview{ID: Int64(1)} if !reflect.DeepEqual(review, want) { t.Errorf("PullRequests.CreateReview returned %+v, want %+v", review, want) } @@ -221,7 +221,7 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { t.Errorf("PullRequests.SubmitReview returned error: %v", err) } - want := &PullRequestReview{ID: Int(1)} + want := &PullRequestReview{ID: Int64(1)} if !reflect.DeepEqual(review, want) { t.Errorf("PullRequests.SubmitReview returned %+v, want %+v", review, want) } @@ -258,7 +258,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { t.Errorf("PullRequests.DismissReview returned error: %v", err) } - want := &PullRequestReview{ID: Int(1)} + want := &PullRequestReview{ID: Int64(1)} if !reflect.DeepEqual(review, want) { t.Errorf("PullRequests.DismissReview returned %+v, want %+v", review, want) } diff --git a/github/pulls_test.go b/github/pulls_test.go index fabc7110511..eb4fcd92c6b 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -148,11 +148,11 @@ func TestPullRequestsService_Get_headAndBase(t *testing.T) { Number: Int(1), Head: &PullRequestBranch{ Ref: String("r2"), - Repo: &Repository{ID: Int(2)}, + Repo: &Repository{ID: Int64(2)}, }, Base: &PullRequestBranch{ Ref: String("r1"), - Repo: &Repository{ID: Int(1)}, + Repo: &Repository{ID: Int64(1)}, }, } if !reflect.DeepEqual(pull, want) { diff --git a/github/reactions.go b/github/reactions.go index 739413d716e..b276ff3e059 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -19,8 +19,8 @@ type ReactionsService service // Reaction represents a GitHub reaction. type Reaction struct { // ID is the Reaction ID. - ID *int `json:"id,omitempty"` - User *User `json:"user,omitempty"` + ID *int64 `json:"id,omitempty"` + User *User `json:"user,omitempty"` // Content is the type of reaction. // Possible values are: // "+1", "-1", "laugh", "confused", "heart", "hooray". @@ -46,7 +46,7 @@ func (r Reaction) String() string { // ListCommentReactions lists the reactions for a commit comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opt) if err != nil { @@ -75,7 +75,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo // previously created reaction will be returned with Status: 200 OK. // // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment -func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int, 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) body := &Reaction{Content: String(content)} @@ -152,7 +152,7 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s // ListIssueCommentReactions lists the reactions for an issue comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opt) if err != nil { @@ -181,7 +181,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, // previously created reaction will be returned with Status: 200 OK. // // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment -func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int, 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) body := &Reaction{Content: String(content)} @@ -205,7 +205,7 @@ func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opt) if err != nil { @@ -234,7 +234,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, // previously created reaction will be returned with Status: 200 OK. // // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment -func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int, 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) body := &Reaction{Content: String(content)} @@ -258,7 +258,7 @@ func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, // DeleteReaction deletes a reaction. // // GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive -func (s *ReactionsService) DeleteReaction(ctx context.Context, id int) (*Response, error) { +func (s *ReactionsService) DeleteReaction(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("reactions/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/reactions_test.go b/github/reactions_test.go index fc3fe7e5295..2a43a8b8612 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -28,7 +28,7 @@ func TestReactionsService_ListCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListCommentReactions returned error: %v", err) } - if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { + if want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { t.Errorf("ListCommentReactions = %+v, want %+v", got, want) } } @@ -49,7 +49,7 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")} + want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} if !reflect.DeepEqual(got, want) { t.Errorf("CreateCommentReaction = %+v, want %+v", got, want) } @@ -71,7 +71,7 @@ func TestReactionsService_ListIssueReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueReactions returned error: %v", err) } - if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { + if want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { t.Errorf("ListIssueReactions = %+v, want %+v", got, want) } } @@ -92,7 +92,7 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueReaction returned error: %v", err) } - want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")} + want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} if !reflect.DeepEqual(got, want) { t.Errorf("CreateIssueReaction = %+v, want %+v", got, want) } @@ -114,7 +114,7 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListIssueCommentReactions returned error: %v", err) } - if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { + if want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want) } } @@ -135,7 +135,7 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreateIssueCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")} + want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} if !reflect.DeepEqual(got, want) { t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want) } @@ -157,7 +157,7 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) { if err != nil { t.Errorf("ListPullRequestCommentReactions returned error: %v", err) } - if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { + if want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) { t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want) } } @@ -178,7 +178,7 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) { if err != nil { t.Errorf("CreatePullRequestCommentReaction returned error: %v", err) } - want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")} + want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")} if !reflect.DeepEqual(got, want) { t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want) } diff --git a/github/repos.go b/github/repos.go index 34f1218bb9f..68accf7ff15 100644 --- a/github/repos.go +++ b/github/repos.go @@ -20,7 +20,7 @@ type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` FullName *string `json:"full_name,omitempty"` @@ -72,7 +72,7 @@ type Repository struct { Archived *bool `json:"archived,omitempty"` // Creating an organization repository. Required for non-owners. - TeamID *int `json:"team_id,omitempty"` + TeamID *int64 `json:"team_id,omitempty"` // API URLs URL *string `json:"url,omitempty"` @@ -233,7 +233,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *Re // RepositoriesService.ListAll method. type RepositoryListAllOptions struct { // ID of the last repository seen - Since int `url:"since,omitempty"` + Since int64 `url:"since,omitempty"` } // ListAll lists all GitHub repositories in the order that they were created. @@ -335,7 +335,7 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // GetByID fetches a repository. // // Note: GetByID uses the undocumented GitHub API endpoint /repositories/:id. -func (s *RepositoriesService) GetByID(ctx context.Context, id int) (*Repository, *Response, error) { +func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { u := fmt.Sprintf("repositories/%d", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -390,7 +390,7 @@ func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (* // Contributor represents a repository contributor type Contributor struct { Login *string `json:"login,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` GravatarID *string `json:"gravatar_id,omitempty"` URL *string `json:"url,omitempty"` @@ -1042,8 +1042,8 @@ 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 []int `json:"team_id,omitempty"` + NewOwner string `json:"new_owner"` + TeamID []int64 `json:"team_id,omitempty"` } // Transfer transfers a repository from one account or organization to another. diff --git a/github/repos_collaborators_test.go b/github/repos_collaborators_test.go index 14be59c173c..c814a5f999e 100644 --- a/github/repos_collaborators_test.go +++ b/github/repos_collaborators_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListCollaborators(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Int(1)}, {ID: Int(2)}} + want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(users, want) { t.Errorf("Repositori es.ListCollaborators returned %+v, want %+v", users, want) } @@ -58,7 +58,7 @@ func TestRepositoriesService_ListCollaborators_withAffiliation(t *testing.T) { t.Errorf("Repositories.ListCollaborators returned error: %v", err) } - want := []*User{{ID: Int(1)}, {ID: Int(2)}} + want := []*User{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(users, want) { t.Errorf("Repositories.ListCollaborators returned %+v, want %+v", users, want) } diff --git a/github/repos_comments.go b/github/repos_comments.go index 4830ee2206d..fa2377d403d 100644 --- a/github/repos_comments.go +++ b/github/repos_comments.go @@ -15,7 +15,7 @@ import ( type RepositoryComment struct { HTMLURL *string `json:"html_url,omitempty"` URL *string `json:"url,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` CommitID *string `json:"commit_id,omitempty"` User *User `json:"user,omitempty"` Reactions *Reactions `json:"reactions,omitempty"` @@ -110,7 +110,7 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh // GetComment gets a single comment from a repository. // // GitHub API docs: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment -func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -132,7 +132,7 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // UpdateComment updates the body of a single comment. // // GitHub API docs: https://developer.github.com/v3/repos/comments/#update-a-commit-comment -func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int, 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) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { @@ -151,7 +151,7 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str // DeleteComment deletes a single comment from a repository. // // GitHub API docs: https://developer.github.com/v3/repos/comments/#delete-a-commit-comment -func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index 95aa2eca44a..0eb54eba2ee 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListComments(t *testing.T) { t.Errorf("Repositories.ListComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Int(1)}, {ID: Int(2)}} + want := []*RepositoryComment{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(comments, want) { t.Errorf("Repositories.ListComments returned %+v, want %+v", comments, want) } @@ -62,7 +62,7 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) { t.Errorf("Repositories.ListCommitComments returned error: %v", err) } - want := []*RepositoryComment{{ID: Int(1)}, {ID: Int(2)}} + want := []*RepositoryComment{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(comments, want) { t.Errorf("Repositories.ListCommitComments returned %+v, want %+v", comments, want) } @@ -99,7 +99,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { t.Errorf("Repositories.CreateComment returned error: %v", err) } - want := &RepositoryComment{ID: Int(1)} + want := &RepositoryComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Repositories.CreateComment returned %+v, want %+v", comment, want) } @@ -128,7 +128,7 @@ func TestRepositoriesService_GetComment(t *testing.T) { t.Errorf("Repositories.GetComment returned error: %v", err) } - want := &RepositoryComment{ID: Int(1)} + want := &RepositoryComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Repositories.GetComment returned %+v, want %+v", comment, want) } @@ -165,7 +165,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { t.Errorf("Repositories.UpdateComment returned error: %v", err) } - want := &RepositoryComment{ID: Int(1)} + want := &RepositoryComment{ID: Int64(1)} if !reflect.DeepEqual(comment, want) { t.Errorf("Repositories.UpdateComment returned %+v, want %+v", comment, want) } diff --git a/github/repos_deployments.go b/github/repos_deployments.go index ec0e8421573..bb17a8ba223 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -14,7 +14,7 @@ import ( // Deployment represents a deployment in a repo type Deployment struct { URL *string `json:"url,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` SHA *string `json:"sha,omitempty"` Ref *string `json:"ref,omitempty"` Task *string `json:"task,omitempty"` @@ -86,7 +86,7 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s // GetDeployment returns a single deployment of a repository. // // GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment -func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int) (*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) req, err := s.client.NewRequest("GET", u, nil) @@ -129,7 +129,7 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo // DeploymentStatus represents the status of a // particular deployment. type DeploymentStatus struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` // State is the deployment state. // Possible values are: "pending", "success", "failure", "error", "inactive". State *string `json:"state,omitempty"` @@ -154,7 +154,7 @@ type DeploymentStatusRequest struct { // ListDeploymentStatuses lists the statuses of a given deployment of a repository. // // GitHub API docs: https://developer.github.com/v3/repos/deployments/#list-deployment-statuses -func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int, opt *ListOptions) ([]*DeploymentStatus, *Response, error) { +func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opt *ListOptions) ([]*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) u, err := addOptions(u, opt) if err != nil { @@ -178,7 +178,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, // GetDeploymentStatus returns a single deployment status of a repository. // // GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment-status -func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int) (*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) req, err := s.client.NewRequest("GET", u, nil) @@ -201,7 +201,7 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // CreateDeploymentStatus creates a new status for a deployment. // // GitHub API docs: https://developer.github.com/v3/repos/deployments/#create-a-deployment-status -func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int, 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) req, err := s.client.NewRequest("POST", u, request) diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index d9d4080f628..f6f333aa25f 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListDeployments(t *testing.T) { t.Errorf("Repositories.ListDeployments returned error: %v", err) } - want := []*Deployment{{ID: Int(1)}, {ID: Int(2)}} + want := []*Deployment{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(deployments, want) { t.Errorf("Repositories.ListDeployments returned %+v, want %+v", deployments, want) } @@ -50,7 +50,7 @@ func TestRepositoriesService_GetDeployment(t *testing.T) { t.Errorf("Repositories.GetDeployment returned error: %v", err) } - want := &Deployment{ID: Int(3)} + want := &Deployment{ID: Int64(3)} if !reflect.DeepEqual(deployment, want) { t.Errorf("Repositories.GetDeployment returned %+v, want %+v", deployment, want) @@ -103,7 +103,7 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { t.Errorf("Repositories.ListDeploymentStatuses returned error: %v", err) } - want := []*DeploymentStatus{{ID: Int(1)}, {ID: Int(2)}} + want := []*DeploymentStatus{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(statutses, want) { t.Errorf("Repositories.ListDeploymentStatuses returned %+v, want %+v", statutses, want) } @@ -124,7 +124,7 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) { t.Errorf("Repositories.GetDeploymentStatus returned error: %v", err) } - want := &DeploymentStatus{ID: Int(4)} + want := &DeploymentStatus{ID: Int64(4)} if !reflect.DeepEqual(deploymentStatus, want) { t.Errorf("Repositories.GetDeploymentStatus returned %+v, want %+v", deploymentStatus, want) } diff --git a/github/repos_forks_test.go b/github/repos_forks_test.go index e9d9a108b21..8513f0e2ac2 100644 --- a/github/repos_forks_test.go +++ b/github/repos_forks_test.go @@ -36,7 +36,7 @@ func TestRepositoriesService_ListForks(t *testing.T) { t.Errorf("Repositories.ListForks returned error: %v", err) } - want := []*Repository{{ID: Int(1)}, {ID: Int(2)}} + want := []*Repository{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.ListForks returned %+v, want %+v", repos, want) } @@ -66,7 +66,7 @@ func TestRepositoriesService_CreateFork(t *testing.T) { t.Errorf("Repositories.CreateFork returned error: %v", err) } - want := &Repository{ID: Int(1)} + want := &Repository{ID: Int64(1)} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.CreateFork returned %+v, want %+v", repo, want) } diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 67ce96ac342..f7ab3a13d63 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -76,7 +76,7 @@ type Hook struct { Events []string `json:"events,omitempty"` Active *bool `json:"active,omitempty"` Config map[string]interface{} `json:"config,omitempty"` - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` } func (h Hook) String() string { @@ -130,7 +130,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // // GitHub API docs: https://developer.github.com/v3/repos/hooks/#get-single-hook -func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -144,7 +144,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // // GitHub API docs: https://developer.github.com/v3/repos/hooks/#edit-a-hook -func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int, 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) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { @@ -158,7 +158,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // // GitHub API docs: https://developer.github.com/v3/repos/hooks/#delete-a-hook -func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -170,7 +170,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // PingHook triggers a 'ping' event to be sent to the Hook. // // GitHub API docs: https://developer.github.com/v3/repos/hooks/#ping-a-hook -func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("POST", u, nil) if err != nil { @@ -182,7 +182,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // TestHook triggers a test Hook by github. // // GitHub API docs: https://developer.github.com/v3/repos/hooks/#test-a-push-hook -func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("POST", u, nil) if err != nil { diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index e8e3e1681c9..a1435619b68 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -37,7 +37,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) { t.Errorf("Repositories.CreateHook returned error: %v", err) } - want := &Hook{ID: Int(1)} + want := &Hook{ID: Int64(1)} if !reflect.DeepEqual(hook, want) { t.Errorf("Repositories.CreateHook returned %+v, want %+v", hook, want) } @@ -68,7 +68,7 @@ func TestRepositoriesService_ListHooks(t *testing.T) { t.Errorf("Repositories.ListHooks returned error: %v", err) } - want := []*Hook{{ID: Int(1)}, {ID: Int(2)}} + want := []*Hook{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(hooks, want) { t.Errorf("Repositories.ListHooks returned %+v, want %+v", hooks, want) } @@ -96,7 +96,7 @@ func TestRepositoriesService_GetHook(t *testing.T) { t.Errorf("Repositories.GetHook returned error: %v", err) } - want := &Hook{ID: Int(1)} + want := &Hook{ID: Int64(1)} if !reflect.DeepEqual(hook, want) { t.Errorf("Repositories.GetHook returned %+v, want %+v", hook, want) } @@ -133,7 +133,7 @@ func TestRepositoriesService_EditHook(t *testing.T) { t.Errorf("Repositories.EditHook returned error: %v", err) } - want := &Hook{ID: Int(1)} + want := &Hook{ID: Int64(1)} if !reflect.DeepEqual(hook, want) { t.Errorf("Repositories.EditHook returned %+v, want %+v", hook, want) } diff --git a/github/repos_invitations.go b/github/repos_invitations.go index 0a2b7c1987e..34bf3830fb1 100644 --- a/github/repos_invitations.go +++ b/github/repos_invitations.go @@ -12,7 +12,7 @@ import ( // 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"` @@ -55,7 +55,7 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s // DeleteInvitation deletes a repository invitation. // // GitHub API docs: https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation -func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -75,7 +75,7 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo // 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(ctx context.Context, owner, repo string, 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} diff --git a/github/repos_invitations_test.go b/github/repos_invitations_test.go index 729601f77a5..27bec41db03 100644 --- a/github/repos_invitations_test.go +++ b/github/repos_invitations_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListInvitations(t *testing.T) { t.Errorf("Repositories.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Int(1)}, {ID: Int(2)}} + want := []*RepositoryInvitation{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.ListInvitations = %+v, want %+v", got, want) } @@ -67,7 +67,7 @@ func TestRepositoriesService_UpdateInvitation(t *testing.T) { t.Errorf("Repositories.UpdateInvitation returned error: %v", err) } - want := &RepositoryInvitation{ID: Int(1)} + want := &RepositoryInvitation{ID: Int64(1)} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.UpdateInvitation = %+v, want %+v", got, want) } diff --git a/github/repos_keys.go b/github/repos_keys.go index f5a865813a5..966d7b540b1 100644 --- a/github/repos_keys.go +++ b/github/repos_keys.go @@ -39,7 +39,7 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GetKey fetches a single deploy key. // // GitHub API docs: https://developer.github.com/v3/repos/keys/#get -func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_keys_test.go b/github/repos_keys_test.go index 33cc1970f15..75a17356edd 100644 --- a/github/repos_keys_test.go +++ b/github/repos_keys_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListKeys(t *testing.T) { t.Errorf("Repositories.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int(1)}} + want := []*Key{{ID: Int64(1)}} if !reflect.DeepEqual(keys, want) { t.Errorf("Repositories.ListKeys returned %+v, want %+v", keys, want) } @@ -58,7 +58,7 @@ func TestRepositoriesService_GetKey(t *testing.T) { t.Errorf("Repositories.GetKey returned error: %v", err) } - want := &Key{ID: Int(1)} + want := &Key{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Repositories.GetKey returned %+v, want %+v", key, want) } @@ -95,7 +95,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { t.Errorf("Repositories.GetKey returned error: %v", err) } - want := &Key{ID: Int(1)} + want := &Key{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Repositories.GetKey returned %+v, want %+v", key, want) } @@ -132,7 +132,7 @@ func TestRepositoriesService_EditKey(t *testing.T) { t.Errorf("Repositories.EditKey returned error: %v", err) } - want := &Key{ID: Int(1)} + want := &Key{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Repositories.EditKey returned %+v, want %+v", key, want) } diff --git a/github/repos_pages.go b/github/repos_pages.go index 075f5742d11..94a95f2b8ed 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -104,7 +104,7 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re // GetPageBuild fetches the specific build information for a GitHub pages site. // // GitHub API docs: https://developer.github.com/v3/repos/pages/#list-a-specific-pages-build -func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/github/repos_projects_test.go b/github/repos_projects_test.go index fe02f378837..c03922545ea 100644 --- a/github/repos_projects_test.go +++ b/github/repos_projects_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_ListProjects(t *testing.T) { t.Errorf("Repositories.ListProjects returned error: %v", err) } - want := []*Project{{ID: Int(1)}} + want := []*Project{{ID: Int64(1)}} if !reflect.DeepEqual(projects, want) { t.Errorf("Repositories.ListProjects returned %+v, want %+v", projects, want) } @@ -61,7 +61,7 @@ func TestRepositoriesService_CreateProject(t *testing.T) { t.Errorf("Repositories.CreateProject returned error: %v", err) } - want := &Project{ID: Int(1)} + want := &Project{ID: Int64(1)} if !reflect.DeepEqual(project, want) { t.Errorf("Repositories.CreateProject returned %+v, want %+v", project, want) } diff --git a/github/repos_releases.go b/github/repos_releases.go index 1ee7ecf9948..7ad2b278ab5 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -19,7 +19,7 @@ import ( // RepositoryRelease represents a GitHub release in a repository. type RepositoryRelease struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` TagName *string `json:"tag_name,omitempty"` TargetCommitish *string `json:"target_commitish,omitempty"` Name *string `json:"name,omitempty"` @@ -44,7 +44,7 @@ func (r RepositoryRelease) String() string { // ReleaseAsset represents a GitHub release asset in a repository. type ReleaseAsset struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Name *string `json:"name,omitempty"` Label *string `json:"label,omitempty"` @@ -88,7 +88,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // GetRelease fetches a single release. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release -func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int) (*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) return s.getSingleRelease(ctx, u) } @@ -145,7 +145,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str // EditRelease edits a repository release. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release -func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int, 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) req, err := s.client.NewRequest("PATCH", u, release) @@ -164,7 +164,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin // DeleteRelease delete a single release from a repository. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release -func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) @@ -177,7 +177,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str // ListReleaseAssets lists the release's assets. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#list-assets-for-a-release -func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*ReleaseAsset, *Response, error) { +func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opt) if err != nil { @@ -200,7 +200,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // GetReleaseAsset fetches a single release asset. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("GET", u, nil) @@ -224,7 +224,7 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // of the io.ReadCloser. Exactly one of rc and redirectURL will be zero. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset -func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int) (rc io.ReadCloser, redirectURL string, err error) { +func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64) (rc io.ReadCloser, redirectURL string, err error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -264,7 +264,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, r // EditReleaseAsset edits a repository release asset. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release-asset -func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int, 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) req, err := s.client.NewRequest("PATCH", u, release) @@ -283,7 +283,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo // DeleteReleaseAsset delete a single release asset from a repository. // // GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release-asset -func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int) (*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) req, err := s.client.NewRequest("DELETE", u, nil) @@ -297,7 +297,7 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep // 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 -func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { +func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opt) if err != nil { diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index b7420e8a108..126a4284f7f 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -33,7 +33,7 @@ func TestRepositoriesService_ListReleases(t *testing.T) { if err != nil { t.Errorf("Repositories.ListReleases returned error: %v", err) } - want := []*RepositoryRelease{{ID: Int(1)}} + want := []*RepositoryRelease{{ID: Int64(1)}} if !reflect.DeepEqual(releases, want) { t.Errorf("Repositories.ListReleases returned %+v, want %+v", releases, want) } @@ -53,7 +53,7 @@ func TestRepositoriesService_GetRelease(t *testing.T) { t.Errorf("Repositories.GetRelease returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int(1), Author: &User{Login: String("l")}} + want := &RepositoryRelease{ID: Int64(1), Author: &User{Login: String("l")}} if !reflect.DeepEqual(release, want) { t.Errorf("Repositories.GetRelease returned %+v, want %+v", release, want) } @@ -73,7 +73,7 @@ func TestRepositoriesService_GetLatestRelease(t *testing.T) { t.Errorf("Repositories.GetLatestRelease returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int(3)} + want := &RepositoryRelease{ID: Int64(3)} if !reflect.DeepEqual(release, want) { t.Errorf("Repositories.GetLatestRelease returned %+v, want %+v", release, want) } @@ -93,7 +93,7 @@ func TestRepositoriesService_GetReleaseByTag(t *testing.T) { t.Errorf("Repositories.GetReleaseByTag returned error: %v\n%v", err, resp.Body) } - want := &RepositoryRelease{ID: Int(13)} + want := &RepositoryRelease{ID: Int64(13)} if !reflect.DeepEqual(release, want) { t.Errorf("Repositories.GetReleaseByTag returned %+v, want %+v", release, want) } @@ -121,7 +121,7 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { t.Errorf("Repositories.CreateRelease returned error: %v", err) } - want := &RepositoryRelease{ID: Int(1)} + want := &RepositoryRelease{ID: Int64(1)} if !reflect.DeepEqual(release, want) { t.Errorf("Repositories.CreateRelease returned %+v, want %+v", release, want) } @@ -148,7 +148,7 @@ func TestRepositoriesService_EditRelease(t *testing.T) { if err != nil { t.Errorf("Repositories.EditRelease returned error: %v", err) } - want := &RepositoryRelease{ID: Int(1)} + want := &RepositoryRelease{ID: Int64(1)} if !reflect.DeepEqual(release, want) { t.Errorf("Repositories.EditRelease returned = %+v, want %+v", release, want) } @@ -183,7 +183,7 @@ func TestRepositoriesService_ListReleaseAssets(t *testing.T) { if err != nil { t.Errorf("Repositories.ListReleaseAssets returned error: %v", err) } - want := []*ReleaseAsset{{ID: Int(1)}} + want := []*ReleaseAsset{{ID: Int64(1)}} if !reflect.DeepEqual(assets, want) { t.Errorf("Repositories.ListReleaseAssets returned %+v, want %+v", assets, want) } @@ -202,7 +202,7 @@ func TestRepositoriesService_GetReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.GetReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Int(1)} + want := &ReleaseAsset{ID: Int64(1)} if !reflect.DeepEqual(asset, want) { t.Errorf("Repositories.GetReleaseAsset returned %+v, want %+v", asset, want) } @@ -301,7 +301,7 @@ func TestRepositoriesService_EditReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.EditReleaseAsset returned error: %v", err) } - want := &ReleaseAsset{ID: Int(1)} + want := &ReleaseAsset{ID: Int64(1)} if !reflect.DeepEqual(asset, want) { t.Errorf("Repositories.EditReleaseAsset returned = %+v, want %+v", asset, want) } @@ -346,7 +346,7 @@ func TestRepositoriesService_UploadReleaseAsset(t *testing.T) { if err != nil { t.Errorf("Repositories.UploadReleaseAssert returned error: %v", err) } - want := &ReleaseAsset{ID: Int(1)} + want := &ReleaseAsset{ID: Int64(1)} if !reflect.DeepEqual(asset, want) { t.Errorf("Repositories.UploadReleaseAssert returned %+v, want %+v", asset, want) } diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go index db136bcbd8f..875acfc74be 100644 --- a/github/repos_stats_test.go +++ b/github/repos_stats_test.go @@ -49,7 +49,7 @@ func TestRepositoriesService_ListContributorsStats(t *testing.T) { want := []*ContributorStats{ { Author: &Contributor{ - ID: Int(1), + ID: Int64(1), }, Total: Int(135), Weeks: []WeeklyStats{ diff --git a/github/repos_statuses.go b/github/repos_statuses.go index 6db501076ca..f94fdc858b8 100644 --- a/github/repos_statuses.go +++ b/github/repos_statuses.go @@ -13,7 +13,7 @@ import ( // RepoStatus represents the status of a repository at a particular reference. type RepoStatus struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` // State is the current state of the repository. Possible values are: diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go index 21cc238cf4d..b556b716695 100644 --- a/github/repos_statuses_test.go +++ b/github/repos_statuses_test.go @@ -30,7 +30,7 @@ func TestRepositoriesService_ListStatuses(t *testing.T) { t.Errorf("Repositories.ListStatuses returned error: %v", err) } - want := []*RepoStatus{{ID: Int(1)}} + want := []*RepoStatus{{ID: Int64(1)}} if !reflect.DeepEqual(statuses, want) { t.Errorf("Repositories.ListStatuses returned %+v, want %+v", statuses, want) } @@ -66,7 +66,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { t.Errorf("Repositories.CreateStatus returned error: %v", err) } - want := &RepoStatus{ID: Int(1)} + want := &RepoStatus{ID: Int64(1)} if !reflect.DeepEqual(status, want) { t.Errorf("Repositories.CreateStatus returned %+v, want %+v", status, want) } @@ -96,7 +96,7 @@ func TestRepositoriesService_GetCombinedStatus(t *testing.T) { t.Errorf("Repositories.GetCombinedStatus returned error: %v", err) } - want := &CombinedStatus{State: String("success"), Statuses: []RepoStatus{{ID: Int(1)}}} + want := &CombinedStatus{State: String("success"), Statuses: []RepoStatus{{ID: Int64(1)}}} if !reflect.DeepEqual(status, want) { t.Errorf("Repositories.GetCombinedStatus returned %+v, want %+v", status, want) } diff --git a/github/repos_test.go b/github/repos_test.go index 573c48ab98b..d553ccca7d5 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -31,7 +31,7 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) { t.Errorf("Repositories.List returned error: %v", err) } - want := []*Repository{{ID: Int(1)}, {ID: Int(2)}} + want := []*Repository{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.List returned %+v, want %+v", repos, want) } @@ -67,7 +67,7 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) { t.Errorf("Repositories.List returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.List returned %+v, want %+v", repos, want) } @@ -95,7 +95,7 @@ func TestRepositoriesService_List_specifiedUser_type(t *testing.T) { t.Errorf("Repositories.List returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.List returned %+v, want %+v", repos, want) } @@ -130,7 +130,7 @@ func TestRepositoriesService_ListByOrg(t *testing.T) { t.Errorf("Repositories.ListByOrg returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.ListByOrg returned %+v, want %+v", repos, want) } @@ -162,7 +162,7 @@ func TestRepositoriesService_ListAll(t *testing.T) { t.Errorf("Repositories.ListAll returned error: %v", err) } - want := []*Repository{{ID: Int(1)}} + want := []*Repository{{ID: Int64(1)}} if !reflect.DeepEqual(repos, want) { t.Errorf("Repositories.ListAll returned %+v, want %+v", repos, want) } @@ -191,7 +191,7 @@ func TestRepositoriesService_Create_user(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Int(1)} + want := &Repository{ID: Int64(1)} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.Create returned %+v, want %+v", repo, want) } @@ -220,7 +220,7 @@ func TestRepositoriesService_Create_org(t *testing.T) { t.Errorf("Repositories.Create returned error: %v", err) } - want := &Repository{ID: Int(1)} + want := &Repository{ID: Int64(1)} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.Create returned %+v, want %+v", repo, want) } @@ -250,7 +250,7 @@ func TestRepositoriesService_Get(t *testing.T) { t.Errorf("Repositories.Get returned error: %v", err) } - want := &Repository{ID: Int(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} + want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.Get returned %+v, want %+v", repo, want) } @@ -303,7 +303,7 @@ func TestRepositoriesService_GetByID(t *testing.T) { t.Fatalf("Repositories.GetByID returned error: %v", err) } - want := &Repository{ID: Int(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} + want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.GetByID returned %+v, want %+v", repo, want) } @@ -332,7 +332,7 @@ func TestRepositoriesService_Edit(t *testing.T) { t.Errorf("Repositories.Edit returned error: %v", err) } - want := &Repository{ID: Int(1)} + want := &Repository{ID: Int64(1)} if !reflect.DeepEqual(repo, want) { t.Errorf("Repositories.Edit returned %+v, want %+v", repo, want) } @@ -430,7 +430,7 @@ func TestRepositoriesService_ListTeams(t *testing.T) { t.Errorf("Repositories.ListTeams returned error: %v", err) } - want := []*Team{{ID: Int(1)}} + want := []*Team{{ID: Int64(1)}} if !reflect.DeepEqual(teams, want) { t.Errorf("Repositories.ListTeams returned %+v, want %+v", teams, want) } @@ -549,10 +549,10 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int(3)}, + {Login: String("u"), ID: Int64(3)}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int(4)}, + {Slug: String("t"), ID: Int64(4)}, }, }, RequireCodeOwnerReviews: true, @@ -563,10 +563,10 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int(1)}, + {Login: String("u"), ID: Int64(1)}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int(2)}, + {Slug: String("t"), ID: Int64(2)}, }, }, } @@ -623,20 +623,20 @@ func TestRepositoriesService_UpdateBranchProtection(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: DismissalRestrictions{ Users: []*User{ - {Login: String("uu"), ID: Int(3)}, + {Login: String("uu"), ID: Int64(3)}, }, Teams: []*Team{ - {Slug: String("tt"), ID: Int(4)}, + {Slug: String("tt"), ID: Int64(4)}, }, }, RequireCodeOwnerReviews: true, }, Restrictions: &BranchRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int(1)}, + {Login: String("u"), ID: Int64(1)}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int(2)}, + {Slug: String("t"), ID: Int64(2)}, }, }, } @@ -770,10 +770,10 @@ func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int(1)}, + {Login: String("u"), ID: Int64(1)}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int(2)}, + {Slug: String("t"), ID: Int64(2)}, }, }, RequireCodeOwnerReviews: true, @@ -816,10 +816,10 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { DismissStaleReviews: true, DismissalRestrictions: DismissalRestrictions{ Users: []*User{ - {Login: String("u"), ID: Int(1)}, + {Login: String("u"), ID: Int64(1)}, }, Teams: []*Team{ - {Slug: String("t"), ID: Int(2)}, + {Slug: String("t"), ID: Int64(2)}, }, }, RequireCodeOwnerReviews: true, @@ -1064,7 +1064,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - input := TransferRequest{NewOwner: "a", TeamID: []int{123}} + input := TransferRequest{NewOwner: "a", TeamID: []int64{123}} mux.HandleFunc("/repos/o/r/transfer", func(w http.ResponseWriter, r *http.Request) { var v TransferRequest diff --git a/github/search_test.go b/github/search_test.go index 30014a550bd..cc9faacf697 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -40,7 +40,7 @@ func TestSearchService_Repositories(t *testing.T) { want := &RepositoriesSearchResult{ Total: Int(4), IncompleteResults: Bool(false), - Repositories: []Repository{{ID: Int(1)}, {ID: Int(2)}}, + Repositories: []Repository{{ID: Int64(1)}, {ID: Int64(2)}}, } if !reflect.DeepEqual(result, want) { t.Errorf("Search.Repositories returned %+v, want %+v", result, want) @@ -166,7 +166,7 @@ func TestSearchService_Users(t *testing.T) { want := &UsersSearchResult{ Total: Int(4), IncompleteResults: Bool(false), - Users: []User{{ID: Int(1)}, {ID: Int(2)}}, + Users: []User{{ID: Int64(1)}, {ID: Int64(2)}}, } if !reflect.DeepEqual(result, want) { t.Errorf("Search.Users returned %+v, want %+v", result, want) diff --git a/github/strings_test.go b/github/strings_test.go index 6af88acd390..b0a82089c06 100644 --- a/github/strings_test.go +++ b/github/strings_test.go @@ -62,11 +62,11 @@ func TestStringify(t *testing.T) { `github.Timestamp{2006-01-02 15:04:05 +0000 UTC}`, }, { - User{ID: Int(123), Name: String("n")}, + User{ID: Int64(123), Name: String("n")}, `github.User{ID:123, Name:"n"}`, }, { - Repository{Owner: &User{ID: Int(123)}}, + Repository{Owner: &User{ID: Int64(123)}}, `github.Repository{Owner:github.User{ID:123}}`, }, } @@ -96,37 +96,37 @@ func TestString(t *testing.T) { {CommitsComparison{TotalCommits: Int(1)}, `github.CommitsComparison{TotalCommits:1}`}, {Commit{SHA: String("s")}, `github.Commit{SHA:"s"}`}, {Event{ID: String("1")}, `github.Event{ID:"1"}`}, - {GistComment{ID: Int(1)}, `github.GistComment{ID:1}`}, + {GistComment{ID: Int64(1)}, `github.GistComment{ID:1}`}, {GistFile{Size: Int(1)}, `github.GistFile{Size:1}`}, {Gist{ID: String("1")}, `github.Gist{ID:"1", Files:map[]}`}, {GitObject{SHA: String("s")}, `github.GitObject{SHA:"s"}`}, {Gitignore{Name: String("n")}, `github.Gitignore{Name:"n"}`}, - {Hook{ID: Int(1)}, `github.Hook{Config:map[], ID:1}`}, - {IssueComment{ID: Int(1)}, `github.IssueComment{ID:1}`}, + {Hook{ID: Int64(1)}, `github.Hook{Config:map[], ID:1}`}, + {IssueComment{ID: Int64(1)}, `github.IssueComment{ID:1}`}, {Issue{Number: Int(1)}, `github.Issue{Number:1}`}, - {Key{ID: Int(1)}, `github.Key{ID:1}`}, - {Label{ID: Int(1), Name: String("l")}, `github.Label{ID:1, Name:"l"}`}, - {Organization{ID: Int(1)}, `github.Organization{ID:1}`}, - {PullRequestComment{ID: Int(1)}, `github.PullRequestComment{ID:1}`}, + {Key{ID: Int64(1)}, `github.Key{ID:1}`}, + {Label{ID: Int64(1), Name: String("l")}, `github.Label{ID:1, Name:"l"}`}, + {Organization{ID: Int64(1)}, `github.Organization{ID:1}`}, + {PullRequestComment{ID: Int64(1)}, `github.PullRequestComment{ID:1}`}, {PullRequest{Number: Int(1)}, `github.PullRequest{Number:1}`}, - {PullRequestReview{ID: Int(1)}, `github.PullRequestReview{ID:1}`}, + {PullRequestReview{ID: Int64(1)}, `github.PullRequestReview{ID:1}`}, {DraftReviewComment{Position: Int(1)}, `github.DraftReviewComment{Position:1}`}, {PullRequestReviewRequest{Body: String("r")}, `github.PullRequestReviewRequest{Body:"r"}`}, {PullRequestReviewDismissalRequest{Message: String("r")}, `github.PullRequestReviewDismissalRequest{Message:"r"}`}, {PushEventCommit{SHA: String("s")}, `github.PushEventCommit{SHA:"s"}`}, - {PushEvent{PushID: Int(1)}, `github.PushEvent{PushID:1}`}, + {PushEvent{PushID: Int64(1)}, `github.PushEvent{PushID:1}`}, {Reference{Ref: String("r")}, `github.Reference{Ref:"r"}`}, - {ReleaseAsset{ID: Int(1)}, `github.ReleaseAsset{ID:1}`}, - {RepoStatus{ID: Int(1)}, `github.RepoStatus{ID:1}`}, - {RepositoryComment{ID: Int(1)}, `github.RepositoryComment{ID:1}`}, + {ReleaseAsset{ID: Int64(1)}, `github.ReleaseAsset{ID:1}`}, + {RepoStatus{ID: Int64(1)}, `github.RepoStatus{ID:1}`}, + {RepositoryComment{ID: Int64(1)}, `github.RepositoryComment{ID:1}`}, {RepositoryCommit{SHA: String("s")}, `github.RepositoryCommit{SHA:"s"}`}, {RepositoryContent{Name: String("n")}, `github.RepositoryContent{Name:"n"}`}, - {RepositoryRelease{ID: Int(1)}, `github.RepositoryRelease{ID:1}`}, - {Repository{ID: Int(1)}, `github.Repository{ID:1}`}, - {Team{ID: Int(1)}, `github.Team{ID:1}`}, + {RepositoryRelease{ID: Int64(1)}, `github.RepositoryRelease{ID:1}`}, + {Repository{ID: Int64(1)}, `github.Repository{ID:1}`}, + {Team{ID: Int64(1)}, `github.Team{ID:1}`}, {TreeEntry{SHA: String("s")}, `github.TreeEntry{SHA:"s"}`}, {Tree{SHA: String("s")}, `github.Tree{SHA:"s"}`}, - {User{ID: Int(1)}, `github.User{ID:1}`}, + {User{ID: Int64(1)}, `github.User{ID:1}`}, {WebHookAuthor{Name: String("n")}, `github.WebHookAuthor{Name:"n"}`}, {WebHookCommit{ID: String("1")}, `github.WebHookCommit{ID:"1"}`}, {WebHookPayload{Ref: String("r")}, `github.WebHookPayload{Ref:"r"}`}, diff --git a/github/users.go b/github/users.go index 83cfb45b5ab..ef8f3dd573a 100644 --- a/github/users.go +++ b/github/users.go @@ -19,7 +19,7 @@ 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"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` GravatarID *string `json:"gravatar_id,omitempty"` @@ -99,7 +99,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 { @@ -138,7 +138,7 @@ func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, // method. type UserListOptions struct { // ID of the last user seen - Since int `url:"since,omitempty"` + Since int64 `url:"since,omitempty"` ListOptions } @@ -199,7 +199,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 +216,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 { diff --git a/github/users_followers_test.go b/github/users_followers_test.go index 255efbdab83..777fe801438 100644 --- a/github/users_followers_test.go +++ b/github/users_followers_test.go @@ -29,7 +29,7 @@ func TestUsersService_ListFollowers_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -49,7 +49,7 @@ func TestUsersService_ListFollowers_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowers returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(users, want) { t.Errorf("Users.ListFollowers returned %+v, want %+v", users, want) } @@ -79,7 +79,7 @@ func TestUsersService_ListFollowing_authenticatedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(users, want) { t.Errorf("Users.ListFollowing returned %+v, want %+v", users, want) } @@ -99,7 +99,7 @@ func TestUsersService_ListFollowing_specifiedUser(t *testing.T) { t.Errorf("Users.ListFollowing returned error: %v", err) } - want := []*User{{ID: Int(1)}} + want := []*User{{ID: Int64(1)}} if !reflect.DeepEqual(users, want) { t.Errorf("Users.ListFollowing returned %+v, want %+v", users, want) } diff --git a/github/users_gpg_keys.go b/github/users_gpg_keys.go index 3e95fb44604..d8bbc5201f3 100644 --- a/github/users_gpg_keys.go +++ b/github/users_gpg_keys.go @@ -15,8 +15,8 @@ import ( // // https://developer.github.com/changes/2016-04-04-git-signing-api-preview/ type GPGKey struct { - ID *int `json:"id,omitempty"` - PrimaryKeyID *int `json:"primary_key_id,omitempty"` + ID *int64 `json:"id,omitempty"` + PrimaryKeyID *int64 `json:"primary_key_id,omitempty"` KeyID *string `json:"key_id,omitempty"` PublicKey *string `json:"public_key,omitempty"` Emails []GPGEmail `json:"emails,omitempty"` @@ -78,7 +78,7 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opt *ListOp // via Basic Auth or via OAuth with at least read:gpg_key scope. // // GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#get-a-single-gpg-key -func (s *UsersService) GetGPGKey(ctx context.Context, id int) (*GPGKey, *Response, error) { +func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -126,7 +126,7 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string // via OAuth with at least admin:gpg_key scope. // // GitHub API docs: https://developer.github.com/v3/users/gpg_keys/#delete-a-gpg-key -func (s *UsersService) DeleteGPGKey(ctx context.Context, id int) (*Response, error) { +func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/github/users_gpg_keys_test.go b/github/users_gpg_keys_test.go index dc89712b4ac..ca0207eb432 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -31,7 +31,7 @@ func TestUsersService_ListGPGKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Int(1), PrimaryKeyID: Int(2)}} + want := []*GPGKey{{ID: Int64(1), PrimaryKeyID: Int64(2)}} if !reflect.DeepEqual(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -52,7 +52,7 @@ func TestUsersService_ListGPGKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListGPGKeys returned error: %v", err) } - want := []*GPGKey{{ID: Int(1), PrimaryKeyID: Int(2)}} + want := []*GPGKey{{ID: Int64(1), PrimaryKeyID: Int64(2)}} if !reflect.DeepEqual(keys, want) { t.Errorf("Users.ListGPGKeys = %+v, want %+v", keys, want) } @@ -81,7 +81,7 @@ func TestUsersService_GetGPGKey(t *testing.T) { t.Errorf("Users.GetGPGKey returned error: %v", err) } - want := &GPGKey{ID: Int(1)} + want := &GPGKey{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", key, want) } @@ -120,7 +120,7 @@ mQINBFcEd9kBEACo54TDbGhKlXKWMvJgecEUKPPcv7XdnpKdGb3LRw5MvFwT0V0f t.Errorf("Users.GetGPGKey returned error: %v", err) } - want := &GPGKey{ID: Int(1)} + want := &GPGKey{ID: Int64(1)} if !reflect.DeepEqual(gpgKey, want) { t.Errorf("Users.GetGPGKey = %+v, want %+v", gpgKey, want) } diff --git a/github/users_keys.go b/github/users_keys.go index 97ed4b86112..ddc832a1ece 100644 --- a/github/users_keys.go +++ b/github/users_keys.go @@ -12,7 +12,7 @@ import ( // Key represents a public SSH key used to authenticate a user or deploy script. type Key struct { - ID *int `json:"id,omitempty"` + ID *int64 `json:"id,omitempty"` Key *string `json:"key,omitempty"` URL *string `json:"url,omitempty"` Title *string `json:"title,omitempty"` @@ -56,7 +56,7 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opt *ListOptio // GetKey fetches a single public key. // // GitHub API docs: https://developer.github.com/v3/users/keys/#get-a-single-public-key -func (s *UsersService) GetKey(ctx context.Context, id int) (*Key, *Response, error) { +func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -96,7 +96,7 @@ func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response // DeleteKey deletes a public key. // // GitHub API docs: https://developer.github.com/v3/users/keys/#delete-a-public-key -func (s *UsersService) DeleteKey(ctx context.Context, id int) (*Response, error) { +func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_keys_test.go b/github/users_keys_test.go index 801f44fdf41..3115fdb2e14 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -30,7 +30,7 @@ func TestUsersService_ListKeys_authenticatedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int(1)}} + want := []*Key{{ID: Int64(1)}} if !reflect.DeepEqual(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -50,7 +50,7 @@ func TestUsersService_ListKeys_specifiedUser(t *testing.T) { t.Errorf("Users.ListKeys returned error: %v", err) } - want := []*Key{{ID: Int(1)}} + want := []*Key{{ID: Int64(1)}} if !reflect.DeepEqual(keys, want) { t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want) } @@ -78,7 +78,7 @@ func TestUsersService_GetKey(t *testing.T) { t.Errorf("Users.GetKey returned error: %v", err) } - want := &Key{ID: Int(1)} + want := &Key{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Users.GetKey returned %+v, want %+v", key, want) } @@ -107,7 +107,7 @@ func TestUsersService_CreateKey(t *testing.T) { t.Errorf("Users.GetKey returned error: %v", err) } - want := &Key{ID: Int(1)} + want := &Key{ID: Int64(1)} if !reflect.DeepEqual(key, want) { t.Errorf("Users.GetKey returned %+v, want %+v", key, want) } diff --git a/github/users_test.go b/github/users_test.go index c0c99560c7f..750b6733de3 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -19,7 +19,7 @@ func TestUser_marshall(t *testing.T) { u := &User{ Login: String("l"), - ID: Int(1), + ID: Int64(1), URL: String("u"), AvatarURL: String("a"), GravatarID: String("g"), @@ -70,7 +70,7 @@ func TestUsersService_Get_authenticatedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Int(1)} + want := &User{ID: Int64(1)} if !reflect.DeepEqual(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -90,7 +90,7 @@ func TestUsersService_Get_specifiedUser(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := &User{ID: Int(1)} + want := &User{ID: Int64(1)} if !reflect.DeepEqual(user, want) { t.Errorf("Users.Get returned %+v, want %+v", user, want) } @@ -118,7 +118,7 @@ func TestUsersService_GetByID(t *testing.T) { t.Fatalf("Users.GetByID returned error: %v", err) } - want := &User{ID: Int(1)} + want := &User{ID: Int64(1)} if !reflect.DeepEqual(user, want) { t.Errorf("Users.GetByID returned %+v, want %+v", user, want) } @@ -147,7 +147,7 @@ func TestUsersService_Edit(t *testing.T) { t.Errorf("Users.Edit returned error: %v", err) } - want := &User{ID: Int(1)} + want := &User{ID: Int64(1)} if !reflect.DeepEqual(user, want) { t.Errorf("Users.Edit returned %+v, want %+v", user, want) } @@ -169,7 +169,7 @@ func TestUsersService_ListAll(t *testing.T) { t.Errorf("Users.Get returned error: %v", err) } - want := []*User{{ID: Int(2)}} + want := []*User{{ID: Int64(2)}} if !reflect.DeepEqual(users, want) { t.Errorf("Users.ListAll returned %+v, want %+v", users, want) } @@ -190,7 +190,7 @@ func TestUsersService_ListInvitations(t *testing.T) { t.Errorf("Users.ListInvitations returned error: %v", err) } - want := []*RepositoryInvitation{{ID: Int(1)}, {ID: Int(2)}} + want := []*RepositoryInvitation{{ID: Int64(1)}, {ID: Int64(2)}} if !reflect.DeepEqual(got, want) { t.Errorf("Users.ListInvitations = %+v, want %+v", got, want) }