Skip to content

Commit c7788f9

Browse files
authored
refactor!: Change app installation Find* methods to Get* (#4243)
BREAKING CHANGE: App installation methods are renamed from `Find*` to `Get*`.
1 parent dd6521c commit c7788f9

2 files changed

Lines changed: 46 additions & 46 deletions

File tree

github/apps.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,48 +448,48 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i
448448
return m, resp, nil
449449
}
450450

451-
// FindOrganizationInstallation finds the organization's installation information.
451+
// GetOrganizationInstallation finds the organization's installation information.
452452
//
453453
// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-organization-installation-for-the-authenticated-app
454454
//
455455
//meta:operation GET /orgs/{org}/installation
456-
func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) {
456+
func (s *AppsService) GetOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) {
457457
return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org))
458458
}
459459

460-
// FindEnterpriseInstallation finds the enterprise's installation information.
460+
// GetEnterpriseInstallation finds the enterprise's installation information.
461461
//
462462
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#get-an-enterprise-installation-for-the-authenticated-app
463463
//
464464
//meta:operation GET /enterprises/{enterprise}/installation
465-
func (s *AppsService) FindEnterpriseInstallation(ctx context.Context, enterprise string) (*Installation, *Response, error) {
465+
func (s *AppsService) GetEnterpriseInstallation(ctx context.Context, enterprise string) (*Installation, *Response, error) {
466466
return s.getInstallation(ctx, fmt.Sprintf("enterprises/%v/installation", enterprise))
467467
}
468468

469-
// FindRepositoryInstallation finds the repository's installation information.
469+
// GetRepositoryInstallation finds the repository's installation information.
470470
//
471471
// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app
472472
//
473473
//meta:operation GET /repos/{owner}/{repo}/installation
474-
func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) {
474+
func (s *AppsService) GetRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) {
475475
return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo))
476476
}
477477

478-
// FindRepositoryInstallationByID finds the repository's installation information.
478+
// GetRepositoryInstallationByID finds the repository's installation information.
479479
//
480-
// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation".
480+
// Note: GetRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation".
481481
//
482482
//meta:operation GET /repositories/{repository_id}/installation
483-
func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) {
483+
func (s *AppsService) GetRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) {
484484
return s.getInstallation(ctx, fmt.Sprintf("repositories/%v/installation", id))
485485
}
486486

487-
// FindUserInstallation finds the user's installation information.
487+
// GetUserInstallation finds the user's installation information.
488488
//
489489
// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app
490490
//
491491
//meta:operation GET /users/{username}/installation
492-
func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) {
492+
func (s *AppsService) GetUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) {
493493
return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user))
494494
}
495495

github/apps_test.go

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ func TestAppsService_CreateAttachment(t *testing.T) {
569569
})
570570
}
571571

572-
func TestAppsService_FindOrganizationInstallation(t *testing.T) {
572+
func TestAppsService_GetOrganizationInstallation(t *testing.T) {
573573
t.Parallel()
574574
client, mux, _ := setup(t)
575575

@@ -579,32 +579,32 @@ func TestAppsService_FindOrganizationInstallation(t *testing.T) {
579579
})
580580

581581
ctx := t.Context()
582-
installation, _, err := client.Apps.FindOrganizationInstallation(ctx, "o")
582+
installation, _, err := client.Apps.GetOrganizationInstallation(ctx, "o")
583583
if err != nil {
584-
t.Errorf("Apps.FindOrganizationInstallation returned error: %v", err)
584+
t.Errorf("Apps.GetOrganizationInstallation returned error: %v", err)
585585
}
586586

587587
want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")}
588588
if !cmp.Equal(installation, want) {
589-
t.Errorf("Apps.FindOrganizationInstallation returned %+v, want %+v", installation, want)
589+
t.Errorf("Apps.GetOrganizationInstallation returned %+v, want %+v", installation, want)
590590
}
591591

592-
const methodName = "FindOrganizationInstallation"
592+
const methodName = "GetOrganizationInstallation"
593593
testBadOptions(t, methodName, func() (err error) {
594-
_, _, err = client.Apps.FindOrganizationInstallation(ctx, "\n")
594+
_, _, err = client.Apps.GetOrganizationInstallation(ctx, "\n")
595595
return err
596596
})
597597

598598
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
599-
got, resp, err := client.Apps.FindOrganizationInstallation(ctx, "o")
599+
got, resp, err := client.Apps.GetOrganizationInstallation(ctx, "o")
600600
if got != nil {
601601
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
602602
}
603603
return resp, err
604604
})
605605
}
606606

