41 lines
728 B
Go
41 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)
|
||
|
}
|