Added delete endpoint (#8)

* Added a files endpoint, corrected a documents bug in answers requests, added error messages to API error handling

* Added file upload endpoint

* Added DeleteFile endpoint

Co-authored-by: eyelevelai <33876565+eyelevelai@users.noreply.github.com>
This commit is contained in:
blfletcher
2021-08-05 01:59:34 -06:00
committed by GitHub
parent 3dfb5bd804
commit 7c56bd3034
2 changed files with 16 additions and 2 deletions

6
api.go
View File

@@ -74,8 +74,10 @@ func (c *Client) sendRequest(req *http.Request, v interface{}) error {
return fmt.Errorf("error, status code: %d, message: %s", res.StatusCode, errRes.Error.Message)
}
if err = json.NewDecoder(res.Body).Decode(&v); err != nil {
return err
if v != nil {
if err = json.NewDecoder(res.Body).Decode(&v); err != nil {
return err
}
}
return nil