607-
func TestAppsService_FindEnterpriseInstallation(t *testing.T) {
607+
func TestAppsService_GetEnterpriseInstallation(t *testing.T) {
608608
t.Parallel()
609609
client, mux, _ := setup(t)
610610

@@ -614,32 +614,32 @@ func TestAppsService_FindEnterpriseInstallation(t *testing.T) {
614614
})
615615

616616
ctx := t.Context()
617-
installation, _, err := client.Apps.FindEnterpriseInstallation(ctx, "e")
617+
installation, _, err := client.Apps.GetEnterpriseInstallation(ctx, "e")
618618
if err != nil {
619-
t.Errorf("Apps.FindEnterpriseInstallation returned error: %v", err)
619+
t.Errorf("Apps.GetEnterpriseInstallation returned error: %v", err)
620620
}
621621

622622
want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Enterprise")}
623623
if !cmp.Equal(installation, want) {
624-
t.Errorf("Apps.FindEnterpriseInstallation returned %+v, want %+v", installation, want)
624+
t.Errorf("Apps.GetEnterpriseInstallation returned %+v, want %+v", installation, want)
625625
}
626626

627-
const methodName = "FindEnterpriseInstallation"
627+
const methodName = "GetEnterpriseInstallation"
628628
testBadOptions(t, methodName, func() (err error) {
629-
_, _, err = client.Apps.FindEnterpriseInstallation(ctx, "\n")
629+
_, _, err = client.Apps.GetEnterpriseInstallation(ctx, "\n")
630630
return err
631631
})
632632

633633
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
634-
got, resp, err := client.Apps.FindEnterpriseInstallation(ctx, "e")
634+
got, resp, err := client.Apps.GetEnterpriseInstallation(ctx, "e")
635635
if got != nil {
636636
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
637637
}
638638
return resp, err
639639
})
640640
}
641641

642-
func TestAppsService_FindRepositoryInstallation(t *testing.T) {
642+
func TestAppsService_GetRepositoryInstallation(t *testing.T) {
643643
t.Parallel()
644644
client, mux, _ := setup(t)
645645

@@ -649,32 +649,32 @@ func TestAppsService_FindRepositoryInstallation(t *testing.T) {
649649
})
650650

651651
ctx := t.Context()
652-
installation, _, err := client.Apps.FindRepositoryInstallation(ctx, "o", "r")
652+
installation, _, err := client.Apps.GetRepositoryInstallation(ctx, "o", "r")
653653
if err != nil {
654-
t.Errorf("Apps.FindRepositoryInstallation returned error: %v", err)
654+
t.Errorf("Apps.GetRepositoryInstallation returned error: %v", err)
655655
}
656656

657657
want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")}
658658
if !cmp.Equal(installation, want) {
659-
t.Errorf("Apps.FindRepositoryInstallation returned %+v, want %+v", installation, want)
659+
t.Errorf("Apps.GetRepositoryInstallation returned %+v, want %+v", installation, want)
660660
}
661661

662-
const methodName = "FindRepositoryInstallation"
662+
const methodName = "GetRepositoryInstallation"
663663
testBadOptions(t, methodName, func() (err error) {
664-
_, _, err = client.Apps.FindRepositoryInstallation(ctx, "\n", "\n")
664+
_, _, err = client.Apps.GetRepositoryInstallation(ctx, "\n", "\n")
665665
return err
666666
})
667667

668668
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
669-
got, resp, err := client.Apps.FindRepositoryInstallation(ctx, "o", "r")
669+
got, resp, err := client.Apps.GetRepositoryInstallation(ctx, "o", "r")
670670
if got != nil {
671671
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
672672
}
673673
return resp, err
674674
})
675675
}
676676

