Skip to content

Commit 6f0d882

Browse files
aldevvbtipling
authored andcommitted
fix github deprecated calls 2
1 parent 0f953c7 commit 6f0d882

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/connector/repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour
298298
return nil, fmt.Errorf("github-connectorv2: failed to add user to a repository: %w", e)
299299
}
300300
case resourceTypeTeam.Id:
301-
team, _, err := o.client.Teams.GetTeamByID(ctx, org.GetID(), principalID)
301+
team, _, err := o.client.Teams.GetTeamBySlug(ctx, fmt.Sprintf("%v", org.GetID()), fmt.Sprintf("%v", principalID))
302302
if err != nil {
303303
return nil, fmt.Errorf("github-connectorv2: failed to get team: %w", err)
304304
}
@@ -356,7 +356,7 @@ func (o *repositoryResourceType) Revoke(ctx context.Context, grant *v2.Grant) (a
356356
return nil, fmt.Errorf("github-connectorv2: failed to remove user from repo: %w", e)
357357
}
358358
case resourceTypeTeam.Id:
359-
team, _, err := o.client.Teams.GetTeamByID(ctx, org.GetID(), principalID)
359+
team, _, err := o.client.Teams.GetTeamBySlug(ctx, fmt.Sprintf("%v", org.GetID()), fmt.Sprintf("%v", principalID))
360360
if err != nil {
361361
return nil, fmt.Errorf("github-connectorv2: failed to get team: %w", err)
362362
}

pkg/connector/team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (o *teamResourceType) List(ctx context.Context, parentID *v2.ResourceId, pt
104104
}
105105

106106
for _, team := range teams {
107-
fullTeam, resp, err := o.client.Teams.GetTeamByID(ctx, orgID, team.GetID())
107+
fullTeam, _, err := o.client.Teams.GetTeamBySlug(ctx, fmt.Sprintf("%v", orgID), fmt.Sprintf("%v", team.GetID()))
108108
if err != nil {
109109
if isNotFoundError(resp) {
110110
return nil, "", nil, uhttp.WrapErrors(codes.NotFound, fmt.Sprintf("team: %d not found", team.GetID()))

0 commit comments

Comments
 (0)