~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/prediction/v1.5/prediction-gen.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.5"
 
8
//   ...
 
9
//   predictionService, err := prediction.New(oauthHttpClient)
 
10
package prediction
 
11
 
 
12
import (
 
13
        "bytes"
 
14
        "encoding/json"
 
15
        "errors"
 
16
        "fmt"
 
17
        "google.golang.org/api/googleapi"
 
18
        "io"
 
19
        "net/http"
 
20
        "net/url"
 
21
        "strconv"
 
22
        "strings"
 
23
)
 
24
 
 
25
// Always reference these packages, just in case the auto-generated code
 
26
// below doesn't.
 
27
var _ = bytes.NewBuffer
 
28
var _ = strconv.Itoa
 
29
var _ = fmt.Sprintf
 
30
var _ = json.NewDecoder
 
31
var _ = io.Copy
 
32
var _ = url.Parse
 
33
var _ = googleapi.Version
 
34
var _ = errors.New
 
35
var _ = strings.Replace
 
36
 
 
37
const apiId = "prediction:v1.5"
 
38
const apiName = "prediction"
 
39
const apiVersion = "v1.5"
 
40
const basePath = "https://www.googleapis.com/prediction/v1.5/"
 
41
 
 
42
// OAuth2 scopes used by this API.
 
43
const (
 
44
        // Manage your data and permissions in Google Cloud Storage
 
45
        DevstorageFull_controlScope = "https://www.googleapis.com/auth/devstorage.full_control"
 
46
 
 
47
        // View your data in Google Cloud Storage
 
48
        DevstorageRead_onlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
 
49
 
 
50
        // Manage your data in Google Cloud Storage
 
51
        DevstorageRead_writeScope = "https://www.googleapis.com/auth/devstorage.read_write"
 
52
 
 
53
        // Manage your data in the Google Prediction API
 
54
        PredictionScope = "https://www.googleapis.com/auth/prediction"
 
55
)
 
56
 
 
57
func New(client *http.Client) (*Service, error) {
 
58
        if client == nil {
 
59
                return nil, errors.New("client is nil")
 
60
        }
 
61
        s := &Service{client: client, BasePath: basePath}
 
62
        s.Hostedmodels = NewHostedmodelsService(s)
 
63
        s.Trainedmodels = NewTrainedmodelsService(s)
 
64
        return s, nil
 
65
}
 
66
 
 
67
type Service struct {
 
68
        client   *http.Client
 
69
        BasePath string // API endpoint base URL
 
70
 
 
71
        Hostedmodels *HostedmodelsService
 
72
 
 
73
        Trainedmodels *TrainedmodelsService
 
74
}
 
75
 
 
76
func NewHostedmodelsService(s *Service) *HostedmodelsService {
 
77
        rs := &HostedmodelsService{s: s}
 
78
        return rs
 
79
}
 
80
 
 
81
type HostedmodelsService struct {
 
82
        s *Service
 
83
}
 
84
 
 
85
func NewTrainedmodelsService(s *Service) *TrainedmodelsService {
 
86
        rs := &TrainedmodelsService{s: s}
 
87
        return rs
 
88
}
 
89
 
 
90
type TrainedmodelsService struct {
 
91
        s *Service
 
92
}
 
93
 
 
94
type Analyze struct {
 
95
        // DataDescription: Description of the data the model was trained on.
 
96
        DataDescription *AnalyzeDataDescription `json:"dataDescription,omitempty"`
 
97
 
 
98
        // Errors: List of errors with the data.
 
99
        Errors []map[string]string `json:"errors,omitempty"`
 
100
 
 
101
        // Id: The unique name for the predictive model.
 
102
        Id string `json:"id,omitempty"`
 
103
 
 
104
        // Kind: What kind of resource this is.
 
105
        Kind string `json:"kind,omitempty"`
 
106
 
 
107
        // ModelDescription: Description of the model.
 
108
        ModelDescription *AnalyzeModelDescription `json:"modelDescription,omitempty"`
 
109
 
 
110
        // SelfLink: A URL to re-request this resource.
 
111
        SelfLink string `json:"selfLink,omitempty"`
 
112
}
 
113
 
 
114
type AnalyzeDataDescription struct {
 
115
        // Features: Description of the input features in the data set.
 
116
        Features []*AnalyzeDataDescriptionFeatures `json:"features,omitempty"`
 
117
 
 
118
        // OutputFeature: Description of the output value or label.
 
119
        OutputFeature *AnalyzeDataDescriptionOutputFeature `json:"outputFeature,omitempty"`
 
120
}
 
121
 
 
122
type AnalyzeDataDescriptionFeatures struct {
 
123
        // Categorical: Description of the categorical values of this feature.
 
124
        Categorical *AnalyzeDataDescriptionFeaturesCategorical `json:"categorical,omitempty"`
 
125
 
 
126
        // Index: The feature index.
 
127
        Index int64 `json:"index,omitempty,string"`
 
128
 
 
129
        // Numeric: Description of the numeric values of this feature.
 
130
        Numeric *AnalyzeDataDescriptionFeaturesNumeric `json:"numeric,omitempty"`
 
131
 
 
132
        // Text: Description of multiple-word text values of this feature.
 
133
        Text *AnalyzeDataDescriptionFeaturesText `json:"text,omitempty"`
 
134
}
 