677-
func TestAppsService_FindRepositoryInstallationByID(t *testing.T) {
677+
func TestAppsService_GetRepositoryInstallationByID(t *testing.T) {
678678
t.Parallel()
679679
client, mux, _ := setup(t)
680680

@@ -684,32 +684,32 @@ func TestAppsService_FindRepositoryInstallationByID(t *testing.T) {
684684
})
685685

686686
ctx := t.Context()
687-
installation, _, err := client.Apps.FindRepositoryInstallationByID(ctx, 1)
687+
installation, _, err := client.Apps.GetRepositoryInstallationByID(ctx, 1)
688688
if err != nil {
689-
t.Errorf("Apps.FindRepositoryInstallationByID returned error: %v", err)
689+
t.Errorf("Apps.GetRepositoryInstallationByID returned error: %v", err)
690690
}
691691

692692
want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("Organization")}
693693
if !cmp.Equal(installation, want) {
694-
t.Errorf("Apps.FindRepositoryInstallationByID returned %+v, want %+v", installation, want)
694+
t.Errorf("Apps.GetRepositoryInstallationByID returned %+v, want %+v", installation, want)
695695
}
696696

697-
const methodName = "FindRepositoryInstallationByID"
697+
const methodName = "GetRepositoryInstallationByID"
698698
testBadOptions(t, methodName, func() (err error) {
699-
_, _, err = client.Apps.FindRepositoryInstallationByID(ctx, -1)
699+
_, _, err = client.Apps.GetRepositoryInstallationByID(ctx, -1)
700700
return err
701701
})
702702

703703
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
704-
got, resp, err := client.Apps.FindRepositoryInstallationByID(ctx, 1)
704+
got, resp, err := client.Apps.GetRepositoryInstallationByID(ctx, 1)
705705
if got != nil {
706706
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
707707
}
708708
return resp, err
709709
})
710710
}
711711

712-
func TestAppsService_FindUserInstallation(t *testing.T) {
712+
func TestAppsService_GetUserInstallation(t *testing.T) {
713713
t.Parallel()
714714
client, mux, _ := setup(t)
715715

@@ -719,24 +719,24 @@ func TestAppsService_FindUserInstallation(t *testing.T) {
719719
})
720720

721721
ctx := t.Context()
722-
installation, _, err := client.Apps.FindUserInstallation(ctx, "u")
722+
installation, _, err := client.Apps.GetUserInstallation(ctx, "u")
723723
if err != nil {
724-
t.Errorf("Apps.FindUserInstallation returned error: %v", err)
724+
t.Errorf("Apps.GetUserInstallation returned error: %v", err)
725725
}
726726

727727
want := &Installation{ID: Ptr(int64(1)), AppID: Ptr(int64(1)), TargetID: Ptr(int64(1)), TargetType: Ptr("User")}
728728
if !cmp.Equal(installation, want) {
729-
t.Errorf("Apps.FindUserInstallation returned %+v, want %+v", installation, want)
729+
t.Errorf("Apps.GetUserInstallation returned %+v, want %+v", installation, want)
730730
}
731731

732-
const methodName = "FindUserInstallation"
732+
const methodName = "GetUserInstallation"
733733
testBadOptions(t, methodName, func() (err error) {
734-
_, _, err = client.Apps.FindUserInstallation(ctx, "\n")
734+
_, _, err = client.Apps.GetUserInstallation(ctx, "\n")
735735
return err
736736
})
737737

738738
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
739-
got, resp, err := client.Apps.FindUserInstallation(ctx, "u")
739+
got, resp, err := client.Apps.GetUserInstallation(ctx, "u")
740740
if got != nil {
741741
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
742742
}

0 commit comments

Comments
 (0)