Eoin McAfee 2 years ago committed by GitHub
parent fdfe23995f
commit 3dbe29d23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,7 +16,7 @@ type organizationService struct {
}
func (s *organizationService) Find(ctx context.Context, name string) (*scm.Organization, *scm.Response, error) {
path := fmt.Sprintf("2.0/teams/%s", name)
path := fmt.Sprintf("2.0/workspaces/%s", name)
out := new(organization)
res, err := s.client.do(ctx, "GET", path, nil, out)
return convertOrganization(out), res, err
@ -27,7 +27,7 @@ func (s *organizationService) FindMembership(ctx context.Context, name, username
}
func (s *organizationService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Organization, *scm.Response, error) {
path := fmt.Sprintf("2.0/teams?%s", encodeListRoleOptions(opts))
path := fmt.Sprintf("2.0/workspaces?%s", encodeListRoleOptions(opts))
out := new(organizationList)
res, err := s.client.do(ctx, "GET", path, nil, out)
copyPagination(out.pagination, res)
@ -48,7 +48,7 @@ type organizationList struct {
}
type organization struct {
Login string `json:"username"`
Login string `json:"slug"`
}
func convertOrganization(from *organization) *scm.Organization {

@ -20,7 +20,7 @@ func TestOrganizationFind(t *testing.T) {
defer gock.Off()
gock.New("https://api.bitbucket.org").
Get("/2.0/teams/atlassian").
Get("/2.0/workspaces/atlassian").
Reply(200).
Type("application/json").
File("testdata/team.json")
@ -45,7 +45,7 @@ func TestOrganizationList(t *testing.T) {
defer gock.Off()
gock.New("https://api.bitbucket.org").
Get("/2.0/teams").
Get("/2.0/workspaces").
MatchParam("pagelen", "30").
MatchParam("page", "1").
Reply(200).

@ -1,17 +1,37 @@
{
"username": "atlassian",
"type": "team",
"display_name": "Atlassian",
"uuid": "{02b941e3-cfaa-40f9-9a58-cec53e20bdc3}",
"links": {
"owners": {
"href": "https://api.bitbucket.org/2.0/workspaces/atlassian/members?q=permission%3D%22owner%22"
},
"hooks": {
"href": "https://api.bitbucket.org/2.0/workspaces/atlassian/hooks"
},
"self": {
"href": "https:\/\/api.bitbucket.org\/2.0\/teams\/atlassian"
"href": "https://api.bitbucket.org/2.0/workspaces/atlassian"
},
"repositories": {
"href": "https://api.bitbucket.org/2.0/repositories/atlassian"
},
"html": {
"href": "https:\/\/bitbucket.org\/atlassian\/"
"href": "https://bitbucket.org/atlassian/"
},
"avatar": {
"href": "https:\/\/bitbucket.org\/account\/atlassian\/avatar\/32\/"
"href": "https://bitbucket.org/workspaces/atlassian/avatar/?ts=1612327398"
},
"members": {
"href": "https://api.bitbucket.org/2.0/workspaces/atlassian/members"
},
"projects": {
"href": "https://api.bitbucket.org/2.0/workspaces/atlassian/projects"
},
"snippets": {
"href": "https://api.bitbucket.org/2.0/snippets/atlassian"
}
}
},
"created_on": "2018-11-29T02:26:39.297476+00:00",
"type": "workspace",
"slug": "atlassian",
"is_private": true,
"name": "Atlassian"
}

@ -2,9 +2,10 @@
"pagelen": 30,
"values": [
{
"username": "atlassian",
"slug": "atlassian",
"website": null,
"display_name": "Atlassian",
"is_private": false,
"name": "Atlassian",
"uuid": "{d5bb8c49-f033-4498-910e-7e4b546b04ee}",
"links": {
"hooks": {
@ -39,8 +40,7 @@
}
},
"created_on": "2012-11-08T19:05:39.080491+00:00",
"location": null,
"type": "team"
"type": "workspace"
}
],
"page": 1,

Loading…
Cancel
Save