1
// Package datastore provides access to the Google Cloud Datastore API.
3
// See https://developers.google.com/datastore/
7
// import "google.golang.org/api/datastore/v1beta2"
9
// datastoreService, err := datastore.New(oauthHttpClient)
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "datastore:v1beta2"
38
const apiName = "datastore"
39
const apiVersion = "v1beta2"
40
const basePath = "https://www.googleapis.com/datastore/v1beta2/datasets/"
42
// OAuth2 scopes used by this API.
44
// View and manage your data across Google Cloud Platform services
45
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
47
// View and manage your Google Cloud Datastore data
48
DatastoreScope = "https://www.googleapis.com/auth/datastore"
50
// View your email address
51
UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
54
func New(client *http.Client) (*Service, error) {
56
return nil, errors.New("client is nil")
58
s := &Service{client: client, BasePath: basePath}
59
s.Datasets = NewDatasetsService(s)
65
BasePath string // API endpoint base URL
67
Datasets *DatasetsService
70
func NewDatasetsService(s *Service) *DatasetsService {
71
rs := &DatasetsService{s: s}
75
type DatasetsService struct {
79
type AllocateIdsRequest struct {
80
// Keys: A list of keys with incomplete key paths to allocate IDs for.
81
// No key may be reserved/read-only.
82
Keys []*Key `json:"keys,omitempty"`
85
type AllocateIdsResponse struct {
86
Header *ResponseHeader `json:"header,omitempty"`
88
// Keys: The keys specified in the request (in the same order), each
89
// with its key path completed with a newly allocated ID.
90
Keys []*Key `json:"keys,omitempty"`
93
type BeginTransactionRequest struct {
94
// IsolationLevel: The transaction isolation level. Either snapshot or
95
// serializable. The default isolation level is snapshot isolation,
96
// which means that another transaction may not concurrently modify the
97
// data that is modified by this transaction. Optionally, a transaction
98
// can request to be made serializable which means that another
99
// transaction cannot concurrently modify the data that is read or
100
// modified by this transaction.
101
IsolationLevel string `json:"isolationLevel,omitempty"`
104
type BeginTransactionResponse struct {
105
Header *ResponseHeader `json:"header,omitempty"`
107
// Transaction: The transaction identifier (always present).
108
Transaction string `json:"transaction,omitempty"`
111
type CommitRequest struct {
112
IgnoreReadOnly bool `json:"ignoreReadOnly,omitempty"`
114
// Mode: The type of commit to perform. Either TRANSACTIONAL or
115
// NON_TRANSACTIONAL.
116
Mode string `json:"mode,omitempty"`
118
// Mutation: The mutation to perform. Optional.
119
Mutation *Mutation `json:"mutation,omitempty"`
121
// Transaction: The transaction identifier, returned by a call to
122
// beginTransaction. Must be set when mode is TRANSACTIONAL.
123
Transaction string `json:"transaction,omitempty"`
126
type CommitResponse struct {
127
Header *ResponseHeader `json:"header,omitempty"`
129
// MutationResult: The result of performing the mutation (if any).
130
MutationResult *MutationResult `json:"mutationResult,omitempty"`
133
type CompositeFilter struct {
134
// Filters: The list of filters to combine. Must contain at least one
136
Filters []*Filter `json:"filters,omitempty"`
138
// Operator: The operator for combining multiple filters. Only "and" is
139
// currently supported.
140
Operator string `json:"operator,omitempty"`
144
// Key: The entity's key.
146
// An entity must have a key, unless otherwise
147
// documented (for example, an entity in Value.entityValue may have no
148
// key). An entity's kind is its key's path's last element's kind, or
149
// null if it has no key.
150
Key *Key `json:"key,omitempty"`
152
// Properties: The entity's properties.
153
Properties map[string]Property `json:"properties,omitempty"`
156
type EntityResult struct {
157
// Entity: The resulting entity.
158
Entity *Entity `json:"entity,omitempty"`
162
// CompositeFilter: A composite filter.
163
CompositeFilter *CompositeFilter `json:"compositeFilter,omitempty"`
165
// PropertyFilter: A filter on a property.
166
PropertyFilter *PropertyFilter `json:"propertyFilter,omitempty"`
169
type GqlQuery struct {
170
// AllowLiteral: When false, the query string must not contain a
172
AllowLiteral bool `json:"allowLiteral,omitempty"`
174
// NameArgs: A named argument must set field GqlQueryArg.name. No two
175
// named arguments may have the same name. For each non-reserved named
176
// binding site in the query string, there must be a named argument with
177
// that name, but not necessarily the inverse.
178
NameArgs []*GqlQueryArg `json:"nameArgs,omitempty"`
180
// NumberArgs: Numbered binding site @1 references the first numbered
181
// argument, effectively using 1-based indexing, rather than the usual
182
// 0. A numbered argument must NOT set field GqlQueryArg.name. For each
183
// binding site numbered i in query_string, there must be an ith
184
// numbered argument. The inverse must also be true.
185
NumberArgs []*GqlQueryArg `json:"numberArgs,omitempty"`
187
// QueryString: The query string.
188
QueryString string `json:"queryString,omitempty"`
191
type GqlQueryArg struct {
192
Cursor string `json:"cursor,omitempty"`
194
// Name: Must match regex "[A-Za-z_$][A-Za-z_$0-9]*". Must not match
195
// regex "__.*__". Must not be "".
196
Name string `json:"name,omitempty"`
198
Value *Value `json:"value,omitempty"`
202
// PartitionId: Entities are partitioned into subsets, currently
203
// identified by a dataset (usually implicitly specified by the project)
204
// and namespace ID. Queries are scoped to a single partition.
205
PartitionId *PartitionId `json:"partitionId,omitempty"`
207
// Path: The entity path. An entity path consists of one or more
208
// elements composed of a kind and a string or numerical identifier,
209
// which identify entities. The first element identifies a root entity,
210
// the second element identifies a child of the root entity, the third
211
// element a child of the second entity, and so forth. The entities
212
// identified by all prefixes of the path are called the element's
213
// ancestors. An entity path is always fully complete: ALL of the
214
// entity's ancestors are required to be in the path along with the
215
// entity identifier itself. The only exception is that in some
216
// documented cases, the identifier in the last path element (for the
217
// entity) itself may be omitted. A path can never be empty. The path
218
// can have at most 100 elements.
219
Path []*KeyPathElement `json:"path,omitempty"`
222
type KeyPathElement struct {
223
// Id: The ID of the entity. Never equal to zero. Values less than zero
224
// are discouraged and will not be supported in the future.
225
Id int64 `json:"id,omitempty,string"`
227
// Kind: The kind of the entity. A kind matching regex "__.*__" is
228
// reserved/read-only. A kind must not contain more than 500 characters.
230
Kind string `json:"kind,omitempty"`
232
// Name: The name of the entity. A name matching regex "__.*__" is
233
// reserved/read-only. A name must not be more than 500 characters.
235
Name string `json:"name,omitempty"`
238
type KindExpression struct {
239
// Name: The name of the kind.
240
Name string `json:"name,omitempty"`
243
type LookupRequest struct {
244
// Keys: Keys of entities to look up from the datastore.
245
Keys []*Key `json:"keys,omitempty"`
247
// ReadOptions: Options for this lookup request. Optional.
248
ReadOptions *ReadOptions `json:"readOptions,omitempty"`
251
type LookupResponse struct {
252
// Deferred: A list of keys that were not looked up due to resource
254
Deferred []*Key `json:"deferred,omitempty"`
256
// Found: Entities found.
257
Found []*EntityResult `json:"found,omitempty"`
259
Header *ResponseHeader `json:"header,omitempty"`
261
// Missing: Entities not found, with only the key populated.
262
Missing []*EntityResult `json:"missing,omitempty"`
265
type Mutation struct {
266
// Delete: Keys of entities to delete. Each key must have a complete key
267
// path and must not be reserved/read-only.
268
Delete []*Key `json:"delete,omitempty"`
270
// Force: Ignore a user specified read-only period. Optional.
271
Force bool `json:"force,omitempty"`
273
// Insert: Entities to insert. Each inserted entity's key must have a
274
// complete path and must not be reserved/read-only.
275
Insert []*Entity `json:"insert,omitempty"`
277
// InsertAutoId: Insert entities with a newly allocated ID. Each
278
// inserted entity's key must omit the final identifier in its path and
279
// must not be reserved/read-only.
280
InsertAutoId []*Entity `json:"insertAutoId,omitempty"`
282
// Update: Entities to update. Each updated entity's key must have a
283
// complete path and must not be reserved/read-only.
284
Update []*Entity `json:"update,omitempty"`
286
// Upsert: Entities to upsert. Each upserted entity's key must have a
287
// complete path and must not be reserved/read-only.
288
Upsert []*Entity `json:"upsert,omitempty"`
291
type MutationResult struct {
292
// IndexUpdates: Number of index writes.
293
IndexUpdates int64 `json:"indexUpdates,omitempty"`
295
// InsertAutoIdKeys: Keys for insertAutoId entities. One per entity from
296
// the request, in the same order.
297
InsertAutoIdKeys []*Key `json:"insertAutoIdKeys,omitempty"`
300
type PartitionId struct {
301
// DatasetId: The dataset ID.
302
DatasetId string `json:"datasetId,omitempty"`
304
// Namespace: The namespace.
305
Namespace string `json:"namespace,omitempty"`
308
type Property struct {
309
// BlobKeyValue: A blob key value.
310
BlobKeyValue string `json:"blobKeyValue,omitempty"`
312
// BlobValue: A blob value. May be a maximum of 1,000,000 bytes.
313
BlobValue string `json:"blobValue,omitempty"`
315
// BooleanValue: A boolean value.
316
BooleanValue bool `json:"booleanValue,omitempty"`
318
// DateTimeValue: A timestamp value.
319
DateTimeValue string `json:"dateTimeValue,omitempty"`
321
// DoubleValue: A double value.
322
DoubleValue float64 `json:"doubleValue,omitempty"`
324
// EntityValue: An entity value. May have no key. May have a key with an
325
// incomplete key path. May have a reserved/read-only key.
326
EntityValue *Entity `json:"entityValue,omitempty"`
328
// Indexed: If the value should be indexed.
330
// The indexed property may be
331
// set for a null value. When indexed is true, stringValue is limited to
332
// 500 characters and the blob value is limited to 500 bytes. Input
333
// values by default have indexed set to true; however, you can
334
// explicitly set indexed to true if you want. (An output value never
335
// has indexed explicitly set to true.) If a value is itself an entity,
336
// it cannot have indexed set to true.
337
Indexed bool `json:"indexed,omitempty"`
339
// IntegerValue: An integer value.
340
IntegerValue int64 `json:"integerValue,omitempty,string"`
342
// KeyValue: A key value.
343
KeyValue *Key `json:"keyValue,omitempty"`
345
// ListValue: A list value. Cannot contain another list value. Cannot
346
// also have a meaning and indexing set.
347
ListValue []*Value `json:"listValue,omitempty"`
349
// Meaning: The meaning field is reserved and should not be used.
350
Meaning int64 `json:"meaning,omitempty"`
352
// StringValue: A UTF-8 encoded string value.
353
StringValue string `json:"stringValue,omitempty"`
356
type PropertyExpression struct {
357
// AggregationFunction: The aggregation function to apply to the
358
// property. Optional. Can only be used when grouping by at least one
359
// property. Must then be set on all properties in the projection that
360
// are not being grouped by. Aggregation functions: first selects the
361
// first result as determined by the query's order.
362
AggregationFunction string `json:"aggregationFunction,omitempty"`
364
// Property: The property to project.
365
Property *PropertyReference `json:"property,omitempty"`
368
type PropertyFilter struct {
369
// Operator: The operator to filter by. One of lessThan,
370
// lessThanOrEqual, greaterThan, greaterThanOrEqual, equal, or
372
Operator string `json:"operator,omitempty"`
374
// Property: The property to filter by.
375
Property *PropertyReference `json:"property,omitempty"`
377
// Value: The value to compare the property to.
378
Value *Value `json:"value,omitempty"`
381
type PropertyOrder struct {
382
// Direction: The direction to order by. One of ascending or descending.
383
// Optional, defaults to ascending.
384
Direction string `json:"direction,omitempty"`
386
// Property: The property to order by.
387
Property *PropertyReference `json:"property,omitempty"`
390
type PropertyReference struct {
391
// Name: The name of the property.
392
Name string `json:"name,omitempty"`
396
// EndCursor: An ending point for the query results. Optional. Query
397
// cursors are returned in query result batches.
398
EndCursor string `json:"endCursor,omitempty"`
400
// Filter: The filter to apply (optional).
401
Filter *Filter `json:"filter,omitempty"`
403
// GroupBy: The properties to group by (if empty, no grouping is applied
404
// to the result set).
405
GroupBy []*PropertyReference `json:"groupBy,omitempty"`
407
// Kinds: The kinds to query (if empty, returns entities from all
409
Kinds []*KindExpression `json:"kinds,omitempty"`
411
// Limit: The maximum number of results to return. Applies after all
412
// other constraints. Optional.
413
Limit int64 `json:"limit,omitempty"`
415
// Offset: The number of results to skip. Applies before limit, but
416
// after all other constraints (optional, defaults to 0).
417
Offset int64 `json:"offset,omitempty"`
419
// Order: The order to apply to the query results (if empty, order is
421
Order []*PropertyOrder `json:"order,omitempty"`
423
// Projection: The projection to return. If not set the entire entity is
425
Projection []*PropertyExpression `json:"projection,omitempty"`
427
// StartCursor: A starting point for the query results. Optional. Query
428
// cursors are returned in query result batches.
429
StartCursor string `json:"startCursor,omitempty"`
432
type QueryResultBatch struct {
433
// EndCursor: A cursor that points to the position after the last result
434
// in the batch. May be absent. TODO(arfuller): Once all plans produce
435
// cursors update documentation here.
436
EndCursor string `json:"endCursor,omitempty"`
438
// EntityResultType: The result type for every entity in entityResults.
439
// full for full entities, projection for entities with only projected
440
// properties, keyOnly for entities with only a key.
441
EntityResultType string `json:"entityResultType,omitempty"`
443
// EntityResults: The results for this batch.
444
EntityResults []*EntityResult `json:"entityResults,omitempty"`
446
// MoreResults: The state of the query after the current batch. One of
447
// notFinished, moreResultsAfterLimit, noMoreResults.
448
MoreResults string `json:"moreResults,omitempty"`
450
// SkippedResults: The number of results skipped because of
452
SkippedResults int64 `json:"skippedResults,omitempty"`
455
type ReadOptions struct {
456
// ReadConsistency: The read consistency to use. One of default, strong,
457
// or eventual. Cannot be set when transaction is set. Lookup and
458
// ancestor queries default to strong, global queries default to
459
// eventual and cannot be set to strong. Optional. Default is default.
460
ReadConsistency string `json:"readConsistency,omitempty"`
462
// Transaction: The transaction to use. Optional.
463
Transaction string `json:"transaction,omitempty"`
466
type ResponseHeader struct {
467
// Kind: Identifies what kind of resource this is. Value: the fixed
468
// string "datastore#responseHeader".
469
Kind string `json:"kind,omitempty"`
472
type RollbackRequest struct {
473
// Transaction: The transaction identifier, returned by a call to
475
Transaction string `json:"transaction,omitempty"`
478
type RollbackResponse struct {
479
Header *ResponseHeader `json:"header,omitempty"`
482
type RunQueryRequest struct {
483
// GqlQuery: The GQL query to run. Either this field or field query must
484
// be set, but not both.
485
GqlQuery *GqlQuery `json:"gqlQuery,omitempty"`
487
// PartitionId: Entities are partitioned into subsets, identified by a
488
// dataset (usually implicitly specified by the project) and namespace
489
// ID. Queries are scoped to a single partition. This partition ID is
490
// normalized with the standard default context partition ID, but all
491
// other partition IDs in RunQueryRequest are normalized with this
492
// partition ID as the context partition ID.
493
PartitionId *PartitionId `json:"partitionId,omitempty"`
495
// Query: The query to run. Either this field or field gql_query must be
496
// set, but not both.
497
Query *Query `json:"query,omitempty"`
499
// ReadOptions: The options for this query.
500
ReadOptions *ReadOptions `json:"readOptions,omitempty"`
503
type RunQueryResponse struct {
504
// Batch: A batch of query results (always present).
505
Batch *QueryResultBatch `json:"batch,omitempty"`
507
Header *ResponseHeader `json:"header,omitempty"`
511
// BlobKeyValue: A blob key value.
512
BlobKeyValue string `json:"blobKeyValue,omitempty"`
514
// BlobValue: A blob value. May be a maximum of 1,000,000 bytes.
515
BlobValue string `json:"blobValue,omitempty"`
517
// BooleanValue: A boolean value.
518
BooleanValue bool `json:"booleanValue,omitempty"`
520
// DateTimeValue: A timestamp value.
521
DateTimeValue string `json:"dateTimeValue,omitempty"`
523
// DoubleValue: A double value.
524
DoubleValue float64 `json:"doubleValue,omitempty"`
526
// EntityValue: An entity value. May have no key. May have a key with an
527
// incomplete key path. May have a reserved/read-only key.
528
EntityValue *Entity `json:"entityValue,omitempty"`
530
// Indexed: If the value should be indexed.
532
// The indexed property may be
533
// set for a null value. When indexed is true, stringValue is limited to
534
// 500 characters and the blob value is limited to 500 bytes. Input
535
// values by default have indexed set to true; however, you can
536
// explicitly set indexed to true if you want. (An output value never
537
// has indexed explicitly set to true.) If a value is itself an entity,
538
// it cannot have indexed set to true.
539
Indexed bool `json:"indexed,omitempty"`
541
// IntegerValue: An integer value.
542
IntegerValue int64 `json:"integerValue,omitempty,string"`
544
// KeyValue: A key value.
545
KeyValue *Key `json:"keyValue,omitempty"`
547
// ListValue: A list value. Cannot contain another list value. Cannot
548
// also have a meaning and indexing set.
549
ListValue []*Value `json:"listValue,omitempty"`
551
// Meaning: The meaning field is reserved and should not be used.
552
Meaning int64 `json:"meaning,omitempty"`
554
// StringValue: A UTF-8 encoded string value.
555
StringValue string `json:"stringValue,omitempty"`
558
// method id "datastore.datasets.allocateIds":
560
type DatasetsAllocateIdsCall struct {
563
allocateidsrequest *AllocateIdsRequest
564
opt_ map[string]interface{}
567
// AllocateIds: Allocate IDs for incomplete keys (useful for referencing
568
// an entity before it is inserted).
569
func (r *DatasetsService) AllocateIds(datasetId string, allocateidsrequest *AllocateIdsRequest) *DatasetsAllocateIdsCall {
570
c := &DatasetsAllocateIdsCall{s: r.s, opt_: make(map[string]interface{})}
571
c.datasetId = datasetId
572
c.allocateidsrequest = allocateidsrequest
576
// Fields allows partial responses to be retrieved.
577
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
578
// for more information.
579
func (c *DatasetsAllocateIdsCall) Fields(s ...googleapi.Field) *DatasetsAllocateIdsCall {
580
c.opt_["fields"] = googleapi.CombineFields(s)
584
func (c *DatasetsAllocateIdsCall) Do() (*AllocateIdsResponse, error) {
585
var body io.Reader = nil
586
body, err := googleapi.WithoutDataWrapper.JSONReader(c.allocateidsrequest)
590
ctype := "application/json"
591
params := make(url.Values)
592
params.Set("alt", "json")
593
if v, ok := c.opt_["fields"]; ok {
594
params.Set("fields", fmt.Sprintf("%v", v))
596
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/allocateIds")
597
urls += "?" + params.Encode()
598
req, _ := http.NewRequest("POST", urls, body)
599
googleapi.Expand(req.URL, map[string]string{
600
"datasetId": c.datasetId,
602
req.Header.Set("Content-Type", ctype)
603
req.Header.Set("User-Agent", "google-api-go-client/0.5")
604
res, err := c.s.client.Do(req)
608
defer googleapi.CloseBody(res)
609
if err := googleapi.CheckResponse(res); err != nil {
612
var ret *AllocateIdsResponse
613
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
618
// "description": "Allocate IDs for incomplete keys (useful for referencing an entity before it is inserted).",
619
// "httpMethod": "POST",
620
// "id": "datastore.datasets.allocateIds",
621
// "parameterOrder": [
626
// "description": "Identifies the dataset.",
627
// "location": "path",
632
// "path": "{datasetId}/allocateIds",
634
// "$ref": "AllocateIdsRequest"
637
// "$ref": "AllocateIdsResponse"
640
// "https://www.googleapis.com/auth/cloud-platform",
641
// "https://www.googleapis.com/auth/datastore",
642
// "https://www.googleapis.com/auth/userinfo.email"
648
// method id "datastore.datasets.beginTransaction":
650
type DatasetsBeginTransactionCall struct {
653
begintransactionrequest *BeginTransactionRequest
654
opt_ map[string]interface{}
657
// BeginTransaction: Begin a new transaction.
658
func (r *DatasetsService) BeginTransaction(datasetId string, begintransactionrequest *BeginTransactionRequest) *DatasetsBeginTransactionCall {
659
c := &DatasetsBeginTransactionCall{s: r.s, opt_: make(map[string]interface{})}
660
c.datasetId = datasetId
661
c.begintransactionrequest = begintransactionrequest
665
// Fields allows partial responses to be retrieved.
666
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
667
// for more information.
668
func (c *DatasetsBeginTransactionCall) Fields(s ...googleapi.Field) *DatasetsBeginTransactionCall {
669
c.opt_["fields"] = googleapi.CombineFields(s)
673
func (c *DatasetsBeginTransactionCall) Do() (*BeginTransactionResponse, error) {
674
var body io.Reader = nil
675
body, err := googleapi.WithoutDataWrapper.JSONReader(c.begintransactionrequest)
679
ctype := "application/json"
680
params := make(url.Values)
681
params.Set("alt", "json")
682
if v, ok := c.opt_["fields"]; ok {
683
params.Set("fields", fmt.Sprintf("%v", v))
685
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/beginTransaction")
686
urls += "?" + params.Encode()
687
req, _ := http.NewRequest("POST", urls, body)
688
googleapi.Expand(req.URL, map[string]string{
689
"datasetId": c.datasetId,
691
req.Header.Set("Content-Type", ctype)
692
req.Header.Set("User-Agent", "google-api-go-client/0.5")
693
res, err := c.s.client.Do(req)
697
defer googleapi.CloseBody(res)
698
if err := googleapi.CheckResponse(res); err != nil {
701
var ret *BeginTransactionResponse
702
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
707
// "description": "Begin a new transaction.",
708
// "httpMethod": "POST",
709
// "id": "datastore.datasets.beginTransaction",
710
// "parameterOrder": [
715
// "description": "Identifies the dataset.",
716
// "location": "path",
721
// "path": "{datasetId}/beginTransaction",
723
// "$ref": "BeginTransactionRequest"
726
// "$ref": "BeginTransactionResponse"
729
// "https://www.googleapis.com/auth/cloud-platform",
730
// "https://www.googleapis.com/auth/datastore",
731
// "https://www.googleapis.com/auth/userinfo.email"
737
// method id "datastore.datasets.commit":
739
type DatasetsCommitCall struct {
742
commitrequest *CommitRequest
743
opt_ map[string]interface{}
746
// Commit: Commit a transaction, optionally creating, deleting or
747
// modifying some entities.
748
func (r *DatasetsService) Commit(datasetId string, commitrequest *CommitRequest) *DatasetsCommitCall {
749
c := &DatasetsCommitCall{s: r.s, opt_: make(map[string]interface{})}
750
c.datasetId = datasetId
751
c.commitrequest = commitrequest
755
// Fields allows partial responses to be retrieved.
756
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
757
// for more information.
758
func (c *DatasetsCommitCall) Fields(s ...googleapi.Field) *DatasetsCommitCall {
759
c.opt_["fields"] = googleapi.CombineFields(s)
763
func (c *DatasetsCommitCall) Do() (*CommitResponse, error) {
764
var body io.Reader = nil
765
body, err := googleapi.WithoutDataWrapper.JSONReader(c.commitrequest)
769
ctype := "application/json"
770
params := make(url.Values)
771
params.Set("alt", "json")
772
if v, ok := c.opt_["fields"]; ok {
773
params.Set("fields", fmt.Sprintf("%v", v))
775
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/commit")
776
urls += "?" + params.Encode()
777
req, _ := http.NewRequest("POST", urls, body)
778
googleapi.Expand(req.URL, map[string]string{
779
"datasetId": c.datasetId,
781
req.Header.Set("Content-Type", ctype)
782
req.Header.Set("User-Agent", "google-api-go-client/0.5")
783
res, err := c.s.client.Do(req)
787
defer googleapi.CloseBody(res)
788
if err := googleapi.CheckResponse(res); err != nil {
791
var ret *CommitResponse
792
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
797
// "description": "Commit a transaction, optionally creating, deleting or modifying some entities.",
798
// "httpMethod": "POST",
799
// "id": "datastore.datasets.commit",
800
// "parameterOrder": [
805
// "description": "Identifies the dataset.",
806
// "location": "path",
811
// "path": "{datasetId}/commit",
813
// "$ref": "CommitRequest"
816
// "$ref": "CommitResponse"
819
// "https://www.googleapis.com/auth/cloud-platform",
820
// "https://www.googleapis.com/auth/datastore",
821
// "https://www.googleapis.com/auth/userinfo.email"
827
// method id "datastore.datasets.lookup":
829
type DatasetsLookupCall struct {
832
lookuprequest *LookupRequest
833
opt_ map[string]interface{}
836
// Lookup: Look up some entities by key.
837
func (r *DatasetsService) Lookup(datasetId string, lookuprequest *LookupRequest) *DatasetsLookupCall {
838
c := &DatasetsLookupCall{s: r.s, opt_: make(map[string]interface{})}
839
c.datasetId = datasetId
840
c.lookuprequest = lookuprequest
844
// Fields allows partial responses to be retrieved.
845
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
846
// for more information.
847
func (c *DatasetsLookupCall) Fields(s ...googleapi.Field) *DatasetsLookupCall {
848
c.opt_["fields"] = googleapi.CombineFields(s)
852
func (c *DatasetsLookupCall) Do() (*LookupResponse, error) {
853
var body io.Reader = nil
854
body, err := googleapi.WithoutDataWrapper.JSONReader(c.lookuprequest)
858
ctype := "application/json"
859
params := make(url.Values)
860
params.Set("alt", "json")
861
if v, ok := c.opt_["fields"]; ok {
862
params.Set("fields", fmt.Sprintf("%v", v))
864
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/lookup")
865
urls += "?" + params.Encode()
866
req, _ := http.NewRequest("POST", urls, body)
867
googleapi.Expand(req.URL, map[string]string{
868
"datasetId": c.datasetId,
870
req.Header.Set("Content-Type", ctype)
871
req.Header.Set("User-Agent", "google-api-go-client/0.5")
872
res, err := c.s.client.Do(req)
876
defer googleapi.CloseBody(res)
877
if err := googleapi.CheckResponse(res); err != nil {
880
var ret *LookupResponse
881
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
886
// "description": "Look up some entities by key.",
887
// "httpMethod": "POST",
888
// "id": "datastore.datasets.lookup",
889
// "parameterOrder": [
894
// "description": "Identifies the dataset.",
895
// "location": "path",
900
// "path": "{datasetId}/lookup",
902
// "$ref": "LookupRequest"
905
// "$ref": "LookupResponse"
908
// "https://www.googleapis.com/auth/cloud-platform",
909
// "https://www.googleapis.com/auth/datastore",
910
// "https://www.googleapis.com/auth/userinfo.email"
916
// method id "datastore.datasets.rollback":
918
type DatasetsRollbackCall struct {
921
rollbackrequest *RollbackRequest
922
opt_ map[string]interface{}
925
// Rollback: Roll back a transaction.
926
func (r *DatasetsService) Rollback(datasetId string, rollbackrequest *RollbackRequest) *DatasetsRollbackCall {
927
c := &DatasetsRollbackCall{s: r.s, opt_: make(map[string]interface{})}
928
c.datasetId = datasetId
929
c.rollbackrequest = rollbackrequest
933
// Fields allows partial responses to be retrieved.
934
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
935
// for more information.
936
func (c *DatasetsRollbackCall) Fields(s ...googleapi.Field) *DatasetsRollbackCall {
937
c.opt_["fields"] = googleapi.CombineFields(s)
941
func (c *DatasetsRollbackCall) Do() (*RollbackResponse, error) {
942
var body io.Reader = nil
943
body, err := googleapi.WithoutDataWrapper.JSONReader(c.rollbackrequest)
947
ctype := "application/json"
948
params := make(url.Values)
949
params.Set("alt", "json")
950
if v, ok := c.opt_["fields"]; ok {
951
params.Set("fields", fmt.Sprintf("%v", v))
953
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/rollback")
954
urls += "?" + params.Encode()
955
req, _ := http.NewRequest("POST", urls, body)
956
googleapi.Expand(req.URL, map[string]string{
957
"datasetId": c.datasetId,
959
req.Header.Set("Content-Type", ctype)
960
req.Header.Set("User-Agent", "google-api-go-client/0.5")
961
res, err := c.s.client.Do(req)
965
defer googleapi.CloseBody(res)
966
if err := googleapi.CheckResponse(res); err != nil {
969
var ret *RollbackResponse
970
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
975
// "description": "Roll back a transaction.",
976
// "httpMethod": "POST",
977
// "id": "datastore.datasets.rollback",
978
// "parameterOrder": [
983
// "description": "Identifies the dataset.",
984
// "location": "path",
989
// "path": "{datasetId}/rollback",
991
// "$ref": "RollbackRequest"
994
// "$ref": "RollbackResponse"
997
// "https://www.googleapis.com/auth/cloud-platform",
998
// "https://www.googleapis.com/auth/datastore",
999
// "https://www.googleapis.com/auth/userinfo.email"
1005
// method id "datastore.datasets.runQuery":
1007
type DatasetsRunQueryCall struct {
1010
runqueryrequest *RunQueryRequest
1011
opt_ map[string]interface{}
1014
// RunQuery: Query for entities.
1015
func (r *DatasetsService) RunQuery(datasetId string, runqueryrequest *RunQueryRequest) *DatasetsRunQueryCall {
1016
c := &DatasetsRunQueryCall{s: r.s, opt_: make(map[string]interface{})}
1017
c.datasetId = datasetId
1018
c.runqueryrequest = runqueryrequest
1022
// Fields allows partial responses to be retrieved.
1023
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1024
// for more information.
1025
func (c *DatasetsRunQueryCall) Fields(s ...googleapi.Field) *DatasetsRunQueryCall {
1026
c.opt_["fields"] = googleapi.CombineFields(s)
1030
func (c *DatasetsRunQueryCall) Do() (*RunQueryResponse, error) {
1031
var body io.Reader = nil
1032
body, err := googleapi.WithoutDataWrapper.JSONReader(c.runqueryrequest)
1036
ctype := "application/json"
1037
params := make(url.Values)
1038
params.Set("alt", "json")
1039
if v, ok := c.opt_["fields"]; ok {
1040
params.Set("fields", fmt.Sprintf("%v", v))
1042
urls := googleapi.ResolveRelative(c.s.BasePath, "{datasetId}/runQuery")
1043
urls += "?" + params.Encode()
1044
req, _ := http.NewRequest("POST", urls, body)
1045
googleapi.Expand(req.URL, map[string]string{
1046
"datasetId": c.datasetId,
1048
req.Header.Set("Content-Type", ctype)
1049
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1050
res, err := c.s.client.Do(req)
1054
defer googleapi.CloseBody(res)
1055
if err := googleapi.CheckResponse(res); err != nil {
1058
var ret *RunQueryResponse
1059
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1064
// "description": "Query for entities.",
1065
// "httpMethod": "POST",
1066
// "id": "datastore.datasets.runQuery",
1067
// "parameterOrder": [
1072
// "description": "Identifies the dataset.",
1073
// "location": "path",
1074
// "required": true,
1078
// "path": "{datasetId}/runQuery",
1080
// "$ref": "RunQueryRequest"
1083
// "$ref": "RunQueryResponse"
1086
// "https://www.googleapis.com/auth/cloud-platform",
1087
// "https://www.googleapis.com/auth/datastore",
1088
// "https://www.googleapis.com/auth/userinfo.email"