Git Product home page Git Product logo

rollbar-go's People

Contributors

fmasuhr avatar graffzon avatar jtsaito avatar parabolic avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jgordor

rollbar-go's Issues

Testing the API auth.

Should we maybe add a test which tries to authorize with the api and fail if it's not able to do so?

Abstraction for API Resources

Currently, the API resources correspond to one file each which is natural for an SDK. However, the files define methods on the Client. Instead they should define methods on the respective struct.

Example: users.go defines InviteUser() on Client which is in client.go.

It would seem more natural to have a struct for each API resource. In the example, a User struct would contain the client and have a method User.Invite(). All methods for users would be encapsulated with a User struct. The resource specific struct defines things such as its API endpoint.

For convenience, the client can delegate the methods back or an instance of each struct.

Example SDK

mux.HandleFunc wrapper.

Convenience function that gets the fixture and sets the handler so that we don't have to repeat mux.HandleFunc

Refactor Client

When making a request we currently build a string by hand, then create a http.request, then hand it to the Client's makeRequestmethod.

Simplified example:

url := fmt.Sprintf("%steam/%d/invites?access_token=%s&page=%d", c.ApiBaseUrl, teamID, c.ApiKey, pageNum)
req, err := http.NewRequest("GET", url, nil)
bytes, err := c.makeRequest(req)

The Client should abstract away from low level http objects and handle the composition of the request. Only high-level things should still be handled by the user of the Client. So the above example should look more like this:

params = map[string]string{"teamID":teamID, "page":pageNum}
result, err := Client.Get("invites", params)

This also addresses the issue of makeRequest returning bodies and handling response codes for all http methods, which is wrong and only works for the current small set of methods. Instead, it would be nicer to have one client method for each http method: Get for GET, Delete for DELETE etc.

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.