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

View File

@@ -116,6 +116,18 @@ func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File
return
}
// DeleteFile deletes an existing file
func (c *Client) DeleteFile(ctx context.Context, fileID string) (err error) {
req, err := http.NewRequest("DELETE", c.fullURL("/files/"+fileID), nil)
if err != nil {
return
}
req = req.WithContext(ctx)
err = c.sendRequest(req, nil)
return
}
// ListFiles Lists the currently available files,
// and provides basic information about each file such as the file name and purpose.
func (c *Client) ListFiles(ctx context.Context) (files FilesList, err error) {