135
 
 
136
type AnalyzeDataDescriptionFeaturesCategorical struct {
 
137
        // Count: Number of categorical values for this feature in the data.
 
138
        Count int64 `json:"count,omitempty,string"`
 
139
 
 
140
        // Values: List of all the categories for this feature in the data set.
 
141
        Values []*AnalyzeDataDescriptionFeaturesCategoricalValues `json:"values,omitempty"`
 
142
}
 
143
 
 
144
type AnalyzeDataDescriptionFeaturesCategoricalValues struct {
 
145
        // Count: Number of times this feature had this value.
 
146
        Count int64 `json:"count,omitempty,string"`
 
147
 
 
148
        // Value: The category name.
 
149
        Value string `json:"value,omitempty"`
 
150
}
 
151
 
 
152
type AnalyzeDataDescriptionFeaturesNumeric struct {
 
153
        // Count: Number of numeric values for this feature in the data set.
 
154
        Count int64 `json:"count,omitempty,string"`
 
155
 
 
156
        // Mean: Mean of the numeric values of this feature in the data set.
 
157
        Mean float64 `json:"mean,omitempty"`
 
158
 
 
159
        // Variance: Variance of the numeric values of this feature in the data
 
160
        // set.
 
161
        Variance float64 `json:"variance,omitempty"`
 
162
}
 
163
 
 
164
type AnalyzeDataDescriptionFeaturesText struct {
 
165
        // Count: Number of multiple-word text values for this feature.
 
166
        Count int64 `json:"count,omitempty,string"`
 
167
}
 
168
 
 
169
type AnalyzeDataDescriptionOutputFeature struct {
 
170
        // Numeric: Description of the output values in the data set.
 
171
        Numeric *AnalyzeDataDescriptionOutputFeatureNumeric `json:"numeric,omitempty"`
 
172
 
 
173
        // Text: Description of the output labels in the data set.
 
174
        Text []*AnalyzeDataDescriptionOutputFeatureText `json:"text,omitempty"`
 
175
}
 
176
 
 
177
type AnalyzeDataDescriptionOutputFeatureNumeric struct {
 
178
        // Count: Number of numeric output values in the data set.
 
179
        Count int64 `json:"count,omitempty,string"`
 
180
 
 
181
        // Mean: Mean of the output values in the data set.
 
182
        Mean float64 `json:"mean,omitempty"`
 
183
 
 
184
        // Variance: Variance of the output values in the data set.
 
185
        Variance float64 `json:"variance,omitempty"`
 
186
}
 
187
 
 
188
type AnalyzeDataDescriptionOutputFeatureText struct {
 
189
        // Count: Number of times the output label occurred in the data set.
 
190
        Count int64 `json:"count,omitempty,string"`
 
191
 
 
192
        // Value: The output label.
 
193
        Value string `json:"value,omitempty"`
 
194
}
 
195
 
 
196
type AnalyzeModelDescription struct {
 
197
        // ConfusionMatrix: An output confusion matrix. This shows an estimate
 
198
        // for how this model will do in predictions. This is first indexed by
 
199
        // the true class label. For each true class label, this provides a pair
 
200
        // {predicted_label, count}, where count is the estimated number of
 
201
        // times the model will predict the predicted label given the true
 
202
        // label. Will not output if more then 100 classes [Categorical models
 
203
        // only].
 
204
        ConfusionMatrix *AnalyzeModelDescriptionConfusionMatrix `json:"confusionMatrix,omitempty"`
 
205
 
 
206
        // ConfusionMatrixRowTotals: A list of the confusion matrix row totals
 
207
        ConfusionMatrixRowTotals *AnalyzeModelDescriptionConfusionMatrixRowTotals `json:"confusionMatrixRowTotals,omitempty"`
 
208
 
 
209
        // Modelinfo: Basic information about the model.
 
210
        Modelinfo *Training `json:"modelinfo,omitempty"`
 
211
}
 
212
 
 
213
type AnalyzeModelDescriptionConfusionMatrix struct {
 
214
}
 
215
 
 
216
type AnalyzeModelDescriptionConfusionMatrixRowTotals struct {
 
217
}
 
218
 
 
219
type Input struct {
 
220
        // Input: Input to the model for a prediction
 
221
        Input *InputInput `json:"input,omitempty"`
 
222
}
 
223
 
 
224
type InputInput struct {
 
225
        // CsvInstance: A list of input features, these can be strings or
 
226
        // doubles.
 
227
        CsvInstance []interface{} `json:"csvInstance,omitempty"`
 
228
}
 
229
 
 
230
type List struct {
 
231
        // Items: List of models.
 
232
        Items []*Training `json:"items,omitempty"`
 
233
 
 
234
        // Kind: What kind of resource this is.
 
235
        Kind string `json:"kind,omitempty"`
 
236
 
 
237
        // NextPageToken: Pagination token to fetch the next page, if one
 
238
        // exists.
 
239
        NextPageToken string `json:"nextPageToken,omitempty"`
 
240
 
 
241
        // SelfLink: A URL to re-request this resource.
 
242
        SelfLink string `json:"selfLink,omitempty"`
 
243
}
 
244
 
 
245
type Output struct {
 
246
        // Id: The unique name for the predictive model.
 
247
        Id string `json:"id,omitempty"`
 
248
 
 
249
        // Kind: What kind of resource this is.
 
250
        Kind string `json:"kind,omitempty"`
 
251
 
 
252
        // OutputLabel: The most likely class label [Categorical models only].
 
253
        OutputLabel string `json:"outputLabel,omitempty"`
 
254
 
 
255
        // OutputMulti: A list of class labels with their estimated
 
256
        // probabilities [Categorical models only].
 
257
        OutputMulti []*OutputOutputMulti `json:"outputMulti,omitempty"`
 
258
 
 
259
        // OutputValue: The estimated regression value [Regression models only].
 
260
        OutputValue float64 `json:"outputValue,omitempty"`
 
261
 
 
262
        // SelfLink: A URL to re-request this resource.
 
263
        SelfLink string `json:"selfLink,omitempty"`
 
264
}
 
265
 
 
266
type OutputOutputMulti struct {
 
267
        // Label: The class label.
 
268
        Label string `json:"label,omitempty"`
 
269
 
 
270
        // Score: The probability of the class label.
 
271
        Score float64 `json:"score,omitempty"`
 
272
}
 
273
 
 
274
type Training struct {
 
275
        // Created: Insert time of the model (as a RFC 3339 timestamp).
 
276
        Created string `json:"created,omitempty"`
 
277
 
 
278
        // Id: The unique name for the predictive model.
 
279
        Id string `json:"id,omitempty"`
 
280
 
 
281
        // Kind: What kind of resource this is.
 
282
        Kind string `json:"kind,omitempty"`
 
283
 
 
284
        // ModelInfo: Model metadata.
 
285
        ModelInfo *TrainingModelInfo `json:"modelInfo,omitempty"`
 
286
 
 
287
        // ModelType: Type of predictive model (classification or regression)
 
288
        ModelType string `json:"modelType,omitempty"`
 
289
 
 
290
        // SelfLink: A URL to re-request this resource.
 
291
        SelfLink string `json:"selfLink,omitempty"`
 
292
 
 
293
        // StorageDataLocation: Google storage location of the training data
 
294
        // file.
 
295
        StorageDataLocation string `json:"storageDataLocation,omitempty"`
 
296
 
 
297
        // StoragePMMLLocation: Google storage location of the preprocessing
 
298
        // pmml file.
 
299
        StoragePMMLLocation string `json:"storagePMMLLocation,omitempty"`
 
300
 
 
301
        // StoragePMMLModelLocation: Google storage location of the pmml model
 
302
        // file.
 
303
        StoragePMMLModelLocation string `json:"storagePMMLModelLocation,omitempty"`
 
304
 
 
305
        // TrainingComplete: Training completion time (as a RFC 3339 timestamp).
 
306
        TrainingComplete string `json:"trainingComplete,omitempty"`
 
307
 
 
308
        // TrainingInstances: Instances to train model on.
 
309
        TrainingInstances []*TrainingTrainingInstances `json:"trainingInstances,omitempty"`
 
310
 
 
311
        // TrainingStatus: The current status of the training job. This can be
 
312
        // one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
 
313
        TrainingStatus string `json:"trainingStatus,omitempty"`
 
314
 
 
315
        // Utility: A class weighting function, which allows the importance
 
316
        // weights for class labels to be specified [Categorical models only].
 
317
        Utility []*TrainingUtility `json:"utility,omitempty"`
 
318
}
 
319
 
 
320
type TrainingModelInfo struct {
 
321
        // ClassWeightedAccuracy: Estimated accuracy of model taking utility
 
322
        // weights into account [Categorical models only].
 
323
        ClassWeightedAccuracy float64 `json:"classWeightedAccuracy,omitempty"`
 
324
 
 
325
        // ClassificationAccuracy: A number between 0.0 and 1.0, where 1.0 is
 
326
        // 100% accurate. This is an estimate, based on the amount and quality
 
327
        // of the training data, of the estimated prediction accuracy. You can
 
328
        // use this is a guide to decide whether the results are accurate enough
 
329
        // for your needs. This estimate will be more reliable if your real
 
330
        // input data is similar to your training data [Categorical models
 
331
        // only].
 
332
        ClassificationAccuracy float64 `json:"classificationAccuracy,omitempty"`
 
333
 
 
334
        // MeanSquaredError: An estimated mean squared error. The can be used to
 
335
        // measure the quality of the predicted model [Regression models only].
 
336
        MeanSquaredError float64 `json:"meanSquaredError,omitempty"`
 
337
 
 
338
        // ModelType: Type of predictive model (CLASSIFICATION or REGRESSION)
 
339
        ModelType string `json:"modelType,omitempty"`
 
340
 
 
341
        // NumberInstances: Number of valid data instances used in the trained
 
342
        // model.
 
343
        NumberInstances int64 `json:"numberInstances,omitempty,string"`
 
344
 
 
345
        // NumberLabels: Number of class labels in the trained model
 
346
        // [Categorical models only].
 
347
        NumberLabels int64 `json:"numberLabels,omitempty,string"`
 
348
}
 
349
 
 
350
type TrainingTrainingInstances struct {
 
351
        // CsvInstance: The input features for this instance
 
352
        CsvInstance []interface{} `json:"csvInstance,omitempty"`
 
353
 
 
354
        // Output: The generic output value - could be regression or class label
 
355
        Output string `json:"output,omitempty"`
 
356
}
 
357
 
 
358
type TrainingUtility struct {
 
359
}
 
360
 
 
361
type Update struct {
 
362
        // CsvInstance: The input features for this instance
 
363
        CsvInstance []interface{} `json:"csvInstance,omitempty"`
 
364
 
 
365
        // Label: The class label of this instance
 
366
        Label string `json:"label,omitempty"`
 
367
 
 
368
        // Output: The generic output value - could be regression value or class
 
369
        // label
 
370
        Output string `json:"output,omitempty"`
 
371
}
 
372
 
 
373
// method id "prediction.hostedmodels.predict":
 
374
 
 
375
type HostedmodelsPredictCall struct {
 
376
        s               *Service
 
377
        hostedModelName string
 
378
        input           *Input
 
379
        opt_            map[string]interface{}
 
380
}
 
381
 
 
382
// Predict: Submit input and request an output against a hosted model.
 
383
func (r *HostedmodelsService) Predict(hostedModelName string, input *Input) *HostedmodelsPredictCall {
 
384
        c := &HostedmodelsPredictCall{s: r.s, opt_: make(map[string]interface{})}
 
385
        c.hostedModelName = hostedModelName
 
386
        c.input = input
 
387
        return c
 
388
}
 
389
 
 
390
// Fields allows partial responses to be retrieved.
 
391
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
392
// for more information.
 
393
func (c *HostedmodelsPredictCall) Fields(s ...googleapi.Field) *HostedmodelsPredictCall {
 
394
        c.opt_["fields"] = googleapi.CombineFields(s)
 
395
        return c
 
396
}
 
397
 
 
398
func (c *HostedmodelsPredictCall) Do() (*Output, error) {
 
399
        var body io.Reader = nil
 
400
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.input)
 
401
        if err != nil {
 
402
                return nil, err
 
403
        }
 
404
        ctype := "application/json"
 
405
        params := make(url.Values)
 
406
        params.Set("alt", "json")
 
407
        if v, ok := c.opt_["fields"]; ok {
 
408
                params.Set("fields", fmt.Sprintf("%v", v))
 
409
        }
 
410
        urls := googleapi.ResolveRelative(c.s.BasePath, "hostedmodels/{hostedModelName}/predict")
 
411
        urls += "?" + params.Encode()
 
412
        req, _ := http.NewRequest("POST", urls, body)
 
413
        googleapi.Expand(req.URL, map[string]string{
 
414
                "hostedModelName": c.hostedModelName,
 
415
        })
 
416
        req.Header.Set("Content-Type", ctype)
 
417
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
418
        res, err := c.s.client.Do(req)
 
419
        if err != nil {
 
420
                return nil, err
 
421
        }
 
422
        defer googleapi.CloseBody(res)
 
423
        if err := googleapi.CheckResponse(res); err != nil {
 
424
                return nil, err
 
425
        }
 
426
        var ret *Output
 
427
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
428
                return nil, err
 
429
        }
 
430
        return ret, nil
 
431
        // {
 
432
        //   "description": "Submit input and request an output against a hosted model.",
 
433
        //   "httpMethod": "POST",
 
434
        //   "id": "prediction.hostedmodels.predict",
 
435
        //   "parameterOrder": [
 
436
        //     "hostedModelName"
 
437
        //   ],
 
438
        //   "parameters": {
 
439
        //     "hostedModelName": {
 
440
        //       "description": "The name of a hosted model.",
 
441
        //       "location": "path",
 
442
        //       "required": true,
 
443
        //       "type": "string"
 
444
        //     }
 
445
        //   },
 
446
        //   "path": "hostedmodels/{hostedModelName}/predict",
 
447
        //   "request": {
 
448
        //     "$ref": "Input"
 
449
        //   },
 
450
        //   "response": {
 
451
        //     "$ref": "Output"
 
452
        //   },
 
453
        //   "scopes": [
 
454
        //     "https://www.googleapis.com/auth/prediction"
 
455
        //   ]
 
456
        // }
 
457
 
 
458
}
 
459
 
 
460
// method id "prediction.trainedmodels.analyze":
 
461
 
 
462
type TrainedmodelsAnalyzeCall struct {
 
463
        s    *Service
 
464
        id   string
 
465
        opt_ map[string]interface{}
 
466
}
 
467
 
 
468
// Analyze: Get analysis of the model and the data the model was trained
 
469
// on.
 
470
func (r *TrainedmodelsService) Analyze(id string) *TrainedmodelsAnalyzeCall {
 
471
        c := &TrainedmodelsAnalyzeCall{s: r.s, opt_: make(map[string]interface{})}
 
472
        c.id = id
 
473
        return c
 
474
}
 
475
 
 
476
// Fields allows partial responses to be retrieved.
 
477
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
478
// for more information.
 
479
func (c *TrainedmodelsAnalyzeCall) Fields(s ...googleapi.Field) *TrainedmodelsAnalyzeCall {
 
480
        c.opt_["fields"] = googleapi.CombineFields(s)
 
481
        return c
 
482
}
 
483
 
 
484
func (c *TrainedmodelsAnalyzeCall) Do() (*Analyze, error) {
 
485
        var body io.Reader = nil
 
486
        params := make(url.Values)
 
487
        params.Set("alt", "json")
 
488
        if v, ok := c.opt_["fields"]; ok {
 
489
                params.Set("fields", fmt.Sprintf("%v", v))
 
490
        }
 
491
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/{id}/analyze")
 
492
        urls += "?" + params.Encode()
 
493
        req, _ := http.NewRequest("GET", urls, body)
 
494
        googleapi.Expand(req.URL, map[string]string{
 
495
                "id": c.id,
 
496
        })
 
497
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
498
        res, err := c.s.client.Do(req)
 
499
        if err != nil {
 
500
                return nil, err
 
501
        }
 
502
        defer googleapi.CloseBody(res)
 
503
        if err := googleapi.CheckResponse(res); err != nil {
 
504
                return nil, err
 
505
        }
 
506
        var ret *Analyze
 
507
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
508
                return nil, err
 
509
        }
 
510
        return ret, nil
 
511
        // {
 
512
        //   "description": "Get analysis of the model and the data the model was trained on.",
 
513
        //   "httpMethod": "GET",
 
514
        //   "id": "prediction.trainedmodels.analyze",
 
515
        //   "parameterOrder": [
 
516
        //     "id"
 
517
        //   ],
 
518
        //   "parameters": {
 
519
        //     "id": {
 
520
        //       "description": "The unique name for the predictive model.",
 
521
        //       "location": "path",
 
522
        //       "required": true,
 
523
        //       "type": "string"
 
524
        //     }
 
525
        //   },
 
526
        //   "path": "trainedmodels/{id}/analyze",
 
527
        //   "response": {
 
528
        //     "$ref": "Analyze"
 
529
        //   },
 
530
        //   "scopes": [
 
531
        //     "https://www.googleapis.com/auth/prediction"
 
532
        //   ]
 
533
        // }
 
534
 
 
535
}
 
536
 
 
537
// method id "prediction.trainedmodels.delete":
 
538
 
 
539
type TrainedmodelsDeleteCall struct {
 
540
        s    *Service
 
541
        id   string
 
542
        opt_ map[string]interface{}
 
543
}
 
544
 
 
545
// Delete: Delete a trained model.
 
546
func (r *TrainedmodelsService) Delete(id string) *TrainedmodelsDeleteCall {
 
547
        c := &TrainedmodelsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
 
548
        c.id = id
 
549
        return c
 
550
}
 
551
 
 
552
// Fields allows partial responses to be retrieved.
 
553
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
554
// for more information.
 
555
func (c *TrainedmodelsDeleteCall) Fields(s ...googleapi.Field) *TrainedmodelsDeleteCall {
 
556
        c.opt_["fields"] = googleapi.CombineFields(s)
 
557
        return c
 
558
}
 
559
 
 
560
func (c *TrainedmodelsDeleteCall) Do() error {
 
561
        var body io.Reader = nil
 
562
        params := make(url.Values)
 
563
        params.Set("alt", "json")
 
564
        if v, ok := c.opt_["fields"]; ok {
 
565
                params.Set("fields", fmt.Sprintf("%v", v))
 
566
        }
 
567
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/{id}")
 
568
        urls += "?" + params.Encode()
 
569
        req, _ := http.NewRequest("DELETE", urls, body)
 
570
        googleapi.Expand(req.URL, map[string]string{
 
571
                "id": c.id,
 
572
        })
 
573
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
574
        res, err := c.s.client.Do(req)
 
575
        if err != nil {
 
576
                return err
 
577
        }
 
578
        defer googleapi.CloseBody(res)
 
579
        if err := googleapi.CheckResponse(res); err != nil {
 
580
                return err
 
581
        }
 
582
        return nil
 
583
        // {
 
584
        //   "description": "Delete a trained model.",
 
585
        //   "httpMethod": "DELETE",
 
586
        //   "id": "prediction.trainedmodels.delete",
 
587
        //   "parameterOrder": [
 
588
        //     "id"
 
589
        //   ],
 
590
        //   "parameters": {
 
591
        //     "id": {
 
592
        //       "description": "The unique name for the predictive model.",
 
593
        //       "location": "path",
 
594
        //       "required": true,
 
595
        //       "type": "string"
 
596
        //     }
 
597
        //   },
 
598
        //   "path": "trainedmodels/{id}",
 
599
        //   "scopes": [
 
600
        //     "https://www.googleapis.com/auth/prediction"
 
601
        //   ]
 
602
        // }
 
603
 
 
604
}
 
605
 
 
606
// method id "prediction.trainedmodels.get":
 
607
 
 
608
type TrainedmodelsGetCall struct {
 
609
        s    *Service
 
610
        id   string
 
611
        opt_ map[string]interface{}
 
612
}
 
613
 
 
614
// Get: Check training status of your model.
 
615
func (r *TrainedmodelsService) Get(id string) *TrainedmodelsGetCall {
 
616
        c := &TrainedmodelsGetCall{s: r.s, opt_: make(map[string]interface{})}
 
617
        c.id = id
 
618
        return c
 
619
}
 
620
 
 
621
// Fields allows partial responses to be retrieved.
 
622
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
623
// for more information.
 
624
func (c *TrainedmodelsGetCall) Fields(s ...googleapi.Field) *TrainedmodelsGetCall {
 
625
        c.opt_["fields"] = googleapi.CombineFields(s)
 
626
        return c
 
627
}
 
628
 
 
629
func (c *TrainedmodelsGetCall) Do() (*Training, error) {
 
630
        var body io.Reader = nil
 
631
        params := make(url.Values)
 
632
        params.Set("alt", "json")
 
633
        if v, ok := c.opt_["fields"]; ok {
 
634
                params.Set("fields", fmt.Sprintf("%v", v))
 
635
        }
 
636
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/{id}")
 
637
        urls += "?" + params.Encode()
 
638
        req, _ := http.NewRequest("GET", urls, body)
 
639
        googleapi.Expand(req.URL, map[string]string{
 
640
                "id": c.id,
 
641
        })
 
642
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
643
        res, err := c.s.client.Do(req)
 
644
        if err != nil {
 
645
                return nil, err
 
646
        }
 
647
        defer googleapi.CloseBody(res)
 
648
        if err := googleapi.CheckResponse(res); err != nil {
 
649
                return nil, err
 
650
        }
 
651
        var ret *Training
 
652
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
653
                return nil, err
 
654
        }
 
655
        return ret, nil
 
656
        // {
 
657
        //   "description": "Check training status of your model.",
 
658
        //   "httpMethod": "GET",
 
659
        //   "id": "prediction.trainedmodels.get",
 
660
        //   "parameterOrder": [
 
661
        //     "id"
 
662
        //   ],
 
663
        //   "parameters": {
 
664
        //     "id": {
 
665
        //       "description": "The unique name for the predictive model.",
 
666
        //       "location": "path",
 
667
        //       "required": true,
 
668
        //       "type": "string"
 
669
        //     }
 
670
        //   },
 
671
        //   "path": "trainedmodels/{id}",
 
672
        //   "response": {
 
673
        //     "$ref": "Training"
 
674
        //   },
 
675
        //   "scopes": [
 
676
        //     "https://www.googleapis.com/auth/prediction"
 
677
        //   ]
 
678
        // }
 
679
 
 
680
}
 
681
 
 
682
// method id "prediction.trainedmodels.insert":
 
683
 
 
684
type TrainedmodelsInsertCall struct {
 
685
        s        *Service
 
686
        training *Training
 
687
        opt_     map[string]interface{}
 
688
}
 
689
 
 
690
// Insert: Begin training your model.
 
691
func (r *TrainedmodelsService) Insert(training *Training) *TrainedmodelsInsertCall {
 
692
        c := &TrainedmodelsInsertCall{s: r.s, opt_: make(map[string]interface{})}
 
693
        c.training = training
 
694
        return c
 
695
}
 
696
 
 
697
// Fields allows partial responses to be retrieved.
 
698
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
699
// for more information.
 
700
func (c *TrainedmodelsInsertCall) Fields(s ...googleapi.Field) *TrainedmodelsInsertCall {
 
701
        c.opt_["fields"] = googleapi.CombineFields(s)
 
702
        return c
 
703
}
 
704
 
 
705
func (c *TrainedmodelsInsertCall) Do() (*Training, error) {
 
706
        var body io.Reader = nil
 
707
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.training)
 
708
        if err != nil {
 
709
                return nil, err
 
710
        }
 
711
        ctype := "application/json"
 
712
        params := make(url.Values)
 
713
        params.Set("alt", "json")
 
714
        if v, ok := c.opt_["fields"]; ok {
 
715
                params.Set("fields", fmt.Sprintf("%v", v))
 
716
        }
 
717
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels")
 
718
        urls += "?" + params.Encode()
 
719
        req, _ := http.NewRequest("POST", urls, body)
 
720
        googleapi.SetOpaque(req.URL)
 
721
        req.Header.Set("Content-Type", ctype)
 
722
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
723
        res, err := c.s.client.Do(req)
 
724
        if err != nil {
 
725
                return nil, err
 
726
        }
 
727
        defer googleapi.CloseBody(res)
 
728
        if err := googleapi.CheckResponse(res); err != nil {
 
729
                return nil, err
 
730
        }
 
731
        var ret *Training
 
732
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
733
                return nil, err
 
734
        }
 
735
        return ret, nil
 
736
        // {
 
737
        //   "description": "Begin training your model.",
 
738
        //   "httpMethod": "POST",
 
739
        //   "id": "prediction.trainedmodels.insert",
 
740
        //   "path": "trainedmodels",
 
741
        //   "request": {
 
742
        //     "$ref": "Training"
 
743
        //   },
 
744
        //   "response": {
 
745
        //     "$ref": "Training"
 
746
        //   },
 
747
        //   "scopes": [
 
748
        //     "https://www.googleapis.com/auth/devstorage.full_control",
 
749
        //     "https://www.googleapis.com/auth/devstorage.read_only",
 
750
        //     "https://www.googleapis.com/auth/devstorage.read_write",
 
751
        //     "https://www.googleapis.com/auth/prediction"
 
752
        //   ]
 
753
        // }
 
754
 
 
755
}
 
756
 
 
757
// method id "prediction.trainedmodels.list":
 
758
 
 
759
type TrainedmodelsListCall struct {
 
760
        s    *Service
 
761
        opt_ map[string]interface{}
 
762
}
 
763
 
 
764
// List: List available models.
 
765
func (r *TrainedmodelsService) List() *TrainedmodelsListCall {
 
766
        c := &TrainedmodelsListCall{s: r.s, opt_: make(map[string]interface{})}
 
767
        return c
 
768
}
 
769
 
 
770
// MaxResults sets the optional parameter "maxResults": Maximum number
 
771
// of results to return
 
772
func (c *TrainedmodelsListCall) MaxResults(maxResults int64) *TrainedmodelsListCall {
 
773
        c.opt_["maxResults"] = maxResults
 
774
        return c
 
775
}
 
776
 
 
777
// PageToken sets the optional parameter "pageToken": Pagination token
 
778
func (c *TrainedmodelsListCall) PageToken(pageToken string) *TrainedmodelsListCall {
 
779
        c.opt_["pageToken"] = pageToken
 
780
        return c
 
781
}
 
782
 
 
783
// Fields allows partial responses to be retrieved.
 
784
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
785
// for more information.
 
786
func (c *TrainedmodelsListCall) Fields(s ...googleapi.Field) *TrainedmodelsListCall {
 
787
        c.opt_["fields"] = googleapi.CombineFields(s)
 
788
        return c
 
789
}
 
790
 
 
791
func (c *TrainedmodelsListCall) Do() (*List, error) {
 
792
        var body io.Reader = nil
 
793
        params := make(url.Values)
 
794
        params.Set("alt", "json")
 
795
        if v, ok := c.opt_["maxResults"]; ok {
 
796
                params.Set("maxResults", fmt.Sprintf("%v", v))
 
797
        }
 
798
        if v, ok := c.opt_["pageToken"]; ok {
 
799
                params.Set("pageToken", fmt.Sprintf("%v", v))
 
800
        }
 
801
        if v, ok := c.opt_["fields"]; ok {
 
802
                params.Set("fields", fmt.Sprintf("%v", v))
 
803
        }
 
804
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/list")
 
805
        urls += "?" + params.Encode()
 
806
        req, _ := http.NewRequest("GET", urls, body)
 
807
        googleapi.SetOpaque(req.URL)
 
808
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
809
        res, err := c.s.client.Do(req)
 
810
        if err != nil {
 
811
                return nil, err
 
812
        }
 
813
        defer googleapi.CloseBody(res)
 
814
        if err := googleapi.CheckResponse(res); err != nil {
 
815
                return nil, err
 
816
        }
 
817
        var ret *List
 
818
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
819
                return nil, err
 
820
        }
 
821
        return ret, nil
 
822
        // {
 
823
        //   "description": "List available models.",
 
824
        //   "httpMethod": "GET",
 
825
        //   "id": "prediction.trainedmodels.list",
 
826
        //   "parameters": {
 
827
        //     "maxResults": {
 
828
        //       "description": "Maximum number of results to return",
 
829
        //       "format": "uint32",
 
830
        //       "location": "query",
 
831
        //       "minimum": "0",
 
832
        //       "type": "integer"
 
833
        //     },
 
834
        //     "pageToken": {
 
835
        //       "description": "Pagination token",
 
836
        //       "location": "query",
 
837
        //       "type": "string"
 
838
        //     }
 
839
        //   },
 
840
        //   "path": "trainedmodels/list",
 
841
        //   "response": {
 
842
        //     "$ref": "List"
 
843
        //   },
 
844
        //   "scopes": [
 
845
        //     "https://www.googleapis.com/auth/prediction"
 
846
        //   ]
 
847
        // }
 
848
 
 
849
}
 
850
 
 
851
// method id "prediction.trainedmodels.predict":
 
852
 
 
853
type TrainedmodelsPredictCall struct {
 
854
        s     *Service
 
855
        id    string
 
856
        input *Input
 
857
        opt_  map[string]interface{}
 
858
}
 
859
 
 
860
// Predict: Submit model id and request a prediction.
 
861
func (r *TrainedmodelsService) Predict(id string, input *Input) *TrainedmodelsPredictCall {
 
862
        c := &TrainedmodelsPredictCall{s: r.s, opt_: make(map[string]interface{})}
 
863
        c.id = id
 
864
        c.input = input
 
865
        return c
 
866
}
 
867
 
 
868
// Fields allows partial responses to be retrieved.
 
869
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
870
// for more information.
 
871
func (c *TrainedmodelsPredictCall) Fields(s ...googleapi.Field) *TrainedmodelsPredictCall {
 
872
        c.opt_["fields"] = googleapi.CombineFields(s)
 
873
        return c
 
874
}
 
875
 
 
876
func (c *TrainedmodelsPredictCall) Do() (*Output, error) {
 
877
        var body io.Reader = nil
 
878
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.input)
 
879
        if err != nil {
 
880
                return nil, err
 
881
        }
 
882
        ctype := "application/json"
 
883
        params := make(url.Values)
 
884
        params.Set("alt", "json")
 
885
        if v, ok := c.opt_["fields"]; ok {
 
886
                params.Set("fields", fmt.Sprintf("%v", v))
 
887
        }
 
888
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/{id}/predict")
 
889
        urls += "?" + params.Encode()
 
890
        req, _ := http.NewRequest("POST", urls, body)
 
891
        googleapi.Expand(req.URL, map[string]string{
 
892
                "id": c.id,
 
893
        })
 
894
        req.Header.Set("Content-Type", ctype)
 
895
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
896
        res, err := c.s.client.Do(req)
 
897
        if err != nil {
 
898
                return nil, err
 
899
        }
 
900
        defer googleapi.CloseBody(res)
 
901
        if err := googleapi.CheckResponse(res); err != nil {
 
902
                return nil, err
 
903
        }
 
904
        var ret *Output
 
905
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
906
                return nil, err
 
907
        }
 
908
        return ret, nil
 
909
        // {
 
910
        //   "description": "Submit model id and request a prediction.",
 
911
        //   "httpMethod": "POST",
 
912
        //   "id": "prediction.trainedmodels.predict",
 
913
        //   "parameterOrder": [
 
914
        //     "id"
 
915
        //   ],
 
916
        //   "parameters": {
 
917
        //     "id": {
 
918
        //       "description": "The unique name for the predictive model.",
 
919
        //       "location": "path",
 
920
        //       "required": true,
 
921
        //       "type": "string"
 
922
        //     }
 
923
        //   },
 
924
        //   "path": "trainedmodels/{id}/predict",
 
925
        //   "request": {
 
926
        //     "$ref": "Input"
 
927
        //   },
 
928
        //   "response": {
 
929
        //     "$ref": "Output"
 
930
        //   },
 
931
        //   "scopes": [
 
932
        //     "https://www.googleapis.com/auth/prediction"
 
933
        //   ]
 
934
        // }
 
935
 
 
936
}
 
937
 
 
938
// method id "prediction.trainedmodels.update":
 
939
 
 
940
type TrainedmodelsUpdateCall struct {
 
941
        s      *Service
 
942
        id     string
 
943
        update *Update
 
944
        opt_   map[string]interface{}
 
945
}
 
946
 
 
947
// Update: Add new data to a trained model.
 
948
func (r *TrainedmodelsService) Update(id string, update *Update) *TrainedmodelsUpdateCall {
 
949
        c := &TrainedmodelsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
 
950
        c.id = id
 
951
        c.update = update
 
952
        return c
 
953
}
 
954
 
 
955
// Fields allows partial responses to be retrieved.
 
956
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
957
// for more information.
 
958
func (c *TrainedmodelsUpdateCall) Fields(s ...googleapi.Field) *TrainedmodelsUpdateCall {
 
959
        c.opt_["fields"] = googleapi.CombineFields(s)
 
960
        return c
 
961
}
 
962
 
 
963
func (c *TrainedmodelsUpdateCall) Do() (*Training, error) {
 
964
        var body io.Reader = nil
 
965
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.update)
 
966
        if err != nil {
 
967
                return nil, err
 
968
        }
 
969
        ctype := "application/json"
 
970
        params := make(url.Values)
 
971
        params.Set("alt", "json")
 
972
        if v, ok := c.opt_["fields"]; ok {
 
973
                params.Set("fields", fmt.Sprintf("%v", v))
 
974
        }
 
975
        urls := googleapi.ResolveRelative(c.s.BasePath, "trainedmodels/{id}")
 
976
        urls += "?" + params.Encode()
 
977
        req, _ := http.NewRequest("PUT", urls, body)
 
978
        googleapi.Expand(req.URL, map[string]string{
 
979
                "id": c.id,
 
980
        })
 
981
        req.Header.Set("Content-Type", ctype)
 
982
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
983
        res, err := c.s.client.Do(req)
 
984
        if err != nil {
 
985
                return nil, err
 
986
        }
 
987
        defer googleapi.CloseBody(res)
 
988
        if err := googleapi.CheckResponse(res); err != nil {
 
989
                return nil, err
 
990
        }
 
991
        var ret *Training
 
992
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
993
                return nil, err
 
994
        }
 
995
        return ret, nil
 
996
        // {
 
997
        //   "description": "Add new data to a trained model.",
 
998
        //   "httpMethod": "PUT",
 
999
        //   "id": "prediction.trainedmodels.update",
 
1000
        //   "parameterOrder": [
 
1001
        //     "id"
 
1002
        //   ],
 
1003
        //   "parameters": {
 
1004
        //     "id": {
 
1005
        //       "description": "The unique name for the predictive model.",
 
1006
        //       "location": "path",
 
1007
        //       "required": true,
 
1008
        //       "type": "string"
 
1009
        //     }
 
1010
        //   },
 
1011
        //   "path": "trainedmodels/{id}",
 
1012
        //   "request": {
 
1013
        //     "$ref": "Update"
 
1014
        //   },
 
1015
        //   "response": {
 
1016
        //     "$ref": "Training"
 
1017
        //   },
 
1018
        //   "scopes": [
 
1019
        //     "https://www.googleapis.com/auth/prediction"
 
1020
        //   ]
 
1021
        // }
 
1022
 
 
1023
}