Git Product home page Git Product logo

Comments (5)

mntlty avatar mntlty commented on June 10, 2024

A concrete implementation is in 114787b in case this makes sense to others

from go-gh.

mislav avatar mislav commented on June 10, 2024

Thanks for bringing this up. Will the examples still get rendered of on the main page of generated docs? If so, I'm in favor of this 👍

from go-gh.

mntlty avatar mntlty commented on June 10, 2024

@mislav I ran godoc -http=:6060 on the example branch, and it renders the examples while adding the gh package. Comparing local output for http://localhost:6060/pkg/github.com/cli/go-gh/#example_RESTClient_advanced

From trunk:

opts := api.ClientOptions{
    Host:      "github.com",
    AuthToken: "xxxxxxxxxx", // Replace with valid auth token.
    Headers:   map[string]string{"Time-Zone": "America/Los_Angeles"},
    Log:       os.Stdout,
}
client, err := RESTClient(&opts)
if err != nil {
    log.Fatal(err)
}
response := []struct{ Name string }{}
err = client.Get("repos/cli/cli/tags", &response)
if err != nil {
    log.Fatal(err)
}
fmt.Println(response)

From the example branch:

opts := api.ClientOptions{
    Host:      "github.com",
    AuthToken: "xxxxxxxxxx", // Replace with valid auth token.
    Headers:   map[string]string{"Time-Zone": "America/Los_Angeles"},
    Log:       os.Stdout,
}
client, err := gh.RESTClient(&opts)
if err != nil {
    log.Fatal(err)
}
response := []struct{ Name string }{}
err = client.Get("repos/cli/cli/tags", &response)
if err != nil {
    log.Fatal(err)
}
fmt.Println(response)

is there something else I should check for?

from go-gh.

mislav avatar mislav commented on June 10, 2024

Nice, thanks for checking! Please send a PR for this 🙇

from go-gh.

mntlty avatar mntlty commented on June 10, 2024

done!

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.