Skip to content

Commit

Permalink
Add: GoogleApi__HttpBody.DataReader
Browse files Browse the repository at this point in the history
  • Loading branch information
shinofara committed Jul 31, 2018
1 parent 7c1cb4a commit 0b8fe77
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ml/v1/ml-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/url"
"strconv"
"strings"
"io/ioutil"
)

// Always reference these packages, just in case the auto-generated code
Expand Down Expand Up @@ -198,6 +199,10 @@ type GoogleApi__HttpBody struct {
// Data: HTTP body binary data.
Data string `json:"data,omitempty"`

// DataReader is a TensorTask modification to make sending files from GCS
// oh so much more efficient.
DataReader io.Reader `json:"-"`

// Extensions: Application specific response metadata. Must be set in
// the first response
// for streaming APIs.
Expand Down Expand Up @@ -2887,7 +2892,12 @@ func (c *ProjectsPredictCall) Do(opts ...googleapi.CallOption) (*GoogleApi__Http
HTTPStatusCode: res.StatusCode,
},
}
ret.DataReader = res.Body
b, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}

ret.Data = string(b)
return ret, nil
// {
// "description": "Performs prediction on the data in the request.\nCloud ML Engine implements a custom `predict` verb on top of an HTTP POST\nmethod. \u003cp\u003eFor details of the request and response format, see the **guide\nto the [predict request format](/ml-engine/docs/v1/predict-request)**.",
Expand Down

0 comments on commit 0b8fe77

Please sign in to comment.