prediction-gen.go 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786
  1. // Package prediction provides access to the Prediction API.
  2. //
  3. // See https://developers.google.com/prediction/docs/developer-guide
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/prediction/v1.6"
  8. // ...
  9. // predictionService, err := prediction.New(oauthHttpClient)
  10. package prediction // import "google.golang.org/api/prediction/v1.6"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "prediction:v1.6"
  41. const apiName = "prediction"
  42. const apiVersion = "v1.6"
  43. const basePath = "https://www.googleapis.com/prediction/v1.6/projects/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage your data and permissions in Google Cloud Storage
  47. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  48. // View your data in Google Cloud Storage
  49. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  50. // Manage your data in Google Cloud Storage
  51. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  52. // Manage your data in the Google Prediction API
  53. PredictionScope = "https://www.googleapis.com/auth/prediction"
  54. )
  55. func New(client *http.Client) (*Service, error) {
  56. if client == nil {
  57. return nil, errors.New("client is nil")
  58. }
  59. s := &Service{client: client, BasePath: basePath}
  60. s.Hostedmodels = NewHostedmodelsService(s)
  61. s.Trainedmodels = NewTrainedmodelsService(s)
  62. return s, nil
  63. }
  64. type Service struct {
  65. client *http.Client
  66. BasePath string // API endpoint base URL
  67. UserAgent string // optional additional User-Agent fragment
  68. Hostedmodels *HostedmodelsService
  69. Trainedmodels *TrainedmodelsService
  70. }
  71. func (s *Service) userAgent() string {
  72. if s.UserAgent == "" {
  73. return googleapi.UserAgent
  74. }
  75. return googleapi.UserAgent + " " + s.UserAgent
  76. }
  77. func NewHostedmodelsService(s *Service) *HostedmodelsService {
  78. rs := &HostedmodelsService{s: s}
  79. return rs
  80. }
  81. type HostedmodelsService struct {
  82. s *Service
  83. }
  84. func NewTrainedmodelsService(s *Service) *TrainedmodelsService {
  85. rs := &TrainedmodelsService{s: s}
  86. return rs
  87. }
  88. type TrainedmodelsService struct {
  89. s *Service
  90. }
  91. type Analyze struct {
  92. // DataDescription: Description of the data the model was trained on.
  93. DataDescription *AnalyzeDataDescription `json:"dataDescription,omitempty"`
  94. // Errors: List of errors with the data.
  95. Errors []map[string]string `json:"errors,omitempty"`
  96. // Id: The unique name for the predictive model.
  97. Id string `json:"id,omitempty"`
  98. // Kind: What kind of resource this is.
  99. Kind string `json:"kind,omitempty"`
  100. // ModelDescription: Description of the model.
  101. ModelDescription *AnalyzeModelDescription `json:"modelDescription,omitempty"`
  102. // SelfLink: A URL to re-request this resource.
  103. SelfLink string `json:"selfLink,omitempty"`
  104. // ServerResponse contains the HTTP response code and headers from the
  105. // server.
  106. googleapi.ServerResponse `json:"-"`
  107. // ForceSendFields is a list of field names (e.g. "DataDescription") to
  108. // unconditionally include in API requests. By default, fields with
  109. // empty values are omitted from API requests. However, any non-pointer,
  110. // non-interface field appearing in ForceSendFields will be sent to the
  111. // server regardless of whether the field is empty or not. This may be
  112. // used to include empty fields in Patch requests.
  113. ForceSendFields []string `json:"-"`
  114. }
  115. func (s *Analyze) MarshalJSON() ([]byte, error) {
  116. type noMethod Analyze
  117. raw := noMethod(*s)
  118. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  119. }
  120. // AnalyzeDataDescription: Description of the data the model was trained
  121. // on.
  122. type AnalyzeDataDescription struct {
  123. // Features: Description of the input features in the data set.
  124. Features []*AnalyzeDataDescriptionFeatures `json:"features,omitempty"`
  125. // OutputFeature: Description of the output value or label.
  126. OutputFeature *AnalyzeDataDescriptionOutputFeature `json:"outputFeature,omitempty"`
  127. // ForceSendFields is a list of field names (e.g. "Features") to
  128. // unconditionally include in API requests. By default, fields with
  129. // empty values are omitted from API requests. However, any non-pointer,
  130. // non-interface field appearing in ForceSendFields will be sent to the
  131. // server regardless of whether the field is empty or not. This may be
  132. // used to include empty fields in Patch requests.
  133. ForceSendFields []string `json:"-"`
  134. }
  135. func (s *AnalyzeDataDescription) MarshalJSON() ([]byte, error) {
  136. type noMethod AnalyzeDataDescription
  137. raw := noMethod(*s)
  138. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  139. }
  140. type AnalyzeDataDescriptionFeatures struct {
  141. // Categorical: Description of the categorical values of this feature.
  142. Categorical *AnalyzeDataDescriptionFeaturesCategorical `json:"categorical,omitempty"`
  143. // Index: The feature index.
  144. Index int64 `json:"index,omitempty,string"`
  145. // Numeric: Description of the numeric values of this feature.
  146. Numeric *AnalyzeDataDescriptionFeaturesNumeric `json:"numeric,omitempty"`
  147. // Text: Description of multiple-word text values of this feature.
  148. Text *AnalyzeDataDescriptionFeaturesText `json:"text,omitempty"`
  149. // ForceSendFields is a list of field names (e.g. "Categorical") to
  150. // unconditionally include in API requests. By default, fields with
  151. // empty values are omitted from API requests. However, any non-pointer,
  152. // non-interface field appearing in ForceSendFields will be sent to the
  153. // server regardless of whether the field is empty or not. This may be
  154. // used to include empty fields in Patch requests.
  155. ForceSendFields []string `json:"-"`
  156. }
  157. func (s *AnalyzeDataDescriptionFeatures) MarshalJSON() ([]byte, error) {
  158. type noMethod AnalyzeDataDescriptionFeatures
  159. raw := noMethod(*s)
  160. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  161. }
  162. // AnalyzeDataDescriptionFeaturesCategorical: Description of the
  163. // categorical values of this feature.
  164. type AnalyzeDataDescriptionFeaturesCategorical struct {
  165. // Count: Number of categorical values for this feature in the data.
  166. Count int64 `json:"count,omitempty,string"`
  167. // Values: List of all the categories for this feature in the data set.
  168. Values []*AnalyzeDataDescriptionFeaturesCategoricalValues `json:"values,omitempty"`
  169. // ForceSendFields is a list of field names (e.g. "Count") to
  170. // unconditionally include in API requests. By default, fields with
  171. // empty values are omitted from API requests. However, any non-pointer,
  172. // non-interface field appearing in ForceSendFields will be sent to the
  173. // server regardless of whether the field is empty or not. This may be
  174. // used to include empty fields in Patch requests.
  175. ForceSendFields []string `json:"-"`
  176. }
  177. func (s *AnalyzeDataDescriptionFeaturesCategorical) MarshalJSON() ([]byte, error) {
  178. type noMethod AnalyzeDataDescriptionFeaturesCategorical
  179. raw := noMethod(*s)
  180. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  181. }
  182. type AnalyzeDataDescriptionFeaturesCategoricalValues struct {
  183. // Count: Number of times this feature had this value.
  184. Count int64 `json:"count,omitempty,string"`
  185. // Value: The category name.
  186. Value string `json:"value,omitempty"`
  187. // ForceSendFields is a list of field names (e.g. "Count") to
  188. // unconditionally include in API requests. By default, fields with
  189. // empty values are omitted from API requests. However, any non-pointer,
  190. // non-interface field appearing in ForceSendFields will be sent to the
  191. // server regardless of whether the field is empty or not. This may be
  192. // used to include empty fields in Patch requests.
  193. ForceSendFields []string `json:"-"`
  194. }
  195. func (s *AnalyzeDataDescriptionFeaturesCategoricalValues) MarshalJSON() ([]byte, error) {
  196. type noMethod AnalyzeDataDescriptionFeaturesCategoricalValues
  197. raw := noMethod(*s)
  198. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  199. }
  200. // AnalyzeDataDescriptionFeaturesNumeric: Description of the numeric
  201. // values of this feature.
  202. type AnalyzeDataDescriptionFeaturesNumeric struct {
  203. // Count: Number of numeric values for this feature in the data set.
  204. Count int64 `json:"count,omitempty,string"`
  205. // Mean: Mean of the numeric values of this feature in the data set.
  206. Mean string `json:"mean,omitempty"`
  207. // Variance: Variance of the numeric values of this feature in the data
  208. // set.
  209. Variance string `json:"variance,omitempty"`
  210. // ForceSendFields is a list of field names (e.g. "Count") to
  211. // unconditionally include in API requests. By default, fields with
  212. // empty values are omitted from API requests. However, any non-pointer,
  213. // non-interface field appearing in ForceSendFields will be sent to the
  214. // server regardless of whether the field is empty or not. This may be
  215. // used to include empty fields in Patch requests.
  216. ForceSendFields []string `json:"-"`
  217. }
  218. func (s *AnalyzeDataDescriptionFeaturesNumeric) MarshalJSON() ([]byte, error) {
  219. type noMethod AnalyzeDataDescriptionFeaturesNumeric
  220. raw := noMethod(*s)
  221. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  222. }
  223. // AnalyzeDataDescriptionFeaturesText: Description of multiple-word text
  224. // values of this feature.
  225. type AnalyzeDataDescriptionFeaturesText struct {
  226. // Count: Number of multiple-word text values for this feature.
  227. Count int64 `json:"count,omitempty,string"`
  228. // ForceSendFields is a list of field names (e.g. "Count") to
  229. // unconditionally include in API requests. By default, fields with
  230. // empty values are omitted from API requests. However, any non-pointer,
  231. // non-interface field appearing in ForceSendFields will be sent to the
  232. // server regardless of whether the field is empty or not. This may be
  233. // used to include empty fields in Patch requests.
  234. ForceSendFields []string `json:"-"`
  235. }
  236. func (s *AnalyzeDataDescriptionFeaturesText) MarshalJSON() ([]byte, error) {
  237. type noMethod AnalyzeDataDescriptionFeaturesText
  238. raw := noMethod(*s)
  239. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  240. }
  241. // AnalyzeDataDescriptionOutputFeature: Description of the output value
  242. // or label.
  243. type AnalyzeDataDescriptionOutputFeature struct {
  244. // Numeric: Description of the output values in the data set.
  245. Numeric *AnalyzeDataDescriptionOutputFeatureNumeric `json:"numeric,omitempty"`
  246. // Text: Description of the output labels in the data set.
  247. Text []*AnalyzeDataDescriptionOutputFeatureText `json:"text,omitempty"`
  248. // ForceSendFields is a list of field names (e.g. "Numeric") to
  249. // unconditionally include in API requests. By default, fields with
  250. // empty values are omitted from API requests. However, any non-pointer,
  251. // non-interface field appearing in ForceSendFields will be sent to the
  252. // server regardless of whether the field is empty or not. This may be
  253. // used to include empty fields in Patch requests.
  254. ForceSendFields []string `json:"-"`
  255. }
  256. func (s *AnalyzeDataDescriptionOutputFeature) MarshalJSON() ([]byte, error) {
  257. type noMethod AnalyzeDataDescriptionOutputFeature
  258. raw := noMethod(*s)
  259. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  260. }
  261. // AnalyzeDataDescriptionOutputFeatureNumeric: Description of the output
  262. // values in the data set.
  263. type AnalyzeDataDescriptionOutputFeatureNumeric struct {
  264. // Count: Number of numeric output values in the data set.
  265. Count int64 `json:"count,omitempty,string"`
  266. // Mean: Mean of the output values in the data set.
  267. Mean string `json:"mean,omitempty"`
  268. // Variance: Variance of the output values in the data set.
  269. Variance string `json:"variance,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "Count") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. }
  278. func (s *AnalyzeDataDescriptionOutputFeatureNumeric) MarshalJSON() ([]byte, error) {
  279. type noMethod AnalyzeDataDescriptionOutputFeatureNumeric
  280. raw := noMethod(*s)
  281. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  282. }
  283. type AnalyzeDataDescriptionOutputFeatureText struct {
  284. // Count: Number of times the output label occurred in the data set.
  285. Count int64 `json:"count,omitempty,string"`
  286. // Value: The output label.
  287. Value string `json:"value,omitempty"`
  288. // ForceSendFields is a list of field names (e.g. "Count") to
  289. // unconditionally include in API requests. By default, fields with
  290. // empty values are omitted from API requests. However, any non-pointer,
  291. // non-interface field appearing in ForceSendFields will be sent to the
  292. // server regardless of whether the field is empty or not. This may be
  293. // used to include empty fields in Patch requests.
  294. ForceSendFields []string `json:"-"`
  295. }
  296. func (s *AnalyzeDataDescriptionOutputFeatureText) MarshalJSON() ([]byte, error) {
  297. type noMethod AnalyzeDataDescriptionOutputFeatureText
  298. raw := noMethod(*s)
  299. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  300. }
  301. // AnalyzeModelDescription: Description of the model.
  302. type AnalyzeModelDescription struct {
  303. // ConfusionMatrix: An output confusion matrix. This shows an estimate
  304. // for how this model will do in predictions. This is first indexed by
  305. // the true class label. For each true class label, this provides a pair
  306. // {predicted_label, count}, where count is the estimated number of
  307. // times the model will predict the predicted label given the true
  308. // label. Will not output if more then 100 classes (Categorical models
  309. // only).
  310. ConfusionMatrix *AnalyzeModelDescriptionConfusionMatrix `json:"confusionMatrix,omitempty"`
  311. // ConfusionMatrixRowTotals: A list of the confusion matrix row totals.
  312. ConfusionMatrixRowTotals map[string]string `json:"confusionMatrixRowTotals,omitempty"`
  313. // Modelinfo: Basic information about the model.
  314. Modelinfo *Insert2 `json:"modelinfo,omitempty"`
  315. // ForceSendFields is a list of field names (e.g. "ConfusionMatrix") to
  316. // unconditionally include in API requests. By default, fields with
  317. // empty values are omitted from API requests. However, any non-pointer,
  318. // non-interface field appearing in ForceSendFields will be sent to the
  319. // server regardless of whether the field is empty or not. This may be
  320. // used to include empty fields in Patch requests.
  321. ForceSendFields []string `json:"-"`
  322. }
  323. func (s *AnalyzeModelDescription) MarshalJSON() ([]byte, error) {
  324. type noMethod AnalyzeModelDescription
  325. raw := noMethod(*s)
  326. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  327. }
  328. // AnalyzeModelDescriptionConfusionMatrix: An output confusion matrix.
  329. // This shows an estimate for how this model will do in predictions.
  330. // This is first indexed by the true class label. For each true class
  331. // label, this provides a pair {predicted_label, count}, where count is
  332. // the estimated number of times the model will predict the predicted
  333. // label given the true label. Will not output if more then 100 classes
  334. // (Categorical models only).
  335. type AnalyzeModelDescriptionConfusionMatrix struct {
  336. }
  337. type Input struct {
  338. // Input: Input to the model for a prediction.
  339. Input *InputInput `json:"input,omitempty"`
  340. // ForceSendFields is a list of field names (e.g. "Input") to
  341. // unconditionally include in API requests. By default, fields with
  342. // empty values are omitted from API requests. However, any non-pointer,
  343. // non-interface field appearing in ForceSendFields will be sent to the
  344. // server regardless of whether the field is empty or not. This may be
  345. // used to include empty fields in Patch requests.
  346. ForceSendFields []string `json:"-"`
  347. }
  348. func (s *Input) MarshalJSON() ([]byte, error) {
  349. type noMethod Input
  350. raw := noMethod(*s)
  351. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  352. }
  353. // InputInput: Input to the model for a prediction.
  354. type InputInput struct {
  355. // CsvInstance: A list of input features, these can be strings or
  356. // doubles.
  357. CsvInstance []interface{} `json:"csvInstance,omitempty"`
  358. // ForceSendFields is a list of field names (e.g. "CsvInstance") to
  359. // unconditionally include in API requests. By default, fields with
  360. // empty values are omitted from API requests. However, any non-pointer,
  361. // non-interface field appearing in ForceSendFields will be sent to the
  362. // server regardless of whether the field is empty or not. This may be
  363. // used to include empty fields in Patch requests.
  364. ForceSendFields []string `json:"-"`
  365. }
  366. func (s *InputInput) MarshalJSON() ([]byte, error) {
  367. type noMethod InputInput
  368. raw := noMethod(*s)
  369. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  370. }
  371. type Insert struct {
  372. // Id: The unique name for the predictive model.
  373. Id string `json:"id,omitempty"`
  374. // ModelType: Type of predictive model (classification or regression).
  375. ModelType string `json:"modelType,omitempty"`
  376. // SourceModel: The Id of the model to be copied over.
  377. SourceModel string `json:"sourceModel,omitempty"`
  378. // StorageDataLocation: Google storage location of the training data
  379. // file.
  380. StorageDataLocation string `json:"storageDataLocation,omitempty"`
  381. // StoragePMMLLocation: Google storage location of the preprocessing
  382. // pmml file.
  383. StoragePMMLLocation string `json:"storagePMMLLocation,omitempty"`
  384. // StoragePMMLModelLocation: Google storage location of the pmml model
  385. // file.
  386. StoragePMMLModelLocation string `json:"storagePMMLModelLocation,omitempty"`
  387. // TrainingInstances: Instances to train model on.
  388. TrainingInstances []*InsertTrainingInstances `json:"trainingInstances,omitempty"`
  389. // Utility: A class weighting function, which allows the importance
  390. // weights for class labels to be specified (Categorical models only).
  391. Utility []*InsertUtility `json:"utility,omitempty"`
  392. // ForceSendFields is a list of field names (e.g. "Id") to
  393. // unconditionally include in API requests. By default, fields with
  394. // empty values are omitted from API requests. However, any non-pointer,
  395. // non-interface field appearing in ForceSendFields will be sent to the
  396. // server regardless of whether the field is empty or not. This may be
  397. // used to include empty fields in Patch requests.
  398. ForceSendFields []string `json:"-"`
  399. }
  400. func (s *Insert) MarshalJSON() ([]byte, error) {
  401. type noMethod Insert
  402. raw := noMethod(*s)
  403. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  404. }
  405. type InsertTrainingInstances struct {
  406. // CsvInstance: The input features for this instance.
  407. CsvInstance []interface{} `json:"csvInstance,omitempty"`
  408. // Output: The generic output value - could be regression or class
  409. // label.
  410. Output string `json:"output,omitempty"`
  411. // ForceSendFields is a list of field names (e.g. "CsvInstance") to
  412. // unconditionally include in API requests. By default, fields with
  413. // empty values are omitted from API requests. However, any non-pointer,
  414. // non-interface field appearing in ForceSendFields will be sent to the
  415. // server regardless of whether the field is empty or not. This may be
  416. // used to include empty fields in Patch requests.
  417. ForceSendFields []string `json:"-"`
  418. }
  419. func (s *InsertTrainingInstances) MarshalJSON() ([]byte, error) {
  420. type noMethod InsertTrainingInstances
  421. raw := noMethod(*s)
  422. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  423. }
  424. // InsertUtility: Class label (string).
  425. type InsertUtility struct {
  426. }
  427. type Insert2 struct {
  428. // Created: Insert time of the model (as a RFC 3339 timestamp).
  429. Created string `json:"created,omitempty"`
  430. // Id: The unique name for the predictive model.
  431. Id string `json:"id,omitempty"`
  432. // Kind: What kind of resource this is.
  433. Kind string `json:"kind,omitempty"`
  434. // ModelInfo: Model metadata.
  435. ModelInfo *Insert2ModelInfo `json:"modelInfo,omitempty"`
  436. // ModelType: Type of predictive model (CLASSIFICATION or REGRESSION).
  437. ModelType string `json:"modelType,omitempty"`
  438. // SelfLink: A URL to re-request this resource.
  439. SelfLink string `json:"selfLink,omitempty"`
  440. // StorageDataLocation: Google storage location of the training data
  441. // file.
  442. StorageDataLocation string `json:"storageDataLocation,omitempty"`
  443. // StoragePMMLLocation: Google storage location of the preprocessing
  444. // pmml file.
  445. StoragePMMLLocation string `json:"storagePMMLLocation,omitempty"`
  446. // StoragePMMLModelLocation: Google storage location of the pmml model
  447. // file.
  448. StoragePMMLModelLocation string `json:"storagePMMLModelLocation,omitempty"`
  449. // TrainingComplete: Training completion time (as a RFC 3339 timestamp).
  450. TrainingComplete string `json:"trainingComplete,omitempty"`
  451. // TrainingStatus: The current status of the training job. This can be
  452. // one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
  453. TrainingStatus string `json:"trainingStatus,omitempty"`
  454. // ServerResponse contains the HTTP response code and headers from the
  455. // server.
  456. googleapi.ServerResponse `json:"-"`
  457. // ForceSendFields is a list of field names (e.g. "Created") to
  458. // unconditionally include in API requests. By default, fields with
  459. // empty values are omitted from API requests. However, any non-pointer,
  460. // non-interface field appearing in ForceSendFields will be sent to the
  461. // server regardless of whether the field is empty or not. This may be
  462. // used to include empty fields in Patch requests.
  463. ForceSendFields []string `json:"-"`
  464. }
  465. func (s *Insert2) MarshalJSON() ([]byte, error) {
  466. type noMethod Insert2
  467. raw := noMethod(*s)
  468. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  469. }
  470. // Insert2ModelInfo: Model metadata.
  471. type Insert2ModelInfo struct {
  472. // ClassWeightedAccuracy: Estimated accuracy of model taking utility
  473. // weights into account (Categorical models only).
  474. ClassWeightedAccuracy string `json:"classWeightedAccuracy,omitempty"`
  475. // ClassificationAccuracy: A number between 0.0 and 1.0, where 1.0 is
  476. // 100% accurate. This is an estimate, based on the amount and quality
  477. // of the training data, of the estimated prediction accuracy. You can
  478. // use this is a guide to decide whether the results are accurate enough
  479. // for your needs. This estimate will be more reliable if your real
  480. // input data is similar to your training data (Categorical models
  481. // only).
  482. ClassificationAccuracy string `json:"classificationAccuracy,omitempty"`
  483. // MeanSquaredError: An estimated mean squared error. The can be used to
  484. // measure the quality of the predicted model (Regression models only).
  485. MeanSquaredError string `json:"meanSquaredError,omitempty"`
  486. // ModelType: Type of predictive model (CLASSIFICATION or REGRESSION).
  487. ModelType string `json:"modelType,omitempty"`
  488. // NumberInstances: Number of valid data instances used in the trained
  489. // model.
  490. NumberInstances int64 `json:"numberInstances,omitempty,string"`
  491. // NumberLabels: Number of class labels in the trained model
  492. // (Categorical models only).
  493. NumberLabels int64 `json:"numberLabels,omitempty,string"`
  494. // ForceSendFields is a list of field names (e.g.
  495. // "ClassWeightedAccuracy") to unconditionally include in API requests.
  496. // By default, fields with empty values are omitted from API requests.
  497. // However, any non-pointer, non-interface field appearing in
  498. // ForceSendFields will be sent to the server regardless of whether the
  499. // field is empty or not. This may be used to include empty fields in
  500. // Patch requests.
  501. ForceSendFields []string `json:"-"`
  502. }
  503. func (s *Insert2ModelInfo) MarshalJSON() ([]byte, error) {
  504. type noMethod Insert2ModelInfo
  505. raw := noMethod(*s)
  506. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  507. }
  508. type List struct {
  509. // Items: List of models.
  510. Items []*Insert2 `json:"items,omitempty"`
  511. // Kind: What kind of resource this is.
  512. Kind string `json:"kind,omitempty"`
  513. // NextPageToken: Pagination token to fetch the next page, if one
  514. // exists.
  515. NextPageToken string `json:"nextPageToken,omitempty"`
  516. // SelfLink: A URL to re-request this resource.
  517. SelfLink string `json:"selfLink,omitempty"`
  518. // ServerResponse contains the HTTP response code and headers from the
  519. // server.
  520. googleapi.ServerResponse `json:"-"`
  521. // ForceSendFields is a list of field names (e.g. "Items") to
  522. // unconditionally include in API requests. By default, fields with
  523. // empty values are omitted from API requests. However, any non-pointer,
  524. // non-interface field appearing in ForceSendFields will be sent to the
  525. // server regardless of whether the field is empty or not. This may be
  526. // used to include empty fields in Patch requests.
  527. ForceSendFields []string `json:"-"`
  528. }
  529. func (s *List) MarshalJSON() ([]byte, error) {
  530. type noMethod List
  531. raw := noMethod(*s)
  532. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  533. }
  534. type Output struct {
  535. // Id: The unique name for the predictive model.
  536. Id string `json:"id,omitempty"`
  537. // Kind: What kind of resource this is.
  538. Kind string `json:"kind,omitempty"`
  539. // OutputLabel: The most likely class label (Categorical models only).
  540. OutputLabel string `json:"outputLabel,omitempty"`
  541. // OutputMulti: A list of class labels with their estimated
  542. // probabilities (Categorical models only).
  543. OutputMulti []*OutputOutputMulti `json:"outputMulti,omitempty"`
  544. // OutputValue: The estimated regression value (Regression models only).
  545. OutputValue string `json:"outputValue,omitempty"`
  546. // SelfLink: A URL to re-request this resource.
  547. SelfLink string `json:"selfLink,omitempty"`
  548. // ServerResponse contains the HTTP response code and headers from the
  549. // server.
  550. googleapi.ServerResponse `json:"-"`
  551. // ForceSendFields is a list of field names (e.g. "Id") to
  552. // unconditionally include in API requests. By default, fields with
  553. // empty values are omitted from API requests. However, any non-pointer,
  554. // non-interface field appearing in ForceSendFields will be sent to the
  555. // server regardless of whether the field is empty or not. This may be
  556. // used to include empty fields in Patch requests.
  557. ForceSendFields []string `json:"-"`
  558. }
  559. func (s *Output) MarshalJSON() ([]byte, error) {
  560. type noMethod Output
  561. raw := noMethod(*s)
  562. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  563. }
  564. type OutputOutputMulti struct {
  565. // Label: The class label.
  566. Label string `json:"label,omitempty"`
  567. // Score: The probability of the class label.
  568. Score string `json:"score,omitempty"`
  569. // ForceSendFields is a list of field names (e.g. "Label") to
  570. // unconditionally include in API requests. By default, fields with
  571. // empty values are omitted from API requests. However, any non-pointer,
  572. // non-interface field appearing in ForceSendFields will be sent to the
  573. // server regardless of whether the field is empty or not. This may be
  574. // used to include empty fields in Patch requests.
  575. ForceSendFields []string `json:"-"`
  576. }
  577. func (s *OutputOutputMulti) MarshalJSON() ([]byte, error) {
  578. type noMethod OutputOutputMulti
  579. raw := noMethod(*s)
  580. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  581. }
  582. type Update struct {
  583. // CsvInstance: The input features for this instance.
  584. CsvInstance []interface{} `json:"csvInstance,omitempty"`
  585. // Output: The generic output value - could be regression or class
  586. // label.
  587. Output string `json:"output,omitempty"`
  588. // ForceSendFields is a list of field names (e.g. "CsvInstance") to
  589. // unconditionally include in API requests. By default, fields with
  590. // empty values are omitted from API requests. However, any non-pointer,
  591. // non-interface field appearing in ForceSendFields will be sent to the
  592. // server regardless of whether the field is empty or not. This may be
  593. // used to include empty fields in Patch requests.
  594. ForceSendFields []string `json:"-"`
  595. }
  596. func (s *Update) MarshalJSON() ([]byte, error) {
  597. type noMethod Update
  598. raw := noMethod(*s)
  599. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  600. }
  601. // method id "prediction.hostedmodels.predict":
  602. type HostedmodelsPredictCall struct {
  603. s *Service
  604. project string
  605. hostedModelName string
  606. input *Input
  607. urlParams_ gensupport.URLParams
  608. ctx_ context.Context
  609. }
  610. // Predict: Submit input and request an output against a hosted model.
  611. func (r *HostedmodelsService) Predict(project string, hostedModelName string, input *Input) *HostedmodelsPredictCall {
  612. c := &HostedmodelsPredictCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  613. c.project = project
  614. c.hostedModelName = hostedModelName
  615. c.input = input
  616. return c
  617. }
  618. // Fields allows partial responses to be retrieved. See
  619. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  620. // for more information.
  621. func (c *HostedmodelsPredictCall) Fields(s ...googleapi.Field) *HostedmodelsPredictCall {
  622. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  623. return c
  624. }
  625. // Context sets the context to be used in this call's Do method. Any
  626. // pending HTTP request will be aborted if the provided context is
  627. // canceled.
  628. func (c *HostedmodelsPredictCall) Context(ctx context.Context) *HostedmodelsPredictCall {
  629. c.ctx_ = ctx
  630. return c
  631. }
  632. func (c *HostedmodelsPredictCall) doRequest(alt string) (*http.Response, error) {
  633. var body io.Reader = nil
  634. body, err := googleapi.WithoutDataWrapper.JSONReader(c.input)
  635. if err != nil {
  636. return nil, err
  637. }
  638. ctype := "application/json"
  639. c.urlParams_.Set("alt", alt)
  640. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/hostedmodels/{hostedModelName}/predict")
  641. urls += "?" + c.urlParams_.Encode()
  642. req, _ := http.NewRequest("POST", urls, body)
  643. googleapi.Expand(req.URL, map[string]string{
  644. "project": c.project,
  645. "hostedModelName": c.hostedModelName,
  646. })
  647. req.Header.Set("Content-Type", ctype)
  648. req.Header.Set("User-Agent", c.s.userAgent())
  649. if c.ctx_ != nil {
  650. return ctxhttp.Do(c.ctx_, c.s.client, req)
  651. }
  652. return c.s.client.Do(req)
  653. }
  654. // Do executes the "prediction.hostedmodels.predict" call.
  655. // Exactly one of *Output or error will be non-nil. Any non-2xx status
  656. // code is an error. Response headers are in either
  657. // *Output.ServerResponse.Header or (if a response was returned at all)
  658. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  659. // check whether the returned error was because http.StatusNotModified
  660. // was returned.
  661. func (c *HostedmodelsPredictCall) Do(opts ...googleapi.CallOption) (*Output, error) {
  662. gensupport.SetOptions(c.urlParams_, opts...)
  663. res, err := c.doRequest("json")
  664. if res != nil && res.StatusCode == http.StatusNotModified {
  665. if res.Body != nil {
  666. res.Body.Close()
  667. }
  668. return nil, &googleapi.Error{
  669. Code: res.StatusCode,
  670. Header: res.Header,
  671. }
  672. }
  673. if err != nil {
  674. return nil, err
  675. }
  676. defer googleapi.CloseBody(res)
  677. if err := googleapi.CheckResponse(res); err != nil {
  678. return nil, err
  679. }
  680. ret := &Output{
  681. ServerResponse: googleapi.ServerResponse{
  682. Header: res.Header,
  683. HTTPStatusCode: res.StatusCode,
  684. },
  685. }
  686. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  687. return nil, err
  688. }
  689. return ret, nil
  690. // {
  691. // "description": "Submit input and request an output against a hosted model.",
  692. // "httpMethod": "POST",
  693. // "id": "prediction.hostedmodels.predict",
  694. // "parameterOrder": [
  695. // "project",
  696. // "hostedModelName"
  697. // ],
  698. // "parameters": {
  699. // "hostedModelName": {
  700. // "description": "The name of a hosted model.",
  701. // "location": "path",
  702. // "required": true,
  703. // "type": "string"
  704. // },
  705. // "project": {
  706. // "description": "The project associated with the model.",
  707. // "location": "path",
  708. // "required": true,
  709. // "type": "string"
  710. // }
  711. // },
  712. // "path": "{project}/hostedmodels/{hostedModelName}/predict",
  713. // "request": {
  714. // "$ref": "Input"
  715. // },
  716. // "response": {
  717. // "$ref": "Output"
  718. // },
  719. // "scopes": [
  720. // "https://www.googleapis.com/auth/prediction"
  721. // ]
  722. // }
  723. }
  724. // method id "prediction.trainedmodels.analyze":
  725. type TrainedmodelsAnalyzeCall struct {
  726. s *Service
  727. project string
  728. id string
  729. urlParams_ gensupport.URLParams
  730. ifNoneMatch_ string
  731. ctx_ context.Context
  732. }
  733. // Analyze: Get analysis of the model and the data the model was trained
  734. // on.
  735. func (r *TrainedmodelsService) Analyze(project string, id string) *TrainedmodelsAnalyzeCall {
  736. c := &TrainedmodelsAnalyzeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  737. c.project = project
  738. c.id = id
  739. return c
  740. }
  741. // Fields allows partial responses to be retrieved. See
  742. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  743. // for more information.
  744. func (c *TrainedmodelsAnalyzeCall) Fields(s ...googleapi.Field) *TrainedmodelsAnalyzeCall {
  745. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  746. return c
  747. }
  748. // IfNoneMatch sets the optional parameter which makes the operation
  749. // fail if the object's ETag matches the given value. This is useful for
  750. // getting updates only after the object has changed since the last
  751. // request. Use googleapi.IsNotModified to check whether the response
  752. // error from Do is the result of In-None-Match.
  753. func (c *TrainedmodelsAnalyzeCall) IfNoneMatch(entityTag string) *TrainedmodelsAnalyzeCall {
  754. c.ifNoneMatch_ = entityTag
  755. return c
  756. }
  757. // Context sets the context to be used in this call's Do method. Any
  758. // pending HTTP request will be aborted if the provided context is
  759. // canceled.
  760. func (c *TrainedmodelsAnalyzeCall) Context(ctx context.Context) *TrainedmodelsAnalyzeCall {
  761. c.ctx_ = ctx
  762. return c
  763. }
  764. func (c *TrainedmodelsAnalyzeCall) doRequest(alt string) (*http.Response, error) {
  765. var body io.Reader = nil
  766. c.urlParams_.Set("alt", alt)
  767. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}/analyze")
  768. urls += "?" + c.urlParams_.Encode()
  769. req, _ := http.NewRequest("GET", urls, body)
  770. googleapi.Expand(req.URL, map[string]string{
  771. "project": c.project,
  772. "id": c.id,
  773. })
  774. req.Header.Set("User-Agent", c.s.userAgent())
  775. if c.ifNoneMatch_ != "" {
  776. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  777. }
  778. if c.ctx_ != nil {
  779. return ctxhttp.Do(c.ctx_, c.s.client, req)
  780. }
  781. return c.s.client.Do(req)
  782. }
  783. // Do executes the "prediction.trainedmodels.analyze" call.
  784. // Exactly one of *Analyze or error will be non-nil. Any non-2xx status
  785. // code is an error. Response headers are in either
  786. // *Analyze.ServerResponse.Header or (if a response was returned at all)
  787. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  788. // check whether the returned error was because http.StatusNotModified
  789. // was returned.
  790. func (c *TrainedmodelsAnalyzeCall) Do(opts ...googleapi.CallOption) (*Analyze, error) {
  791. gensupport.SetOptions(c.urlParams_, opts...)
  792. res, err := c.doRequest("json")
  793. if res != nil && res.StatusCode == http.StatusNotModified {
  794. if res.Body != nil {
  795. res.Body.Close()
  796. }
  797. return nil, &googleapi.Error{
  798. Code: res.StatusCode,
  799. Header: res.Header,
  800. }
  801. }
  802. if err != nil {
  803. return nil, err
  804. }
  805. defer googleapi.CloseBody(res)
  806. if err := googleapi.CheckResponse(res); err != nil {
  807. return nil, err
  808. }
  809. ret := &Analyze{
  810. ServerResponse: googleapi.ServerResponse{
  811. Header: res.Header,
  812. HTTPStatusCode: res.StatusCode,
  813. },
  814. }
  815. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  816. return nil, err
  817. }
  818. return ret, nil
  819. // {
  820. // "description": "Get analysis of the model and the data the model was trained on.",
  821. // "httpMethod": "GET",
  822. // "id": "prediction.trainedmodels.analyze",
  823. // "parameterOrder": [
  824. // "project",
  825. // "id"
  826. // ],
  827. // "parameters": {
  828. // "id": {
  829. // "description": "The unique name for the predictive model.",
  830. // "location": "path",
  831. // "required": true,
  832. // "type": "string"
  833. // },
  834. // "project": {
  835. // "description": "The project associated with the model.",
  836. // "location": "path",
  837. // "required": true,
  838. // "type": "string"
  839. // }
  840. // },
  841. // "path": "{project}/trainedmodels/{id}/analyze",
  842. // "response": {
  843. // "$ref": "Analyze"
  844. // },
  845. // "scopes": [
  846. // "https://www.googleapis.com/auth/prediction"
  847. // ]
  848. // }
  849. }
  850. // method id "prediction.trainedmodels.delete":
  851. type TrainedmodelsDeleteCall struct {
  852. s *Service
  853. project string
  854. id string
  855. urlParams_ gensupport.URLParams
  856. ctx_ context.Context
  857. }
  858. // Delete: Delete a trained model.
  859. func (r *TrainedmodelsService) Delete(project string, id string) *TrainedmodelsDeleteCall {
  860. c := &TrainedmodelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  861. c.project = project
  862. c.id = id
  863. return c
  864. }
  865. // Fields allows partial responses to be retrieved. See
  866. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  867. // for more information.
  868. func (c *TrainedmodelsDeleteCall) Fields(s ...googleapi.Field) *TrainedmodelsDeleteCall {
  869. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  870. return c
  871. }
  872. // Context sets the context to be used in this call's Do method. Any
  873. // pending HTTP request will be aborted if the provided context is
  874. // canceled.
  875. func (c *TrainedmodelsDeleteCall) Context(ctx context.Context) *TrainedmodelsDeleteCall {
  876. c.ctx_ = ctx
  877. return c
  878. }
  879. func (c *TrainedmodelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  880. var body io.Reader = nil
  881. c.urlParams_.Set("alt", alt)
  882. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}")
  883. urls += "?" + c.urlParams_.Encode()
  884. req, _ := http.NewRequest("DELETE", urls, body)
  885. googleapi.Expand(req.URL, map[string]string{
  886. "project": c.project,
  887. "id": c.id,
  888. })
  889. req.Header.Set("User-Agent", c.s.userAgent())
  890. if c.ctx_ != nil {
  891. return ctxhttp.Do(c.ctx_, c.s.client, req)
  892. }
  893. return c.s.client.Do(req)
  894. }
  895. // Do executes the "prediction.trainedmodels.delete" call.
  896. func (c *TrainedmodelsDeleteCall) Do(opts ...googleapi.CallOption) error {
  897. gensupport.SetOptions(c.urlParams_, opts...)
  898. res, err := c.doRequest("json")
  899. if err != nil {
  900. return err
  901. }
  902. defer googleapi.CloseBody(res)
  903. if err := googleapi.CheckResponse(res); err != nil {
  904. return err
  905. }
  906. return nil
  907. // {
  908. // "description": "Delete a trained model.",
  909. // "httpMethod": "DELETE",
  910. // "id": "prediction.trainedmodels.delete",
  911. // "parameterOrder": [
  912. // "project",
  913. // "id"
  914. // ],
  915. // "parameters": {
  916. // "id": {
  917. // "description": "The unique name for the predictive model.",
  918. // "location": "path",
  919. // "required": true,
  920. // "type": "string"
  921. // },
  922. // "project": {
  923. // "description": "The project associated with the model.",
  924. // "location": "path",
  925. // "required": true,
  926. // "type": "string"
  927. // }
  928. // },
  929. // "path": "{project}/trainedmodels/{id}",
  930. // "scopes": [
  931. // "https://www.googleapis.com/auth/prediction"
  932. // ]
  933. // }
  934. }
  935. // method id "prediction.trainedmodels.get":
  936. type TrainedmodelsGetCall struct {
  937. s *Service
  938. project string
  939. id string
  940. urlParams_ gensupport.URLParams
  941. ifNoneMatch_ string
  942. ctx_ context.Context
  943. }
  944. // Get: Check training status of your model.
  945. func (r *TrainedmodelsService) Get(project string, id string) *TrainedmodelsGetCall {
  946. c := &TrainedmodelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  947. c.project = project
  948. c.id = id
  949. return c
  950. }
  951. // Fields allows partial responses to be retrieved. See
  952. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  953. // for more information.
  954. func (c *TrainedmodelsGetCall) Fields(s ...googleapi.Field) *TrainedmodelsGetCall {
  955. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  956. return c
  957. }
  958. // IfNoneMatch sets the optional parameter which makes the operation
  959. // fail if the object's ETag matches the given value. This is useful for
  960. // getting updates only after the object has changed since the last
  961. // request. Use googleapi.IsNotModified to check whether the response
  962. // error from Do is the result of In-None-Match.
  963. func (c *TrainedmodelsGetCall) IfNoneMatch(entityTag string) *TrainedmodelsGetCall {
  964. c.ifNoneMatch_ = entityTag
  965. return c
  966. }
  967. // Context sets the context to be used in this call's Do method. Any
  968. // pending HTTP request will be aborted if the provided context is
  969. // canceled.
  970. func (c *TrainedmodelsGetCall) Context(ctx context.Context) *TrainedmodelsGetCall {
  971. c.ctx_ = ctx
  972. return c
  973. }
  974. func (c *TrainedmodelsGetCall) doRequest(alt string) (*http.Response, error) {
  975. var body io.Reader = nil
  976. c.urlParams_.Set("alt", alt)
  977. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}")
  978. urls += "?" + c.urlParams_.Encode()
  979. req, _ := http.NewRequest("GET", urls, body)
  980. googleapi.Expand(req.URL, map[string]string{
  981. "project": c.project,
  982. "id": c.id,
  983. })
  984. req.Header.Set("User-Agent", c.s.userAgent())
  985. if c.ifNoneMatch_ != "" {
  986. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  987. }
  988. if c.ctx_ != nil {
  989. return ctxhttp.Do(c.ctx_, c.s.client, req)
  990. }
  991. return c.s.client.Do(req)
  992. }
  993. // Do executes the "prediction.trainedmodels.get" call.
  994. // Exactly one of *Insert2 or error will be non-nil. Any non-2xx status
  995. // code is an error. Response headers are in either
  996. // *Insert2.ServerResponse.Header or (if a response was returned at all)
  997. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  998. // check whether the returned error was because http.StatusNotModified
  999. // was returned.
  1000. func (c *TrainedmodelsGetCall) Do(opts ...googleapi.CallOption) (*Insert2, error) {
  1001. gensupport.SetOptions(c.urlParams_, opts...)
  1002. res, err := c.doRequest("json")
  1003. if res != nil && res.StatusCode == http.StatusNotModified {
  1004. if res.Body != nil {
  1005. res.Body.Close()
  1006. }
  1007. return nil, &googleapi.Error{
  1008. Code: res.StatusCode,
  1009. Header: res.Header,
  1010. }
  1011. }
  1012. if err != nil {
  1013. return nil, err
  1014. }
  1015. defer googleapi.CloseBody(res)
  1016. if err := googleapi.CheckResponse(res); err != nil {
  1017. return nil, err
  1018. }
  1019. ret := &Insert2{
  1020. ServerResponse: googleapi.ServerResponse{
  1021. Header: res.Header,
  1022. HTTPStatusCode: res.StatusCode,
  1023. },
  1024. }
  1025. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1026. return nil, err
  1027. }
  1028. return ret, nil
  1029. // {
  1030. // "description": "Check training status of your model.",
  1031. // "httpMethod": "GET",
  1032. // "id": "prediction.trainedmodels.get",
  1033. // "parameterOrder": [
  1034. // "project",
  1035. // "id"
  1036. // ],
  1037. // "parameters": {
  1038. // "id": {
  1039. // "description": "The unique name for the predictive model.",
  1040. // "location": "path",
  1041. // "required": true,
  1042. // "type": "string"
  1043. // },
  1044. // "project": {
  1045. // "description": "The project associated with the model.",
  1046. // "location": "path",
  1047. // "required": true,
  1048. // "type": "string"
  1049. // }
  1050. // },
  1051. // "path": "{project}/trainedmodels/{id}",
  1052. // "response": {
  1053. // "$ref": "Insert2"
  1054. // },
  1055. // "scopes": [
  1056. // "https://www.googleapis.com/auth/prediction"
  1057. // ]
  1058. // }
  1059. }
  1060. // method id "prediction.trainedmodels.insert":
  1061. type TrainedmodelsInsertCall struct {
  1062. s *Service
  1063. project string
  1064. insert *Insert
  1065. urlParams_ gensupport.URLParams
  1066. ctx_ context.Context
  1067. }
  1068. // Insert: Train a Prediction API model.
  1069. func (r *TrainedmodelsService) Insert(project string, insert *Insert) *TrainedmodelsInsertCall {
  1070. c := &TrainedmodelsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1071. c.project = project
  1072. c.insert = insert
  1073. return c
  1074. }
  1075. // Fields allows partial responses to be retrieved. See
  1076. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1077. // for more information.
  1078. func (c *TrainedmodelsInsertCall) Fields(s ...googleapi.Field) *TrainedmodelsInsertCall {
  1079. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1080. return c
  1081. }
  1082. // Context sets the context to be used in this call's Do method. Any
  1083. // pending HTTP request will be aborted if the provided context is
  1084. // canceled.
  1085. func (c *TrainedmodelsInsertCall) Context(ctx context.Context) *TrainedmodelsInsertCall {
  1086. c.ctx_ = ctx
  1087. return c
  1088. }
  1089. func (c *TrainedmodelsInsertCall) doRequest(alt string) (*http.Response, error) {
  1090. var body io.Reader = nil
  1091. body, err := googleapi.WithoutDataWrapper.JSONReader(c.insert)
  1092. if err != nil {
  1093. return nil, err
  1094. }
  1095. ctype := "application/json"
  1096. c.urlParams_.Set("alt", alt)
  1097. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels")
  1098. urls += "?" + c.urlParams_.Encode()
  1099. req, _ := http.NewRequest("POST", urls, body)
  1100. googleapi.Expand(req.URL, map[string]string{
  1101. "project": c.project,
  1102. })
  1103. req.Header.Set("Content-Type", ctype)
  1104. req.Header.Set("User-Agent", c.s.userAgent())
  1105. if c.ctx_ != nil {
  1106. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1107. }
  1108. return c.s.client.Do(req)
  1109. }
  1110. // Do executes the "prediction.trainedmodels.insert" call.
  1111. // Exactly one of *Insert2 or error will be non-nil. Any non-2xx status
  1112. // code is an error. Response headers are in either
  1113. // *Insert2.ServerResponse.Header or (if a response was returned at all)
  1114. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1115. // check whether the returned error was because http.StatusNotModified
  1116. // was returned.
  1117. func (c *TrainedmodelsInsertCall) Do(opts ...googleapi.CallOption) (*Insert2, error) {
  1118. gensupport.SetOptions(c.urlParams_, opts...)
  1119. res, err := c.doRequest("json")
  1120. if res != nil && res.StatusCode == http.StatusNotModified {
  1121. if res.Body != nil {
  1122. res.Body.Close()
  1123. }
  1124. return nil, &googleapi.Error{
  1125. Code: res.StatusCode,
  1126. Header: res.Header,
  1127. }
  1128. }
  1129. if err != nil {
  1130. return nil, err
  1131. }
  1132. defer googleapi.CloseBody(res)
  1133. if err := googleapi.CheckResponse(res); err != nil {
  1134. return nil, err
  1135. }
  1136. ret := &Insert2{
  1137. ServerResponse: googleapi.ServerResponse{
  1138. Header: res.Header,
  1139. HTTPStatusCode: res.StatusCode,
  1140. },
  1141. }
  1142. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1143. return nil, err
  1144. }
  1145. return ret, nil
  1146. // {
  1147. // "description": "Train a Prediction API model.",
  1148. // "httpMethod": "POST",
  1149. // "id": "prediction.trainedmodels.insert",
  1150. // "parameterOrder": [
  1151. // "project"
  1152. // ],
  1153. // "parameters": {
  1154. // "project": {
  1155. // "description": "The project associated with the model.",
  1156. // "location": "path",
  1157. // "required": true,
  1158. // "type": "string"
  1159. // }
  1160. // },
  1161. // "path": "{project}/trainedmodels",
  1162. // "request": {
  1163. // "$ref": "Insert"
  1164. // },
  1165. // "response": {
  1166. // "$ref": "Insert2"
  1167. // },
  1168. // "scopes": [
  1169. // "https://www.googleapis.com/auth/devstorage.full_control",
  1170. // "https://www.googleapis.com/auth/devstorage.read_only",
  1171. // "https://www.googleapis.com/auth/devstorage.read_write",
  1172. // "https://www.googleapis.com/auth/prediction"
  1173. // ]
  1174. // }
  1175. }
  1176. // method id "prediction.trainedmodels.list":
  1177. type TrainedmodelsListCall struct {
  1178. s *Service
  1179. project string
  1180. urlParams_ gensupport.URLParams
  1181. ifNoneMatch_ string
  1182. ctx_ context.Context
  1183. }
  1184. // List: List available models.
  1185. func (r *TrainedmodelsService) List(project string) *TrainedmodelsListCall {
  1186. c := &TrainedmodelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1187. c.project = project
  1188. return c
  1189. }
  1190. // MaxResults sets the optional parameter "maxResults": Maximum number
  1191. // of results to return.
  1192. func (c *TrainedmodelsListCall) MaxResults(maxResults int64) *TrainedmodelsListCall {
  1193. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1194. return c
  1195. }
  1196. // PageToken sets the optional parameter "pageToken": Pagination token.
  1197. func (c *TrainedmodelsListCall) PageToken(pageToken string) *TrainedmodelsListCall {
  1198. c.urlParams_.Set("pageToken", pageToken)
  1199. return c
  1200. }
  1201. // Fields allows partial responses to be retrieved. See
  1202. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1203. // for more information.
  1204. func (c *TrainedmodelsListCall) Fields(s ...googleapi.Field) *TrainedmodelsListCall {
  1205. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1206. return c
  1207. }
  1208. // IfNoneMatch sets the optional parameter which makes the operation
  1209. // fail if the object's ETag matches the given value. This is useful for
  1210. // getting updates only after the object has changed since the last
  1211. // request. Use googleapi.IsNotModified to check whether the response
  1212. // error from Do is the result of In-None-Match.
  1213. func (c *TrainedmodelsListCall) IfNoneMatch(entityTag string) *TrainedmodelsListCall {
  1214. c.ifNoneMatch_ = entityTag
  1215. return c
  1216. }
  1217. // Context sets the context to be used in this call's Do method. Any
  1218. // pending HTTP request will be aborted if the provided context is
  1219. // canceled.
  1220. func (c *TrainedmodelsListCall) Context(ctx context.Context) *TrainedmodelsListCall {
  1221. c.ctx_ = ctx
  1222. return c
  1223. }
  1224. func (c *TrainedmodelsListCall) doRequest(alt string) (*http.Response, error) {
  1225. var body io.Reader = nil
  1226. c.urlParams_.Set("alt", alt)
  1227. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/list")
  1228. urls += "?" + c.urlParams_.Encode()
  1229. req, _ := http.NewRequest("GET", urls, body)
  1230. googleapi.Expand(req.URL, map[string]string{
  1231. "project": c.project,
  1232. })
  1233. req.Header.Set("User-Agent", c.s.userAgent())
  1234. if c.ifNoneMatch_ != "" {
  1235. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1236. }
  1237. if c.ctx_ != nil {
  1238. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1239. }
  1240. return c.s.client.Do(req)
  1241. }
  1242. // Do executes the "prediction.trainedmodels.list" call.
  1243. // Exactly one of *List or error will be non-nil. Any non-2xx status
  1244. // code is an error. Response headers are in either
  1245. // *List.ServerResponse.Header or (if a response was returned at all) in
  1246. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1247. // whether the returned error was because http.StatusNotModified was
  1248. // returned.
  1249. func (c *TrainedmodelsListCall) Do(opts ...googleapi.CallOption) (*List, error) {
  1250. gensupport.SetOptions(c.urlParams_, opts...)
  1251. res, err := c.doRequest("json")
  1252. if res != nil && res.StatusCode == http.StatusNotModified {
  1253. if res.Body != nil {
  1254. res.Body.Close()
  1255. }
  1256. return nil, &googleapi.Error{
  1257. Code: res.StatusCode,
  1258. Header: res.Header,
  1259. }
  1260. }
  1261. if err != nil {
  1262. return nil, err
  1263. }
  1264. defer googleapi.CloseBody(res)
  1265. if err := googleapi.CheckResponse(res); err != nil {
  1266. return nil, err
  1267. }
  1268. ret := &List{
  1269. ServerResponse: googleapi.ServerResponse{
  1270. Header: res.Header,
  1271. HTTPStatusCode: res.StatusCode,
  1272. },
  1273. }
  1274. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1275. return nil, err
  1276. }
  1277. return ret, nil
  1278. // {
  1279. // "description": "List available models.",
  1280. // "httpMethod": "GET",
  1281. // "id": "prediction.trainedmodels.list",
  1282. // "parameterOrder": [
  1283. // "project"
  1284. // ],
  1285. // "parameters": {
  1286. // "maxResults": {
  1287. // "description": "Maximum number of results to return.",
  1288. // "format": "uint32",
  1289. // "location": "query",
  1290. // "minimum": "0",
  1291. // "type": "integer"
  1292. // },
  1293. // "pageToken": {
  1294. // "description": "Pagination token.",
  1295. // "location": "query",
  1296. // "type": "string"
  1297. // },
  1298. // "project": {
  1299. // "description": "The project associated with the model.",
  1300. // "location": "path",
  1301. // "required": true,
  1302. // "type": "string"
  1303. // }
  1304. // },
  1305. // "path": "{project}/trainedmodels/list",
  1306. // "response": {
  1307. // "$ref": "List"
  1308. // },
  1309. // "scopes": [
  1310. // "https://www.googleapis.com/auth/prediction"
  1311. // ]
  1312. // }
  1313. }
  1314. // Pages invokes f for each page of results.
  1315. // A non-nil error returned from f will halt the iteration.
  1316. // The provided context supersedes any context provided to the Context method.
  1317. func (c *TrainedmodelsListCall) Pages(ctx context.Context, f func(*List) error) error {
  1318. c.ctx_ = ctx
  1319. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1320. for {
  1321. x, err := c.Do()
  1322. if err != nil {
  1323. return err
  1324. }
  1325. if err := f(x); err != nil {
  1326. return err
  1327. }
  1328. if x.NextPageToken == "" {
  1329. return nil
  1330. }
  1331. c.PageToken(x.NextPageToken)
  1332. }
  1333. }
  1334. // method id "prediction.trainedmodels.predict":
  1335. type TrainedmodelsPredictCall struct {
  1336. s *Service
  1337. project string
  1338. id string
  1339. input *Input
  1340. urlParams_ gensupport.URLParams
  1341. ctx_ context.Context
  1342. }
  1343. // Predict: Submit model id and request a prediction.
  1344. func (r *TrainedmodelsService) Predict(project string, id string, input *Input) *TrainedmodelsPredictCall {
  1345. c := &TrainedmodelsPredictCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1346. c.project = project
  1347. c.id = id
  1348. c.input = input
  1349. return c
  1350. }
  1351. // Fields allows partial responses to be retrieved. See
  1352. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1353. // for more information.
  1354. func (c *TrainedmodelsPredictCall) Fields(s ...googleapi.Field) *TrainedmodelsPredictCall {
  1355. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1356. return c
  1357. }
  1358. // Context sets the context to be used in this call's Do method. Any
  1359. // pending HTTP request will be aborted if the provided context is
  1360. // canceled.
  1361. func (c *TrainedmodelsPredictCall) Context(ctx context.Context) *TrainedmodelsPredictCall {
  1362. c.ctx_ = ctx
  1363. return c
  1364. }
  1365. func (c *TrainedmodelsPredictCall) doRequest(alt string) (*http.Response, error) {
  1366. var body io.Reader = nil
  1367. body, err := googleapi.WithoutDataWrapper.JSONReader(c.input)
  1368. if err != nil {
  1369. return nil, err
  1370. }
  1371. ctype := "application/json"
  1372. c.urlParams_.Set("alt", alt)
  1373. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}/predict")
  1374. urls += "?" + c.urlParams_.Encode()
  1375. req, _ := http.NewRequest("POST", urls, body)
  1376. googleapi.Expand(req.URL, map[string]string{
  1377. "project": c.project,
  1378. "id": c.id,
  1379. })
  1380. req.Header.Set("Content-Type", ctype)
  1381. req.Header.Set("User-Agent", c.s.userAgent())
  1382. if c.ctx_ != nil {
  1383. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1384. }
  1385. return c.s.client.Do(req)
  1386. }
  1387. // Do executes the "prediction.trainedmodels.predict" call.
  1388. // Exactly one of *Output or error will be non-nil. Any non-2xx status
  1389. // code is an error. Response headers are in either
  1390. // *Output.ServerResponse.Header or (if a response was returned at all)
  1391. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1392. // check whether the returned error was because http.StatusNotModified
  1393. // was returned.
  1394. func (c *TrainedmodelsPredictCall) Do(opts ...googleapi.CallOption) (*Output, error) {
  1395. gensupport.SetOptions(c.urlParams_, opts...)
  1396. res, err := c.doRequest("json")
  1397. if res != nil && res.StatusCode == http.StatusNotModified {
  1398. if res.Body != nil {
  1399. res.Body.Close()
  1400. }
  1401. return nil, &googleapi.Error{
  1402. Code: res.StatusCode,
  1403. Header: res.Header,
  1404. }
  1405. }
  1406. if err != nil {
  1407. return nil, err
  1408. }
  1409. defer googleapi.CloseBody(res)
  1410. if err := googleapi.CheckResponse(res); err != nil {
  1411. return nil, err
  1412. }
  1413. ret := &Output{
  1414. ServerResponse: googleapi.ServerResponse{
  1415. Header: res.Header,
  1416. HTTPStatusCode: res.StatusCode,
  1417. },
  1418. }
  1419. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1420. return nil, err
  1421. }
  1422. return ret, nil
  1423. // {
  1424. // "description": "Submit model id and request a prediction.",
  1425. // "httpMethod": "POST",
  1426. // "id": "prediction.trainedmodels.predict",
  1427. // "parameterOrder": [
  1428. // "project",
  1429. // "id"
  1430. // ],
  1431. // "parameters": {
  1432. // "id": {
  1433. // "description": "The unique name for the predictive model.",
  1434. // "location": "path",
  1435. // "required": true,
  1436. // "type": "string"
  1437. // },
  1438. // "project": {
  1439. // "description": "The project associated with the model.",
  1440. // "location": "path",
  1441. // "required": true,
  1442. // "type": "string"
  1443. // }
  1444. // },
  1445. // "path": "{project}/trainedmodels/{id}/predict",
  1446. // "request": {
  1447. // "$ref": "Input"
  1448. // },
  1449. // "response": {
  1450. // "$ref": "Output"
  1451. // },
  1452. // "scopes": [
  1453. // "https://www.googleapis.com/auth/prediction"
  1454. // ]
  1455. // }
  1456. }
  1457. // method id "prediction.trainedmodels.update":
  1458. type TrainedmodelsUpdateCall struct {
  1459. s *Service
  1460. project string
  1461. id string
  1462. update *Update
  1463. urlParams_ gensupport.URLParams
  1464. ctx_ context.Context
  1465. }
  1466. // Update: Add new data to a trained model.
  1467. func (r *TrainedmodelsService) Update(project string, id string, update *Update) *TrainedmodelsUpdateCall {
  1468. c := &TrainedmodelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1469. c.project = project
  1470. c.id = id
  1471. c.update = update
  1472. return c
  1473. }
  1474. // Fields allows partial responses to be retrieved. See
  1475. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1476. // for more information.
  1477. func (c *TrainedmodelsUpdateCall) Fields(s ...googleapi.Field) *TrainedmodelsUpdateCall {
  1478. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1479. return c
  1480. }
  1481. // Context sets the context to be used in this call's Do method. Any
  1482. // pending HTTP request will be aborted if the provided context is
  1483. // canceled.
  1484. func (c *TrainedmodelsUpdateCall) Context(ctx context.Context) *TrainedmodelsUpdateCall {
  1485. c.ctx_ = ctx
  1486. return c
  1487. }
  1488. func (c *TrainedmodelsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1489. var body io.Reader = nil
  1490. body, err := googleapi.WithoutDataWrapper.JSONReader(c.update)
  1491. if err != nil {
  1492. return nil, err
  1493. }
  1494. ctype := "application/json"
  1495. c.urlParams_.Set("alt", alt)
  1496. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/trainedmodels/{id}")
  1497. urls += "?" + c.urlParams_.Encode()
  1498. req, _ := http.NewRequest("PUT", urls, body)
  1499. googleapi.Expand(req.URL, map[string]string{
  1500. "project": c.project,
  1501. "id": c.id,
  1502. })
  1503. req.Header.Set("Content-Type", ctype)
  1504. req.Header.Set("User-Agent", c.s.userAgent())
  1505. if c.ctx_ != nil {
  1506. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1507. }
  1508. return c.s.client.Do(req)
  1509. }
  1510. // Do executes the "prediction.trainedmodels.update" call.
  1511. // Exactly one of *Insert2 or error will be non-nil. Any non-2xx status
  1512. // code is an error. Response headers are in either
  1513. // *Insert2.ServerResponse.Header or (if a response was returned at all)
  1514. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1515. // check whether the returned error was because http.StatusNotModified
  1516. // was returned.
  1517. func (c *TrainedmodelsUpdateCall) Do(opts ...googleapi.CallOption) (*Insert2, error) {
  1518. gensupport.SetOptions(c.urlParams_, opts...)
  1519. res, err := c.doRequest("json")
  1520. if res != nil && res.StatusCode == http.StatusNotModified {
  1521. if res.Body != nil {
  1522. res.Body.Close()
  1523. }
  1524. return nil, &googleapi.Error{
  1525. Code: res.StatusCode,
  1526. Header: res.Header,
  1527. }
  1528. }
  1529. if err != nil {
  1530. return nil, err
  1531. }
  1532. defer googleapi.CloseBody(res)
  1533. if err := googleapi.CheckResponse(res); err != nil {
  1534. return nil, err
  1535. }
  1536. ret := &Insert2{
  1537. ServerResponse: googleapi.ServerResponse{
  1538. Header: res.Header,
  1539. HTTPStatusCode: res.StatusCode,
  1540. },
  1541. }
  1542. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1543. return nil, err
  1544. }
  1545. return ret, nil
  1546. // {
  1547. // "description": "Add new data to a trained model.",
  1548. // "httpMethod": "PUT",
  1549. // "id": "prediction.trainedmodels.update",
  1550. // "parameterOrder": [
  1551. // "project",
  1552. // "id"
  1553. // ],
  1554. // "parameters": {
  1555. // "id": {
  1556. // "description": "The unique name for the predictive model.",
  1557. // "location": "path",
  1558. // "required": true,
  1559. // "type": "string"
  1560. // },
  1561. // "project": {
  1562. // "description": "The project associated with the model.",
  1563. // "location": "path",
  1564. // "required": true,
  1565. // "type": "string"
  1566. // }
  1567. // },
  1568. // "path": "{project}/trainedmodels/{id}",
  1569. // "request": {
  1570. // "$ref": "Update"
  1571. // },
  1572. // "response": {
  1573. // "$ref": "Insert2"
  1574. // },
  1575. // "scopes": [
  1576. // "https://www.googleapis.com/auth/prediction"
  1577. // ]
  1578. // }
  1579. }