babbel / rollbar-go Goto Github PK
View Code? Open in Web Editor NEWA repository for the rollbar go client.
License: MIT License
A repository for the rollbar go client.
License: MIT License
Should we maybe add a test which tries to authorize with the api and fail if it's not able to do so?
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
Convenience function that gets the fixture and sets the handler so that we don't have to repeat mux.HandleFunc
When making a request we currently build a string by hand, then create a http.request
, then hand it to the Client
's makeRequest
method.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.