refactor: refactoring http request creation and sending (#395)
* refactoring http request creation and sending * fix lint error * increase the test coverage of client.go * refactor: Change the style of HTTPRequestBuilder.Build func to one-argument-per-line.
This commit is contained in:
committed by
GitHub
parent
157de0680f
commit
f1b66967a4
@@ -41,7 +41,7 @@ type ModelsList struct {
|
||||
// ListModels Lists the currently available models,
|
||||
// and provides basic information about each model such as the model id and parent.
|
||||
func (c *Client) ListModels(ctx context.Context) (models ModelsList, err error) {
|
||||
req, err := c.requestBuilder.Build(ctx, http.MethodGet, c.fullURL("/models"), nil)
|
||||
req, err := c.newRequest(ctx, http.MethodGet, c.fullURL("/models"))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func (c *Client) ListModels(ctx context.Context) (models ModelsList, err error)
|
||||
// the model such as the owner and permissioning.
|
||||
func (c *Client) GetModel(ctx context.Context, modelID string) (model Model, err error) {
|
||||
urlSuffix := fmt.Sprintf("/models/%s", modelID)
|
||||
req, err := c.requestBuilder.Build(ctx, http.MethodGet, c.fullURL(urlSuffix), nil)
|
||||
req, err := c.newRequest(ctx, http.MethodGet, c.fullURL(urlSuffix))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user