Coder Social home page Coder Social logo

initial feedback about go-gh HOT 6 CLOSED

vilmibm avatar vilmibm commented on July 26, 2024
initial feedback

from go-gh.

Comments (6)

samcoe avatar samcoe commented on July 26, 2024

@vilmibm Thanks for the feedback!

I like the idea of including a DefaultRESTClient and DefaultGQLClient that will auto-resolve host and token. I don't think we would want to auto-resolve the remote as part of the client instantiation, just because the remote doesn't necessarily need to be resolved depending on the API endpoint being hit. I think it would be more useful to have a function called CurrentRepo that would do the resolving. In fact I am wondering if we should even expose the rest of the packages? @mislav mentioned offline that his main feedback would be to reduce the surface area exposed so we have less to maintain.

After thinking about it a bit more I wonder if we could get away with exposing only four functions in this module.

gh.Exec(args) -- to execute some gh command and return results
gh.DefaultRESTClient(opts) -- REST API client that auto-resolves host and token
gh.DefaultGQLClient(opts) -- GQL API client that auto-resolves host and token
gh.CurrentRepo() -- Resolves remotes to a current repository

This would mean moving config, git, auth packages to internal so that they can't be imported. I envision the api package still having some exposed pieces to give some basic configuration for the API clients.

What do you think?

from go-gh.

vilmibm avatar vilmibm commented on July 26, 2024

Makes sense re: remotes and I like the gh.CurrentRepo() idea to start with.

For now, I'm definitely in favor of a consolidation like this. I'd like us to expose loading config since I'd like extensions to be able to store config stanzas, but I'm comfortable saving that for a future improvement as we might want to do more up front design on that interface.

Is the idea that the clients would resolve the token based on a provided host?

from go-gh.

samcoe avatar samcoe commented on July 26, 2024

Yeah that was what I was thinking. The client initializer options would allow specifying host and/or token, and if they are provided then skip the auto-resolving step for either.

from go-gh.

vilmibm avatar vilmibm commented on July 26, 2024

👍 maybe we don't need to call them Default then?

from go-gh.

samcoe avatar samcoe commented on July 26, 2024

@vilmibm That makes sense. I made the changes if you would like to take another look.

from go-gh.

samcoe avatar samcoe commented on July 26, 2024

@vilmibm Going to close this issue out as I think I have addressed all the feedback here. Let me know if you think otherwise.

from go-gh.

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.