Code Monkey home page Code Monkey logo

Comments (8)

hahmed avatar hahmed commented on May 20, 2024

@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.

from octokit.net.

haacked avatar haacked commented on May 20, 2024

@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?

from octokit.net.

hahmed avatar hahmed commented on May 20, 2024

@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.

from octokit.net.

haacked avatar haacked commented on May 20, 2024

@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; }
}

from octokit.net.

hahmed avatar hahmed commented on May 20, 2024

@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?

from octokit.net.

haacked avatar haacked commented on May 20, 2024

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)

from octokit.net.

hahmed avatar hahmed commented on May 20, 2024

@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.

from octokit.net.

haacked avatar haacked commented on May 20, 2024

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

from octokit.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.