-
Notifications
You must be signed in to change notification settings - Fork 53
Change Collaborators List to include permissions #116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsCollaborator
signature should not be changed
gitea/repo_collaborator.go
Outdated
err := c.getParsedResponse("GET", | ||
fmt.Sprintf("/repos/%s/%s/collaborators", user, repo), | ||
nil, nil, &collaborators) | ||
return collaborators, err | ||
} | ||
|
||
// IsCollaborator check if a user is a collaborator of a repository | ||
func (c *Client) IsCollaborator(user, repo, collaborator string) (bool, error) { | ||
status, err := c.getStatusCode("GET", | ||
func (c *Client) IsCollaborator(user, repo, collaborator string) (*Permission, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is breaking change and will break current SDK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... This was to go with the associated pull-request. Would it better to create a new API end-point to retrieve permissions?
Similarly does the change with reporting the permission in the /repos/{owner}/{repoName}/collaborators break the SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For getting permissions at least new function has to be created even if it would be using same endpoint.
As for type change that is minor breakage as you will still get struct with same properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok. I can do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have restored the signature.
eca264b
to
36295e9
Compare
@@ -47,6 +47,25 @@ type Repository struct { | |||
Permissions *Permission `json:"permissions,omitempty"` | |||
} | |||
|
|||
// Collaborator represents a collaborator | |||
// swagger:model | |||
type Collaborator struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use
// Collaborator represents a user with collaboration details.
type Collaborator struct {
*User
Collaboration *Collaboration
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @zeripath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I'd sorta given up on this PR. I don't actually need it with the Sudo approach.
If you think the PR is still worth doing I'll do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be useful to see which permissions collaborators have, but I have no strong opinion, and I was going through PRs marked as stale so I'm ok with this (and linked PR) being closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revise, rebase and update
36295e9
to
d001685
Compare
Signed-off-by: Andrew Thornton <[email protected]>
…n the permission Signed-off-by: Andrew Thornton <[email protected]>
d001685
to
95682df
Compare
Change the collaborators list to include permissions. Requires go-gitea/gitea#4814.