suzuki-shunsuke/go-graylog

Allow calling generic APIs

Opened this issue · 1 comments

There is a "callAPI" method:

func (client *Client) callAPI(
ctx context.Context, method, endpoint string, input, output interface{},
) (*ErrorInfo, error) {
// prepare request

This is currently private. It would be nice if the User can call any APIs that are not implemented (yet), like /authz/shares. See #332.

I would suggest renaming callAPI to CallAPI to make it public, or provide a equivalent public method.

On implementing the PR, I figured out that just make the func public will not be as useful, as this doen't allow to pass in a relative URL. So I reimplemented it with a "Generic" endpoint. The existing "util.go" file remains unchanged.
New PR #335