Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Functions for Collaborators #27

Merged
merged 1 commit into from
Dec 22, 2016
Merged

Conversation

ethantkoenig
Copy link
Member

Add functions corresponding to the following endpoints:

  • GET repos/:username/:reponame/collaborators: list collaborators
  • GET repos/:username/:reponame/collaborators/:collaborator: check if a user is a collaborator
  • DELETE repos/:username/:reponame/collaborators/:collaborator: remove a collaborator

These endpoints are implemented in go-gitea/gitea#375.

@bkcsoft
Copy link
Member

bkcsoft commented Dec 13, 2016

LGTM

@@ -10,6 +10,29 @@ import (
"fmt"
)

// ListCollaborators list a repository's collaborators
func (c *Client) ListCollaborators(user, repo string) ([]*User, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pager?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs pagination yes, I must've missed that one 🙁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO pager makes only sense for potentially large lists

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's OKay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tboerger having 100 collaborators isn't large enough? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and seeing as it's currently locked at 10 entries per call, pagination is required if you have more than that...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100 is nothing for an api ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunny @bkcsoft @tboerger Do we want pager or not? Happy to add one if we do, just want to make sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree pager is no need currently. But collaborators := make([]*User, 0, 10) is really not collaborators := make([]*User, 10).

@@ -10,6 +10,29 @@ import (
"fmt"
)

// ListCollaborators list a repository's collaborators
func (c *Client) ListCollaborators(user, repo string) ([]*User, error) {
collaborators := make([]*User, 10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collaborators := make([]*User, 0, 10)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -10,6 +10,29 @@ import (
"fmt"
)

// ListCollaborators list a repository's collaborators
func (c *Client) ListCollaborators(user, repo string) ([]*User, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's OKay.

Copy link
Member

@lunny lunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tboerger
Copy link
Member

LGTM

@tboerger tboerger merged commit 46f52f7 into go-gitea:master Dec 22, 2016
@ethantkoenig ethantkoenig deleted the collaborators branch December 24, 2016 03:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants