forked from googleapis/google-api-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datastore-gen.go
1223 lines (1066 loc) · 38 KB
/
datastore-gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package datastore provides access to the Google Cloud Datastore API.
//
// See https://developers.google.com/datastore/
//
// Usage example:
//
// import "google.golang.org/api/datastore/v1beta1"
// ...
// datastoreService, err := datastore.New(oauthHttpClient)
package datastore
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Background
const apiId = "datastore:v1beta1"
const apiName = "datastore"
const apiVersion = "v1beta1"
const basePath = "https://www.googleapis.com/datastore/v1beta1/datasets/"
// OAuth2 scopes used by this API.
const (
// View and manage your data across Google Cloud Platform services
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
// View and manage your Google Cloud Datastore data
DatastoreScope = "https://www.googleapis.com/auth/datastore"
// View your email address
UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Datasets = NewDatasetsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Datasets *DatasetsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewDatasetsService(s *Service) *DatasetsService {
rs := &DatasetsService{s: s}
return rs
}
type DatasetsService struct {
s *Service
}
type AllocateIdsRequest struct {
// Keys: A list of keys with incomplete key paths to allocate IDs for.
// No key may be reserved/read-only.
Keys []*Key `json:"keys,omitempty"`
}
type AllocateIdsResponse struct {
Header *ResponseHeader `json:"header,omitempty"`
// Keys: The keys specified in the request (in the same order), each
// with its key path completed with a newly allocated ID.
Keys []*Key `json:"keys,omitempty"`
}
type BeginTransactionRequest struct {
// IsolationLevel: The transaction isolation level. Either snapshot or
// serializable. The default isolation level is snapshot isolation,
// which means that another transaction may not concurrently modify the
// data that is modified by this transaction. Optionally, a transaction
// can request to be made serializable which means that another
// transaction cannot concurrently modify the data that is read or
// modified by this transaction.
IsolationLevel string `json:"isolationLevel,omitempty"`
}
type BeginTransactionResponse struct {
Header *ResponseHeader `json:"header,omitempty"`
// Transaction: The transaction identifier (always present).
Transaction string `json:"transaction,omitempty"`
}
type BlindWriteRequest struct {
// Mutation: The mutation to perform.
Mutation *Mutation `json:"mutation,omitempty"`
}
type BlindWriteResponse struct {
Header *ResponseHeader `json:"header,omitempty"`
// MutationResult: The result of performing the mutation (always
// present).
MutationResult *MutationResult `json:"mutationResult,omitempty"`
}
type CommitRequest struct {
IgnoreReadOnly bool `json:"ignoreReadOnly,omitempty"`
// Mutation: The mutation to perform. Optional.
Mutation *Mutation `json:"mutation,omitempty"`
// Transaction: The transaction identifier, returned by a call to
// beginTransaction. Must be set when mode is TRANSACTIONAL.
Transaction string `json:"transaction,omitempty"`
}
type CommitResponse struct {
Header *ResponseHeader `json:"header,omitempty"`
// MutationResult: The result of performing the mutation (if any).
MutationResult *MutationResult `json:"mutationResult,omitempty"`
}
// CompositeFilter: A filter that merges the multiple other filters
// using the given operation.
type CompositeFilter struct {
// Filters: The list of filters to combine. Must contain at least one
// filter.
Filters []*Filter `json:"filters,omitempty"`
// Operator: The operator for combining multiple filters. Only "and" is
// currently supported.
Operator string `json:"operator,omitempty"`
}
// Entity: An entity.
type Entity struct {
// Key: The entity's key.
//
// An entity must have a key, unless otherwise documented (for example,
// an entity in Value.entityValue may have no key). An entity's kind is
// its key's path's last element's kind, or null if it has no key.
Key *Key `json:"key,omitempty"`
// Properties: The entity's properties.
Properties map[string]Property `json:"properties,omitempty"`
}
// EntityResult: The result of fetching an entity from the datastore.
type EntityResult struct {
// Entity: The resulting entity.
Entity *Entity `json:"entity,omitempty"`
}
// Filter: A holder for any type of filter. Exactly one field should be
// specified.
type Filter struct {
// CompositeFilter: A composite filter.
CompositeFilter *CompositeFilter `json:"compositeFilter,omitempty"`
// PropertyFilter: A filter on a property.
PropertyFilter *PropertyFilter `json:"propertyFilter,omitempty"`
}
// GqlQuery: A GQL query.
type GqlQuery struct {
// AllowLiteral: When false, the query string must not contain a
// literal.
AllowLiteral bool `json:"allowLiteral,omitempty"`
// NameArgs: A named argument must set field GqlQueryArg.name. No two
// named arguments may have the same name. For each non-reserved named
// binding site in the query string, there must be a named argument with
// that name, but not necessarily the inverse.
NameArgs []*GqlQueryArg `json:"nameArgs,omitempty"`
// NumberArgs: Numbered binding site @1 references the first numbered
// argument, effectively using 1-based indexing, rather than the usual
// 0. A numbered argument must NOT set field GqlQueryArg.name. For each
// binding site numbered i in query_string, there must be an ith
// numbered argument. The inverse must also be true.
NumberArgs []*GqlQueryArg `json:"numberArgs,omitempty"`
// QueryString: The query string.
QueryString string `json:"queryString,omitempty"`
}
// GqlQueryArg: A binding argument for a GQL query.
type GqlQueryArg struct {
Cursor string `json:"cursor,omitempty"`
// Name: Must match regex "[A-Za-z_$][A-Za-z_$0-9]*". Must not match
// regex "__.*__". Must not be "".
Name string `json:"name,omitempty"`
Value *Value `json:"value,omitempty"`
}
// Key: A unique identifier for an entity.
type Key struct {
// PartitionId: Entities are partitioned into subsets, currently
// identified by a dataset (usually implicitly specified by the project)
// and namespace ID. Queries are scoped to a single partition.
PartitionId *PartitionId `json:"partitionId,omitempty"`
// Path: The entity path. An entity path consists of one or more
// elements composed of a kind and a string or numerical identifier,
// which identify entities. The first element identifies a root entity,
// the second element identifies a child of the root entity, the third
// element a child of the second entity, and so forth. The entities
// identified by all prefixes of the path are called the element's
// ancestors. An entity path is always fully complete: ALL of the
// entity's ancestors are required to be in the path along with the
// entity identifier itself. The only exception is that in some
// documented cases, the identifier in the last path element (for the
// entity) itself may be omitted. A path can never be empty. The path
// can have at most 100 elements.
Path []*KeyPathElement `json:"path,omitempty"`
}
// KeyPathElement: A (kind, ID/name) pair used to construct a key
// path.
//
// At most one of name or ID may be set. If either is set, the element
// is complete. If neither is set, the element is incomplete.
type KeyPathElement struct {
// Id: The ID of the entity. Never equal to zero. Values less than zero
// are discouraged and will not be supported in the future.
Id int64 `json:"id,omitempty,string"`
// Kind: The kind of the entity. A kind matching regex "__.*__" is
// reserved/read-only. A kind must not contain more than 500 characters.
// Cannot be "".
Kind string `json:"kind,omitempty"`
// Name: The name of the entity. A name matching regex "__.*__" is
// reserved/read-only. A name must not be more than 500 characters.
// Cannot be "".
Name string `json:"name,omitempty"`
}
// KindExpression: A representation of a kind.
type KindExpression struct {
// Name: The name of the kind.
Name string `json:"name,omitempty"`
}
type LookupRequest struct {
// Keys: Keys of entities to look up from the datastore.
Keys []*Key `json:"keys,omitempty"`
// ReadOptions: Options for this lookup request. Optional.
ReadOptions *ReadOptions `json:"readOptions,omitempty"`
}
type LookupResponse struct {
// Deferred: A list of keys that were not looked up due to resource
// constraints.
Deferred []*Key `json:"deferred,omitempty"`
// Found: Entities found.
Found []*EntityResult `json:"found,omitempty"`
Header *ResponseHeader `json:"header,omitempty"`
// Missing: Entities not found, with only the key populated.
Missing []*EntityResult `json:"missing,omitempty"`
}
// Mutation: A set of changes to apply.
type Mutation struct {
// Delete: Keys of entities to delete. Each key must have a complete key
// path and must not be reserved/read-only.
Delete []*Key `json:"delete,omitempty"`
// Force: Ignore a user specified read-only period. Optional.
Force bool `json:"force,omitempty"`
// Insert: Entities to insert. Each inserted entity's key must have a
// complete path and must not be reserved/read-only.
Insert []*Entity `json:"insert,omitempty"`
// InsertAutoId: Insert entities with a newly allocated ID. Each
// inserted entity's key must omit the final identifier in its path and
// must not be reserved/read-only.
InsertAutoId []*Entity `json:"insertAutoId,omitempty"`
// Update: Entities to update. Each updated entity's key must have a
// complete path and must not be reserved/read-only.
Update []*Entity `json:"update,omitempty"`
// Upsert: Entities to upsert. Each upserted entity's key must have a
// complete path and must not be reserved/read-only.
Upsert []*Entity `json:"upsert,omitempty"`
}
type MutationResult struct {
// IndexUpdates: Number of index writes.
IndexUpdates int64 `json:"indexUpdates,omitempty"`
// InsertAutoIdKeys: Keys for insertAutoId entities. One per entity from
// the request, in the same order.
InsertAutoIdKeys []*Key `json:"insertAutoIdKeys,omitempty"`
}
// PartitionId: An identifier for a particular subset of
// entities.
//
// Entities are partitioned into various subsets, each used by different
// datasets and different namespaces within a dataset and so forth.
type PartitionId struct {
// DatasetId: The dataset ID.
DatasetId string `json:"datasetId,omitempty"`
// Namespace: The namespace.
Namespace string `json:"namespace,omitempty"`
}
// Property: An entity property.
type Property struct {
// Multi: If this property contains a list of values. Input values may
// explicitly set multi to false, but otherwise false is always
// represented by omitting multi.
Multi bool `json:"multi,omitempty"`
// Values: The value(s) of the property. When multi is false there is
// always exactly one value. When multi is true there are always one or
// more values. Each value can have only one value property populated.
// For example, you cannot have a values list of { values: [ {
// integerValue: 22, stringValue: "a" } ] }, but you can have { multi:
// true, values: [ { integerValue: 22 }, { stringValue: "a" } ] }.
Values []*Value `json:"values,omitempty"`
}
// PropertyExpression: A representation of a property in a projection.
type PropertyExpression struct {
// AggregationFunction: The aggregation function to apply to the
// property. Optional. Can only be used when grouping by at least one
// property. Must then be set on all properties in the projection that
// are not being grouped by. Aggregation functions: first selects the
// first result as determined by the query's order.
AggregationFunction string `json:"aggregationFunction,omitempty"`
// Property: The property to project.
Property *PropertyReference `json:"property,omitempty"`
}
// PropertyFilter: A filter on a specific property.
type PropertyFilter struct {
// Operator: The operator to filter by. One of lessThan,
// lessThanOrEqual, greaterThan, greaterThanOrEqual, equal, or
// hasAncestor.
Operator string `json:"operator,omitempty"`
// Property: The property to filter by.
Property *PropertyReference `json:"property,omitempty"`
// Value: The value to compare the property to.
Value *Value `json:"value,omitempty"`
}
// PropertyOrder: The desired order for a specific property.
type PropertyOrder struct {
// Direction: The direction to order by. One of ascending or descending.
// Optional, defaults to ascending.
Direction string `json:"direction,omitempty"`
// Property: The property to order by.
Property *PropertyReference `json:"property,omitempty"`
}
// PropertyReference: A reference to a property relative to the kind
// expressions.
type PropertyReference struct {
// Name: The name of the property.
Name string `json:"name,omitempty"`
}
// Query: A query.
type Query struct {
// EndCursor: An ending point for the query results. Optional. Query
// cursors are returned in query result batches.
EndCursor string `json:"endCursor,omitempty"`
// Filter: The filter to apply (optional).
Filter *Filter `json:"filter,omitempty"`
// GroupBy: The properties to group by (if empty, no grouping is applied
// to the result set).
GroupBy []*PropertyReference `json:"groupBy,omitempty"`
// Kinds: The kinds to query (if empty, returns entities from all
// kinds).
Kinds []*KindExpression `json:"kinds,omitempty"`
// Limit: The maximum number of results to return. Applies after all
// other constraints. Optional.
Limit int64 `json:"limit,omitempty"`
// Offset: The number of results to skip. Applies before limit, but
// after all other constraints (optional, defaults to 0).
Offset int64 `json:"offset,omitempty"`
// Order: The order to apply to the query results (if empty, order is
// unspecified).
Order []*PropertyOrder `json:"order,omitempty"`
// Projection: The projection to return. If not set the entire entity is
// returned.
Projection []*PropertyExpression `json:"projection,omitempty"`
// StartCursor: A starting point for the query results. Optional. Query
// cursors are returned in query result batches.
StartCursor string `json:"startCursor,omitempty"`
}
// QueryResultBatch: A batch of results produced by a query.
type QueryResultBatch struct {
// EndCursor: A cursor that points to the position after the last result
// in the batch. May be absent. TODO(arfuller): Once all plans produce
// cursors update documentation here.
EndCursor string `json:"endCursor,omitempty"`
// EntityResultType: The result type for every entity in entityResults.
// full for full entities, projection for entities with only projected
// properties, keyOnly for entities with only a key.
EntityResultType string `json:"entityResultType,omitempty"`
// EntityResults: The results for this batch.
EntityResults []*EntityResult `json:"entityResults,omitempty"`
// MoreResults: The state of the query after the current batch. One of
// notFinished, moreResultsAfterLimit, noMoreResults.
MoreResults string `json:"moreResults,omitempty"`
// SkippedResults: The number of results skipped because of
// Query.offset.
SkippedResults int64 `json:"skippedResults,omitempty"`
}
type ReadOptions struct {
// ReadConsistency: The read consistency to use. One of default, strong,
// or eventual. Cannot be set when transaction is set. Lookup and
// ancestor queries default to strong, global queries default to
// eventual and cannot be set to strong. Optional. Default is default.
ReadConsistency string `json:"readConsistency,omitempty"`
// Transaction: The transaction to use. Optional.
Transaction string `json:"transaction,omitempty"`
}
type ResponseHeader struct {
// Kind: Identifies what kind of resource this is. Value: the fixed
// string "datastore#responseHeader".
Kind string `json:"kind,omitempty"`
}
type RollbackRequest struct {
// Transaction: The transaction identifier, returned by a call to
// beginTransaction.
Transaction string `json:"transaction,omitempty"`
}
type RollbackResponse struct {
Header *ResponseHeader `json:"header,omitempty"`
}
type RunQueryRequest struct {
// GqlQuery: The GQL query to run. Either this field or field query must
// be set, but not both.
GqlQuery *GqlQuery `json:"gqlQuery,omitempty"`
// PartitionId: Entities are partitioned into subsets, identified by a
// dataset (usually implicitly specified by the project) and namespace
// ID. Queries are scoped to a single partition. This partition ID is
// normalized with the standard default context partition ID, but all
// other partition IDs in RunQueryRequest are normalized with this
// partition ID as the context partition ID.
PartitionId *PartitionId `json:"partitionId,omitempty"`
// Query: The query to run. Either this field or field gql_query must be
// set, but not both.
Query *Query `json:"query,omitempty"`
// ReadOptions: The options for this query.
ReadOptions *ReadOptions `json:"readOptions,omitempty"`
}
type RunQueryResponse struct {
// Batch: A batch of query results (always present).
Batch *QueryResultBatch `json:"batch,omitempty"`
Header *ResponseHeader `json:"header,omitempty"`
}
// Value: A message that can hold any of the supported value types and
// associated metadata.
type Value struct {
// BlobKeyValue: A blob key value.
BlobKeyValue string `json:"blobKeyValue,omitempty"`
// BlobValue: A blob value. May be a maximum of 1,000,000 bytes. When
// indexed is true, may have at most 500 bytes.
BlobValue string `json:"blobValue,omitempty"`
// BooleanValue: A boolean value.
BooleanValue bool `json:"booleanValue,omitempty"`
// DateTimeValue: A timestamp value.
DateTimeValue string `json:"dateTimeValue,omitempty"`
// DoubleValue: A double value.
DoubleValue float64 `json:"doubleValue,omitempty"`
// EntityValue: An entity value. May have no key. May have a key with an
// incomplete key path. May have a reserved/read-only key.
EntityValue *Entity `json:"entityValue,omitempty"`
// Indexed: If the value should be indexed.
//
// The indexed property may be set for a null value. When indexed is
// true, stringValue is limited to 500 characters and the blob value is
// limited to 500 bytes. Input values by default have indexed set to
// true; however, you can explicitly set indexed to true if you want.
// (An output value never has indexed explicitly set to true.) If a
// value is itself an entity, it cannot have indexed set to true.
Indexed bool `json:"indexed,omitempty"`
// IntegerValue: An integer value.
IntegerValue int64 `json:"integerValue,omitempty,string"`
// KeyValue: A key value.
KeyValue *Key `json:"keyValue,omitempty"`
// Meaning: The meaning field is reserved and should not be used.
Meaning int64 `json:"meaning,omitempty"`
// StringValue: A UTF-8 encoded string value. When indexed is true, may
// have at most 500 characters.
StringValue string `json:"stringValue,omitempty"`
}
// method id "datastore.datasets.allocateIds":
type DatasetsAllocateIdsCall struct {
s *Service
datasetId string
allocateidsrequest *AllocateIdsRequest
opt_ map[string]interface{}
}
// AllocateIds: Allocate IDs for incomplete keys (useful for referencing
// an entity before it is inserted).
func (r *DatasetsService) AllocateIds(datasetId string, allocateidsrequest *AllocateIdsRequest) *DatasetsAllocateIdsCall {
c := &DatasetsAllocateIdsCall{s: r.s, opt_: make(map[string]interface{})}
c.datasetId = datasetId
c.allocateidsrequest = allocateidsrequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DatasetsAllocateIdsCall) Fields(s ...googleapi.Field) *DatasetsAllocateIdsCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *DatasetsAllocateIdsCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.allocateidsrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/allocateIds")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"datasetId": c.datasetId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
func (c *DatasetsAllocateIdsCall) Do() (*AllocateIdsResponse, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *AllocateIdsResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Allocate IDs for incomplete keys (useful for referencing an entity before it is inserted).",
// "httpMethod": "POST",
// "id": "datastore.datasets.allocateIds",
// "parameterOrder": [
// "datasetId"
// ],
// "parameters": {
// "datasetId": {
// "description": "Identifies the dataset.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{datasetId}/allocateIds",
// "request": {
// "$ref": "AllocateIdsRequest"
// },
// "response": {
// "$ref": "AllocateIdsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/datastore",
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "datastore.datasets.beginTransaction":
type DatasetsBeginTransactionCall struct {
s *Service
datasetId string
begintransactionrequest *BeginTransactionRequest
opt_ map[string]interface{}
}
// BeginTransaction: Begin a new transaction.
func (r *DatasetsService) BeginTransaction(datasetId string, begintransactionrequest *BeginTransactionRequest) *DatasetsBeginTransactionCall {
c := &DatasetsBeginTransactionCall{s: r.s, opt_: make(map[string]interface{})}
c.datasetId = datasetId
c.begintransactionrequest = begintransactionrequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DatasetsBeginTransactionCall) Fields(s ...googleapi.Field) *DatasetsBeginTransactionCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *DatasetsBeginTransactionCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.begintransactionrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/beginTransaction")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"datasetId": c.datasetId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
func (c *DatasetsBeginTransactionCall) Do() (*BeginTransactionResponse, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *BeginTransactionResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Begin a new transaction.",
// "httpMethod": "POST",
// "id": "datastore.datasets.beginTransaction",
// "parameterOrder": [
// "datasetId"
// ],
// "parameters": {
// "datasetId": {
// "description": "Identifies the dataset.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{datasetId}/beginTransaction",
// "request": {
// "$ref": "BeginTransactionRequest"
// },
// "response": {
// "$ref": "BeginTransactionResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/datastore",
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "datastore.datasets.blindWrite":
type DatasetsBlindWriteCall struct {
s *Service
datasetId string
blindwriterequest *BlindWriteRequest
opt_ map[string]interface{}
}
// BlindWrite: Create, delete or modify some entities outside a
// transaction.
func (r *DatasetsService) BlindWrite(datasetId string, blindwriterequest *BlindWriteRequest) *DatasetsBlindWriteCall {
c := &DatasetsBlindWriteCall{s: r.s, opt_: make(map[string]interface{})}
c.datasetId = datasetId
c.blindwriterequest = blindwriterequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DatasetsBlindWriteCall) Fields(s ...googleapi.Field) *DatasetsBlindWriteCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *DatasetsBlindWriteCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.blindwriterequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/blindWrite")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"datasetId": c.datasetId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
func (c *DatasetsBlindWriteCall) Do() (*BlindWriteResponse, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *BlindWriteResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Create, delete or modify some entities outside a transaction.",
// "httpMethod": "POST",
// "id": "datastore.datasets.blindWrite",
// "parameterOrder": [
// "datasetId"
// ],
// "parameters": {
// "datasetId": {
// "description": "Identifies the dataset.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{datasetId}/blindWrite",
// "request": {
// "$ref": "BlindWriteRequest"
// },
// "response": {
// "$ref": "BlindWriteResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/datastore",
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "datastore.datasets.commit":
type DatasetsCommitCall struct {
s *Service
datasetId string
commitrequest *CommitRequest
opt_ map[string]interface{}
}
// Commit: Commit a transaction, optionally creating, deleting or
// modifying some entities.
func (r *DatasetsService) Commit(datasetId string, commitrequest *CommitRequest) *DatasetsCommitCall {
c := &DatasetsCommitCall{s: r.s, opt_: make(map[string]interface{})}
c.datasetId = datasetId
c.commitrequest = commitrequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DatasetsCommitCall) Fields(s ...googleapi.Field) *DatasetsCommitCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *DatasetsCommitCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.commitrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/commit")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"datasetId": c.datasetId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
func (c *DatasetsCommitCall) Do() (*CommitResponse, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *CommitResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Commit a transaction, optionally creating, deleting or modifying some entities.",
// "httpMethod": "POST",
// "id": "datastore.datasets.commit",
// "parameterOrder": [
// "datasetId"
// ],
// "parameters": {
// "datasetId": {
// "description": "Identifies the dataset.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{datasetId}/commit",
// "request": {
// "$ref": "CommitRequest"
// },
// "response": {
// "$ref": "CommitResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/datastore",
// "https://www.googleapis.com/auth/userinfo.email"
// ]
// }
}
// method id "datastore.datasets.lookup":
type DatasetsLookupCall struct {
s *Service
datasetId string
lookuprequest *LookupRequest
opt_ map[string]interface{}
}
// Lookup: Look up some entities by key.
func (r *DatasetsService) Lookup(datasetId string, lookuprequest *LookupRequest) *DatasetsLookupCall {
c := &DatasetsLookupCall{s: r.s, opt_: make(map[string]interface{})}
c.datasetId = datasetId
c.lookuprequest = lookuprequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *DatasetsLookupCall) Fields(s ...googleapi.Field) *DatasetsLookupCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *DatasetsLookupCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.lookuprequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", alt)
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/lookup")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"datasetId": c.datasetId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
return c.s.client.Do(req)
}
func (c *DatasetsLookupCall) Do() (*LookupResponse, error) {
res, err := c.doRequest("json")
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {