Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Orgs Teams API #134

Closed
haacked opened this issue Oct 31, 2013 · 8 comments · Fixed by #209
Closed

Implement Orgs Teams API #134

haacked opened this issue Oct 31, 2013 · 8 comments · Fixed by #209
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone

Comments

@haacked
Copy link
Contributor

haacked commented Oct 31, 2013

http://developer.github.com/v3/orgs/teams/

@hahmed
Copy link
Contributor

hahmed commented Nov 4, 2013

@haacked how do you want org teams to be implemented (I am new to this so please bear with me).

Would something like this work?

   /// <summary>
    /// organization teams
    /// </summary>
    public class Team
    {
        /// <summary>
        /// team name
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// team id
        /// </summary>
        public int Id { get; set; }

        public Permission Permissions { get; set; }

        public ICollection<User> Members { get; set; }

        public ICollection<Repository> Repositories { get; set; }
    }

    public enum Permission
    {
        /// <summary>
        ///  team members can pull, push and administer these repositories.
        /// </summary>
        admin,

        /// <summary>
        /// team members can pull and push, but not administer these repositories
        /// </summary>
        push,

        /// <summary>
        /// team members can pull, but not push to or administer these repositories
        /// </summary>
        pull
    }

Then should I add a property onto the org class called

public Team Teams {get; set;}

Just wondering what the best way to go about this is... Thanks.

@haacked
Copy link
Contributor Author

haacked commented Nov 4, 2013

@hahmed Thanks for offering to chip in. Take a look at the other clients, especially the Orgs client to get an idea of how clients are implemented.

For example, instead of ICollection we use IReadOnlyList.

We also tend to create classes specifically for creating and updating entities. For example, we'd have a NewTeam and a TeamUpdate class for the Create and Update methods.

Also, for the enum, use standard .NET naming conventions (aka Pascal casing) for the fields: Admin, Push, Pull.

Our JSON serializer will fix it up to match what is expected by the API.

Then should I add a property onto the org class called

No, you'll need to create an ITeamsClient interface and implement it TeamsClient. Then add a property to IOrganizationsClient named Team of type ITeamsClient. make sense?

@hahmed
Copy link
Contributor

hahmed commented Nov 5, 2013

@haacked It's cool, love to help - hope I can be of help.

So far I got:

hahmed@c44b18e

Never understood this bit:

Then add a property to IOrganizationsClient named Team of type ITeamsClient.

@haacked
Copy link
Contributor Author

haacked commented Nov 5, 2013

@hahmed go aheand and open a pull request. Just prefix it with WIP to let us know it's in progress. Much easier to discuss this in the pull request.

http://blog.myget.org/post/2013/10/14/GitHub-Commit-Status-API-now-supported.aspx

In pseudocode

interface IOrganizationsClient {
    ITeamsClient Team { get; }
}

@hahmed hahmed mentioned this issue Nov 5, 2013
4 tasks
@hahmed
Copy link
Contributor

hahmed commented Nov 5, 2013

@haacked Does that mean you want the Teams Api to be only available to end users via OrgsClient.

For example:

OrgsClient.Team.GetAllTeams(string org);
OrgsClient.Team.NewTeam(string name, Permission permission = Permission.Pull) //(default param)

etc.

I assumed you wanted the TeamClient to be separate like I did so in my PR?

@haacked
Copy link
Contributor Author

haacked commented Nov 5, 2013

Does that mean you want the Teams Api to be only available to end users via OrgsClient.

Yep. We're trying to map our API to the structure of the GitHub API http://developer.github.com/v3/orgs/

For context see: #131 (comment)

@hahmed hahmed mentioned this issue Nov 10, 2013
@hahmed
Copy link
Contributor

hahmed commented Nov 10, 2013

@haacked if the above pr gets merged I think that is everything that I needed to implement this feature. Let me know if I have missed anything so I can get this feature fully wrapped up.

@haacked
Copy link
Contributor Author

haacked commented Nov 11, 2013

🆒 I found a potential issue with the PR. But most of it looks great!

@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone and removed up-for-grabs labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants