Add methods to ModerationService, attribute to Post, use go v1.15

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-09-07 21:24:14 -04:00
parent 24a87a260b
commit 078b172e81
11 changed files with 245 additions and 118 deletions
+21
View File
@@ -391,6 +391,27 @@ func CheckResponse(r *http.Response) error {
return errorResponse
}
func (c *Client) getListing(ctx context.Context, path string, opts interface{}) (*listing, *Response, error) {
path, err := addOptions(path, opts)
if err != nil {
return nil, nil, err
}
req, err := c.NewRequest(http.MethodGet, path, nil)
if err != nil {
return nil, nil, err
}
root := new(thing)
resp, err := c.Do(ctx, req, root)
if err != nil {
return nil, resp, err
}
listing, _ := root.Listing()
return listing, resp, nil
}
// ListOptions specifies the optional parameters to various API calls that return a listing.
type ListOptions struct {
// Maximum number of items to be returned.