40 lines
728 B
Go
40 lines
728 B
Go
package api
|
|
|
|
import "net/http"
|
|
|
|
func (api *Client) Get(
|
|
u string,
|
|
result interface{},
|
|
) error {
|
|
params := RequestOptions{
|
|
Method: http.MethodGet,
|
|
Headers: makeHeaders(api.options.AccessToken),
|
|
}
|
|
return api.doRequest(u, params, result)
|
|
}
|
|
|
|
func (api *Client) Post(
|
|
u string,
|
|
request any,
|
|
result any,
|
|
) error {
|
|
params := RequestOptions{
|
|
Method: http.MethodPost,
|
|
Body: request,
|
|
Headers: makeHeaders(api.options.AccessToken),
|
|
}
|
|
return api.doRequest(u, params, result)
|
|
}
|
|
|
|
func (api *Client) Patch(
|
|
u string,
|
|
request any,
|
|
result any,
|
|
) error {
|
|
params := RequestOptions{
|
|
Method: http.MethodPatch,
|
|
Body: request,
|
|
Headers: makeHeaders(api.options.AccessToken),
|
|
}
|
|
return api.doRequest(u, params, result)
|
|
}
|