You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

6218 lines
228 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package firestore provides access to the Cloud Firestore API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/firestore instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/firestore
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/firestore/v1beta1"
  16. // ...
  17. // ctx := context.Background()
  18. // firestoreService, err := firestore.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // firestoreService, err := firestore.NewService(ctx, option.WithScopes(firestore.DatastoreScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // firestoreService, err := firestore.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // firestoreService, err := firestore.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package firestore // import "google.golang.org/api/firestore/v1beta1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "firestore:v1beta1"
  73. const apiName = "firestore"
  74. const apiVersion = "v1beta1"
  75. const basePath = "https://firestore.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View and manage your Google Cloud Datastore data
  81. DatastoreScope = "https://www.googleapis.com/auth/datastore"
  82. )
  83. // NewService creates a new Service.
  84. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  85. scopesOption := option.WithScopes(
  86. "https://www.googleapis.com/auth/cloud-platform",
  87. "https://www.googleapis.com/auth/datastore",
  88. )
  89. // NOTE: prepend, so we don't override user-specified scopes.
  90. opts = append([]option.ClientOption{scopesOption}, opts...)
  91. client, endpoint, err := htransport.NewClient(ctx, opts...)
  92. if err != nil {
  93. return nil, err
  94. }
  95. s, err := New(client)
  96. if err != nil {
  97. return nil, err
  98. }
  99. if endpoint != "" {
  100. s.BasePath = endpoint
  101. }
  102. return s, nil
  103. }
  104. // New creates a new Service. It uses the provided http.Client for requests.
  105. //
  106. // Deprecated: please use NewService instead.
  107. // To provide a custom HTTP client, use option.WithHTTPClient.
  108. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  109. func New(client *http.Client) (*Service, error) {
  110. if client == nil {
  111. return nil, errors.New("client is nil")
  112. }
  113. s := &Service{client: client, BasePath: basePath}
  114. s.Projects = NewProjectsService(s)
  115. return s, nil
  116. }
  117. type Service struct {
  118. client *http.Client
  119. BasePath string // API endpoint base URL
  120. UserAgent string // optional additional User-Agent fragment
  121. Projects *ProjectsService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewProjectsService(s *Service) *ProjectsService {
  130. rs := &ProjectsService{s: s}
  131. rs.Databases = NewProjectsDatabasesService(s)
  132. return rs
  133. }
  134. type ProjectsService struct {
  135. s *Service
  136. Databases *ProjectsDatabasesService
  137. }
  138. func NewProjectsDatabasesService(s *Service) *ProjectsDatabasesService {
  139. rs := &ProjectsDatabasesService{s: s}
  140. rs.Documents = NewProjectsDatabasesDocumentsService(s)
  141. rs.Indexes = NewProjectsDatabasesIndexesService(s)
  142. return rs
  143. }
  144. type ProjectsDatabasesService struct {
  145. s *Service
  146. Documents *ProjectsDatabasesDocumentsService
  147. Indexes *ProjectsDatabasesIndexesService
  148. }
  149. func NewProjectsDatabasesDocumentsService(s *Service) *ProjectsDatabasesDocumentsService {
  150. rs := &ProjectsDatabasesDocumentsService{s: s}
  151. return rs
  152. }
  153. type ProjectsDatabasesDocumentsService struct {
  154. s *Service
  155. }
  156. func NewProjectsDatabasesIndexesService(s *Service) *ProjectsDatabasesIndexesService {
  157. rs := &ProjectsDatabasesIndexesService{s: s}
  158. return rs
  159. }
  160. type ProjectsDatabasesIndexesService struct {
  161. s *Service
  162. }
  163. // ArrayValue: An array value.
  164. type ArrayValue struct {
  165. // Values: Values in the array.
  166. Values []*Value `json:"values,omitempty"`
  167. // ForceSendFields is a list of field names (e.g. "Values") to
  168. // unconditionally include in API requests. By default, fields with
  169. // empty values are omitted from API requests. However, any non-pointer,
  170. // non-interface field appearing in ForceSendFields will be sent to the
  171. // server regardless of whether the field is empty or not. This may be
  172. // used to include empty fields in Patch requests.
  173. ForceSendFields []string `json:"-"`
  174. // NullFields is a list of field names (e.g. "Values") to include in API
  175. // requests with the JSON null value. By default, fields with empty
  176. // values are omitted from API requests. However, any field with an
  177. // empty value appearing in NullFields will be sent to the server as
  178. // null. It is an error if a field in this list has a non-empty value.
  179. // This may be used to include null fields in Patch requests.
  180. NullFields []string `json:"-"`
  181. }
  182. func (s *ArrayValue) MarshalJSON() ([]byte, error) {
  183. type NoMethod ArrayValue
  184. raw := NoMethod(*s)
  185. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  186. }
  187. // BatchGetDocumentsRequest: The request for
  188. // Firestore.BatchGetDocuments.
  189. type BatchGetDocumentsRequest struct {
  190. // Documents: The names of the documents to retrieve. In the
  191. // format:
  192. // `projects/{project_id}/databases/{database_id}/documents/{docu
  193. // ment_path}`.
  194. // The request will fail if any of the document is not a child resource
  195. // of the
  196. // given `database`. Duplicate names will be elided.
  197. Documents []string `json:"documents,omitempty"`
  198. // Mask: The fields to return. If not set, returns all fields.
  199. //
  200. // If a document has a field that is not present in this mask, that
  201. // field will
  202. // not be returned in the response.
  203. Mask *DocumentMask `json:"mask,omitempty"`
  204. // NewTransaction: Starts a new transaction and reads the
  205. // documents.
  206. // Defaults to a read-only transaction.
  207. // The new transaction ID will be returned as the first response in
  208. // the
  209. // stream.
  210. NewTransaction *TransactionOptions `json:"newTransaction,omitempty"`
  211. // ReadTime: Reads documents as they were at the given time.
  212. // This may not be older than 60 seconds.
  213. ReadTime string `json:"readTime,omitempty"`
  214. // Transaction: Reads documents in a transaction.
  215. Transaction string `json:"transaction,omitempty"`
  216. // ForceSendFields is a list of field names (e.g. "Documents") to
  217. // unconditionally include in API requests. By default, fields with
  218. // empty values are omitted from API requests. However, any non-pointer,
  219. // non-interface field appearing in ForceSendFields will be sent to the
  220. // server regardless of whether the field is empty or not. This may be
  221. // used to include empty fields in Patch requests.
  222. ForceSendFields []string `json:"-"`
  223. // NullFields is a list of field names (e.g. "Documents") to include in
  224. // API requests with the JSON null value. By default, fields with empty
  225. // values are omitted from API requests. However, any field with an
  226. // empty value appearing in NullFields will be sent to the server as
  227. // null. It is an error if a field in this list has a non-empty value.
  228. // This may be used to include null fields in Patch requests.
  229. NullFields []string `json:"-"`
  230. }
  231. func (s *BatchGetDocumentsRequest) MarshalJSON() ([]byte, error) {
  232. type NoMethod BatchGetDocumentsRequest
  233. raw := NoMethod(*s)
  234. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  235. }
  236. // BatchGetDocumentsResponse: The streamed response for
  237. // Firestore.BatchGetDocuments.
  238. type BatchGetDocumentsResponse struct {
  239. // Found: A document that was requested.
  240. Found *Document `json:"found,omitempty"`
  241. // Missing: A document name that was requested but does not exist. In
  242. // the
  243. // format:
  244. // `projects/{project_id}/databases/{database_id}/documents/{docu
  245. // ment_path}`.
  246. Missing string `json:"missing,omitempty"`
  247. // ReadTime: The time at which the document was read.
  248. // This may be monotically increasing, in this case the previous
  249. // documents in
  250. // the result stream are guaranteed not to have changed between
  251. // their
  252. // read_time and this one.
  253. ReadTime string `json:"readTime,omitempty"`
  254. // Transaction: The transaction that was started as part of this
  255. // request.
  256. // Will only be set in the first response, and only
  257. // if
  258. // BatchGetDocumentsRequest.new_transaction was set in the request.
  259. Transaction string `json:"transaction,omitempty"`
  260. // ServerResponse contains the HTTP response code and headers from the
  261. // server.
  262. googleapi.ServerResponse `json:"-"`
  263. // ForceSendFields is a list of field names (e.g. "Found") to
  264. // unconditionally include in API requests. By default, fields with
  265. // empty values are omitted from API requests. However, any non-pointer,
  266. // non-interface field appearing in ForceSendFields will be sent to the
  267. // server regardless of whether the field is empty or not. This may be
  268. // used to include empty fields in Patch requests.
  269. ForceSendFields []string `json:"-"`
  270. // NullFields is a list of field names (e.g. "Found") to include in API
  271. // requests with the JSON null value. By default, fields with empty
  272. // values are omitted from API requests. However, any field with an
  273. // empty value appearing in NullFields will be sent to the server as
  274. // null. It is an error if a field in this list has a non-empty value.
  275. // This may be used to include null fields in Patch requests.
  276. NullFields []string `json:"-"`
  277. }
  278. func (s *BatchGetDocumentsResponse) MarshalJSON() ([]byte, error) {
  279. type NoMethod BatchGetDocumentsResponse
  280. raw := NoMethod(*s)
  281. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  282. }
  283. // BeginTransactionRequest: The request for Firestore.BeginTransaction.
  284. type BeginTransactionRequest struct {
  285. // Options: The options for the transaction.
  286. // Defaults to a read-write transaction.
  287. Options *TransactionOptions `json:"options,omitempty"`
  288. // ForceSendFields is a list of field names (e.g. "Options") to
  289. // unconditionally include in API requests. By default, fields with
  290. // empty values are omitted from API requests. However, any non-pointer,
  291. // non-interface field appearing in ForceSendFields will be sent to the
  292. // server regardless of whether the field is empty or not. This may be
  293. // used to include empty fields in Patch requests.
  294. ForceSendFields []string `json:"-"`
  295. // NullFields is a list of field names (e.g. "Options") to include in
  296. // API requests with the JSON null value. By default, fields with empty
  297. // values are omitted from API requests. However, any field with an
  298. // empty value appearing in NullFields will be sent to the server as
  299. // null. It is an error if a field in this list has a non-empty value.
  300. // This may be used to include null fields in Patch requests.
  301. NullFields []string `json:"-"`
  302. }
  303. func (s *BeginTransactionRequest) MarshalJSON() ([]byte, error) {
  304. type NoMethod BeginTransactionRequest
  305. raw := NoMethod(*s)
  306. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  307. }
  308. // BeginTransactionResponse: The response for
  309. // Firestore.BeginTransaction.
  310. type BeginTransactionResponse struct {
  311. // Transaction: The transaction that was started.
  312. Transaction string `json:"transaction,omitempty"`
  313. // ServerResponse contains the HTTP response code and headers from the
  314. // server.
  315. googleapi.ServerResponse `json:"-"`
  316. // ForceSendFields is a list of field names (e.g. "Transaction") to
  317. // unconditionally include in API requests. By default, fields with
  318. // empty values are omitted from API requests. However, any non-pointer,
  319. // non-interface field appearing in ForceSendFields will be sent to the
  320. // server regardless of whether the field is empty or not. This may be
  321. // used to include empty fields in Patch requests.
  322. ForceSendFields []string `json:"-"`
  323. // NullFields is a list of field names (e.g. "Transaction") to include
  324. // in API requests with the JSON null value. By default, fields with
  325. // empty values are omitted from API requests. However, any field with
  326. // an empty value appearing in NullFields will be sent to the server as
  327. // null. It is an error if a field in this list has a non-empty value.
  328. // This may be used to include null fields in Patch requests.
  329. NullFields []string `json:"-"`
  330. }
  331. func (s *BeginTransactionResponse) MarshalJSON() ([]byte, error) {
  332. type NoMethod BeginTransactionResponse
  333. raw := NoMethod(*s)
  334. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  335. }
  336. // CollectionSelector: A selection of a collection, such as `messages as
  337. // m1`.
  338. type CollectionSelector struct {
  339. // AllDescendants: When false, selects only collections that are
  340. // immediate children of
  341. // the `parent` specified in the containing `RunQueryRequest`.
  342. // When true, selects all descendant collections.
  343. AllDescendants bool `json:"allDescendants,omitempty"`
  344. // CollectionId: The collection ID.
  345. // When set, selects only collections with this ID.
  346. CollectionId string `json:"collectionId,omitempty"`
  347. // ForceSendFields is a list of field names (e.g. "AllDescendants") to
  348. // unconditionally include in API requests. By default, fields with
  349. // empty values are omitted from API requests. However, any non-pointer,
  350. // non-interface field appearing in ForceSendFields will be sent to the
  351. // server regardless of whether the field is empty or not. This may be
  352. // used to include empty fields in Patch requests.
  353. ForceSendFields []string `json:"-"`
  354. // NullFields is a list of field names (e.g. "AllDescendants") to
  355. // include in API requests with the JSON null value. By default, fields
  356. // with empty values are omitted from API requests. However, any field
  357. // with an empty value appearing in NullFields will be sent to the
  358. // server as null. It is an error if a field in this list has a
  359. // non-empty value. This may be used to include null fields in Patch
  360. // requests.
  361. NullFields []string `json:"-"`
  362. }
  363. func (s *CollectionSelector) MarshalJSON() ([]byte, error) {
  364. type NoMethod CollectionSelector
  365. raw := NoMethod(*s)
  366. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  367. }
  368. // CommitRequest: The request for Firestore.Commit.
  369. type CommitRequest struct {
  370. // Transaction: If set, applies all writes in this transaction, and
  371. // commits it.
  372. Transaction string `json:"transaction,omitempty"`
  373. // Writes: The writes to apply.
  374. //
  375. // Always executed atomically and in order.
  376. Writes []*Write `json:"writes,omitempty"`
  377. // ForceSendFields is a list of field names (e.g. "Transaction") to
  378. // unconditionally include in API requests. By default, fields with
  379. // empty values are omitted from API requests. However, any non-pointer,
  380. // non-interface field appearing in ForceSendFields will be sent to the
  381. // server regardless of whether the field is empty or not. This may be
  382. // used to include empty fields in Patch requests.
  383. ForceSendFields []string `json:"-"`
  384. // NullFields is a list of field names (e.g. "Transaction") to include
  385. // in API requests with the JSON null value. By default, fields with
  386. // empty values are omitted from API requests. However, any field with
  387. // an empty value appearing in NullFields will be sent to the server as
  388. // null. It is an error if a field in this list has a non-empty value.
  389. // This may be used to include null fields in Patch requests.
  390. NullFields []string `json:"-"`
  391. }
  392. func (s *CommitRequest) MarshalJSON() ([]byte, error) {
  393. type NoMethod CommitRequest
  394. raw := NoMethod(*s)
  395. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  396. }
  397. // CommitResponse: The response for Firestore.Commit.
  398. type CommitResponse struct {
  399. // CommitTime: The time at which the commit occurred.
  400. CommitTime string `json:"commitTime,omitempty"`
  401. // WriteResults: The result of applying the writes.
  402. //
  403. // This i-th write result corresponds to the i-th write in the
  404. // request.
  405. WriteResults []*WriteResult `json:"writeResults,omitempty"`
  406. // ServerResponse contains the HTTP response code and headers from the
  407. // server.
  408. googleapi.ServerResponse `json:"-"`
  409. // ForceSendFields is a list of field names (e.g. "CommitTime") to
  410. // unconditionally include in API requests. By default, fields with
  411. // empty values are omitted from API requests. However, any non-pointer,
  412. // non-interface field appearing in ForceSendFields will be sent to the
  413. // server regardless of whether the field is empty or not. This may be
  414. // used to include empty fields in Patch requests.
  415. ForceSendFields []string `json:"-"`
  416. // NullFields is a list of field names (e.g. "CommitTime") to include in
  417. // API requests with the JSON null value. By default, fields with empty
  418. // values are omitted from API requests. However, any field with an
  419. // empty value appearing in NullFields will be sent to the server as
  420. // null. It is an error if a field in this list has a non-empty value.
  421. // This may be used to include null fields in Patch requests.
  422. NullFields []string `json:"-"`
  423. }
  424. func (s *CommitResponse) MarshalJSON() ([]byte, error) {
  425. type NoMethod CommitResponse
  426. raw := NoMethod(*s)
  427. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  428. }
  429. // CompositeFilter: A filter that merges multiple other filters using
  430. // the given operator.
  431. type CompositeFilter struct {
  432. // Filters: The list of filters to combine.
  433. // Must contain at least one filter.
  434. Filters []*Filter `json:"filters,omitempty"`
  435. // Op: The operator for combining multiple filters.
  436. //
  437. // Possible values:
  438. // "OPERATOR_UNSPECIFIED" - Unspecified. This value must not be used.
  439. // "AND" - The results are required to satisfy each of the combined
  440. // filters.
  441. Op string `json:"op,omitempty"`
  442. // ForceSendFields is a list of field names (e.g. "Filters") to
  443. // unconditionally include in API requests. By default, fields with
  444. // empty values are omitted from API requests. However, any non-pointer,
  445. // non-interface field appearing in ForceSendFields will be sent to the
  446. // server regardless of whether the field is empty or not. This may be
  447. // used to include empty fields in Patch requests.
  448. ForceSendFields []string `json:"-"`
  449. // NullFields is a list of field names (e.g. "Filters") to include in
  450. // API requests with the JSON null value. By default, fields with empty
  451. // values are omitted from API requests. However, any field with an
  452. // empty value appearing in NullFields will be sent to the server as
  453. // null. It is an error if a field in this list has a non-empty value.
  454. // This may be used to include null fields in Patch requests.
  455. NullFields []string `json:"-"`
  456. }
  457. func (s *CompositeFilter) MarshalJSON() ([]byte, error) {
  458. type NoMethod CompositeFilter
  459. raw := NoMethod(*s)
  460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  461. }
  462. // Cursor: A position in a query result set.
  463. type Cursor struct {
  464. // Before: If the position is just before or just after the given
  465. // values, relative
  466. // to the sort order defined by the query.
  467. Before bool `json:"before,omitempty"`
  468. // Values: The values that represent a position, in the order they
  469. // appear in
  470. // the order by clause of a query.
  471. //
  472. // Can contain fewer values than specified in the order by clause.
  473. Values []*Value `json:"values,omitempty"`
  474. // ForceSendFields is a list of field names (e.g. "Before") to
  475. // unconditionally include in API requests. By default, fields with
  476. // empty values are omitted from API requests. However, any non-pointer,
  477. // non-interface field appearing in ForceSendFields will be sent to the
  478. // server regardless of whether the field is empty or not. This may be
  479. // used to include empty fields in Patch requests.
  480. ForceSendFields []string `json:"-"`
  481. // NullFields is a list of field names (e.g. "Before") to include in API
  482. // requests with the JSON null value. By default, fields with empty
  483. // values are omitted from API requests. However, any field with an
  484. // empty value appearing in NullFields will be sent to the server as
  485. // null. It is an error if a field in this list has a non-empty value.
  486. // This may be used to include null fields in Patch requests.
  487. NullFields []string `json:"-"`
  488. }
  489. func (s *Cursor) MarshalJSON() ([]byte, error) {
  490. type NoMethod Cursor
  491. raw := NoMethod(*s)
  492. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  493. }
  494. // Document: A Firestore document.
  495. //
  496. // Must not exceed 1 MiB - 4 bytes.
  497. type Document struct {
  498. // CreateTime: Output only. The time at which the document was
  499. // created.
  500. //
  501. // This value increases monotonically when a document is deleted
  502. // then
  503. // recreated. It can also be compared to values from other documents
  504. // and
  505. // the `read_time` of a query.
  506. CreateTime string `json:"createTime,omitempty"`
  507. // Fields: The document's fields.
  508. //
  509. // The map keys represent field names.
  510. //
  511. // A simple field name contains only characters `a` to `z`, `A` to
  512. // `Z`,
  513. // `0` to `9`, or `_`, and must not start with `0` to `9`. For
  514. // example,
  515. // `foo_bar_17`.
  516. //
  517. // Field names matching the regular expression `__.*__` are reserved.
  518. // Reserved
  519. // field names are forbidden except in certain documented contexts. The
  520. // map
  521. // keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
  522. // be
  523. // empty.
  524. //
  525. // Field paths may be used in other contexts to refer to structured
  526. // fields
  527. // defined here. For `map_value`, the field path is represented by the
  528. // simple
  529. // or quoted field names of the containing fields, delimited by `.`.
  530. // For
  531. // example, the structured field
  532. // "foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would
  533. // be
  534. // represented by the field path `foo.x&y`.
  535. //
  536. // Within a field path, a quoted field name starts and ends with `` ` ``
  537. // and
  538. // may contain any character. Some characters, including `` ` ``, must
  539. // be
  540. // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
  541. // `` `bak\`tik` `` represents `` bak`tik ``.
  542. Fields map[string]Value `json:"fields,omitempty"`
  543. // Name: The resource name of the document, for
  544. // example
  545. // `projects/{project_id}/databases/{database_id}/documents/{docu
  546. // ment_path}`.
  547. Name string `json:"name,omitempty"`
  548. // UpdateTime: Output only. The time at which the document was last
  549. // changed.
  550. //
  551. // This value is initially set to the `create_time` then
  552. // increases
  553. // monotonically with each change to the document. It can also
  554. // be
  555. // compared to values from other documents and the `read_time` of a
  556. // query.
  557. UpdateTime string `json:"updateTime,omitempty"`
  558. // ServerResponse contains the HTTP response code and headers from the
  559. // server.
  560. googleapi.ServerResponse `json:"-"`
  561. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  562. // unconditionally include in API requests. By default, fields with
  563. // empty values are omitted from API requests. However, any non-pointer,
  564. // non-interface field appearing in ForceSendFields will be sent to the
  565. // server regardless of whether the field is empty or not. This may be
  566. // used to include empty fields in Patch requests.
  567. ForceSendFields []string `json:"-"`
  568. // NullFields is a list of field names (e.g. "CreateTime") to include in
  569. // API requests with the JSON null value. By default, fields with empty
  570. // values are omitted from API requests. However, any field with an
  571. // empty value appearing in NullFields will be sent to the server as
  572. // null. It is an error if a field in this list has a non-empty value.
  573. // This may be used to include null fields in Patch requests.
  574. NullFields []string `json:"-"`
  575. }
  576. func (s *Document) MarshalJSON() ([]byte, error) {
  577. type NoMethod Document
  578. raw := NoMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  580. }
  581. // DocumentChange: A Document has changed.
  582. //
  583. // May be the result of multiple writes, including deletes,
  584. // that
  585. // ultimately resulted in a new value for the Document.
  586. //
  587. // Multiple DocumentChange messages may be returned for the same
  588. // logical
  589. // change, if multiple targets are affected.
  590. type DocumentChange struct {
  591. // Document: The new state of the Document.
  592. //
  593. // If `mask` is set, contains only fields that were updated or added.
  594. Document *Document `json:"document,omitempty"`
  595. // RemovedTargetIds: A set of target IDs for targets that no longer
  596. // match this document.
  597. RemovedTargetIds []int64 `json:"removedTargetIds,omitempty"`
  598. // TargetIds: A set of target IDs of targets that match this document.
  599. TargetIds []int64 `json:"targetIds,omitempty"`
  600. // ForceSendFields is a list of field names (e.g. "Document") to
  601. // unconditionally include in API requests. By default, fields with
  602. // empty values are omitted from API requests. However, any non-pointer,
  603. // non-interface field appearing in ForceSendFields will be sent to the
  604. // server regardless of whether the field is empty or not. This may be
  605. // used to include empty fields in Patch requests.
  606. ForceSendFields []string `json:"-"`
  607. // NullFields is a list of field names (e.g. "Document") to include in
  608. // API requests with the JSON null value. By default, fields with empty
  609. // values are omitted from API requests. However, any field with an
  610. // empty value appearing in NullFields will be sent to the server as
  611. // null. It is an error if a field in this list has a non-empty value.
  612. // This may be used to include null fields in Patch requests.
  613. NullFields []string `json:"-"`
  614. }
  615. func (s *DocumentChange) MarshalJSON() ([]byte, error) {
  616. type NoMethod DocumentChange
  617. raw := NoMethod(*s)
  618. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  619. }
  620. // DocumentDelete: A Document has been deleted.
  621. //
  622. // May be the result of multiple writes, including updates, the
  623. // last of which deleted the Document.
  624. //
  625. // Multiple DocumentDelete messages may be returned for the same
  626. // logical
  627. // delete, if multiple targets are affected.
  628. type DocumentDelete struct {
  629. // Document: The resource name of the Document that was deleted.
  630. Document string `json:"document,omitempty"`
  631. // ReadTime: The read timestamp at which the delete was
  632. // observed.
  633. //
  634. // Greater or equal to the `commit_time` of the delete.
  635. ReadTime string `json:"readTime,omitempty"`
  636. // RemovedTargetIds: A set of target IDs for targets that previously
  637. // matched this entity.
  638. RemovedTargetIds []int64 `json:"removedTargetIds,omitempty"`
  639. // ForceSendFields is a list of field names (e.g. "Document") to
  640. // unconditionally include in API requests. By default, fields with
  641. // empty values are omitted from API requests. However, any non-pointer,
  642. // non-interface field appearing in ForceSendFields will be sent to the
  643. // server regardless of whether the field is empty or not. This may be
  644. // used to include empty fields in Patch requests.
  645. ForceSendFields []string `json:"-"`
  646. // NullFields is a list of field names (e.g. "Document") to include in
  647. // API requests with the JSON null value. By default, fields with empty
  648. // values are omitted from API requests. However, any field with an
  649. // empty value appearing in NullFields will be sent to the server as
  650. // null. It is an error if a field in this list has a non-empty value.
  651. // This may be used to include null fields in Patch requests.
  652. NullFields []string `json:"-"`
  653. }
  654. func (s *DocumentDelete) MarshalJSON() ([]byte, error) {
  655. type NoMethod DocumentDelete
  656. raw := NoMethod(*s)
  657. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  658. }
  659. // DocumentMask: A set of field paths on a document.
  660. // Used to restrict a get or update operation on a document to a subset
  661. // of its
  662. // fields.
  663. // This is different from standard field masks, as this is always scoped
  664. // to a
  665. // Document, and takes in account the dynamic nature of Value.
  666. type DocumentMask struct {
  667. // FieldPaths: The list of field paths in the mask. See Document.fields
  668. // for a field
  669. // path syntax reference.
  670. FieldPaths []string `json:"fieldPaths,omitempty"`
  671. // ForceSendFields is a list of field names (e.g. "FieldPaths") to
  672. // unconditionally include in API requests. By default, fields with
  673. // empty values are omitted from API requests. However, any non-pointer,
  674. // non-interface field appearing in ForceSendFields will be sent to the
  675. // server regardless of whether the field is empty or not. This may be
  676. // used to include empty fields in Patch requests.
  677. ForceSendFields []string `json:"-"`
  678. // NullFields is a list of field names (e.g. "FieldPaths") to include in
  679. // API requests with the JSON null value. By default, fields with empty
  680. // values are omitted from API requests. However, any field with an
  681. // empty value appearing in NullFields will be sent to the server as
  682. // null. It is an error if a field in this list has a non-empty value.
  683. // This may be used to include null fields in Patch requests.
  684. NullFields []string `json:"-"`
  685. }
  686. func (s *DocumentMask) MarshalJSON() ([]byte, error) {
  687. type NoMethod DocumentMask
  688. raw := NoMethod(*s)
  689. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  690. }
  691. // DocumentRemove: A Document has been removed from the view of the
  692. // targets.
  693. //
  694. // Sent if the document is no longer relevant to a target and is out of
  695. // view.
  696. // Can be sent instead of a DocumentDelete or a DocumentChange if the
  697. // server
  698. // can not send the new value of the document.
  699. //
  700. // Multiple DocumentRemove messages may be returned for the same
  701. // logical
  702. // write or delete, if multiple targets are affected.
  703. type DocumentRemove struct {
  704. // Document: The resource name of the Document that has gone out of
  705. // view.
  706. Document string `json:"document,omitempty"`
  707. // ReadTime: The read timestamp at which the remove was
  708. // observed.
  709. //
  710. // Greater or equal to the `commit_time` of the change/delete/remove.
  711. ReadTime string `json:"readTime,omitempty"`
  712. // RemovedTargetIds: A set of target IDs for targets that previously
  713. // matched this document.
  714. RemovedTargetIds []int64 `json:"removedTargetIds,omitempty"`
  715. // ForceSendFields is a list of field names (e.g. "Document") to
  716. // unconditionally include in API requests. By default, fields with
  717. // empty values are omitted from API requests. However, any non-pointer,
  718. // non-interface field appearing in ForceSendFields will be sent to the
  719. // server regardless of whether the field is empty or not. This may be
  720. // used to include empty fields in Patch requests.
  721. ForceSendFields []string `json:"-"`
  722. // NullFields is a list of field names (e.g. "Document") to include in
  723. // API requests with the JSON null value. By default, fields with empty
  724. // values are omitted from API requests. However, any field with an
  725. // empty value appearing in NullFields will be sent to the server as
  726. // null. It is an error if a field in this list has a non-empty value.
  727. // This may be used to include null fields in Patch requests.
  728. NullFields []string `json:"-"`
  729. }
  730. func (s *DocumentRemove) MarshalJSON() ([]byte, error) {
  731. type NoMethod DocumentRemove
  732. raw := NoMethod(*s)
  733. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  734. }
  735. // DocumentTransform: A transformation of a document.
  736. type DocumentTransform struct {
  737. // Document: The name of the document to transform.
  738. Document string `json:"document,omitempty"`
  739. // FieldTransforms: The list of transformations to apply to the fields
  740. // of the document, in
  741. // order.
  742. // This must not be empty.
  743. FieldTransforms []*FieldTransform `json:"fieldTransforms,omitempty"`
  744. // ForceSendFields is a list of field names (e.g. "Document") to
  745. // unconditionally include in API requests. By default, fields with
  746. // empty values are omitted from API requests. However, any non-pointer,
  747. // non-interface field appearing in ForceSendFields will be sent to the
  748. // server regardless of whether the field is empty or not. This may be
  749. // used to include empty fields in Patch requests.
  750. ForceSendFields []string `json:"-"`
  751. // NullFields is a list of field names (e.g. "Document") to include in
  752. // API requests with the JSON null value. By default, fields with empty
  753. // values are omitted from API requests. However, any field with an
  754. // empty value appearing in NullFields will be sent to the server as
  755. // null. It is an error if a field in this list has a non-empty value.
  756. // This may be used to include null fields in Patch requests.
  757. NullFields []string `json:"-"`
  758. }
  759. func (s *DocumentTransform) MarshalJSON() ([]byte, error) {
  760. type NoMethod DocumentTransform
  761. raw := NoMethod(*s)
  762. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  763. }
  764. // DocumentsTarget: A target specified by a set of documents names.
  765. type DocumentsTarget struct {
  766. // Documents: The names of the documents to retrieve. In the
  767. // format:
  768. // `projects/{project_id}/databases/{database_id}/documents/{docu
  769. // ment_path}`.
  770. // The request will fail if any of the document is not a child resource
  771. // of
  772. // the given `database`. Duplicate names will be elided.
  773. Documents []string `json:"documents,omitempty"`
  774. // ForceSendFields is a list of field names (e.g. "Documents") to
  775. // unconditionally include in API requests. By default, fields with
  776. // empty values are omitted from API requests. However, any non-pointer,
  777. // non-interface field appearing in ForceSendFields will be sent to the
  778. // server regardless of whether the field is empty or not. This may be
  779. // used to include empty fields in Patch requests.
  780. ForceSendFields []string `json:"-"`
  781. // NullFields is a list of field names (e.g. "Documents") to include in
  782. // API requests with the JSON null value. By default, fields with empty
  783. // values are omitted from API requests. However, any field with an
  784. // empty value appearing in NullFields will be sent to the server as
  785. // null. It is an error if a field in this list has a non-empty value.
  786. // This may be used to include null fields in Patch requests.
  787. NullFields []string `json:"-"`
  788. }
  789. func (s *DocumentsTarget) MarshalJSON() ([]byte, error) {
  790. type NoMethod DocumentsTarget
  791. raw := NoMethod(*s)
  792. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  793. }
  794. // Empty: A generic empty message that you can re-use to avoid defining
  795. // duplicated
  796. // empty messages in your APIs. A typical example is to use it as the
  797. // request
  798. // or the response type of an API method. For instance:
  799. //
  800. // service Foo {
  801. // rpc Bar(google.protobuf.Empty) returns
  802. // (google.protobuf.Empty);
  803. // }
  804. //
  805. // The JSON representation for `Empty` is empty JSON object `{}`.
  806. type Empty struct {
  807. // ServerResponse contains the HTTP response code and headers from the
  808. // server.
  809. googleapi.ServerResponse `json:"-"`
  810. }
  811. // ExistenceFilter: A digest of all the documents that match a given
  812. // target.
  813. type ExistenceFilter struct {
  814. // Count: The total count of documents that match target_id.
  815. //
  816. // If different from the count of documents in the client that match,
  817. // the
  818. // client must manually determine which documents no longer match the
  819. // target.
  820. Count int64 `json:"count,omitempty"`
  821. // TargetId: The target ID to which this filter applies.
  822. TargetId int64 `json:"targetId,omitempty"`
  823. // ForceSendFields is a list of field names (e.g. "Count") to
  824. // unconditionally include in API requests. By default, fields with
  825. // empty values are omitted from API requests. However, any non-pointer,
  826. // non-interface field appearing in ForceSendFields will be sent to the
  827. // server regardless of whether the field is empty or not. This may be
  828. // used to include empty fields in Patch requests.
  829. ForceSendFields []string `json:"-"`
  830. // NullFields is a list of field names (e.g. "Count") to include in API
  831. // requests with the JSON null value. By default, fields with empty
  832. // values are omitted from API requests. However, any field with an
  833. // empty value appearing in NullFields will be sent to the server as
  834. // null. It is an error if a field in this list has a non-empty value.
  835. // This may be used to include null fields in Patch requests.
  836. NullFields []string `json:"-"`
  837. }
  838. func (s *ExistenceFilter) MarshalJSON() ([]byte, error) {
  839. type NoMethod ExistenceFilter
  840. raw := NoMethod(*s)
  841. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  842. }
  843. // FieldFilter: A filter on a specific field.
  844. type FieldFilter struct {
  845. // Field: The field to filter by.
  846. Field *FieldReference `json:"field,omitempty"`
  847. // Op: The operator to filter by.
  848. //
  849. // Possible values:
  850. // "OPERATOR_UNSPECIFIED" - Unspecified. This value must not be used.
  851. // "LESS_THAN" - Less than. Requires that the field come first in
  852. // `order_by`.
  853. // "LESS_THAN_OR_EQUAL" - Less than or equal. Requires that the field
  854. // come first in `order_by`.
  855. // "GREATER_THAN" - Greater than. Requires that the field come first
  856. // in `order_by`.
  857. // "GREATER_THAN_OR_EQUAL" - Greater than or equal. Requires that the
  858. // field come first in
  859. // `order_by`.
  860. // "EQUAL" - Equal.
  861. // "ARRAY_CONTAINS" - Contains. Requires that the field is an array.
  862. Op string `json:"op,omitempty"`
  863. // Value: The value to compare to.
  864. Value *Value `json:"value,omitempty"`
  865. // ForceSendFields is a list of field names (e.g. "Field") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "Field") to include in API
  873. // requests with the JSON null value. By default, fields with empty
  874. // values are omitted from API requests. However, any field with an
  875. // empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *FieldFilter) MarshalJSON() ([]byte, error) {
  881. type NoMethod FieldFilter
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. // FieldReference: A reference to a field, such as `max(messages.time)
  886. // as max_time`.
  887. type FieldReference struct {
  888. FieldPath string `json:"fieldPath,omitempty"`
  889. // ForceSendFields is a list of field names (e.g. "FieldPath") to
  890. // unconditionally include in API requests. By default, fields with
  891. // empty values are omitted from API requests. However, any non-pointer,
  892. // non-interface field appearing in ForceSendFields will be sent to the
  893. // server regardless of whether the field is empty or not. This may be
  894. // used to include empty fields in Patch requests.
  895. ForceSendFields []string `json:"-"`
  896. // NullFields is a list of field names (e.g. "FieldPath") to include in
  897. // API requests with the JSON null value. By default, fields with empty
  898. // values are omitted from API requests. However, any field with an
  899. // empty value appearing in NullFields will be sent to the server as
  900. // null. It is an error if a field in this list has a non-empty value.
  901. // This may be used to include null fields in Patch requests.
  902. NullFields []string `json:"-"`
  903. }
  904. func (s *FieldReference) MarshalJSON() ([]byte, error) {
  905. type NoMethod FieldReference
  906. raw := NoMethod(*s)
  907. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  908. }
  909. // FieldTransform: A transformation of a field of the document.
  910. type FieldTransform struct {
  911. // AppendMissingElements: Append the given elements in order if they are
  912. // not already present in
  913. // the current field value.
  914. // If the field is not an array, or if the field does not yet exist, it
  915. // is
  916. // first set to the empty array.
  917. //
  918. // Equivalent numbers of different types (e.g. 3L and 3.0)
  919. // are
  920. // considered equal when checking if a value is missing.
  921. // NaN is equal to NaN, and Null is equal to Null.
  922. // If the input contains multiple equivalent values, only the first
  923. // will
  924. // be considered.
  925. //
  926. // The corresponding transform_result will be the null value.
  927. AppendMissingElements *ArrayValue `json:"appendMissingElements,omitempty"`
  928. // FieldPath: The path of the field. See Document.fields for the field
  929. // path syntax
  930. // reference.
  931. FieldPath string `json:"fieldPath,omitempty"`
  932. // Increment: Adds the given value to the field's current value.
  933. //
  934. // This must be an integer or a double value.
  935. // If the field is not an integer or double, or if the field does not
  936. // yet
  937. // exist, the transformation will set the field to the given value.
  938. // If either of the given value or the current field value are
  939. // doubles,
  940. // both values will be interpreted as doubles. Double arithmetic
  941. // and
  942. // representation of double values follow IEEE 754 semantics.
  943. // If there is positive/negative integer overflow, the field is
  944. // resolved
  945. // to the largest magnitude positive/negative integer.
  946. Increment *Value `json:"increment,omitempty"`
  947. // Maximum: Sets the field to the maximum of its current value and the
  948. // given value.
  949. //
  950. // This must be an integer or a double value.
  951. // If the field is not an integer or double, or if the field does not
  952. // yet
  953. // exist, the transformation will set the field to the given value.
  954. // If a maximum operation is applied where the field and the input
  955. // value
  956. // are of mixed types (that is - one is an integer and one is a
  957. // double)
  958. // the field takes on the type of the larger operand. If the operands
  959. // are
  960. // equivalent (e.g. 3 and 3.0), the field does not change.
  961. // 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value
  962. // and
  963. // zero input value is always the stored value.
  964. // The maximum of any numeric value x and NaN is NaN.
  965. Maximum *Value `json:"maximum,omitempty"`
  966. // Minimum: Sets the field to the minimum of its current value and the
  967. // given value.
  968. //
  969. // This must be an integer or a double value.
  970. // If the field is not an integer or double, or if the field does not
  971. // yet
  972. // exist, the transformation will set the field to the input value.
  973. // If a minimum operation is applied where the field and the input
  974. // value
  975. // are of mixed types (that is - one is an integer and one is a
  976. // double)
  977. // the field takes on the type of the smaller operand. If the operands
  978. // are
  979. // equivalent (e.g. 3 and 3.0), the field does not change.
  980. // 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value
  981. // and
  982. // zero input value is always the stored value.
  983. // The minimum of any numeric value x and NaN is NaN.
  984. Minimum *Value `json:"minimum,omitempty"`
  985. // RemoveAllFromArray: Remove all of the given elements from the array
  986. // in the field.
  987. // If the field is not an array, or if the field does not yet exist, it
  988. // is
  989. // set to the empty array.
  990. //
  991. // Equivalent numbers of the different types (e.g. 3L and 3.0)
  992. // are
  993. // considered equal when deciding whether an element should be
  994. // removed.
  995. // NaN is equal to NaN, and Null is equal to Null.
  996. // This will remove all equivalent values if there are duplicates.
  997. //
  998. // The corresponding transform_result will be the null value.
  999. RemoveAllFromArray *ArrayValue `json:"removeAllFromArray,omitempty"`
  1000. // SetToServerValue: Sets the field to the given server value.
  1001. //
  1002. // Possible values:
  1003. // "SERVER_VALUE_UNSPECIFIED" - Unspecified. This value must not be
  1004. // used.
  1005. // "REQUEST_TIME" - The time at which the server processed the
  1006. // request, with millisecond
  1007. // precision.
  1008. SetToServerValue string `json:"setToServerValue,omitempty"`
  1009. // ForceSendFields is a list of field names (e.g.
  1010. // "AppendMissingElements") to unconditionally include in API requests.
  1011. // By default, fields with empty values are omitted from API requests.
  1012. // However, any non-pointer, non-interface field appearing in
  1013. // ForceSendFields will be sent to the server regardless of whether the
  1014. // field is empty or not. This may be used to include empty fields in
  1015. // Patch requests.
  1016. ForceSendFields []string `json:"-"`
  1017. // NullFields is a list of field names (e.g. "AppendMissingElements") to
  1018. // include in API requests with the JSON null value. By default, fields
  1019. // with empty values are omitted from API requests. However, any field
  1020. // with an empty value appearing in NullFields will be sent to the
  1021. // server as null. It is an error if a field in this list has a
  1022. // non-empty value. This may be used to include null fields in Patch
  1023. // requests.
  1024. NullFields []string `json:"-"`
  1025. }
  1026. func (s *FieldTransform) MarshalJSON() ([]byte, error) {
  1027. type NoMethod FieldTransform
  1028. raw := NoMethod(*s)
  1029. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1030. }
  1031. // Filter: A filter.
  1032. type Filter struct {
  1033. // CompositeFilter: A composite filter.
  1034. CompositeFilter *CompositeFilter `json:"compositeFilter,omitempty"`
  1035. // FieldFilter: A filter on a document field.
  1036. FieldFilter *FieldFilter `json:"fieldFilter,omitempty"`
  1037. // UnaryFilter: A filter that takes exactly one argument.
  1038. UnaryFilter *UnaryFilter `json:"unaryFilter,omitempty"`
  1039. // ForceSendFields is a list of field names (e.g. "CompositeFilter") to
  1040. // unconditionally include in API requests. By default, fields with
  1041. // empty values are omitted from API requests. However, any non-pointer,
  1042. // non-interface field appearing in ForceSendFields will be sent to the
  1043. // server regardless of whether the field is empty or not. This may be
  1044. // used to include empty fields in Patch requests.
  1045. ForceSendFields []string `json:"-"`
  1046. // NullFields is a list of field names (e.g. "CompositeFilter") to
  1047. // include in API requests with the JSON null value. By default, fields
  1048. // with empty values are omitted from API requests. However, any field
  1049. // with an empty value appearing in NullFields will be sent to the
  1050. // server as null. It is an error if a field in this list has a
  1051. // non-empty value. This may be used to include null fields in Patch
  1052. // requests.
  1053. NullFields []string `json:"-"`
  1054. }
  1055. func (s *Filter) MarshalJSON() ([]byte, error) {
  1056. type NoMethod Filter
  1057. raw := NoMethod(*s)
  1058. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1059. }
  1060. // GoogleFirestoreAdminV1beta1ExportDocumentsMetadata: Metadata for
  1061. // ExportDocuments operations.
  1062. type GoogleFirestoreAdminV1beta1ExportDocumentsMetadata struct {
  1063. // CollectionIds: Which collection ids are being exported.
  1064. CollectionIds []string `json:"collectionIds,omitempty"`
  1065. // EndTime: The time the operation ended, either successfully or
  1066. // otherwise. Unset if
  1067. // the operation is still active.
  1068. EndTime string `json:"endTime,omitempty"`
  1069. // OperationState: The state of the export operation.
  1070. //
  1071. // Possible values:
  1072. // "STATE_UNSPECIFIED" - Unspecified.
  1073. // "INITIALIZING" - Request is being prepared for processing.
  1074. // "PROCESSING" - Request is actively being processed.
  1075. // "CANCELLING" - Request is in the process of being cancelled after
  1076. // user called
  1077. // google.longrunning.Operations.CancelOperation on the operation.
  1078. // "FINALIZING" - Request has been processed and is in its
  1079. // finalization stage.
  1080. // "SUCCESSFUL" - Request has completed successfully.
  1081. // "FAILED" - Request has finished being processed, but encountered an
  1082. // error.
  1083. // "CANCELLED" - Request has finished being cancelled after user
  1084. // called
  1085. // google.longrunning.Operations.CancelOperation.
  1086. OperationState string `json:"operationState,omitempty"`
  1087. // OutputUriPrefix: Where the entities are being exported to.
  1088. OutputUriPrefix string `json:"outputUriPrefix,omitempty"`
  1089. // ProgressBytes: An estimate of the number of bytes processed.
  1090. ProgressBytes *GoogleFirestoreAdminV1beta1Progress `json:"progressBytes,omitempty"`
  1091. // ProgressDocuments: An estimate of the number of documents processed.
  1092. ProgressDocuments *GoogleFirestoreAdminV1beta1Progress `json:"progressDocuments,omitempty"`
  1093. // StartTime: The time that work began on the operation.
  1094. StartTime string `json:"startTime,omitempty"`
  1095. // ForceSendFields is a list of field names (e.g. "CollectionIds") to
  1096. // unconditionally include in API requests. By default, fields with
  1097. // empty values are omitted from API requests. However, any non-pointer,
  1098. // non-interface field appearing in ForceSendFields will be sent to the
  1099. // server regardless of whether the field is empty or not. This may be
  1100. // used to include empty fields in Patch requests.
  1101. ForceSendFields []string `json:"-"`
  1102. // NullFields is a list of field names (e.g. "CollectionIds") to include
  1103. // in API requests with the JSON null value. By default, fields with
  1104. // empty values are omitted from API requests. However, any field with
  1105. // an empty value appearing in NullFields will be sent to the server as
  1106. // null. It is an error if a field in this list has a non-empty value.
  1107. // This may be used to include null fields in Patch requests.
  1108. NullFields []string `json:"-"`
  1109. }
  1110. func (s *GoogleFirestoreAdminV1beta1ExportDocumentsMetadata) MarshalJSON() ([]byte, error) {
  1111. type NoMethod GoogleFirestoreAdminV1beta1ExportDocumentsMetadata
  1112. raw := NoMethod(*s)
  1113. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1114. }
  1115. // GoogleFirestoreAdminV1beta1ExportDocumentsRequest: The request for
  1116. // FirestoreAdmin.ExportDocuments.
  1117. type GoogleFirestoreAdminV1beta1ExportDocumentsRequest struct {
  1118. // CollectionIds: Which collection ids to export. Unspecified means all
  1119. // collections.
  1120. CollectionIds []string `json:"collectionIds,omitempty"`
  1121. // OutputUriPrefix: The output URI. Currently only supports Google Cloud
  1122. // Storage URIs of the
  1123. // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
  1124. // name
  1125. // of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an
  1126. // optional
  1127. // Google Cloud Storage namespace path. When
  1128. // choosing a name, be sure to consider Google Cloud Storage
  1129. // naming
  1130. // guidelines: https://cloud.google.com/storage/docs/naming.
  1131. // If the URI is a bucket (without a namespace path), a prefix will
  1132. // be
  1133. // generated based on the start time.
  1134. OutputUriPrefix string `json:"outputUriPrefix,omitempty"`
  1135. // ForceSendFields is a list of field names (e.g. "CollectionIds") to
  1136. // unconditionally include in API requests. By default, fields with
  1137. // empty values are omitted from API requests. However, any non-pointer,
  1138. // non-interface field appearing in ForceSendFields will be sent to the
  1139. // server regardless of whether the field is empty or not. This may be
  1140. // used to include empty fields in Patch requests.
  1141. ForceSendFields []string `json:"-"`
  1142. // NullFields is a list of field names (e.g. "CollectionIds") to include
  1143. // in API requests with the JSON null value. By default, fields with
  1144. // empty values are omitted from API requests. However, any field with
  1145. // an empty value appearing in NullFields will be sent to the server as
  1146. // null. It is an error if a field in this list has a non-empty value.
  1147. // This may be used to include null fields in Patch requests.
  1148. NullFields []string `json:"-"`
  1149. }
  1150. func (s *GoogleFirestoreAdminV1beta1ExportDocumentsRequest) MarshalJSON() ([]byte, error) {
  1151. type NoMethod GoogleFirestoreAdminV1beta1ExportDocumentsRequest
  1152. raw := NoMethod(*s)
  1153. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1154. }
  1155. // GoogleFirestoreAdminV1beta1ExportDocumentsResponse: Returned in the
  1156. // google.longrunning.Operation response field.
  1157. type GoogleFirestoreAdminV1beta1ExportDocumentsResponse struct {
  1158. // OutputUriPrefix: Location of the output files. This can be used to
  1159. // begin an import
  1160. // into Cloud Firestore (this project or another project) after the
  1161. // operation
  1162. // completes successfully.
  1163. OutputUriPrefix string `json:"outputUriPrefix,omitempty"`
  1164. // ForceSendFields is a list of field names (e.g. "OutputUriPrefix") to
  1165. // unconditionally include in API requests. By default, fields with
  1166. // empty values are omitted from API requests. However, any non-pointer,
  1167. // non-interface field appearing in ForceSendFields will be sent to the
  1168. // server regardless of whether the field is empty or not. This may be
  1169. // used to include empty fields in Patch requests.
  1170. ForceSendFields []string `json:"-"`
  1171. // NullFields is a list of field names (e.g. "OutputUriPrefix") to
  1172. // include in API requests with the JSON null value. By default, fields
  1173. // with empty values are omitted from API requests. However, any field
  1174. // with an empty value appearing in NullFields will be sent to the
  1175. // server as null. It is an error if a field in this list has a
  1176. // non-empty value. This may be used to include null fields in Patch
  1177. // requests.
  1178. NullFields []string `json:"-"`
  1179. }
  1180. func (s *GoogleFirestoreAdminV1beta1ExportDocumentsResponse) MarshalJSON() ([]byte, error) {
  1181. type NoMethod GoogleFirestoreAdminV1beta1ExportDocumentsResponse
  1182. raw := NoMethod(*s)
  1183. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1184. }
  1185. // GoogleFirestoreAdminV1beta1ImportDocumentsMetadata: Metadata for
  1186. // ImportDocuments operations.
  1187. type GoogleFirestoreAdminV1beta1ImportDocumentsMetadata struct {
  1188. // CollectionIds: Which collection ids are being imported.
  1189. CollectionIds []string `json:"collectionIds,omitempty"`
  1190. // EndTime: The time the operation ended, either successfully or
  1191. // otherwise. Unset if
  1192. // the operation is still active.
  1193. EndTime string `json:"endTime,omitempty"`
  1194. // InputUriPrefix: The location of the documents being imported.
  1195. InputUriPrefix string `json:"inputUriPrefix,omitempty"`
  1196. // OperationState: The state of the import operation.
  1197. //
  1198. // Possible values:
  1199. // "STATE_UNSPECIFIED" - Unspecified.
  1200. // "INITIALIZING" - Request is being prepared for processing.
  1201. // "PROCESSING" - Request is actively being processed.
  1202. // "CANCELLING" - Request is in the process of being cancelled after
  1203. // user called
  1204. // google.longrunning.Operations.CancelOperation on the operation.
  1205. // "FINALIZING" - Request has been processed and is in its
  1206. // finalization stage.
  1207. // "SUCCESSFUL" - Request has completed successfully.
  1208. // "FAILED" - Request has finished being processed, but encountered an
  1209. // error.
  1210. // "CANCELLED" - Request has finished being cancelled after user
  1211. // called
  1212. // google.longrunning.Operations.CancelOperation.
  1213. OperationState string `json:"operationState,omitempty"`
  1214. // ProgressBytes: An estimate of the number of bytes processed.
  1215. ProgressBytes *GoogleFirestoreAdminV1beta1Progress `json:"progressBytes,omitempty"`
  1216. // ProgressDocuments: An estimate of the number of documents processed.
  1217. ProgressDocuments *GoogleFirestoreAdminV1beta1Progress `json:"progressDocuments,omitempty"`
  1218. // StartTime: The time that work began on the operation.
  1219. StartTime string `json:"startTime,omitempty"`
  1220. // ForceSendFields is a list of field names (e.g. "CollectionIds") to
  1221. // unconditionally include in API requests. By default, fields with
  1222. // empty values are omitted from API requests. However, any non-pointer,
  1223. // non-interface field appearing in ForceSendFields will be sent to the
  1224. // server regardless of whether the field is empty or not. This may be
  1225. // used to include empty fields in Patch requests.
  1226. ForceSendFields []string `json:"-"`
  1227. // NullFields is a list of field names (e.g. "CollectionIds") to include
  1228. // in API requests with the JSON null value. By default, fields with
  1229. // empty values are omitted from API requests. However, any field with
  1230. // an empty value appearing in NullFields will be sent to the server as
  1231. // null. It is an error if a field in this list has a non-empty value.
  1232. // This may be used to include null fields in Patch requests.
  1233. NullFields []string `json:"-"`
  1234. }
  1235. func (s *GoogleFirestoreAdminV1beta1ImportDocumentsMetadata) MarshalJSON() ([]byte, error) {
  1236. type NoMethod GoogleFirestoreAdminV1beta1ImportDocumentsMetadata
  1237. raw := NoMethod(*s)
  1238. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1239. }
  1240. // GoogleFirestoreAdminV1beta1ImportDocumentsRequest: The request for
  1241. // FirestoreAdmin.ImportDocuments.
  1242. type GoogleFirestoreAdminV1beta1ImportDocumentsRequest struct {
  1243. // CollectionIds: Which collection ids to import. Unspecified means all
  1244. // collections included
  1245. // in the import.
  1246. CollectionIds []string `json:"collectionIds,omitempty"`
  1247. // InputUriPrefix: Location of the exported files.
  1248. // This must match the output_uri_prefix of an ExportDocumentsResponse
  1249. // from
  1250. // an export that has completed
  1251. // successfully.
  1252. // See:
  1253. // google.firestore.admin.v1beta1.ExportDocumentsRespo
  1254. // nse.output_uri_prefix.
  1255. InputUriPrefix string `json:"inputUriPrefix,omitempty"`
  1256. // ForceSendFields is a list of field names (e.g. "CollectionIds") to
  1257. // unconditionally include in API requests. By default, fields with
  1258. // empty values are omitted from API requests. However, any non-pointer,
  1259. // non-interface field appearing in ForceSendFields will be sent to the
  1260. // server regardless of whether the field is empty or not. This may be
  1261. // used to include empty fields in Patch requests.
  1262. ForceSendFields []string `json:"-"`
  1263. // NullFields is a list of field names (e.g. "CollectionIds") to include
  1264. // in API requests with the JSON null value. By default, fields with
  1265. // empty values are omitted from API requests. However, any field with
  1266. // an empty value appearing in NullFields will be sent to the server as
  1267. // null. It is an error if a field in this list has a non-empty value.
  1268. // This may be used to include null fields in Patch requests.
  1269. NullFields []string `json:"-"`
  1270. }
  1271. func (s *GoogleFirestoreAdminV1beta1ImportDocumentsRequest) MarshalJSON() ([]byte, error) {
  1272. type NoMethod GoogleFirestoreAdminV1beta1ImportDocumentsRequest
  1273. raw := NoMethod(*s)
  1274. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1275. }
  1276. // GoogleFirestoreAdminV1beta1Index: An index definition.
  1277. type GoogleFirestoreAdminV1beta1Index struct {
  1278. // CollectionId: The collection ID to which this index applies.
  1279. // Required.
  1280. CollectionId string `json:"collectionId,omitempty"`
  1281. // Fields: The fields to index.
  1282. Fields []*GoogleFirestoreAdminV1beta1IndexField `json:"fields,omitempty"`
  1283. // Name: The resource name of the index.
  1284. // Output only.
  1285. Name string `json:"name,omitempty"`
  1286. // State: The state of the index.
  1287. // Output only.
  1288. //
  1289. // Possible values:
  1290. // "STATE_UNSPECIFIED" - The state is unspecified.
  1291. // "CREATING" - The index is being created.
  1292. // There is an active long-running operation for the index.
  1293. // The index is updated when writing a document.
  1294. // Some index data may exist.
  1295. // "READY" - The index is ready to be used.
  1296. // The index is updated when writing a document.
  1297. // The index is fully populated from all stored documents it applies to.
  1298. // "ERROR" - The index was being created, but something went
  1299. // wrong.
  1300. // There is no active long-running operation for the index,
  1301. // and the most recently finished long-running operation failed.
  1302. // The index is not updated when writing a document.
  1303. // Some index data may exist.
  1304. State string `json:"state,omitempty"`
  1305. // ServerResponse contains the HTTP response code and headers from the
  1306. // server.
  1307. googleapi.ServerResponse `json:"-"`
  1308. // ForceSendFields is a list of field names (e.g. "CollectionId") to
  1309. // unconditionally include in API requests. By default, fields with
  1310. // empty values are omitted from API requests. However, any non-pointer,
  1311. // non-interface field appearing in ForceSendFields will be sent to the
  1312. // server regardless of whether the field is empty or not. This may be
  1313. // used to include empty fields in Patch requests.
  1314. ForceSendFields []string `json:"-"`
  1315. // NullFields is a list of field names (e.g. "CollectionId") to include
  1316. // in API requests with the JSON null value. By default, fields with
  1317. // empty values are omitted from API requests. However, any field with
  1318. // an empty value appearing in NullFields will be sent to the server as
  1319. // null. It is an error if a field in this list has a non-empty value.
  1320. // This may be used to include null fields in Patch requests.
  1321. NullFields []string `json:"-"`
  1322. }
  1323. func (s *GoogleFirestoreAdminV1beta1Index) MarshalJSON() ([]byte, error) {
  1324. type NoMethod GoogleFirestoreAdminV1beta1Index
  1325. raw := NoMethod(*s)
  1326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1327. }
  1328. // GoogleFirestoreAdminV1beta1IndexField: A field of an index.
  1329. type GoogleFirestoreAdminV1beta1IndexField struct {
  1330. // FieldPath: The path of the field. Must match the field path
  1331. // specification described
  1332. // by google.firestore.v1beta1.Document.fields.
  1333. // Special field path `__name__` may be used by itself or at the end of
  1334. // a
  1335. // path. `__type__` may be used only at the end of path.
  1336. FieldPath string `json:"fieldPath,omitempty"`
  1337. // Mode: The field's mode.
  1338. //
  1339. // Possible values:
  1340. // "MODE_UNSPECIFIED" - The mode is unspecified.
  1341. // "ASCENDING" - The field's values are indexed so as to support
  1342. // sequencing in
  1343. // ascending order and also query by <, >, <=, >=, and =.
  1344. // "DESCENDING" - The field's values are indexed so as to support
  1345. // sequencing in
  1346. // descending order and also query by <, >, <=, >=, and =.
  1347. // "ARRAY_CONTAINS" - The field's array values are indexed so as to
  1348. // support membership using
  1349. // ARRAY_CONTAINS queries.
  1350. Mode string `json:"mode,omitempty"`
  1351. // ForceSendFields is a list of field names (e.g. "FieldPath") to
  1352. // unconditionally include in API requests. By default, fields with
  1353. // empty values are omitted from API requests. However, any non-pointer,
  1354. // non-interface field appearing in ForceSendFields will be sent to the
  1355. // server regardless of whether the field is empty or not. This may be
  1356. // used to include empty fields in Patch requests.
  1357. ForceSendFields []string `json:"-"`
  1358. // NullFields is a list of field names (e.g. "FieldPath") to include in
  1359. // API requests with the JSON null value. By default, fields with empty
  1360. // values are omitted from API requests. However, any field with an
  1361. // empty value appearing in NullFields will be sent to the server as
  1362. // null. It is an error if a field in this list has a non-empty value.
  1363. // This may be used to include null fields in Patch requests.
  1364. NullFields []string `json:"-"`
  1365. }
  1366. func (s *GoogleFirestoreAdminV1beta1IndexField) MarshalJSON() ([]byte, error) {
  1367. type NoMethod GoogleFirestoreAdminV1beta1IndexField
  1368. raw := NoMethod(*s)
  1369. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1370. }
  1371. // GoogleFirestoreAdminV1beta1IndexOperationMetadata: Metadata for index
  1372. // operations. This metadata populates
  1373. // the metadata field of google.longrunning.Operation.
  1374. type GoogleFirestoreAdminV1beta1IndexOperationMetadata struct {
  1375. // Cancelled: True if the [google.longrunning.Operation] was cancelled.
  1376. // If the
  1377. // cancellation is in progress, cancelled will be true
  1378. // but
  1379. // google.longrunning.Operation.done will be false.
  1380. Cancelled bool `json:"cancelled,omitempty"`
  1381. // DocumentProgress: Progress of the existing operation, measured in
  1382. // number of documents.
  1383. DocumentProgress *GoogleFirestoreAdminV1beta1Progress `json:"documentProgress,omitempty"`
  1384. // EndTime: The time the operation ended, either successfully or
  1385. // otherwise. Unset if
  1386. // the operation is still active.
  1387. EndTime string `json:"endTime,omitempty"`
  1388. // Index: The index resource that this operation is acting on. For
  1389. // example:
  1390. // `projects/{project_id}/databases/{database_id}/indexes/{index
  1391. // _id}`
  1392. Index string `json:"index,omitempty"`
  1393. // OperationType: The type of index operation.
  1394. //
  1395. // Possible values:
  1396. // "OPERATION_TYPE_UNSPECIFIED" - Unspecified. Never set by server.
  1397. // "CREATING_INDEX" - The operation is creating the index. Initiated
  1398. // by a `CreateIndex` call.
  1399. OperationType string `json:"operationType,omitempty"`
  1400. // StartTime: The time that work began on the operation.
  1401. StartTime string `json:"startTime,omitempty"`
  1402. // ForceSendFields is a list of field names (e.g. "Cancelled") to
  1403. // unconditionally include in API requests. By default, fields with
  1404. // empty values are omitted from API requests. However, any non-pointer,
  1405. // non-interface field appearing in ForceSendFields will be sent to the
  1406. // server regardless of whether the field is empty or not. This may be
  1407. // used to include empty fields in Patch requests.
  1408. ForceSendFields []string `json:"-"`
  1409. // NullFields is a list of field names (e.g. "Cancelled") to include in
  1410. // API requests with the JSON null value. By default, fields with empty
  1411. // values are omitted from API requests. However, any field with an
  1412. // empty value appearing in NullFields will be sent to the server as
  1413. // null. It is an error if a field in this list has a non-empty value.
  1414. // This may be used to include null fields in Patch requests.
  1415. NullFields []string `json:"-"`
  1416. }
  1417. func (s *GoogleFirestoreAdminV1beta1IndexOperationMetadata) MarshalJSON() ([]byte, error) {
  1418. type NoMethod GoogleFirestoreAdminV1beta1IndexOperationMetadata
  1419. raw := NoMethod(*s)
  1420. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1421. }
  1422. // GoogleFirestoreAdminV1beta1ListIndexesResponse: The response for
  1423. // FirestoreAdmin.ListIndexes.
  1424. type GoogleFirestoreAdminV1beta1ListIndexesResponse struct {
  1425. // Indexes: The indexes.
  1426. Indexes []*GoogleFirestoreAdminV1beta1Index `json:"indexes,omitempty"`
  1427. // NextPageToken: The standard List next-page token.
  1428. NextPageToken string `json:"nextPageToken,omitempty"`
  1429. // ServerResponse contains the HTTP response code and headers from the
  1430. // server.
  1431. googleapi.ServerResponse `json:"-"`
  1432. // ForceSendFields is a list of field names (e.g. "Indexes") to
  1433. // unconditionally include in API requests. By default, fields with
  1434. // empty values are omitted from API requests. However, any non-pointer,
  1435. // non-interface field appearing in ForceSendFields will be sent to the
  1436. // server regardless of whether the field is empty or not. This may be
  1437. // used to include empty fields in Patch requests.
  1438. ForceSendFields []string `json:"-"`
  1439. // NullFields is a list of field names (e.g. "Indexes") to include in
  1440. // API requests with the JSON null value. By default, fields with empty
  1441. // values are omitted from API requests. However, any field with an
  1442. // empty value appearing in NullFields will be sent to the server as
  1443. // null. It is an error if a field in this list has a non-empty value.
  1444. // This may be used to include null fields in Patch requests.
  1445. NullFields []string `json:"-"`
  1446. }
  1447. func (s *GoogleFirestoreAdminV1beta1ListIndexesResponse) MarshalJSON() ([]byte, error) {
  1448. type NoMethod GoogleFirestoreAdminV1beta1ListIndexesResponse
  1449. raw := NoMethod(*s)
  1450. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1451. }
  1452. // GoogleFirestoreAdminV1beta1LocationMetadata: The metadata message for
  1453. // google.cloud.location.Location.metadata.
  1454. type GoogleFirestoreAdminV1beta1LocationMetadata struct {
  1455. }
  1456. // GoogleFirestoreAdminV1beta1Progress: Measures the progress of a
  1457. // particular metric.
  1458. type GoogleFirestoreAdminV1beta1Progress struct {
  1459. // WorkCompleted: An estimate of how much work has been completed. Note
  1460. // that this may be
  1461. // greater than `work_estimated`.
  1462. WorkCompleted int64 `json:"workCompleted,omitempty,string"`
  1463. // WorkEstimated: An estimate of how much work needs to be performed.
  1464. // Zero if the
  1465. // work estimate is unavailable. May change as work progresses.
  1466. WorkEstimated int64 `json:"workEstimated,omitempty,string"`
  1467. // ForceSendFields is a list of field names (e.g. "WorkCompleted") to
  1468. // unconditionally include in API requests. By default, fields with
  1469. // empty values are omitted from API requests. However, any non-pointer,
  1470. // non-interface field appearing in ForceSendFields will be sent to the
  1471. // server regardless of whether the field is empty or not. This may be
  1472. // used to include empty fields in Patch requests.
  1473. ForceSendFields []string `json:"-"`
  1474. // NullFields is a list of field names (e.g. "WorkCompleted") to include
  1475. // in API requests with the JSON null value. By default, fields with
  1476. // empty values are omitted from API requests. However, any field with
  1477. // an empty value appearing in NullFields will be sent to the server as
  1478. // null. It is an error if a field in this list has a non-empty value.
  1479. // This may be used to include null fields in Patch requests.
  1480. NullFields []string `json:"-"`
  1481. }
  1482. func (s *GoogleFirestoreAdminV1beta1Progress) MarshalJSON() ([]byte, error) {
  1483. type NoMethod GoogleFirestoreAdminV1beta1Progress
  1484. raw := NoMethod(*s)
  1485. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1486. }
  1487. // GoogleLongrunningOperation: This resource represents a long-running
  1488. // operation that is the result of a
  1489. // network API call.
  1490. type GoogleLongrunningOperation struct {
  1491. // Done: If the value is `false`, it means the operation is still in
  1492. // progress.
  1493. // If `true`, the operation is completed, and either `error` or
  1494. // `response` is
  1495. // available.
  1496. Done bool `json:"done,omitempty"`
  1497. // Error: The error result of the operation in case of failure or
  1498. // cancellation.
  1499. Error *Status `json:"error,omitempty"`
  1500. // Metadata: Service-specific metadata associated with the operation.
  1501. // It typically
  1502. // contains progress information and common metadata such as create
  1503. // time.
  1504. // Some services might not provide such metadata. Any method that
  1505. // returns a
  1506. // long-running operation should document the metadata type, if any.
  1507. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1508. // Name: The server-assigned name, which is only unique within the same
  1509. // service that
  1510. // originally returns it. If you use the default HTTP mapping,
  1511. // the
  1512. // `name` should have the format of `operations/some/unique/name`.
  1513. Name string `json:"name,omitempty"`
  1514. // Response: The normal response of the operation in case of success.
  1515. // If the original
  1516. // method returns no data on success, such as `Delete`, the response
  1517. // is
  1518. // `google.protobuf.Empty`. If the original method is
  1519. // standard
  1520. // `Get`/`Create`/`Update`, the response should be the resource. For
  1521. // other
  1522. // methods, the response should have the type `XxxResponse`, where
  1523. // `Xxx`
  1524. // is the original method name. For example, if the original method
  1525. // name
  1526. // is `TakeSnapshot()`, the inferred response type
  1527. // is
  1528. // `TakeSnapshotResponse`.
  1529. Response googleapi.RawMessage `json:"response,omitempty"`
  1530. // ServerResponse contains the HTTP response code and headers from the
  1531. // server.
  1532. googleapi.ServerResponse `json:"-"`
  1533. // ForceSendFields is a list of field names (e.g. "Done") to
  1534. // unconditionally include in API requests. By default, fields with
  1535. // empty values are omitted from API requests. However, any non-pointer,
  1536. // non-interface field appearing in ForceSendFields will be sent to the
  1537. // server regardless of whether the field is empty or not. This may be
  1538. // used to include empty fields in Patch requests.
  1539. ForceSendFields []string `json:"-"`
  1540. // NullFields is a list of field names (e.g. "Done") to include in API
  1541. // requests with the JSON null value. By default, fields with empty
  1542. // values are omitted from API requests. However, any field with an
  1543. // empty value appearing in NullFields will be sent to the server as
  1544. // null. It is an error if a field in this list has a non-empty value.
  1545. // This may be used to include null fields in Patch requests.
  1546. NullFields []string `json:"-"`
  1547. }
  1548. func (s *GoogleLongrunningOperation) MarshalJSON() ([]byte, error) {
  1549. type NoMethod GoogleLongrunningOperation
  1550. raw := NoMethod(*s)
  1551. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1552. }
  1553. // LatLng: An object representing a latitude/longitude pair. This is
  1554. // expressed as a pair
  1555. // of doubles representing degrees latitude and degrees longitude.
  1556. // Unless
  1557. // specified otherwise, this must conform to the
  1558. // <a
  1559. // href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
  1560. // st
  1561. // andard</a>. Values must be within normalized ranges.
  1562. type LatLng struct {
  1563. // Latitude: The latitude in degrees. It must be in the range [-90.0,
  1564. // +90.0].
  1565. Latitude float64 `json:"latitude,omitempty"`
  1566. // Longitude: The longitude in degrees. It must be in the range [-180.0,
  1567. // +180.0].
  1568. Longitude float64 `json:"longitude,omitempty"`
  1569. // ForceSendFields is a list of field names (e.g. "Latitude") to
  1570. // unconditionally include in API requests. By default, fields with
  1571. // empty values are omitted from API requests. However, any non-pointer,
  1572. // non-interface field appearing in ForceSendFields will be sent to the
  1573. // server regardless of whether the field is empty or not. This may be
  1574. // used to include empty fields in Patch requests.
  1575. ForceSendFields []string `json:"-"`
  1576. // NullFields is a list of field names (e.g. "Latitude") to include in
  1577. // API requests with the JSON null value. By default, fields with empty
  1578. // values are omitted from API requests. However, any field with an
  1579. // empty value appearing in NullFields will be sent to the server as
  1580. // null. It is an error if a field in this list has a non-empty value.
  1581. // This may be used to include null fields in Patch requests.
  1582. NullFields []string `json:"-"`
  1583. }
  1584. func (s *LatLng) MarshalJSON() ([]byte, error) {
  1585. type NoMethod LatLng
  1586. raw := NoMethod(*s)
  1587. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1588. }
  1589. func (s *LatLng) UnmarshalJSON(data []byte) error {
  1590. type NoMethod LatLng
  1591. var s1 struct {
  1592. Latitude gensupport.JSONFloat64 `json:"latitude"`
  1593. Longitude gensupport.JSONFloat64 `json:"longitude"`
  1594. *NoMethod
  1595. }
  1596. s1.NoMethod = (*NoMethod)(s)
  1597. if err := json.Unmarshal(data, &s1); err != nil {
  1598. return err
  1599. }
  1600. s.Latitude = float64(s1.Latitude)
  1601. s.Longitude = float64(s1.Longitude)
  1602. return nil
  1603. }
  1604. // ListCollectionIdsRequest: The request for
  1605. // Firestore.ListCollectionIds.
  1606. type ListCollectionIdsRequest struct {
  1607. // PageSize: The maximum number of results to return.
  1608. PageSize int64 `json:"pageSize,omitempty"`
  1609. // PageToken: A page token. Must be a value
  1610. // from
  1611. // ListCollectionIdsResponse.
  1612. PageToken string `json:"pageToken,omitempty"`
  1613. // ForceSendFields is a list of field names (e.g. "PageSize") to
  1614. // unconditionally include in API requests. By default, fields with
  1615. // empty values are omitted from API requests. However, any non-pointer,
  1616. // non-interface field appearing in ForceSendFields will be sent to the
  1617. // server regardless of whether the field is empty or not. This may be
  1618. // used to include empty fields in Patch requests.
  1619. ForceSendFields []string `json:"-"`
  1620. // NullFields is a list of field names (e.g. "PageSize") to include in
  1621. // API requests with the JSON null value. By default, fields with empty
  1622. // values are omitted from API requests. However, any field with an
  1623. // empty value appearing in NullFields will be sent to the server as
  1624. // null. It is an error if a field in this list has a non-empty value.
  1625. // This may be used to include null fields in Patch requests.
  1626. NullFields []string `json:"-"`
  1627. }
  1628. func (s *ListCollectionIdsRequest) MarshalJSON() ([]byte, error) {
  1629. type NoMethod ListCollectionIdsRequest
  1630. raw := NoMethod(*s)
  1631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1632. }
  1633. // ListCollectionIdsResponse: The response from
  1634. // Firestore.ListCollectionIds.
  1635. type ListCollectionIdsResponse struct {
  1636. // CollectionIds: The collection ids.
  1637. CollectionIds []string `json:"collectionIds,omitempty"`
  1638. // NextPageToken: A page token that may be used to continue the list.
  1639. NextPageToken string `json:"nextPageToken,omitempty"`
  1640. // ServerResponse contains the HTTP response code and headers from the
  1641. // server.
  1642. googleapi.ServerResponse `json:"-"`
  1643. // ForceSendFields is a list of field names (e.g. "CollectionIds") to
  1644. // unconditionally include in API requests. By default, fields with
  1645. // empty values are omitted from API requests. However, any non-pointer,
  1646. // non-interface field appearing in ForceSendFields will be sent to the
  1647. // server regardless of whether the field is empty or not. This may be
  1648. // used to include empty fields in Patch requests.
  1649. ForceSendFields []string `json:"-"`
  1650. // NullFields is a list of field names (e.g. "CollectionIds") to include
  1651. // in API requests with the JSON null value. By default, fields with
  1652. // empty values are omitted from API requests. However, any field with
  1653. // an empty value appearing in NullFields will be sent to the server as
  1654. // null. It is an error if a field in this list has a non-empty value.
  1655. // This may be used to include null fields in Patch requests.
  1656. NullFields []string `json:"-"`
  1657. }
  1658. func (s *ListCollectionIdsResponse) MarshalJSON() ([]byte, error) {
  1659. type NoMethod ListCollectionIdsResponse
  1660. raw := NoMethod(*s)
  1661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1662. }
  1663. // ListDocumentsResponse: The response for Firestore.ListDocuments.
  1664. type ListDocumentsResponse struct {
  1665. // Documents: The Documents found.
  1666. Documents []*Document `json:"documents,omitempty"`
  1667. // NextPageToken: The next page token.
  1668. NextPageToken string `json:"nextPageToken,omitempty"`
  1669. // ServerResponse contains the HTTP response code and headers from the
  1670. // server.
  1671. googleapi.ServerResponse `json:"-"`
  1672. // ForceSendFields is a list of field names (e.g. "Documents") to
  1673. // unconditionally include in API requests. By default, fields with
  1674. // empty values are omitted from API requests. However, any non-pointer,
  1675. // non-interface field appearing in ForceSendFields will be sent to the
  1676. // server regardless of whether the field is empty or not. This may be
  1677. // used to include empty fields in Patch requests.
  1678. ForceSendFields []string `json:"-"`
  1679. // NullFields is a list of field names (e.g. "Documents") to include in
  1680. // API requests with the JSON null value. By default, fields with empty
  1681. // values are omitted from API requests. However, any field with an
  1682. // empty value appearing in NullFields will be sent to the server as
  1683. // null. It is an error if a field in this list has a non-empty value.
  1684. // This may be used to include null fields in Patch requests.
  1685. NullFields []string `json:"-"`
  1686. }
  1687. func (s *ListDocumentsResponse) MarshalJSON() ([]byte, error) {
  1688. type NoMethod ListDocumentsResponse
  1689. raw := NoMethod(*s)
  1690. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1691. }
  1692. // ListenRequest: A request for Firestore.Listen
  1693. type ListenRequest struct {
  1694. // AddTarget: A target to add to this stream.
  1695. AddTarget *Target `json:"addTarget,omitempty"`
  1696. // Labels: Labels associated with this target change.
  1697. Labels map[string]string `json:"labels,omitempty"`
  1698. // RemoveTarget: The ID of a target to remove from this stream.
  1699. RemoveTarget int64 `json:"removeTarget,omitempty"`
  1700. // ForceSendFields is a list of field names (e.g. "AddTarget") to
  1701. // unconditionally include in API requests. By default, fields with
  1702. // empty values are omitted from API requests. However, any non-pointer,
  1703. // non-interface field appearing in ForceSendFields will be sent to the
  1704. // server regardless of whether the field is empty or not. This may be
  1705. // used to include empty fields in Patch requests.
  1706. ForceSendFields []string `json:"-"`
  1707. // NullFields is a list of field names (e.g. "AddTarget") to include in
  1708. // API requests with the JSON null value. By default, fields with empty
  1709. // values are omitted from API requests. However, any field with an
  1710. // empty value appearing in NullFields will be sent to the server as
  1711. // null. It is an error if a field in this list has a non-empty value.
  1712. // This may be used to include null fields in Patch requests.
  1713. NullFields []string `json:"-"`
  1714. }
  1715. func (s *ListenRequest) MarshalJSON() ([]byte, error) {
  1716. type NoMethod ListenRequest
  1717. raw := NoMethod(*s)
  1718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1719. }
  1720. // ListenResponse: The response for Firestore.Listen.
  1721. type ListenResponse struct {
  1722. // DocumentChange: A Document has changed.
  1723. DocumentChange *DocumentChange `json:"documentChange,omitempty"`
  1724. // DocumentDelete: A Document has been deleted.
  1725. DocumentDelete *DocumentDelete `json:"documentDelete,omitempty"`
  1726. // DocumentRemove: A Document has been removed from a target (because it
  1727. // is no longer
  1728. // relevant to that target).
  1729. DocumentRemove *DocumentRemove `json:"documentRemove,omitempty"`
  1730. // Filter: A filter to apply to the set of documents previously returned
  1731. // for the
  1732. // given target.
  1733. //
  1734. // Returned when documents may have been removed from the given target,
  1735. // but
  1736. // the exact documents are unknown.
  1737. Filter *ExistenceFilter `json:"filter,omitempty"`
  1738. // TargetChange: Targets have changed.
  1739. TargetChange *TargetChange `json:"targetChange,omitempty"`
  1740. // ServerResponse contains the HTTP response code and headers from the
  1741. // server.
  1742. googleapi.ServerResponse `json:"-"`
  1743. // ForceSendFields is a list of field names (e.g. "DocumentChange") to
  1744. // unconditionally include in API requests. By default, fields with
  1745. // empty values are omitted from API requests. However, any non-pointer,
  1746. // non-interface field appearing in ForceSendFields will be sent to the
  1747. // server regardless of whether the field is empty or not. This may be
  1748. // used to include empty fields in Patch requests.
  1749. ForceSendFields []string `json:"-"`
  1750. // NullFields is a list of field names (e.g. "DocumentChange") to
  1751. // include in API requests with the JSON null value. By default, fields
  1752. // with empty values are omitted from API requests. However, any field
  1753. // with an empty value appearing in NullFields will be sent to the
  1754. // server as null. It is an error if a field in this list has a
  1755. // non-empty value. This may be used to include null fields in Patch
  1756. // requests.
  1757. NullFields []string `json:"-"`
  1758. }
  1759. func (s *ListenResponse) MarshalJSON() ([]byte, error) {
  1760. type NoMethod ListenResponse
  1761. raw := NoMethod(*s)
  1762. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1763. }
  1764. // MapValue: A map value.
  1765. type MapValue struct {
  1766. // Fields: The map's fields.
  1767. //
  1768. // The map keys represent field names. Field names matching the
  1769. // regular
  1770. // expression `__.*__` are reserved. Reserved field names are forbidden
  1771. // except
  1772. // in certain documented contexts. The map keys, represented as UTF-8,
  1773. // must
  1774. // not exceed 1,500 bytes and cannot be empty.
  1775. Fields map[string]Value `json:"fields,omitempty"`
  1776. // ForceSendFields is a list of field names (e.g. "Fields") to
  1777. // unconditionally include in API requests. By default, fields with
  1778. // empty values are omitted from API requests. However, any non-pointer,
  1779. // non-interface field appearing in ForceSendFields will be sent to the
  1780. // server regardless of whether the field is empty or not. This may be
  1781. // used to include empty fields in Patch requests.
  1782. ForceSendFields []string `json:"-"`
  1783. // NullFields is a list of field names (e.g. "Fields") to include in API
  1784. // requests with the JSON null value. By default, fields with empty
  1785. // values are omitted from API requests. However, any field with an
  1786. // empty value appearing in NullFields will be sent to the server as
  1787. // null. It is an error if a field in this list has a non-empty value.
  1788. // This may be used to include null fields in Patch requests.
  1789. NullFields []string `json:"-"`
  1790. }
  1791. func (s *MapValue) MarshalJSON() ([]byte, error) {
  1792. type NoMethod MapValue
  1793. raw := NoMethod(*s)
  1794. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1795. }
  1796. // Order: An order on a field.
  1797. type Order struct {
  1798. // Direction: The direction to order by. Defaults to `ASCENDING`.
  1799. //
  1800. // Possible values:
  1801. // "DIRECTION_UNSPECIFIED" - Unspecified.
  1802. // "ASCENDING" - Ascending.
  1803. // "DESCENDING" - Descending.
  1804. Direction string `json:"direction,omitempty"`
  1805. // Field: The field to order by.
  1806. Field *FieldReference `json:"field,omitempty"`
  1807. // ForceSendFields is a list of field names (e.g. "Direction") to
  1808. // unconditionally include in API requests. By default, fields with
  1809. // empty values are omitted from API requests. However, any non-pointer,
  1810. // non-interface field appearing in ForceSendFields will be sent to the
  1811. // server regardless of whether the field is empty or not. This may be
  1812. // used to include empty fields in Patch requests.
  1813. ForceSendFields []string `json:"-"`
  1814. // NullFields is a list of field names (e.g. "Direction") to include in
  1815. // API requests with the JSON null value. By default, fields with empty
  1816. // values are omitted from API requests. However, any field with an
  1817. // empty value appearing in NullFields will be sent to the server as
  1818. // null. It is an error if a field in this list has a non-empty value.
  1819. // This may be used to include null fields in Patch requests.
  1820. NullFields []string `json:"-"`
  1821. }
  1822. func (s *Order) MarshalJSON() ([]byte, error) {
  1823. type NoMethod Order
  1824. raw := NoMethod(*s)
  1825. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1826. }
  1827. // Precondition: A precondition on a document, used for conditional
  1828. // operations.
  1829. type Precondition struct {
  1830. // Exists: When set to `true`, the target document must exist.
  1831. // When set to `false`, the target document must not exist.
  1832. Exists bool `json:"exists,omitempty"`
  1833. // UpdateTime: When set, the target document must exist and have been
  1834. // last updated at
  1835. // that time.
  1836. UpdateTime string `json:"updateTime,omitempty"`
  1837. // ForceSendFields is a list of field names (e.g. "Exists") to
  1838. // unconditionally include in API requests. By default, fields with
  1839. // empty values are omitted from API requests. However, any non-pointer,
  1840. // non-interface field appearing in ForceSendFields will be sent to the
  1841. // server regardless of whether the field is empty or not. This may be
  1842. // used to include empty fields in Patch requests.
  1843. ForceSendFields []string `json:"-"`
  1844. // NullFields is a list of field names (e.g. "Exists") to include in API
  1845. // requests with the JSON null value. By default, fields with empty
  1846. // values are omitted from API requests. However, any field with an
  1847. // empty value appearing in NullFields will be sent to the server as
  1848. // null. It is an error if a field in this list has a non-empty value.
  1849. // This may be used to include null fields in Patch requests.
  1850. NullFields []string `json:"-"`
  1851. }
  1852. func (s *Precondition) MarshalJSON() ([]byte, error) {
  1853. type NoMethod Precondition
  1854. raw := NoMethod(*s)
  1855. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1856. }
  1857. // Projection: The projection of document's fields to return.
  1858. type Projection struct {
  1859. // Fields: The fields to return.
  1860. //
  1861. // If empty, all fields are returned. To only return the name
  1862. // of the document, use `['__name__']`.
  1863. Fields []*FieldReference `json:"fields,omitempty"`
  1864. // ForceSendFields is a list of field names (e.g. "Fields") to
  1865. // unconditionally include in API requests. By default, fields with
  1866. // empty values are omitted from API requests. However, any non-pointer,
  1867. // non-interface field appearing in ForceSendFields will be sent to the
  1868. // server regardless of whether the field is empty or not. This may be
  1869. // used to include empty fields in Patch requests.
  1870. ForceSendFields []string `json:"-"`
  1871. // NullFields is a list of field names (e.g. "Fields") to include in API
  1872. // requests with the JSON null value. By default, fields with empty
  1873. // values are omitted from API requests. However, any field with an
  1874. // empty value appearing in NullFields will be sent to the server as
  1875. // null. It is an error if a field in this list has a non-empty value.
  1876. // This may be used to include null fields in Patch requests.
  1877. NullFields []string `json:"-"`
  1878. }
  1879. func (s *Projection) MarshalJSON() ([]byte, error) {
  1880. type NoMethod Projection
  1881. raw := NoMethod(*s)
  1882. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1883. }
  1884. // QueryTarget: A target specified by a query.
  1885. type QueryTarget struct {
  1886. // Parent: The parent resource name. In the
  1887. // format:
  1888. // `projects/{project_id}/databases/{database_id}/documents`
  1889. // or
  1890. // `projects/{project_id}/databases/{database_id}/documents/{document_
  1891. // path}`.
  1892. // For example:
  1893. // `projects/my-project/databases/my-database/documents`
  1894. // or
  1895. // `projects/my-project/databases/my-database/documents/chatrooms/my-c
  1896. // hatroom`
  1897. Parent string `json:"parent,omitempty"`
  1898. // StructuredQuery: A structured query.
  1899. StructuredQuery *StructuredQuery `json:"structuredQuery,omitempty"`
  1900. // ForceSendFields is a list of field names (e.g. "Parent") to
  1901. // unconditionally include in API requests. By default, fields with
  1902. // empty values are omitted from API requests. However, any non-pointer,
  1903. // non-interface field appearing in ForceSendFields will be sent to the
  1904. // server regardless of whether the field is empty or not. This may be
  1905. // used to include empty fields in Patch requests.
  1906. ForceSendFields []string `json:"-"`
  1907. // NullFields is a list of field names (e.g. "Parent") to include in API
  1908. // requests with the JSON null value. By default, fields with empty
  1909. // values are omitted from API requests. However, any field with an
  1910. // empty value appearing in NullFields will be sent to the server as
  1911. // null. It is an error if a field in this list has a non-empty value.
  1912. // This may be used to include null fields in Patch requests.
  1913. NullFields []string `json:"-"`
  1914. }
  1915. func (s *QueryTarget) MarshalJSON() ([]byte, error) {
  1916. type NoMethod QueryTarget
  1917. raw := NoMethod(*s)
  1918. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1919. }
  1920. // ReadOnly: Options for a transaction that can only be used to read
  1921. // documents.
  1922. type ReadOnly struct {
  1923. // ReadTime: Reads documents at the given time.
  1924. // This may not be older than 60 seconds.
  1925. ReadTime string `json:"readTime,omitempty"`
  1926. // ForceSendFields is a list of field names (e.g. "ReadTime") to
  1927. // unconditionally include in API requests. By default, fields with
  1928. // empty values are omitted from API requests. However, any non-pointer,
  1929. // non-interface field appearing in ForceSendFields will be sent to the
  1930. // server regardless of whether the field is empty or not. This may be
  1931. // used to include empty fields in Patch requests.
  1932. ForceSendFields []string `json:"-"`
  1933. // NullFields is a list of field names (e.g. "ReadTime") to include in
  1934. // API requests with the JSON null value. By default, fields with empty
  1935. // values are omitted from API requests. However, any field with an
  1936. // empty value appearing in NullFields will be sent to the server as
  1937. // null. It is an error if a field in this list has a non-empty value.
  1938. // This may be used to include null fields in Patch requests.
  1939. NullFields []string `json:"-"`
  1940. }
  1941. func (s *ReadOnly) MarshalJSON() ([]byte, error) {
  1942. type NoMethod ReadOnly
  1943. raw := NoMethod(*s)
  1944. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1945. }
  1946. // ReadWrite: Options for a transaction that can be used to read and
  1947. // write documents.
  1948. type ReadWrite struct {
  1949. // RetryTransaction: An optional transaction to retry.
  1950. RetryTransaction string `json:"retryTransaction,omitempty"`
  1951. // ForceSendFields is a list of field names (e.g. "RetryTransaction") to
  1952. // unconditionally include in API requests. By default, fields with
  1953. // empty values are omitted from API requests. However, any non-pointer,
  1954. // non-interface field appearing in ForceSendFields will be sent to the
  1955. // server regardless of whether the field is empty or not. This may be
  1956. // used to include empty fields in Patch requests.
  1957. ForceSendFields []string `json:"-"`
  1958. // NullFields is a list of field names (e.g. "RetryTransaction") to
  1959. // include in API requests with the JSON null value. By default, fields
  1960. // with empty values are omitted from API requests. However, any field
  1961. // with an empty value appearing in NullFields will be sent to the
  1962. // server as null. It is an error if a field in this list has a
  1963. // non-empty value. This may be used to include null fields in Patch
  1964. // requests.
  1965. NullFields []string `json:"-"`
  1966. }
  1967. func (s *ReadWrite) MarshalJSON() ([]byte, error) {
  1968. type NoMethod ReadWrite
  1969. raw := NoMethod(*s)
  1970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1971. }
  1972. // RollbackRequest: The request for Firestore.Rollback.
  1973. type RollbackRequest struct {
  1974. // Transaction: The transaction to roll back.
  1975. Transaction string `json:"transaction,omitempty"`
  1976. // ForceSendFields is a list of field names (e.g. "Transaction") to
  1977. // unconditionally include in API requests. By default, fields with
  1978. // empty values are omitted from API requests. However, any non-pointer,
  1979. // non-interface field appearing in ForceSendFields will be sent to the
  1980. // server regardless of whether the field is empty or not. This may be
  1981. // used to include empty fields in Patch requests.
  1982. ForceSendFields []string `json:"-"`
  1983. // NullFields is a list of field names (e.g. "Transaction") to include
  1984. // in API requests with the JSON null value. By default, fields with
  1985. // empty values are omitted from API requests. However, any field with
  1986. // an empty value appearing in NullFields will be sent to the server as
  1987. // null. It is an error if a field in this list has a non-empty value.
  1988. // This may be used to include null fields in Patch requests.
  1989. NullFields []string `json:"-"`
  1990. }
  1991. func (s *RollbackRequest) MarshalJSON() ([]byte, error) {
  1992. type NoMethod RollbackRequest
  1993. raw := NoMethod(*s)
  1994. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1995. }
  1996. // RunQueryRequest: The request for Firestore.RunQuery.
  1997. type RunQueryRequest struct {
  1998. // NewTransaction: Starts a new transaction and reads the
  1999. // documents.
  2000. // Defaults to a read-only transaction.
  2001. // The new transaction ID will be returned as the first response in
  2002. // the
  2003. // stream.
  2004. NewTransaction *TransactionOptions `json:"newTransaction,omitempty"`
  2005. // ReadTime: Reads documents as they were at the given time.
  2006. // This may not be older than 60 seconds.
  2007. ReadTime string `json:"readTime,omitempty"`
  2008. // StructuredQuery: A structured query.
  2009. StructuredQuery *StructuredQuery `json:"structuredQuery,omitempty"`
  2010. // Transaction: Reads documents in a transaction.
  2011. Transaction string `json:"transaction,omitempty"`
  2012. // ForceSendFields is a list of field names (e.g. "NewTransaction") to
  2013. // unconditionally include in API requests. By default, fields with
  2014. // empty values are omitted from API requests. However, any non-pointer,
  2015. // non-interface field appearing in ForceSendFields will be sent to the
  2016. // server regardless of whether the field is empty or not. This may be
  2017. // used to include empty fields in Patch requests.
  2018. ForceSendFields []string `json:"-"`
  2019. // NullFields is a list of field names (e.g. "NewTransaction") to
  2020. // include in API requests with the JSON null value. By default, fields
  2021. // with empty values are omitted from API requests. However, any field
  2022. // with an empty value appearing in NullFields will be sent to the
  2023. // server as null. It is an error if a field in this list has a
  2024. // non-empty value. This may be used to include null fields in Patch
  2025. // requests.
  2026. NullFields []string `json:"-"`
  2027. }
  2028. func (s *RunQueryRequest) MarshalJSON() ([]byte, error) {
  2029. type NoMethod RunQueryRequest
  2030. raw := NoMethod(*s)
  2031. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2032. }
  2033. // RunQueryResponse: The response for Firestore.RunQuery.
  2034. type RunQueryResponse struct {
  2035. // Document: A query result.
  2036. // Not set when reporting partial progress.
  2037. Document *Document `json:"document,omitempty"`
  2038. // ReadTime: The time at which the document was read. This may be
  2039. // monotonically
  2040. // increasing; in this case, the previous documents in the result stream
  2041. // are
  2042. // guaranteed not to have changed between their `read_time` and this
  2043. // one.
  2044. //
  2045. // If the query returns no results, a response with `read_time` and
  2046. // no
  2047. // `document` will be sent, and this represents the time at which the
  2048. // query
  2049. // was run.
  2050. ReadTime string `json:"readTime,omitempty"`
  2051. // SkippedResults: The number of results that have been skipped due to
  2052. // an offset between
  2053. // the last response and the current response.
  2054. SkippedResults int64 `json:"skippedResults,omitempty"`
  2055. // Transaction: The transaction that was started as part of this
  2056. // request.
  2057. // Can only be set in the first response, and only
  2058. // if
  2059. // RunQueryRequest.new_transaction was set in the request.
  2060. // If set, no other fields will be set in this response.
  2061. Transaction string `json:"transaction,omitempty"`
  2062. // ServerResponse contains the HTTP response code and headers from the
  2063. // server.
  2064. googleapi.ServerResponse `json:"-"`
  2065. // ForceSendFields is a list of field names (e.g. "Document") to
  2066. // unconditionally include in API requests. By default, fields with
  2067. // empty values are omitted from API requests. However, any non-pointer,
  2068. // non-interface field appearing in ForceSendFields will be sent to the
  2069. // server regardless of whether the field is empty or not. This may be
  2070. // used to include empty fields in Patch requests.
  2071. ForceSendFields []string `json:"-"`
  2072. // NullFields is a list of field names (e.g. "Document") to include in
  2073. // API requests with the JSON null value. By default, fields with empty
  2074. // values are omitted from API requests. However, any field with an
  2075. // empty value appearing in NullFields will be sent to the server as
  2076. // null. It is an error if a field in this list has a non-empty value.
  2077. // This may be used to include null fields in Patch requests.
  2078. NullFields []string `json:"-"`
  2079. }
  2080. func (s *RunQueryResponse) MarshalJSON() ([]byte, error) {
  2081. type NoMethod RunQueryResponse
  2082. raw := NoMethod(*s)
  2083. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2084. }
  2085. // Status: The `Status` type defines a logical error model that is
  2086. // suitable for different
  2087. // programming environments, including REST APIs and RPC APIs. It is
  2088. // used by
  2089. // [gRPC](https://github.com/grpc). The error model is designed to
  2090. // be:
  2091. //
  2092. // - Simple to use and understand for most users
  2093. // - Flexible enough to meet unexpected needs
  2094. //
  2095. // # Overview
  2096. //
  2097. // The `Status` message contains three pieces of data: error code, error
  2098. // message,
  2099. // and error details. The error code should be an enum value
  2100. // of
  2101. // google.rpc.Code, but it may accept additional error codes if needed.
  2102. // The
  2103. // error message should be a developer-facing English message that
  2104. // helps
  2105. // developers *understand* and *resolve* the error. If a localized
  2106. // user-facing
  2107. // error message is needed, put the localized message in the error
  2108. // details or
  2109. // localize it in the client. The optional error details may contain
  2110. // arbitrary
  2111. // information about the error. There is a predefined set of error
  2112. // detail types
  2113. // in the package `google.rpc` that can be used for common error
  2114. // conditions.
  2115. //
  2116. // # Language mapping
  2117. //
  2118. // The `Status` message is the logical representation of the error
  2119. // model, but it
  2120. // is not necessarily the actual wire format. When the `Status` message
  2121. // is
  2122. // exposed in different client libraries and different wire protocols,
  2123. // it can be
  2124. // mapped differently. For example, it will likely be mapped to some
  2125. // exceptions
  2126. // in Java, but more likely mapped to some error codes in C.
  2127. //
  2128. // # Other uses
  2129. //
  2130. // The error model and the `Status` message can be used in a variety
  2131. // of
  2132. // environments, either with or without APIs, to provide a
  2133. // consistent developer experience across different
  2134. // environments.
  2135. //
  2136. // Example uses of this error model include:
  2137. //
  2138. // - Partial errors. If a service needs to return partial errors to the
  2139. // client,
  2140. // it may embed the `Status` in the normal response to indicate the
  2141. // partial
  2142. // errors.
  2143. //
  2144. // - Workflow errors. A typical workflow has multiple steps. Each step
  2145. // may
  2146. // have a `Status` message for error reporting.
  2147. //
  2148. // - Batch operations. If a client uses batch request and batch
  2149. // response, the
  2150. // `Status` message should be used directly inside batch response,
  2151. // one for
  2152. // each error sub-response.
  2153. //
  2154. // - Asynchronous operations. If an API call embeds asynchronous
  2155. // operation
  2156. // results in its response, the status of those operations should
  2157. // be
  2158. // represented directly using the `Status` message.
  2159. //
  2160. // - Logging. If some API errors are stored in logs, the message
  2161. // `Status` could
  2162. // be used directly after any stripping needed for security/privacy
  2163. // reasons.
  2164. type Status struct {
  2165. // Code: The status code, which should be an enum value of
  2166. // google.rpc.Code.
  2167. Code int64 `json:"code,omitempty"`
  2168. // Details: A list of messages that carry the error details. There is a
  2169. // common set of
  2170. // message types for APIs to use.
  2171. Details []googleapi.RawMessage `json:"details,omitempty"`
  2172. // Message: A developer-facing error message, which should be in
  2173. // English. Any
  2174. // user-facing error message should be localized and sent in
  2175. // the
  2176. // google.rpc.Status.details field, or localized by the client.
  2177. Message string `json:"message,omitempty"`
  2178. // ForceSendFields is a list of field names (e.g. "Code") to
  2179. // unconditionally include in API requests. By default, fields with
  2180. // empty values are omitted from API requests. However, any non-pointer,
  2181. // non-interface field appearing in ForceSendFields will be sent to the
  2182. // server regardless of whether the field is empty or not. This may be
  2183. // used to include empty fields in Patch requests.
  2184. ForceSendFields []string `json:"-"`
  2185. // NullFields is a list of field names (e.g. "Code") to include in API
  2186. // requests with the JSON null value. By default, fields with empty
  2187. // values are omitted from API requests. However, any field with an
  2188. // empty value appearing in NullFields will be sent to the server as
  2189. // null. It is an error if a field in this list has a non-empty value.
  2190. // This may be used to include null fields in Patch requests.
  2191. NullFields []string `json:"-"`
  2192. }
  2193. func (s *Status) MarshalJSON() ([]byte, error) {
  2194. type NoMethod Status
  2195. raw := NoMethod(*s)
  2196. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2197. }
  2198. // StructuredQuery: A Firestore query.
  2199. type StructuredQuery struct {
  2200. // EndAt: A end point for the query results.
  2201. EndAt *Cursor `json:"endAt,omitempty"`
  2202. // From: The collections to query.
  2203. From []*CollectionSelector `json:"from,omitempty"`
  2204. // Limit: The maximum number of results to return.
  2205. //
  2206. // Applies after all other constraints.
  2207. // Must be >= 0 if specified.
  2208. Limit int64 `json:"limit,omitempty"`
  2209. // Offset: The number of results to skip.
  2210. //
  2211. // Applies before limit, but after all other constraints. Must be >= 0
  2212. // if
  2213. // specified.
  2214. Offset int64 `json:"offset,omitempty"`
  2215. // OrderBy: The order to apply to the query results.
  2216. //
  2217. // Firestore guarantees a stable ordering through the following rules:
  2218. //
  2219. // * Any field required to appear in `order_by`, that is not already
  2220. // specified in `order_by`, is appended to the order in field name
  2221. // order
  2222. // by default.
  2223. // * If an order on `__name__` is not specified, it is appended by
  2224. // default.
  2225. //
  2226. // Fields are appended with the same sort direction as the last
  2227. // order
  2228. // specified, or 'ASCENDING' if no order was specified. For example:
  2229. //
  2230. // * `SELECT * FROM Foo ORDER BY A` becomes
  2231. // `SELECT * FROM Foo ORDER BY A, __name__`
  2232. // * `SELECT * FROM Foo ORDER BY A DESC` becomes
  2233. // `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
  2234. // * `SELECT * FROM Foo WHERE A > 1` becomes
  2235. // `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
  2236. OrderBy []*Order `json:"orderBy,omitempty"`
  2237. // Select: The projection to return.
  2238. Select *Projection `json:"select,omitempty"`
  2239. // StartAt: A starting point for the query results.
  2240. StartAt *Cursor `json:"startAt,omitempty"`
  2241. // Where: The filter to apply.
  2242. Where *Filter `json:"where,omitempty"`
  2243. // ForceSendFields is a list of field names (e.g. "EndAt") to
  2244. // unconditionally include in API requests. By default, fields with
  2245. // empty values are omitted from API requests. However, any non-pointer,
  2246. // non-interface field appearing in ForceSendFields will be sent to the
  2247. // server regardless of whether the field is empty or not. This may be
  2248. // used to include empty fields in Patch requests.
  2249. ForceSendFields []string `json:"-"`
  2250. // NullFields is a list of field names (e.g. "EndAt") to include in API
  2251. // requests with the JSON null value. By default, fields with empty
  2252. // values are omitted from API requests. However, any field with an
  2253. // empty value appearing in NullFields will be sent to the server as
  2254. // null. It is an error if a field in this list has a non-empty value.
  2255. // This may be used to include null fields in Patch requests.
  2256. NullFields []string `json:"-"`
  2257. }
  2258. func (s *StructuredQuery) MarshalJSON() ([]byte, error) {
  2259. type NoMethod StructuredQuery
  2260. raw := NoMethod(*s)
  2261. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2262. }
  2263. // Target: A specification of a set of documents to listen to.
  2264. type Target struct {
  2265. // Documents: A target specified by a set of document names.
  2266. Documents *DocumentsTarget `json:"documents,omitempty"`
  2267. // Once: If the target should be removed once it is current and
  2268. // consistent.
  2269. Once bool `json:"once,omitempty"`
  2270. // Query: A target specified by a query.
  2271. Query *QueryTarget `json:"query,omitempty"`
  2272. // ReadTime: Start listening after a specific `read_time`.
  2273. //
  2274. // The client must know the state of matching documents at this time.
  2275. ReadTime string `json:"readTime,omitempty"`
  2276. // ResumeToken: A resume token from a prior TargetChange for an
  2277. // identical target.
  2278. //
  2279. // Using a resume token with a different target is unsupported and may
  2280. // fail.
  2281. ResumeToken string `json:"resumeToken,omitempty"`
  2282. // TargetId: A client provided target ID.
  2283. //
  2284. // If not set, the server will assign an ID for the target.
  2285. //
  2286. // Used for resuming a target without changing IDs. The IDs can either
  2287. // be
  2288. // client-assigned or be server-assigned in a previous stream. All
  2289. // targets
  2290. // with client provided IDs must be added before adding a target that
  2291. // needs
  2292. // a server-assigned id.
  2293. TargetId int64 `json:"targetId,omitempty"`
  2294. // ForceSendFields is a list of field names (e.g. "Documents") to
  2295. // unconditionally include in API requests. By default, fields with
  2296. // empty values are omitted from API requests. However, any non-pointer,
  2297. // non-interface field appearing in ForceSendFields will be sent to the
  2298. // server regardless of whether the field is empty or not. This may be
  2299. // used to include empty fields in Patch requests.
  2300. ForceSendFields []string `json:"-"`
  2301. // NullFields is a list of field names (e.g. "Documents") to include in
  2302. // API requests with the JSON null value. By default, fields with empty
  2303. // values are omitted from API requests. However, any field with an
  2304. // empty value appearing in NullFields will be sent to the server as
  2305. // null. It is an error if a field in this list has a non-empty value.
  2306. // This may be used to include null fields in Patch requests.
  2307. NullFields []string `json:"-"`
  2308. }
  2309. func (s *Target) MarshalJSON() ([]byte, error) {
  2310. type NoMethod Target
  2311. raw := NoMethod(*s)
  2312. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2313. }
  2314. // TargetChange: Targets being watched have changed.
  2315. type TargetChange struct {
  2316. // Cause: The error that resulted in this change, if applicable.
  2317. Cause *Status `json:"cause,omitempty"`
  2318. // ReadTime: The consistent `read_time` for the given `target_ids`
  2319. // (omitted when the
  2320. // target_ids are not at a consistent snapshot).
  2321. //
  2322. // The stream is guaranteed to send a `read_time` with `target_ids`
  2323. // empty
  2324. // whenever the entire stream reaches a new consistent snapshot.
  2325. // ADD,
  2326. // CURRENT, and RESET messages are guaranteed to (eventually) result in
  2327. // a
  2328. // new consistent snapshot (while NO_CHANGE and REMOVE messages are
  2329. // not).
  2330. //
  2331. // For a given stream, `read_time` is guaranteed to be
  2332. // monotonically
  2333. // increasing.
  2334. ReadTime string `json:"readTime,omitempty"`
  2335. // ResumeToken: A token that can be used to resume the stream for the
  2336. // given `target_ids`,
  2337. // or all targets if `target_ids` is empty.
  2338. //
  2339. // Not set on every target change.
  2340. ResumeToken string `json:"resumeToken,omitempty"`
  2341. // TargetChangeType: The type of change that occurred.
  2342. //
  2343. // Possible values:
  2344. // "NO_CHANGE" - No change has occurred. Used only to send an updated
  2345. // `resume_token`.
  2346. // "ADD" - The targets have been added.
  2347. // "REMOVE" - The targets have been removed.
  2348. // "CURRENT" - The targets reflect all changes committed before the
  2349. // targets were added
  2350. // to the stream.
  2351. //
  2352. // This will be sent after or with a `read_time` that is greater than
  2353. // or
  2354. // equal to the time at which the targets were added.
  2355. //
  2356. // Listeners can wait for this change if read-after-write semantics
  2357. // are desired.
  2358. // "RESET" - The targets have been reset, and a new initial state for
  2359. // the targets
  2360. // will be returned in subsequent changes.
  2361. //
  2362. // After the initial state is complete, `CURRENT` will be returned
  2363. // even
  2364. // if the target was previously indicated to be `CURRENT`.
  2365. TargetChangeType string `json:"targetChangeType,omitempty"`
  2366. // TargetIds: The target IDs of targets that have changed.
  2367. //
  2368. // If empty, the change applies to all targets.
  2369. //
  2370. // For `target_change_type=ADD`, the order of the target IDs matches the
  2371. // order
  2372. // of the requests to add the targets. This allows clients to
  2373. // unambiguously
  2374. // associate server-assigned target IDs with added targets.
  2375. //
  2376. // For other states, the order of the target IDs is not defined.
  2377. TargetIds []int64 `json:"targetIds,omitempty"`
  2378. // ForceSendFields is a list of field names (e.g. "Cause") to
  2379. // unconditionally include in API requests. By default, fields with
  2380. // empty values are omitted from API requests. However, any non-pointer,
  2381. // non-interface field appearing in ForceSendFields will be sent to the
  2382. // server regardless of whether the field is empty or not. This may be
  2383. // used to include empty fields in Patch requests.
  2384. ForceSendFields []string `json:"-"`
  2385. // NullFields is a list of field names (e.g. "Cause") to include in API
  2386. // requests with the JSON null value. By default, fields with empty
  2387. // values are omitted from API requests. However, any field with an
  2388. // empty value appearing in NullFields will be sent to the server as
  2389. // null. It is an error if a field in this list has a non-empty value.
  2390. // This may be used to include null fields in Patch requests.
  2391. NullFields []string `json:"-"`
  2392. }
  2393. func (s *TargetChange) MarshalJSON() ([]byte, error) {
  2394. type NoMethod TargetChange
  2395. raw := NoMethod(*s)
  2396. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2397. }
  2398. // TransactionOptions: Options for creating a new transaction.
  2399. type TransactionOptions struct {
  2400. // ReadOnly: The transaction can only be used for read operations.
  2401. ReadOnly *ReadOnly `json:"readOnly,omitempty"`
  2402. // ReadWrite: The transaction can be used for both read and write
  2403. // operations.
  2404. ReadWrite *ReadWrite `json:"readWrite,omitempty"`
  2405. // ForceSendFields is a list of field names (e.g. "ReadOnly") to
  2406. // unconditionally include in API requests. By default, fields with
  2407. // empty values are omitted from API requests. However, any non-pointer,
  2408. // non-interface field appearing in ForceSendFields will be sent to the
  2409. // server regardless of whether the field is empty or not. This may be
  2410. // used to include empty fields in Patch requests.
  2411. ForceSendFields []string `json:"-"`
  2412. // NullFields is a list of field names (e.g. "ReadOnly") to include in
  2413. // API requests with the JSON null value. By default, fields with empty
  2414. // values are omitted from API requests. However, any field with an
  2415. // empty value appearing in NullFields will be sent to the server as
  2416. // null. It is an error if a field in this list has a non-empty value.
  2417. // This may be used to include null fields in Patch requests.
  2418. NullFields []string `json:"-"`
  2419. }
  2420. func (s *TransactionOptions) MarshalJSON() ([]byte, error) {
  2421. type NoMethod TransactionOptions
  2422. raw := NoMethod(*s)
  2423. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2424. }
  2425. // UnaryFilter: A filter with a single operand.
  2426. type UnaryFilter struct {
  2427. // Field: The field to which to apply the operator.
  2428. Field *FieldReference `json:"field,omitempty"`
  2429. // Op: The unary operator to apply.
  2430. //
  2431. // Possible values:
  2432. // "OPERATOR_UNSPECIFIED" - Unspecified. This value must not be used.
  2433. // "IS_NAN" - Test if a field is equal to NaN.
  2434. // "IS_NULL" - Test if an exprestion evaluates to Null.
  2435. Op string `json:"op,omitempty"`
  2436. // ForceSendFields is a list of field names (e.g. "Field") to
  2437. // unconditionally include in API requests. By default, fields with
  2438. // empty values are omitted from API requests. However, any non-pointer,
  2439. // non-interface field appearing in ForceSendFields will be sent to the
  2440. // server regardless of whether the field is empty or not. This may be
  2441. // used to include empty fields in Patch requests.
  2442. ForceSendFields []string `json:"-"`
  2443. // NullFields is a list of field names (e.g. "Field") to include in API
  2444. // requests with the JSON null value. By default, fields with empty
  2445. // values are omitted from API requests. However, any field with an
  2446. // empty value appearing in NullFields will be sent to the server as
  2447. // null. It is an error if a field in this list has a non-empty value.
  2448. // This may be used to include null fields in Patch requests.
  2449. NullFields []string `json:"-"`
  2450. }
  2451. func (s *UnaryFilter) MarshalJSON() ([]byte, error) {
  2452. type NoMethod UnaryFilter
  2453. raw := NoMethod(*s)
  2454. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2455. }
  2456. // Value: A message that can hold any of the supported value types.
  2457. type Value struct {
  2458. // ArrayValue: An array value.
  2459. //
  2460. // Cannot directly contain another array value, though can contain
  2461. // an
  2462. // map which contains another array.
  2463. ArrayValue *ArrayValue `json:"arrayValue,omitempty"`
  2464. // BooleanValue: A boolean value.
  2465. BooleanValue bool `json:"booleanValue,omitempty"`
  2466. // BytesValue: A bytes value.
  2467. //
  2468. // Must not exceed 1 MiB - 89 bytes.
  2469. // Only the first 1,500 bytes are considered by queries.
  2470. BytesValue string `json:"bytesValue,omitempty"`
  2471. // DoubleValue: A double value.
  2472. DoubleValue float64 `json:"doubleValue,omitempty"`
  2473. // GeoPointValue: A geo point value representing a point on the surface
  2474. // of Earth.
  2475. GeoPointValue *LatLng `json:"geoPointValue,omitempty"`
  2476. // IntegerValue: An integer value.
  2477. IntegerValue int64 `json:"integerValue,omitempty,string"`
  2478. // MapValue: A map value.
  2479. MapValue *MapValue `json:"mapValue,omitempty"`
  2480. // NullValue: A null value.
  2481. //
  2482. // Possible values:
  2483. // "NULL_VALUE" - Null value.
  2484. NullValue string `json:"nullValue,omitempty"`
  2485. // ReferenceValue: A reference to a document. For
  2486. // example:
  2487. // `projects/{project_id}/databases/{database_id}/documents/{doc
  2488. // ument_path}`.
  2489. ReferenceValue string `json:"referenceValue,omitempty"`
  2490. // StringValue: A string value.
  2491. //
  2492. // The string, represented as UTF-8, must not exceed 1 MiB - 89
  2493. // bytes.
  2494. // Only the first 1,500 bytes of the UTF-8 representation are considered
  2495. // by
  2496. // queries.
  2497. StringValue string `json:"stringValue,omitempty"`
  2498. // TimestampValue: A timestamp value.
  2499. //
  2500. // Precise only to microseconds. When stored, any additional precision
  2501. // is
  2502. // rounded down.
  2503. TimestampValue string `json:"timestampValue,omitempty"`
  2504. // ForceSendFields is a list of field names (e.g. "ArrayValue") to
  2505. // unconditionally include in API requests. By default, fields with
  2506. // empty values are omitted from API requests. However, any non-pointer,
  2507. // non-interface field appearing in ForceSendFields will be sent to the
  2508. // server regardless of whether the field is empty or not. This may be
  2509. // used to include empty fields in Patch requests.
  2510. ForceSendFields []string `json:"-"`
  2511. // NullFields is a list of field names (e.g. "ArrayValue") to include in
  2512. // API requests with the JSON null value. By default, fields with empty
  2513. // values are omitted from API requests. However, any field with an
  2514. // empty value appearing in NullFields will be sent to the server as
  2515. // null. It is an error if a field in this list has a non-empty value.
  2516. // This may be used to include null fields in Patch requests.
  2517. NullFields []string `json:"-"`
  2518. }
  2519. func (s *Value) MarshalJSON() ([]byte, error) {
  2520. type NoMethod Value
  2521. raw := NoMethod(*s)
  2522. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2523. }
  2524. func (s *Value) UnmarshalJSON(data []byte) error {
  2525. type NoMethod Value
  2526. var s1 struct {
  2527. DoubleValue gensupport.JSONFloat64 `json:"doubleValue"`
  2528. *NoMethod
  2529. }
  2530. s1.NoMethod = (*NoMethod)(s)
  2531. if err := json.Unmarshal(data, &s1); err != nil {
  2532. return err
  2533. }
  2534. s.DoubleValue = float64(s1.DoubleValue)
  2535. return nil
  2536. }
  2537. // Write: A write on a document.
  2538. type Write struct {
  2539. // CurrentDocument: An optional precondition on the document.
  2540. //
  2541. // The write will fail if this is set and not met by the target
  2542. // document.
  2543. CurrentDocument *Precondition `json:"currentDocument,omitempty"`
  2544. // Delete: A document name to delete. In the
  2545. // format:
  2546. // `projects/{project_id}/databases/{database_id}/documents/{docu
  2547. // ment_path}`.
  2548. Delete string `json:"delete,omitempty"`
  2549. // Transform: Applies a tranformation to a document.
  2550. // At most one `transform` per document is allowed in a given
  2551. // request.
  2552. // An `update` cannot follow a `transform` on the same document in a
  2553. // given
  2554. // request.
  2555. Transform *DocumentTransform `json:"transform,omitempty"`
  2556. // Update: A document to write.
  2557. Update *Document `json:"update,omitempty"`
  2558. // UpdateMask: The fields to update in this write.
  2559. //
  2560. // This field can be set only when the operation is `update`.
  2561. // If the mask is not set for an `update` and the document exists,
  2562. // any
  2563. // existing data will be overwritten.
  2564. // If the mask is set and the document on the server has fields not
  2565. // covered by
  2566. // the mask, they are left unchanged.
  2567. // Fields referenced in the mask, but not present in the input document,
  2568. // are
  2569. // deleted from the document on the server.
  2570. // The field paths in this mask must not contain a reserved field name.
  2571. UpdateMask *DocumentMask `json:"updateMask,omitempty"`
  2572. // ForceSendFields is a list of field names (e.g. "CurrentDocument") to
  2573. // unconditionally include in API requests. By default, fields with
  2574. // empty values are omitted from API requests. However, any non-pointer,
  2575. // non-interface field appearing in ForceSendFields will be sent to the
  2576. // server regardless of whether the field is empty or not. This may be
  2577. // used to include empty fields in Patch requests.
  2578. ForceSendFields []string `json:"-"`
  2579. // NullFields is a list of field names (e.g. "CurrentDocument") to
  2580. // include in API requests with the JSON null value. By default, fields
  2581. // with empty values are omitted from API requests. However, any field
  2582. // with an empty value appearing in NullFields will be sent to the
  2583. // server as null. It is an error if a field in this list has a
  2584. // non-empty value. This may be used to include null fields in Patch
  2585. // requests.
  2586. NullFields []string `json:"-"`
  2587. }
  2588. func (s *Write) MarshalJSON() ([]byte, error) {
  2589. type NoMethod Write
  2590. raw := NoMethod(*s)
  2591. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2592. }
  2593. // WriteRequest: The request for Firestore.Write.
  2594. //
  2595. // The first request creates a stream, or resumes an existing one from a
  2596. // token.
  2597. //
  2598. // When creating a new stream, the server replies with a response
  2599. // containing
  2600. // only an ID and a token, to use in the next request.
  2601. //
  2602. // When resuming a stream, the server first streams any responses later
  2603. // than the
  2604. // given token, then a response containing only an up-to-date token, to
  2605. // use in
  2606. // the next request.
  2607. type WriteRequest struct {
  2608. // Labels: Labels associated with this write request.
  2609. Labels map[string]string `json:"labels,omitempty"`
  2610. // StreamId: The ID of the write stream to resume.
  2611. // This may only be set in the first message. When left empty, a new
  2612. // write
  2613. // stream will be created.
  2614. StreamId string `json:"streamId,omitempty"`
  2615. // StreamToken: A stream token that was previously sent by the
  2616. // server.
  2617. //
  2618. // The client should set this field to the token from the most
  2619. // recent
  2620. // WriteResponse it has received. This acknowledges that the client
  2621. // has
  2622. // received responses up to this token. After sending this token,
  2623. // earlier
  2624. // tokens may not be used anymore.
  2625. //
  2626. // The server may close the stream if there are too many
  2627. // unacknowledged
  2628. // responses.
  2629. //
  2630. // Leave this field unset when creating a new stream. To resume a stream
  2631. // at
  2632. // a specific point, set this field and the `stream_id` field.
  2633. //
  2634. // Leave this field unset when creating a new stream.
  2635. StreamToken string `json:"streamToken,omitempty"`
  2636. // Writes: The writes to apply.
  2637. //
  2638. // Always executed atomically and in order.
  2639. // This must be empty on the first request.
  2640. // This may be empty on the last request.
  2641. // This must not be empty on all other requests.
  2642. Writes []*Write `json:"writes,omitempty"`
  2643. // ForceSendFields is a list of field names (e.g. "Labels") to
  2644. // unconditionally include in API requests. By default, fields with
  2645. // empty values are omitted from API requests. However, any non-pointer,
  2646. // non-interface field appearing in ForceSendFields will be sent to the
  2647. // server regardless of whether the field is empty or not. This may be
  2648. // used to include empty fields in Patch requests.
  2649. ForceSendFields []string `json:"-"`
  2650. // NullFields is a list of field names (e.g. "Labels") to include in API
  2651. // requests with the JSON null value. By default, fields with empty
  2652. // values are omitted from API requests. However, any field with an
  2653. // empty value appearing in NullFields will be sent to the server as
  2654. // null. It is an error if a field in this list has a non-empty value.
  2655. // This may be used to include null fields in Patch requests.
  2656. NullFields []string `json:"-"`
  2657. }
  2658. func (s *WriteRequest) MarshalJSON() ([]byte, error) {
  2659. type NoMethod WriteRequest
  2660. raw := NoMethod(*s)
  2661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2662. }
  2663. // WriteResponse: The response for Firestore.Write.
  2664. type WriteResponse struct {
  2665. // CommitTime: The time at which the commit occurred.
  2666. CommitTime string `json:"commitTime,omitempty"`
  2667. // StreamId: The ID of the stream.
  2668. // Only set on the first message, when a new stream was created.
  2669. StreamId string `json:"streamId,omitempty"`
  2670. // StreamToken: A token that represents the position of this response in
  2671. // the stream.
  2672. // This can be used by a client to resume the stream at this
  2673. // point.
  2674. //
  2675. // This field is always set.
  2676. StreamToken string `json:"streamToken,omitempty"`
  2677. // WriteResults: The result of applying the writes.
  2678. //
  2679. // This i-th write result corresponds to the i-th write in the
  2680. // request.
  2681. WriteResults []*WriteResult `json:"writeResults,omitempty"`
  2682. // ServerResponse contains the HTTP response code and headers from the
  2683. // server.
  2684. googleapi.ServerResponse `json:"-"`
  2685. // ForceSendFields is a list of field names (e.g. "CommitTime") to
  2686. // unconditionally include in API requests. By default, fields with
  2687. // empty values are omitted from API requests. However, any non-pointer,
  2688. // non-interface field appearing in ForceSendFields will be sent to the
  2689. // server regardless of whether the field is empty or not. This may be
  2690. // used to include empty fields in Patch requests.
  2691. ForceSendFields []string `json:"-"`
  2692. // NullFields is a list of field names (e.g. "CommitTime") to include in
  2693. // API requests with the JSON null value. By default, fields with empty
  2694. // values are omitted from API requests. However, any field with an
  2695. // empty value appearing in NullFields will be sent to the server as
  2696. // null. It is an error if a field in this list has a non-empty value.
  2697. // This may be used to include null fields in Patch requests.
  2698. NullFields []string `json:"-"`
  2699. }
  2700. func (s *WriteResponse) MarshalJSON() ([]byte, error) {
  2701. type NoMethod WriteResponse
  2702. raw := NoMethod(*s)
  2703. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2704. }
  2705. // WriteResult: The result of applying a write.
  2706. type WriteResult struct {
  2707. // TransformResults: The results of applying each
  2708. // DocumentTransform.FieldTransform, in the
  2709. // same order.
  2710. TransformResults []*Value `json:"transformResults,omitempty"`
  2711. // UpdateTime: The last update time of the document after applying the
  2712. // write. Not set
  2713. // after a `delete`.
  2714. //
  2715. // If the write did not actually change the document, this will be
  2716. // the
  2717. // previous update_time.
  2718. UpdateTime string `json:"updateTime,omitempty"`
  2719. // ForceSendFields is a list of field names (e.g. "TransformResults") to
  2720. // unconditionally include in API requests. By default, fields with
  2721. // empty values are omitted from API requests. However, any non-pointer,
  2722. // non-interface field appearing in ForceSendFields will be sent to the
  2723. // server regardless of whether the field is empty or not. This may be
  2724. // used to include empty fields in Patch requests.
  2725. ForceSendFields []string `json:"-"`
  2726. // NullFields is a list of field names (e.g. "TransformResults") to
  2727. // include in API requests with the JSON null value. By default, fields
  2728. // with empty values are omitted from API requests. However, any field
  2729. // with an empty value appearing in NullFields will be sent to the
  2730. // server as null. It is an error if a field in this list has a
  2731. // non-empty value. This may be used to include null fields in Patch
  2732. // requests.
  2733. NullFields []string `json:"-"`
  2734. }
  2735. func (s *WriteResult) MarshalJSON() ([]byte, error) {
  2736. type NoMethod WriteResult
  2737. raw := NoMethod(*s)
  2738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2739. }
  2740. // method id "firestore.projects.databases.exportDocuments":
  2741. type ProjectsDatabasesExportDocumentsCall struct {
  2742. s *Service
  2743. name string
  2744. googlefirestoreadminv1beta1exportdocumentsrequest *GoogleFirestoreAdminV1beta1ExportDocumentsRequest
  2745. urlParams_ gensupport.URLParams
  2746. ctx_ context.Context
  2747. header_ http.Header
  2748. }
  2749. // ExportDocuments: Exports a copy of all or a subset of documents from
  2750. // Google Cloud Firestore
  2751. // to another storage system, such as Google Cloud Storage. Recent
  2752. // updates to
  2753. // documents may not be reflected in the export. The export occurs in
  2754. // the
  2755. // background and its progress can be monitored and managed via
  2756. // the
  2757. // Operation resource that is created. The output of an export may only
  2758. // be
  2759. // used once the associated operation is done. If an export operation
  2760. // is
  2761. // cancelled before completion it may leave partial data behind in
  2762. // Google
  2763. // Cloud Storage.
  2764. func (r *ProjectsDatabasesService) ExportDocuments(name string, googlefirestoreadminv1beta1exportdocumentsrequest *GoogleFirestoreAdminV1beta1ExportDocumentsRequest) *ProjectsDatabasesExportDocumentsCall {
  2765. c := &ProjectsDatabasesExportDocumentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2766. c.name = name
  2767. c.googlefirestoreadminv1beta1exportdocumentsrequest = googlefirestoreadminv1beta1exportdocumentsrequest
  2768. return c
  2769. }
  2770. // Fields allows partial responses to be retrieved. See
  2771. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2772. // for more information.
  2773. func (c *ProjectsDatabasesExportDocumentsCall) Fields(s ...googleapi.Field) *ProjectsDatabasesExportDocumentsCall {
  2774. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2775. return c
  2776. }
  2777. // Context sets the context to be used in this call's Do method. Any
  2778. // pending HTTP request will be aborted if the provided context is
  2779. // canceled.
  2780. func (c *ProjectsDatabasesExportDocumentsCall) Context(ctx context.Context) *ProjectsDatabasesExportDocumentsCall {
  2781. c.ctx_ = ctx
  2782. return c
  2783. }
  2784. // Header returns an http.Header that can be modified by the caller to
  2785. // add HTTP headers to the request.
  2786. func (c *ProjectsDatabasesExportDocumentsCall) Header() http.Header {
  2787. if c.header_ == nil {
  2788. c.header_ = make(http.Header)
  2789. }
  2790. return c.header_
  2791. }
  2792. func (c *ProjectsDatabasesExportDocumentsCall) doRequest(alt string) (*http.Response, error) {
  2793. reqHeaders := make(http.Header)
  2794. for k, v := range c.header_ {
  2795. reqHeaders[k] = v
  2796. }
  2797. reqHeaders.Set("User-Agent", c.s.userAgent())
  2798. var body io.Reader = nil
  2799. body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlefirestoreadminv1beta1exportdocumentsrequest)
  2800. if err != nil {
  2801. return nil, err
  2802. }
  2803. reqHeaders.Set("Content-Type", "application/json")
  2804. c.urlParams_.Set("alt", alt)
  2805. c.urlParams_.Set("prettyPrint", "false")
  2806. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:exportDocuments")
  2807. urls += "?" + c.urlParams_.Encode()
  2808. req, err := http.NewRequest("POST", urls, body)
  2809. if err != nil {
  2810. return nil, err
  2811. }
  2812. req.Header = reqHeaders
  2813. googleapi.Expand(req.URL, map[string]string{
  2814. "name": c.name,
  2815. })
  2816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2817. }
  2818. // Do executes the "firestore.projects.databases.exportDocuments" call.
  2819. // Exactly one of *GoogleLongrunningOperation or error will be non-nil.
  2820. // Any non-2xx status code is an error. Response headers are in either
  2821. // *GoogleLongrunningOperation.ServerResponse.Header or (if a response
  2822. // was returned at all) in error.(*googleapi.Error).Header. Use
  2823. // googleapi.IsNotModified to check whether the returned error was
  2824. // because http.StatusNotModified was returned.
  2825. func (c *ProjectsDatabasesExportDocumentsCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
  2826. gensupport.SetOptions(c.urlParams_, opts...)
  2827. res, err := c.doRequest("json")
  2828. if res != nil && res.StatusCode == http.StatusNotModified {
  2829. if res.Body != nil {
  2830. res.Body.Close()
  2831. }
  2832. return nil, &googleapi.Error{
  2833. Code: res.StatusCode,
  2834. Header: res.Header,
  2835. }
  2836. }
  2837. if err != nil {
  2838. return nil, err
  2839. }
  2840. defer googleapi.CloseBody(res)
  2841. if err := googleapi.CheckResponse(res); err != nil {
  2842. return nil, err
  2843. }
  2844. ret := &GoogleLongrunningOperation{
  2845. ServerResponse: googleapi.ServerResponse{
  2846. Header: res.Header,
  2847. HTTPStatusCode: res.StatusCode,
  2848. },
  2849. }
  2850. target := &ret
  2851. if err := gensupport.DecodeResponse(target, res); err != nil {
  2852. return nil, err
  2853. }
  2854. return ret, nil
  2855. // {
  2856. // "description": "Exports a copy of all or a subset of documents from Google Cloud Firestore\nto another storage system, such as Google Cloud Storage. Recent updates to\ndocuments may not be reflected in the export. The export occurs in the\nbackground and its progress can be monitored and managed via the\nOperation resource that is created. The output of an export may only be\nused once the associated operation is done. If an export operation is\ncancelled before completion it may leave partial data behind in Google\nCloud Storage.",
  2857. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}:exportDocuments",
  2858. // "httpMethod": "POST",
  2859. // "id": "firestore.projects.databases.exportDocuments",
  2860. // "parameterOrder": [
  2861. // "name"
  2862. // ],
  2863. // "parameters": {
  2864. // "name": {
  2865. // "description": "Database to export. Should be of the form:\n`projects/{project_id}/databases/{database_id}`.",
  2866. // "location": "path",
  2867. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  2868. // "required": true,
  2869. // "type": "string"
  2870. // }
  2871. // },
  2872. // "path": "v1beta1/{+name}:exportDocuments",
  2873. // "request": {
  2874. // "$ref": "GoogleFirestoreAdminV1beta1ExportDocumentsRequest"
  2875. // },
  2876. // "response": {
  2877. // "$ref": "GoogleLongrunningOperation"
  2878. // },
  2879. // "scopes": [
  2880. // "https://www.googleapis.com/auth/cloud-platform",
  2881. // "https://www.googleapis.com/auth/datastore"
  2882. // ]
  2883. // }
  2884. }
  2885. // method id "firestore.projects.databases.importDocuments":
  2886. type ProjectsDatabasesImportDocumentsCall struct {
  2887. s *Service
  2888. name string
  2889. googlefirestoreadminv1beta1importdocumentsrequest *GoogleFirestoreAdminV1beta1ImportDocumentsRequest
  2890. urlParams_ gensupport.URLParams
  2891. ctx_ context.Context
  2892. header_ http.Header
  2893. }
  2894. // ImportDocuments: Imports documents into Google Cloud Firestore.
  2895. // Existing documents with the
  2896. // same name are overwritten. The import occurs in the background and
  2897. // its
  2898. // progress can be monitored and managed via the Operation resource that
  2899. // is
  2900. // created. If an ImportDocuments operation is cancelled, it is
  2901. // possible
  2902. // that a subset of the data has already been imported to Cloud
  2903. // Firestore.
  2904. func (r *ProjectsDatabasesService) ImportDocuments(name string, googlefirestoreadminv1beta1importdocumentsrequest *GoogleFirestoreAdminV1beta1ImportDocumentsRequest) *ProjectsDatabasesImportDocumentsCall {
  2905. c := &ProjectsDatabasesImportDocumentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2906. c.name = name
  2907. c.googlefirestoreadminv1beta1importdocumentsrequest = googlefirestoreadminv1beta1importdocumentsrequest
  2908. return c
  2909. }
  2910. // Fields allows partial responses to be retrieved. See
  2911. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2912. // for more information.
  2913. func (c *ProjectsDatabasesImportDocumentsCall) Fields(s ...googleapi.Field) *ProjectsDatabasesImportDocumentsCall {
  2914. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2915. return c
  2916. }
  2917. // Context sets the context to be used in this call's Do method. Any
  2918. // pending HTTP request will be aborted if the provided context is
  2919. // canceled.
  2920. func (c *ProjectsDatabasesImportDocumentsCall) Context(ctx context.Context) *ProjectsDatabasesImportDocumentsCall {
  2921. c.ctx_ = ctx
  2922. return c
  2923. }
  2924. // Header returns an http.Header that can be modified by the caller to
  2925. // add HTTP headers to the request.
  2926. func (c *ProjectsDatabasesImportDocumentsCall) Header() http.Header {
  2927. if c.header_ == nil {
  2928. c.header_ = make(http.Header)
  2929. }
  2930. return c.header_
  2931. }
  2932. func (c *ProjectsDatabasesImportDocumentsCall) doRequest(alt string) (*http.Response, error) {
  2933. reqHeaders := make(http.Header)
  2934. for k, v := range c.header_ {
  2935. reqHeaders[k] = v
  2936. }
  2937. reqHeaders.Set("User-Agent", c.s.userAgent())
  2938. var body io.Reader = nil
  2939. body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlefirestoreadminv1beta1importdocumentsrequest)
  2940. if err != nil {
  2941. return nil, err
  2942. }
  2943. reqHeaders.Set("Content-Type", "application/json")
  2944. c.urlParams_.Set("alt", alt)
  2945. c.urlParams_.Set("prettyPrint", "false")
  2946. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:importDocuments")
  2947. urls += "?" + c.urlParams_.Encode()
  2948. req, err := http.NewRequest("POST", urls, body)
  2949. if err != nil {
  2950. return nil, err
  2951. }
  2952. req.Header = reqHeaders
  2953. googleapi.Expand(req.URL, map[string]string{
  2954. "name": c.name,
  2955. })
  2956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2957. }
  2958. // Do executes the "firestore.projects.databases.importDocuments" call.
  2959. // Exactly one of *GoogleLongrunningOperation or error will be non-nil.
  2960. // Any non-2xx status code is an error. Response headers are in either
  2961. // *GoogleLongrunningOperation.ServerResponse.Header or (if a response
  2962. // was returned at all) in error.(*googleapi.Error).Header. Use
  2963. // googleapi.IsNotModified to check whether the returned error was
  2964. // because http.StatusNotModified was returned.
  2965. func (c *ProjectsDatabasesImportDocumentsCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
  2966. gensupport.SetOptions(c.urlParams_, opts...)
  2967. res, err := c.doRequest("json")
  2968. if res != nil && res.StatusCode == http.StatusNotModified {
  2969. if res.Body != nil {
  2970. res.Body.Close()
  2971. }
  2972. return nil, &googleapi.Error{
  2973. Code: res.StatusCode,
  2974. Header: res.Header,
  2975. }
  2976. }
  2977. if err != nil {
  2978. return nil, err
  2979. }
  2980. defer googleapi.CloseBody(res)
  2981. if err := googleapi.CheckResponse(res); err != nil {
  2982. return nil, err
  2983. }
  2984. ret := &GoogleLongrunningOperation{
  2985. ServerResponse: googleapi.ServerResponse{
  2986. Header: res.Header,
  2987. HTTPStatusCode: res.StatusCode,
  2988. },
  2989. }
  2990. target := &ret
  2991. if err := gensupport.DecodeResponse(target, res); err != nil {
  2992. return nil, err
  2993. }
  2994. return ret, nil
  2995. // {
  2996. // "description": "Imports documents into Google Cloud Firestore. Existing documents with the\nsame name are overwritten. The import occurs in the background and its\nprogress can be monitored and managed via the Operation resource that is\ncreated. If an ImportDocuments operation is cancelled, it is possible\nthat a subset of the data has already been imported to Cloud Firestore.",
  2997. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}:importDocuments",
  2998. // "httpMethod": "POST",
  2999. // "id": "firestore.projects.databases.importDocuments",
  3000. // "parameterOrder": [
  3001. // "name"
  3002. // ],
  3003. // "parameters": {
  3004. // "name": {
  3005. // "description": "Database to import into. Should be of the form:\n`projects/{project_id}/databases/{database_id}`.",
  3006. // "location": "path",
  3007. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  3008. // "required": true,
  3009. // "type": "string"
  3010. // }
  3011. // },
  3012. // "path": "v1beta1/{+name}:importDocuments",
  3013. // "request": {
  3014. // "$ref": "GoogleFirestoreAdminV1beta1ImportDocumentsRequest"
  3015. // },
  3016. // "response": {
  3017. // "$ref": "GoogleLongrunningOperation"
  3018. // },
  3019. // "scopes": [
  3020. // "https://www.googleapis.com/auth/cloud-platform",
  3021. // "https://www.googleapis.com/auth/datastore"
  3022. // ]
  3023. // }
  3024. }
  3025. // method id "firestore.projects.databases.documents.batchGet":
  3026. type ProjectsDatabasesDocumentsBatchGetCall struct {
  3027. s *Service
  3028. database string
  3029. batchgetdocumentsrequest *BatchGetDocumentsRequest
  3030. urlParams_ gensupport.URLParams
  3031. ctx_ context.Context
  3032. header_ http.Header
  3033. }
  3034. // BatchGet: Gets multiple documents.
  3035. //
  3036. // Documents returned by this method are not guaranteed to be returned
  3037. // in the
  3038. // same order that they were requested.
  3039. func (r *ProjectsDatabasesDocumentsService) BatchGet(database string, batchgetdocumentsrequest *BatchGetDocumentsRequest) *ProjectsDatabasesDocumentsBatchGetCall {
  3040. c := &ProjectsDatabasesDocumentsBatchGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3041. c.database = database
  3042. c.batchgetdocumentsrequest = batchgetdocumentsrequest
  3043. return c
  3044. }
  3045. // Fields allows partial responses to be retrieved. See
  3046. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3047. // for more information.
  3048. func (c *ProjectsDatabasesDocumentsBatchGetCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsBatchGetCall {
  3049. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3050. return c
  3051. }
  3052. // Context sets the context to be used in this call's Do method. Any
  3053. // pending HTTP request will be aborted if the provided context is
  3054. // canceled.
  3055. func (c *ProjectsDatabasesDocumentsBatchGetCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsBatchGetCall {
  3056. c.ctx_ = ctx
  3057. return c
  3058. }
  3059. // Header returns an http.Header that can be modified by the caller to
  3060. // add HTTP headers to the request.
  3061. func (c *ProjectsDatabasesDocumentsBatchGetCall) Header() http.Header {
  3062. if c.header_ == nil {
  3063. c.header_ = make(http.Header)
  3064. }
  3065. return c.header_
  3066. }
  3067. func (c *ProjectsDatabasesDocumentsBatchGetCall) doRequest(alt string) (*http.Response, error) {
  3068. reqHeaders := make(http.Header)
  3069. for k, v := range c.header_ {
  3070. reqHeaders[k] = v
  3071. }
  3072. reqHeaders.Set("User-Agent", c.s.userAgent())
  3073. var body io.Reader = nil
  3074. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchgetdocumentsrequest)
  3075. if err != nil {
  3076. return nil, err
  3077. }
  3078. reqHeaders.Set("Content-Type", "application/json")
  3079. c.urlParams_.Set("alt", alt)
  3080. c.urlParams_.Set("prettyPrint", "false")
  3081. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:batchGet")
  3082. urls += "?" + c.urlParams_.Encode()
  3083. req, err := http.NewRequest("POST", urls, body)
  3084. if err != nil {
  3085. return nil, err
  3086. }
  3087. req.Header = reqHeaders
  3088. googleapi.Expand(req.URL, map[string]string{
  3089. "database": c.database,
  3090. })
  3091. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3092. }
  3093. // Do executes the "firestore.projects.databases.documents.batchGet" call.
  3094. // Exactly one of *BatchGetDocumentsResponse or error will be non-nil.
  3095. // Any non-2xx status code is an error. Response headers are in either
  3096. // *BatchGetDocumentsResponse.ServerResponse.Header or (if a response
  3097. // was returned at all) in error.(*googleapi.Error).Header. Use
  3098. // googleapi.IsNotModified to check whether the returned error was
  3099. // because http.StatusNotModified was returned.
  3100. func (c *ProjectsDatabasesDocumentsBatchGetCall) Do(opts ...googleapi.CallOption) (*BatchGetDocumentsResponse, error) {
  3101. gensupport.SetOptions(c.urlParams_, opts...)
  3102. res, err := c.doRequest("json")
  3103. if res != nil && res.StatusCode == http.StatusNotModified {
  3104. if res.Body != nil {
  3105. res.Body.Close()
  3106. }
  3107. return nil, &googleapi.Error{
  3108. Code: res.StatusCode,
  3109. Header: res.Header,
  3110. }
  3111. }
  3112. if err != nil {
  3113. return nil, err
  3114. }
  3115. defer googleapi.CloseBody(res)
  3116. if err := googleapi.CheckResponse(res); err != nil {
  3117. return nil, err
  3118. }
  3119. ret := &BatchGetDocumentsResponse{
  3120. ServerResponse: googleapi.ServerResponse{
  3121. Header: res.Header,
  3122. HTTPStatusCode: res.StatusCode,
  3123. },
  3124. }
  3125. target := &ret
  3126. if err := gensupport.DecodeResponse(target, res); err != nil {
  3127. return nil, err
  3128. }
  3129. return ret, nil
  3130. // {
  3131. // "description": "Gets multiple documents.\n\nDocuments returned by this method are not guaranteed to be returned in the\nsame order that they were requested.",
  3132. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:batchGet",
  3133. // "httpMethod": "POST",
  3134. // "id": "firestore.projects.databases.documents.batchGet",
  3135. // "parameterOrder": [
  3136. // "database"
  3137. // ],
  3138. // "parameters": {
  3139. // "database": {
  3140. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.",
  3141. // "location": "path",
  3142. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  3143. // "required": true,
  3144. // "type": "string"
  3145. // }
  3146. // },
  3147. // "path": "v1beta1/{+database}/documents:batchGet",
  3148. // "request": {
  3149. // "$ref": "BatchGetDocumentsRequest"
  3150. // },
  3151. // "response": {
  3152. // "$ref": "BatchGetDocumentsResponse"
  3153. // },
  3154. // "scopes": [
  3155. // "https://www.googleapis.com/auth/cloud-platform",
  3156. // "https://www.googleapis.com/auth/datastore"
  3157. // ]
  3158. // }
  3159. }
  3160. // method id "firestore.projects.databases.documents.beginTransaction":
  3161. type ProjectsDatabasesDocumentsBeginTransactionCall struct {
  3162. s *Service
  3163. database string
  3164. begintransactionrequest *BeginTransactionRequest
  3165. urlParams_ gensupport.URLParams
  3166. ctx_ context.Context
  3167. header_ http.Header
  3168. }
  3169. // BeginTransaction: Starts a new transaction.
  3170. func (r *ProjectsDatabasesDocumentsService) BeginTransaction(database string, begintransactionrequest *BeginTransactionRequest) *ProjectsDatabasesDocumentsBeginTransactionCall {
  3171. c := &ProjectsDatabasesDocumentsBeginTransactionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3172. c.database = database
  3173. c.begintransactionrequest = begintransactionrequest
  3174. return c
  3175. }
  3176. // Fields allows partial responses to be retrieved. See
  3177. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3178. // for more information.
  3179. func (c *ProjectsDatabasesDocumentsBeginTransactionCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsBeginTransactionCall {
  3180. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3181. return c
  3182. }
  3183. // Context sets the context to be used in this call's Do method. Any
  3184. // pending HTTP request will be aborted if the provided context is
  3185. // canceled.
  3186. func (c *ProjectsDatabasesDocumentsBeginTransactionCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsBeginTransactionCall {
  3187. c.ctx_ = ctx
  3188. return c
  3189. }
  3190. // Header returns an http.Header that can be modified by the caller to
  3191. // add HTTP headers to the request.
  3192. func (c *ProjectsDatabasesDocumentsBeginTransactionCall) Header() http.Header {
  3193. if c.header_ == nil {
  3194. c.header_ = make(http.Header)
  3195. }
  3196. return c.header_
  3197. }
  3198. func (c *ProjectsDatabasesDocumentsBeginTransactionCall) doRequest(alt string) (*http.Response, error) {
  3199. reqHeaders := make(http.Header)
  3200. for k, v := range c.header_ {
  3201. reqHeaders[k] = v
  3202. }
  3203. reqHeaders.Set("User-Agent", c.s.userAgent())
  3204. var body io.Reader = nil
  3205. body, err := googleapi.WithoutDataWrapper.JSONReader(c.begintransactionrequest)
  3206. if err != nil {
  3207. return nil, err
  3208. }
  3209. reqHeaders.Set("Content-Type", "application/json")
  3210. c.urlParams_.Set("alt", alt)
  3211. c.urlParams_.Set("prettyPrint", "false")
  3212. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:beginTransaction")
  3213. urls += "?" + c.urlParams_.Encode()
  3214. req, err := http.NewRequest("POST", urls, body)
  3215. if err != nil {
  3216. return nil, err
  3217. }
  3218. req.Header = reqHeaders
  3219. googleapi.Expand(req.URL, map[string]string{
  3220. "database": c.database,
  3221. })
  3222. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3223. }
  3224. // Do executes the "firestore.projects.databases.documents.beginTransaction" call.
  3225. // Exactly one of *BeginTransactionResponse or error will be non-nil.
  3226. // Any non-2xx status code is an error. Response headers are in either
  3227. // *BeginTransactionResponse.ServerResponse.Header or (if a response was
  3228. // returned at all) in error.(*googleapi.Error).Header. Use
  3229. // googleapi.IsNotModified to check whether the returned error was
  3230. // because http.StatusNotModified was returned.
  3231. func (c *ProjectsDatabasesDocumentsBeginTransactionCall) Do(opts ...googleapi.CallOption) (*BeginTransactionResponse, error) {
  3232. gensupport.SetOptions(c.urlParams_, opts...)
  3233. res, err := c.doRequest("json")
  3234. if res != nil && res.StatusCode == http.StatusNotModified {
  3235. if res.Body != nil {
  3236. res.Body.Close()
  3237. }
  3238. return nil, &googleapi.Error{
  3239. Code: res.StatusCode,
  3240. Header: res.Header,
  3241. }
  3242. }
  3243. if err != nil {
  3244. return nil, err
  3245. }
  3246. defer googleapi.CloseBody(res)
  3247. if err := googleapi.CheckResponse(res); err != nil {
  3248. return nil, err
  3249. }
  3250. ret := &BeginTransactionResponse{
  3251. ServerResponse: googleapi.ServerResponse{
  3252. Header: res.Header,
  3253. HTTPStatusCode: res.StatusCode,
  3254. },
  3255. }
  3256. target := &ret
  3257. if err := gensupport.DecodeResponse(target, res); err != nil {
  3258. return nil, err
  3259. }
  3260. return ret, nil
  3261. // {
  3262. // "description": "Starts a new transaction.",
  3263. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:beginTransaction",
  3264. // "httpMethod": "POST",
  3265. // "id": "firestore.projects.databases.documents.beginTransaction",
  3266. // "parameterOrder": [
  3267. // "database"
  3268. // ],
  3269. // "parameters": {
  3270. // "database": {
  3271. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.",
  3272. // "location": "path",
  3273. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  3274. // "required": true,
  3275. // "type": "string"
  3276. // }
  3277. // },
  3278. // "path": "v1beta1/{+database}/documents:beginTransaction",
  3279. // "request": {
  3280. // "$ref": "BeginTransactionRequest"
  3281. // },
  3282. // "response": {
  3283. // "$ref": "BeginTransactionResponse"
  3284. // },
  3285. // "scopes": [
  3286. // "https://www.googleapis.com/auth/cloud-platform",
  3287. // "https://www.googleapis.com/auth/datastore"
  3288. // ]
  3289. // }
  3290. }
  3291. // method id "firestore.projects.databases.documents.commit":
  3292. type ProjectsDatabasesDocumentsCommitCall struct {
  3293. s *Service
  3294. database string
  3295. commitrequest *CommitRequest
  3296. urlParams_ gensupport.URLParams
  3297. ctx_ context.Context
  3298. header_ http.Header
  3299. }
  3300. // Commit: Commits a transaction, while optionally updating documents.
  3301. func (r *ProjectsDatabasesDocumentsService) Commit(database string, commitrequest *CommitRequest) *ProjectsDatabasesDocumentsCommitCall {
  3302. c := &ProjectsDatabasesDocumentsCommitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3303. c.database = database
  3304. c.commitrequest = commitrequest
  3305. return c
  3306. }
  3307. // Fields allows partial responses to be retrieved. See
  3308. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3309. // for more information.
  3310. func (c *ProjectsDatabasesDocumentsCommitCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsCommitCall {
  3311. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3312. return c
  3313. }
  3314. // Context sets the context to be used in this call's Do method. Any
  3315. // pending HTTP request will be aborted if the provided context is
  3316. // canceled.
  3317. func (c *ProjectsDatabasesDocumentsCommitCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsCommitCall {
  3318. c.ctx_ = ctx
  3319. return c
  3320. }
  3321. // Header returns an http.Header that can be modified by the caller to
  3322. // add HTTP headers to the request.
  3323. func (c *ProjectsDatabasesDocumentsCommitCall) Header() http.Header {
  3324. if c.header_ == nil {
  3325. c.header_ = make(http.Header)
  3326. }
  3327. return c.header_
  3328. }
  3329. func (c *ProjectsDatabasesDocumentsCommitCall) doRequest(alt string) (*http.Response, error) {
  3330. reqHeaders := make(http.Header)
  3331. for k, v := range c.header_ {
  3332. reqHeaders[k] = v
  3333. }
  3334. reqHeaders.Set("User-Agent", c.s.userAgent())
  3335. var body io.Reader = nil
  3336. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commitrequest)
  3337. if err != nil {
  3338. return nil, err
  3339. }
  3340. reqHeaders.Set("Content-Type", "application/json")
  3341. c.urlParams_.Set("alt", alt)
  3342. c.urlParams_.Set("prettyPrint", "false")
  3343. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:commit")
  3344. urls += "?" + c.urlParams_.Encode()
  3345. req, err := http.NewRequest("POST", urls, body)
  3346. if err != nil {
  3347. return nil, err
  3348. }
  3349. req.Header = reqHeaders
  3350. googleapi.Expand(req.URL, map[string]string{
  3351. "database": c.database,
  3352. })
  3353. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3354. }
  3355. // Do executes the "firestore.projects.databases.documents.commit" call.
  3356. // Exactly one of *CommitResponse or error will be non-nil. Any non-2xx
  3357. // status code is an error. Response headers are in either
  3358. // *CommitResponse.ServerResponse.Header or (if a response was returned
  3359. // at all) in error.(*googleapi.Error).Header. Use
  3360. // googleapi.IsNotModified to check whether the returned error was
  3361. // because http.StatusNotModified was returned.
  3362. func (c *ProjectsDatabasesDocumentsCommitCall) Do(opts ...googleapi.CallOption) (*CommitResponse, error) {
  3363. gensupport.SetOptions(c.urlParams_, opts...)
  3364. res, err := c.doRequest("json")
  3365. if res != nil && res.StatusCode == http.StatusNotModified {
  3366. if res.Body != nil {
  3367. res.Body.Close()
  3368. }
  3369. return nil, &googleapi.Error{
  3370. Code: res.StatusCode,
  3371. Header: res.Header,
  3372. }
  3373. }
  3374. if err != nil {
  3375. return nil, err
  3376. }
  3377. defer googleapi.CloseBody(res)
  3378. if err := googleapi.CheckResponse(res); err != nil {
  3379. return nil, err
  3380. }
  3381. ret := &CommitResponse{
  3382. ServerResponse: googleapi.ServerResponse{
  3383. Header: res.Header,
  3384. HTTPStatusCode: res.StatusCode,
  3385. },
  3386. }
  3387. target := &ret
  3388. if err := gensupport.DecodeResponse(target, res); err != nil {
  3389. return nil, err
  3390. }
  3391. return ret, nil
  3392. // {
  3393. // "description": "Commits a transaction, while optionally updating documents.",
  3394. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:commit",
  3395. // "httpMethod": "POST",
  3396. // "id": "firestore.projects.databases.documents.commit",
  3397. // "parameterOrder": [
  3398. // "database"
  3399. // ],
  3400. // "parameters": {
  3401. // "database": {
  3402. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.",
  3403. // "location": "path",
  3404. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  3405. // "required": true,
  3406. // "type": "string"
  3407. // }
  3408. // },
  3409. // "path": "v1beta1/{+database}/documents:commit",
  3410. // "request": {
  3411. // "$ref": "CommitRequest"
  3412. // },
  3413. // "response": {
  3414. // "$ref": "CommitResponse"
  3415. // },
  3416. // "scopes": [
  3417. // "https://www.googleapis.com/auth/cloud-platform",
  3418. // "https://www.googleapis.com/auth/datastore"
  3419. // ]
  3420. // }
  3421. }
  3422. // method id "firestore.projects.databases.documents.createDocument":
  3423. type ProjectsDatabasesDocumentsCreateDocumentCall struct {
  3424. s *Service
  3425. parent string
  3426. collectionId string
  3427. document *Document
  3428. urlParams_ gensupport.URLParams
  3429. ctx_ context.Context
  3430. header_ http.Header
  3431. }
  3432. // CreateDocument: Creates a new document.
  3433. func (r *ProjectsDatabasesDocumentsService) CreateDocument(parent string, collectionId string, document *Document) *ProjectsDatabasesDocumentsCreateDocumentCall {
  3434. c := &ProjectsDatabasesDocumentsCreateDocumentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3435. c.parent = parent
  3436. c.collectionId = collectionId
  3437. c.document = document
  3438. return c
  3439. }
  3440. // DocumentId sets the optional parameter "documentId": The
  3441. // client-assigned document ID to use for this document.
  3442. //
  3443. // If not specified, an ID will be assigned by the service.
  3444. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) DocumentId(documentId string) *ProjectsDatabasesDocumentsCreateDocumentCall {
  3445. c.urlParams_.Set("documentId", documentId)
  3446. return c
  3447. }
  3448. // MaskFieldPaths sets the optional parameter "mask.fieldPaths": The
  3449. // list of field paths in the mask. See Document.fields for a field
  3450. // path syntax reference.
  3451. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) MaskFieldPaths(maskFieldPaths ...string) *ProjectsDatabasesDocumentsCreateDocumentCall {
  3452. c.urlParams_.SetMulti("mask.fieldPaths", append([]string{}, maskFieldPaths...))
  3453. return c
  3454. }
  3455. // Fields allows partial responses to be retrieved. See
  3456. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3457. // for more information.
  3458. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsCreateDocumentCall {
  3459. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3460. return c
  3461. }
  3462. // Context sets the context to be used in this call's Do method. Any
  3463. // pending HTTP request will be aborted if the provided context is
  3464. // canceled.
  3465. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsCreateDocumentCall {
  3466. c.ctx_ = ctx
  3467. return c
  3468. }
  3469. // Header returns an http.Header that can be modified by the caller to
  3470. // add HTTP headers to the request.
  3471. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) Header() http.Header {
  3472. if c.header_ == nil {
  3473. c.header_ = make(http.Header)
  3474. }
  3475. return c.header_
  3476. }
  3477. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) doRequest(alt string) (*http.Response, error) {
  3478. reqHeaders := make(http.Header)
  3479. for k, v := range c.header_ {
  3480. reqHeaders[k] = v
  3481. }
  3482. reqHeaders.Set("User-Agent", c.s.userAgent())
  3483. var body io.Reader = nil
  3484. body, err := googleapi.WithoutDataWrapper.JSONReader(c.document)
  3485. if err != nil {
  3486. return nil, err
  3487. }
  3488. reqHeaders.Set("Content-Type", "application/json")
  3489. c.urlParams_.Set("alt", alt)
  3490. c.urlParams_.Set("prettyPrint", "false")
  3491. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/{collectionId}")
  3492. urls += "?" + c.urlParams_.Encode()
  3493. req, err := http.NewRequest("POST", urls, body)
  3494. if err != nil {
  3495. return nil, err
  3496. }
  3497. req.Header = reqHeaders
  3498. googleapi.Expand(req.URL, map[string]string{
  3499. "parent": c.parent,
  3500. "collectionId": c.collectionId,
  3501. })
  3502. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3503. }
  3504. // Do executes the "firestore.projects.databases.documents.createDocument" call.
  3505. // Exactly one of *Document or error will be non-nil. Any non-2xx status
  3506. // code is an error. Response headers are in either
  3507. // *Document.ServerResponse.Header or (if a response was returned at
  3508. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3509. // to check whether the returned error was because
  3510. // http.StatusNotModified was returned.
  3511. func (c *ProjectsDatabasesDocumentsCreateDocumentCall) Do(opts ...googleapi.CallOption) (*Document, error) {
  3512. gensupport.SetOptions(c.urlParams_, opts...)
  3513. res, err := c.doRequest("json")
  3514. if res != nil && res.StatusCode == http.StatusNotModified {
  3515. if res.Body != nil {
  3516. res.Body.Close()
  3517. }
  3518. return nil, &googleapi.Error{
  3519. Code: res.StatusCode,
  3520. Header: res.Header,
  3521. }
  3522. }
  3523. if err != nil {
  3524. return nil, err
  3525. }
  3526. defer googleapi.CloseBody(res)
  3527. if err := googleapi.CheckResponse(res); err != nil {
  3528. return nil, err
  3529. }
  3530. ret := &Document{
  3531. ServerResponse: googleapi.ServerResponse{
  3532. Header: res.Header,
  3533. HTTPStatusCode: res.StatusCode,
  3534. },
  3535. }
  3536. target := &ret
  3537. if err := gensupport.DecodeResponse(target, res); err != nil {
  3538. return nil, err
  3539. }
  3540. return ret, nil
  3541. // {
  3542. // "description": "Creates a new document.",
  3543. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{collectionId}",
  3544. // "httpMethod": "POST",
  3545. // "id": "firestore.projects.databases.documents.createDocument",
  3546. // "parameterOrder": [
  3547. // "parent",
  3548. // "collectionId"
  3549. // ],
  3550. // "parameters": {
  3551. // "collectionId": {
  3552. // "description": "The collection ID, relative to `parent`, to list. For example: `chatrooms`.",
  3553. // "location": "path",
  3554. // "required": true,
  3555. // "type": "string"
  3556. // },
  3557. // "documentId": {
  3558. // "description": "The client-assigned document ID to use for this document.\n\nOptional. If not specified, an ID will be assigned by the service.",
  3559. // "location": "query",
  3560. // "type": "string"
  3561. // },
  3562. // "mask.fieldPaths": {
  3563. // "description": "The list of field paths in the mask. See Document.fields for a field\npath syntax reference.",
  3564. // "location": "query",
  3565. // "repeated": true,
  3566. // "type": "string"
  3567. // },
  3568. // "parent": {
  3569. // "description": "The parent resource. For example:\n`projects/{project_id}/databases/{database_id}/documents` or\n`projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`",
  3570. // "location": "path",
  3571. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/.+$",
  3572. // "required": true,
  3573. // "type": "string"
  3574. // }
  3575. // },
  3576. // "path": "v1beta1/{+parent}/{collectionId}",
  3577. // "request": {
  3578. // "$ref": "Document"
  3579. // },
  3580. // "response": {
  3581. // "$ref": "Document"
  3582. // },
  3583. // "scopes": [
  3584. // "https://www.googleapis.com/auth/cloud-platform",
  3585. // "https://www.googleapis.com/auth/datastore"
  3586. // ]
  3587. // }
  3588. }
  3589. // method id "firestore.projects.databases.documents.delete":
  3590. type ProjectsDatabasesDocumentsDeleteCall struct {
  3591. s *Service
  3592. name string
  3593. urlParams_ gensupport.URLParams
  3594. ctx_ context.Context
  3595. header_ http.Header
  3596. }
  3597. // Delete: Deletes a document.
  3598. func (r *ProjectsDatabasesDocumentsService) Delete(name string) *ProjectsDatabasesDocumentsDeleteCall {
  3599. c := &ProjectsDatabasesDocumentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3600. c.name = name
  3601. return c
  3602. }
  3603. // CurrentDocumentExists sets the optional parameter
  3604. // "currentDocument.exists": When set to `true`, the target document
  3605. // must exist.
  3606. // When set to `false`, the target document must not exist.
  3607. func (c *ProjectsDatabasesDocumentsDeleteCall) CurrentDocumentExists(currentDocumentExists bool) *ProjectsDatabasesDocumentsDeleteCall {
  3608. c.urlParams_.Set("currentDocument.exists", fmt.Sprint(currentDocumentExists))
  3609. return c
  3610. }
  3611. // CurrentDocumentUpdateTime sets the optional parameter
  3612. // "currentDocument.updateTime": When set, the target document must
  3613. // exist and have been last updated at
  3614. // that time.
  3615. func (c *ProjectsDatabasesDocumentsDeleteCall) CurrentDocumentUpdateTime(currentDocumentUpdateTime string) *ProjectsDatabasesDocumentsDeleteCall {
  3616. c.urlParams_.Set("currentDocument.updateTime", currentDocumentUpdateTime)
  3617. return c
  3618. }
  3619. // Fields allows partial responses to be retrieved. See
  3620. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3621. // for more information.
  3622. func (c *ProjectsDatabasesDocumentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsDeleteCall {
  3623. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3624. return c
  3625. }
  3626. // Context sets the context to be used in this call's Do method. Any
  3627. // pending HTTP request will be aborted if the provided context is
  3628. // canceled.
  3629. func (c *ProjectsDatabasesDocumentsDeleteCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsDeleteCall {
  3630. c.ctx_ = ctx
  3631. return c
  3632. }
  3633. // Header returns an http.Header that can be modified by the caller to
  3634. // add HTTP headers to the request.
  3635. func (c *ProjectsDatabasesDocumentsDeleteCall) Header() http.Header {
  3636. if c.header_ == nil {
  3637. c.header_ = make(http.Header)
  3638. }
  3639. return c.header_
  3640. }
  3641. func (c *ProjectsDatabasesDocumentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3642. reqHeaders := make(http.Header)
  3643. for k, v := range c.header_ {
  3644. reqHeaders[k] = v
  3645. }
  3646. reqHeaders.Set("User-Agent", c.s.userAgent())
  3647. var body io.Reader = nil
  3648. c.urlParams_.Set("alt", alt)
  3649. c.urlParams_.Set("prettyPrint", "false")
  3650. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3651. urls += "?" + c.urlParams_.Encode()
  3652. req, err := http.NewRequest("DELETE", urls, body)
  3653. if err != nil {
  3654. return nil, err
  3655. }
  3656. req.Header = reqHeaders
  3657. googleapi.Expand(req.URL, map[string]string{
  3658. "name": c.name,
  3659. })
  3660. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3661. }
  3662. // Do executes the "firestore.projects.databases.documents.delete" call.
  3663. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3664. // code is an error. Response headers are in either
  3665. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3666. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3667. // check whether the returned error was because http.StatusNotModified
  3668. // was returned.
  3669. func (c *ProjectsDatabasesDocumentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3670. gensupport.SetOptions(c.urlParams_, opts...)
  3671. res, err := c.doRequest("json")
  3672. if res != nil && res.StatusCode == http.StatusNotModified {
  3673. if res.Body != nil {
  3674. res.Body.Close()
  3675. }
  3676. return nil, &googleapi.Error{
  3677. Code: res.StatusCode,
  3678. Header: res.Header,
  3679. }
  3680. }
  3681. if err != nil {
  3682. return nil, err
  3683. }
  3684. defer googleapi.CloseBody(res)
  3685. if err := googleapi.CheckResponse(res); err != nil {
  3686. return nil, err
  3687. }
  3688. ret := &Empty{
  3689. ServerResponse: googleapi.ServerResponse{
  3690. Header: res.Header,
  3691. HTTPStatusCode: res.StatusCode,
  3692. },
  3693. }
  3694. target := &ret
  3695. if err := gensupport.DecodeResponse(target, res); err != nil {
  3696. return nil, err
  3697. }
  3698. return ret, nil
  3699. // {
  3700. // "description": "Deletes a document.",
  3701. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}",
  3702. // "httpMethod": "DELETE",
  3703. // "id": "firestore.projects.databases.documents.delete",
  3704. // "parameterOrder": [
  3705. // "name"
  3706. // ],
  3707. // "parameters": {
  3708. // "currentDocument.exists": {
  3709. // "description": "When set to `true`, the target document must exist.\nWhen set to `false`, the target document must not exist.",
  3710. // "location": "query",
  3711. // "type": "boolean"
  3712. // },
  3713. // "currentDocument.updateTime": {
  3714. // "description": "When set, the target document must exist and have been last updated at\nthat time.",
  3715. // "format": "google-datetime",
  3716. // "location": "query",
  3717. // "type": "string"
  3718. // },
  3719. // "name": {
  3720. // "description": "The resource name of the Document to delete. In the format:\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.",
  3721. // "location": "path",
  3722. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  3723. // "required": true,
  3724. // "type": "string"
  3725. // }
  3726. // },
  3727. // "path": "v1beta1/{+name}",
  3728. // "response": {
  3729. // "$ref": "Empty"
  3730. // },
  3731. // "scopes": [
  3732. // "https://www.googleapis.com/auth/cloud-platform",
  3733. // "https://www.googleapis.com/auth/datastore"
  3734. // ]
  3735. // }
  3736. }
  3737. // method id "firestore.projects.databases.documents.get":
  3738. type ProjectsDatabasesDocumentsGetCall struct {
  3739. s *Service
  3740. name string
  3741. urlParams_ gensupport.URLParams
  3742. ifNoneMatch_ string
  3743. ctx_ context.Context
  3744. header_ http.Header
  3745. }
  3746. // Get: Gets a single document.
  3747. func (r *ProjectsDatabasesDocumentsService) Get(name string) *ProjectsDatabasesDocumentsGetCall {
  3748. c := &ProjectsDatabasesDocumentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3749. c.name = name
  3750. return c
  3751. }
  3752. // MaskFieldPaths sets the optional parameter "mask.fieldPaths": The
  3753. // list of field paths in the mask. See Document.fields for a field
  3754. // path syntax reference.
  3755. func (c *ProjectsDatabasesDocumentsGetCall) MaskFieldPaths(maskFieldPaths ...string) *ProjectsDatabasesDocumentsGetCall {
  3756. c.urlParams_.SetMulti("mask.fieldPaths", append([]string{}, maskFieldPaths...))
  3757. return c
  3758. }
  3759. // ReadTime sets the optional parameter "readTime": Reads the version of
  3760. // the document at the given time.
  3761. // This may not be older than 60 seconds.
  3762. func (c *ProjectsDatabasesDocumentsGetCall) ReadTime(readTime string) *ProjectsDatabasesDocumentsGetCall {
  3763. c.urlParams_.Set("readTime", readTime)
  3764. return c
  3765. }
  3766. // Transaction sets the optional parameter "transaction": Reads the
  3767. // document in a transaction.
  3768. func (c *ProjectsDatabasesDocumentsGetCall) Transaction(transaction string) *ProjectsDatabasesDocumentsGetCall {
  3769. c.urlParams_.Set("transaction", transaction)
  3770. return c
  3771. }
  3772. // Fields allows partial responses to be retrieved. See
  3773. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3774. // for more information.
  3775. func (c *ProjectsDatabasesDocumentsGetCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsGetCall {
  3776. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3777. return c
  3778. }
  3779. // IfNoneMatch sets the optional parameter which makes the operation
  3780. // fail if the object's ETag matches the given value. This is useful for
  3781. // getting updates only after the object has changed since the last
  3782. // request. Use googleapi.IsNotModified to check whether the response
  3783. // error from Do is the result of In-None-Match.
  3784. func (c *ProjectsDatabasesDocumentsGetCall) IfNoneMatch(entityTag string) *ProjectsDatabasesDocumentsGetCall {
  3785. c.ifNoneMatch_ = entityTag
  3786. return c
  3787. }
  3788. // Context sets the context to be used in this call's Do method. Any
  3789. // pending HTTP request will be aborted if the provided context is
  3790. // canceled.
  3791. func (c *ProjectsDatabasesDocumentsGetCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsGetCall {
  3792. c.ctx_ = ctx
  3793. return c
  3794. }
  3795. // Header returns an http.Header that can be modified by the caller to
  3796. // add HTTP headers to the request.
  3797. func (c *ProjectsDatabasesDocumentsGetCall) Header() http.Header {
  3798. if c.header_ == nil {
  3799. c.header_ = make(http.Header)
  3800. }
  3801. return c.header_
  3802. }
  3803. func (c *ProjectsDatabasesDocumentsGetCall) doRequest(alt string) (*http.Response, error) {
  3804. reqHeaders := make(http.Header)
  3805. for k, v := range c.header_ {
  3806. reqHeaders[k] = v
  3807. }
  3808. reqHeaders.Set("User-Agent", c.s.userAgent())
  3809. if c.ifNoneMatch_ != "" {
  3810. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3811. }
  3812. var body io.Reader = nil
  3813. c.urlParams_.Set("alt", alt)
  3814. c.urlParams_.Set("prettyPrint", "false")
  3815. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3816. urls += "?" + c.urlParams_.Encode()
  3817. req, err := http.NewRequest("GET", urls, body)
  3818. if err != nil {
  3819. return nil, err
  3820. }
  3821. req.Header = reqHeaders
  3822. googleapi.Expand(req.URL, map[string]string{
  3823. "name": c.name,
  3824. })
  3825. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3826. }
  3827. // Do executes the "firestore.projects.databases.documents.get" call.
  3828. // Exactly one of *Document or error will be non-nil. Any non-2xx status
  3829. // code is an error. Response headers are in either
  3830. // *Document.ServerResponse.Header or (if a response was returned at
  3831. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3832. // to check whether the returned error was because
  3833. // http.StatusNotModified was returned.
  3834. func (c *ProjectsDatabasesDocumentsGetCall) Do(opts ...googleapi.CallOption) (*Document, error) {
  3835. gensupport.SetOptions(c.urlParams_, opts...)
  3836. res, err := c.doRequest("json")
  3837. if res != nil && res.StatusCode == http.StatusNotModified {
  3838. if res.Body != nil {
  3839. res.Body.Close()
  3840. }
  3841. return nil, &googleapi.Error{
  3842. Code: res.StatusCode,
  3843. Header: res.Header,
  3844. }
  3845. }
  3846. if err != nil {
  3847. return nil, err
  3848. }
  3849. defer googleapi.CloseBody(res)
  3850. if err := googleapi.CheckResponse(res); err != nil {
  3851. return nil, err
  3852. }
  3853. ret := &Document{
  3854. ServerResponse: googleapi.ServerResponse{
  3855. Header: res.Header,
  3856. HTTPStatusCode: res.StatusCode,
  3857. },
  3858. }
  3859. target := &ret
  3860. if err := gensupport.DecodeResponse(target, res); err != nil {
  3861. return nil, err
  3862. }
  3863. return ret, nil
  3864. // {
  3865. // "description": "Gets a single document.",
  3866. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}",
  3867. // "httpMethod": "GET",
  3868. // "id": "firestore.projects.databases.documents.get",
  3869. // "parameterOrder": [
  3870. // "name"
  3871. // ],
  3872. // "parameters": {
  3873. // "mask.fieldPaths": {
  3874. // "description": "The list of field paths in the mask. See Document.fields for a field\npath syntax reference.",
  3875. // "location": "query",
  3876. // "repeated": true,
  3877. // "type": "string"
  3878. // },
  3879. // "name": {
  3880. // "description": "The resource name of the Document to get. In the format:\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.",
  3881. // "location": "path",
  3882. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  3883. // "required": true,
  3884. // "type": "string"
  3885. // },
  3886. // "readTime": {
  3887. // "description": "Reads the version of the document at the given time.\nThis may not be older than 60 seconds.",
  3888. // "format": "google-datetime",
  3889. // "location": "query",
  3890. // "type": "string"
  3891. // },
  3892. // "transaction": {
  3893. // "description": "Reads the document in a transaction.",
  3894. // "format": "byte",
  3895. // "location": "query",
  3896. // "type": "string"
  3897. // }
  3898. // },
  3899. // "path": "v1beta1/{+name}",
  3900. // "response": {
  3901. // "$ref": "Document"
  3902. // },
  3903. // "scopes": [
  3904. // "https://www.googleapis.com/auth/cloud-platform",
  3905. // "https://www.googleapis.com/auth/datastore"
  3906. // ]
  3907. // }
  3908. }
  3909. // method id "firestore.projects.databases.documents.list":
  3910. type ProjectsDatabasesDocumentsListCall struct {
  3911. s *Service
  3912. parent string
  3913. collectionId string
  3914. urlParams_ gensupport.URLParams
  3915. ifNoneMatch_ string
  3916. ctx_ context.Context
  3917. header_ http.Header
  3918. }
  3919. // List: Lists documents.
  3920. func (r *ProjectsDatabasesDocumentsService) List(parent string, collectionId string) *ProjectsDatabasesDocumentsListCall {
  3921. c := &ProjectsDatabasesDocumentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3922. c.parent = parent
  3923. c.collectionId = collectionId
  3924. return c
  3925. }
  3926. // MaskFieldPaths sets the optional parameter "mask.fieldPaths": The
  3927. // list of field paths in the mask. See Document.fields for a field
  3928. // path syntax reference.
  3929. func (c *ProjectsDatabasesDocumentsListCall) MaskFieldPaths(maskFieldPaths ...string) *ProjectsDatabasesDocumentsListCall {
  3930. c.urlParams_.SetMulti("mask.fieldPaths", append([]string{}, maskFieldPaths...))
  3931. return c
  3932. }
  3933. // OrderBy sets the optional parameter "orderBy": The order to sort
  3934. // results by. For example: `priority desc, name`.
  3935. func (c *ProjectsDatabasesDocumentsListCall) OrderBy(orderBy string) *ProjectsDatabasesDocumentsListCall {
  3936. c.urlParams_.Set("orderBy", orderBy)
  3937. return c
  3938. }
  3939. // PageSize sets the optional parameter "pageSize": The maximum number
  3940. // of documents to return.
  3941. func (c *ProjectsDatabasesDocumentsListCall) PageSize(pageSize int64) *ProjectsDatabasesDocumentsListCall {
  3942. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3943. return c
  3944. }
  3945. // PageToken sets the optional parameter "pageToken": The
  3946. // `next_page_token` value returned from a previous List request, if
  3947. // any.
  3948. func (c *ProjectsDatabasesDocumentsListCall) PageToken(pageToken string) *ProjectsDatabasesDocumentsListCall {
  3949. c.urlParams_.Set("pageToken", pageToken)
  3950. return c
  3951. }
  3952. // ReadTime sets the optional parameter "readTime": Reads documents as
  3953. // they were at the given time.
  3954. // This may not be older than 60 seconds.
  3955. func (c *ProjectsDatabasesDocumentsListCall) ReadTime(readTime string) *ProjectsDatabasesDocumentsListCall {
  3956. c.urlParams_.Set("readTime", readTime)
  3957. return c
  3958. }
  3959. // ShowMissing sets the optional parameter "showMissing": If the list
  3960. // should show missing documents. A missing document is a
  3961. // document that does not exist but has sub-documents. These documents
  3962. // will
  3963. // be returned with a key but will not have fields,
  3964. // Document.create_time,
  3965. // or Document.update_time set.
  3966. //
  3967. // Requests with `show_missing` may not specify `where` or
  3968. // `order_by`.
  3969. func (c *ProjectsDatabasesDocumentsListCall) ShowMissing(showMissing bool) *ProjectsDatabasesDocumentsListCall {
  3970. c.urlParams_.Set("showMissing", fmt.Sprint(showMissing))
  3971. return c
  3972. }
  3973. // Transaction sets the optional parameter "transaction": Reads
  3974. // documents in a transaction.
  3975. func (c *ProjectsDatabasesDocumentsListCall) Transaction(transaction string) *ProjectsDatabasesDocumentsListCall {
  3976. c.urlParams_.Set("transaction", transaction)
  3977. return c
  3978. }
  3979. // Fields allows partial responses to be retrieved. See
  3980. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3981. // for more information.
  3982. func (c *ProjectsDatabasesDocumentsListCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsListCall {
  3983. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3984. return c
  3985. }
  3986. // IfNoneMatch sets the optional parameter which makes the operation
  3987. // fail if the object's ETag matches the given value. This is useful for
  3988. // getting updates only after the object has changed since the last
  3989. // request. Use googleapi.IsNotModified to check whether the response
  3990. // error from Do is the result of In-None-Match.
  3991. func (c *ProjectsDatabasesDocumentsListCall) IfNoneMatch(entityTag string) *ProjectsDatabasesDocumentsListCall {
  3992. c.ifNoneMatch_ = entityTag
  3993. return c
  3994. }
  3995. // Context sets the context to be used in this call's Do method. Any
  3996. // pending HTTP request will be aborted if the provided context is
  3997. // canceled.
  3998. func (c *ProjectsDatabasesDocumentsListCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsListCall {
  3999. c.ctx_ = ctx
  4000. return c
  4001. }
  4002. // Header returns an http.Header that can be modified by the caller to
  4003. // add HTTP headers to the request.
  4004. func (c *ProjectsDatabasesDocumentsListCall) Header() http.Header {
  4005. if c.header_ == nil {
  4006. c.header_ = make(http.Header)
  4007. }
  4008. return c.header_
  4009. }
  4010. func (c *ProjectsDatabasesDocumentsListCall) doRequest(alt string) (*http.Response, error) {
  4011. reqHeaders := make(http.Header)
  4012. for k, v := range c.header_ {
  4013. reqHeaders[k] = v
  4014. }
  4015. reqHeaders.Set("User-Agent", c.s.userAgent())
  4016. if c.ifNoneMatch_ != "" {
  4017. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4018. }
  4019. var body io.Reader = nil
  4020. c.urlParams_.Set("alt", alt)
  4021. c.urlParams_.Set("prettyPrint", "false")
  4022. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/{collectionId}")
  4023. urls += "?" + c.urlParams_.Encode()
  4024. req, err := http.NewRequest("GET", urls, body)
  4025. if err != nil {
  4026. return nil, err
  4027. }
  4028. req.Header = reqHeaders
  4029. googleapi.Expand(req.URL, map[string]string{
  4030. "parent": c.parent,
  4031. "collectionId": c.collectionId,
  4032. })
  4033. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4034. }
  4035. // Do executes the "firestore.projects.databases.documents.list" call.
  4036. // Exactly one of *ListDocumentsResponse or error will be non-nil. Any
  4037. // non-2xx status code is an error. Response headers are in either
  4038. // *ListDocumentsResponse.ServerResponse.Header or (if a response was
  4039. // returned at all) in error.(*googleapi.Error).Header. Use
  4040. // googleapi.IsNotModified to check whether the returned error was
  4041. // because http.StatusNotModified was returned.
  4042. func (c *ProjectsDatabasesDocumentsListCall) Do(opts ...googleapi.CallOption) (*ListDocumentsResponse, error) {
  4043. gensupport.SetOptions(c.urlParams_, opts...)
  4044. res, err := c.doRequest("json")
  4045. if res != nil && res.StatusCode == http.StatusNotModified {
  4046. if res.Body != nil {
  4047. res.Body.Close()
  4048. }
  4049. return nil, &googleapi.Error{
  4050. Code: res.StatusCode,
  4051. Header: res.Header,
  4052. }
  4053. }
  4054. if err != nil {
  4055. return nil, err
  4056. }
  4057. defer googleapi.CloseBody(res)
  4058. if err := googleapi.CheckResponse(res); err != nil {
  4059. return nil, err
  4060. }
  4061. ret := &ListDocumentsResponse{
  4062. ServerResponse: googleapi.ServerResponse{
  4063. Header: res.Header,
  4064. HTTPStatusCode: res.StatusCode,
  4065. },
  4066. }
  4067. target := &ret
  4068. if err := gensupport.DecodeResponse(target, res); err != nil {
  4069. return nil, err
  4070. }
  4071. return ret, nil
  4072. // {
  4073. // "description": "Lists documents.",
  4074. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}/{collectionId}",
  4075. // "httpMethod": "GET",
  4076. // "id": "firestore.projects.databases.documents.list",
  4077. // "parameterOrder": [
  4078. // "parent",
  4079. // "collectionId"
  4080. // ],
  4081. // "parameters": {
  4082. // "collectionId": {
  4083. // "description": "The collection ID, relative to `parent`, to list. For example: `chatrooms`\nor `messages`.",
  4084. // "location": "path",
  4085. // "required": true,
  4086. // "type": "string"
  4087. // },
  4088. // "mask.fieldPaths": {
  4089. // "description": "The list of field paths in the mask. See Document.fields for a field\npath syntax reference.",
  4090. // "location": "query",
  4091. // "repeated": true,
  4092. // "type": "string"
  4093. // },
  4094. // "orderBy": {
  4095. // "description": "The order to sort results by. For example: `priority desc, name`.",
  4096. // "location": "query",
  4097. // "type": "string"
  4098. // },
  4099. // "pageSize": {
  4100. // "description": "The maximum number of documents to return.",
  4101. // "format": "int32",
  4102. // "location": "query",
  4103. // "type": "integer"
  4104. // },
  4105. // "pageToken": {
  4106. // "description": "The `next_page_token` value returned from a previous List request, if any.",
  4107. // "location": "query",
  4108. // "type": "string"
  4109. // },
  4110. // "parent": {
  4111. // "description": "The parent resource name. In the format:\n`projects/{project_id}/databases/{database_id}/documents` or\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.\nFor example:\n`projects/my-project/databases/my-database/documents` or\n`projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`",
  4112. // "location": "path",
  4113. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  4114. // "required": true,
  4115. // "type": "string"
  4116. // },
  4117. // "readTime": {
  4118. // "description": "Reads documents as they were at the given time.\nThis may not be older than 60 seconds.",
  4119. // "format": "google-datetime",
  4120. // "location": "query",
  4121. // "type": "string"
  4122. // },
  4123. // "showMissing": {
  4124. // "description": "If the list should show missing documents. A missing document is a\ndocument that does not exist but has sub-documents. These documents will\nbe returned with a key but will not have fields, Document.create_time,\nor Document.update_time set.\n\nRequests with `show_missing` may not specify `where` or\n`order_by`.",
  4125. // "location": "query",
  4126. // "type": "boolean"
  4127. // },
  4128. // "transaction": {
  4129. // "description": "Reads documents in a transaction.",
  4130. // "format": "byte",
  4131. // "location": "query",
  4132. // "type": "string"
  4133. // }
  4134. // },
  4135. // "path": "v1beta1/{+parent}/{collectionId}",
  4136. // "response": {
  4137. // "$ref": "ListDocumentsResponse"
  4138. // },
  4139. // "scopes": [
  4140. // "https://www.googleapis.com/auth/cloud-platform",
  4141. // "https://www.googleapis.com/auth/datastore"
  4142. // ]
  4143. // }
  4144. }
  4145. // Pages invokes f for each page of results.
  4146. // A non-nil error returned from f will halt the iteration.
  4147. // The provided context supersedes any context provided to the Context method.
  4148. func (c *ProjectsDatabasesDocumentsListCall) Pages(ctx context.Context, f func(*ListDocumentsResponse) error) error {
  4149. c.ctx_ = ctx
  4150. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4151. for {
  4152. x, err := c.Do()
  4153. if err != nil {
  4154. return err
  4155. }
  4156. if err := f(x); err != nil {
  4157. return err
  4158. }
  4159. if x.NextPageToken == "" {
  4160. return nil
  4161. }
  4162. c.PageToken(x.NextPageToken)
  4163. }
  4164. }
  4165. // method id "firestore.projects.databases.documents.listCollectionIds":
  4166. type ProjectsDatabasesDocumentsListCollectionIdsCall struct {
  4167. s *Service
  4168. parent string
  4169. listcollectionidsrequest *ListCollectionIdsRequest
  4170. urlParams_ gensupport.URLParams
  4171. ctx_ context.Context
  4172. header_ http.Header
  4173. }
  4174. // ListCollectionIds: Lists all the collection IDs underneath a
  4175. // document.
  4176. func (r *ProjectsDatabasesDocumentsService) ListCollectionIds(parent string, listcollectionidsrequest *ListCollectionIdsRequest) *ProjectsDatabasesDocumentsListCollectionIdsCall {
  4177. c := &ProjectsDatabasesDocumentsListCollectionIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4178. c.parent = parent
  4179. c.listcollectionidsrequest = listcollectionidsrequest
  4180. return c
  4181. }
  4182. // Fields allows partial responses to be retrieved. See
  4183. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4184. // for more information.
  4185. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsListCollectionIdsCall {
  4186. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4187. return c
  4188. }
  4189. // Context sets the context to be used in this call's Do method. Any
  4190. // pending HTTP request will be aborted if the provided context is
  4191. // canceled.
  4192. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsListCollectionIdsCall {
  4193. c.ctx_ = ctx
  4194. return c
  4195. }
  4196. // Header returns an http.Header that can be modified by the caller to
  4197. // add HTTP headers to the request.
  4198. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) Header() http.Header {
  4199. if c.header_ == nil {
  4200. c.header_ = make(http.Header)
  4201. }
  4202. return c.header_
  4203. }
  4204. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) doRequest(alt string) (*http.Response, error) {
  4205. reqHeaders := make(http.Header)
  4206. for k, v := range c.header_ {
  4207. reqHeaders[k] = v
  4208. }
  4209. reqHeaders.Set("User-Agent", c.s.userAgent())
  4210. var body io.Reader = nil
  4211. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listcollectionidsrequest)
  4212. if err != nil {
  4213. return nil, err
  4214. }
  4215. reqHeaders.Set("Content-Type", "application/json")
  4216. c.urlParams_.Set("alt", alt)
  4217. c.urlParams_.Set("prettyPrint", "false")
  4218. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:listCollectionIds")
  4219. urls += "?" + c.urlParams_.Encode()
  4220. req, err := http.NewRequest("POST", urls, body)
  4221. if err != nil {
  4222. return nil, err
  4223. }
  4224. req.Header = reqHeaders
  4225. googleapi.Expand(req.URL, map[string]string{
  4226. "parent": c.parent,
  4227. })
  4228. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4229. }
  4230. // Do executes the "firestore.projects.databases.documents.listCollectionIds" call.
  4231. // Exactly one of *ListCollectionIdsResponse or error will be non-nil.
  4232. // Any non-2xx status code is an error. Response headers are in either
  4233. // *ListCollectionIdsResponse.ServerResponse.Header or (if a response
  4234. // was returned at all) in error.(*googleapi.Error).Header. Use
  4235. // googleapi.IsNotModified to check whether the returned error was
  4236. // because http.StatusNotModified was returned.
  4237. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) Do(opts ...googleapi.CallOption) (*ListCollectionIdsResponse, error) {
  4238. gensupport.SetOptions(c.urlParams_, opts...)
  4239. res, err := c.doRequest("json")
  4240. if res != nil && res.StatusCode == http.StatusNotModified {
  4241. if res.Body != nil {
  4242. res.Body.Close()
  4243. }
  4244. return nil, &googleapi.Error{
  4245. Code: res.StatusCode,
  4246. Header: res.Header,
  4247. }
  4248. }
  4249. if err != nil {
  4250. return nil, err
  4251. }
  4252. defer googleapi.CloseBody(res)
  4253. if err := googleapi.CheckResponse(res); err != nil {
  4254. return nil, err
  4255. }
  4256. ret := &ListCollectionIdsResponse{
  4257. ServerResponse: googleapi.ServerResponse{
  4258. Header: res.Header,
  4259. HTTPStatusCode: res.StatusCode,
  4260. },
  4261. }
  4262. target := &ret
  4263. if err := gensupport.DecodeResponse(target, res); err != nil {
  4264. return nil, err
  4265. }
  4266. return ret, nil
  4267. // {
  4268. // "description": "Lists all the collection IDs underneath a document.",
  4269. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}:listCollectionIds",
  4270. // "httpMethod": "POST",
  4271. // "id": "firestore.projects.databases.documents.listCollectionIds",
  4272. // "parameterOrder": [
  4273. // "parent"
  4274. // ],
  4275. // "parameters": {
  4276. // "parent": {
  4277. // "description": "The parent document. In the format:\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.\nFor example:\n`projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`",
  4278. // "location": "path",
  4279. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  4280. // "required": true,
  4281. // "type": "string"
  4282. // }
  4283. // },
  4284. // "path": "v1beta1/{+parent}:listCollectionIds",
  4285. // "request": {
  4286. // "$ref": "ListCollectionIdsRequest"
  4287. // },
  4288. // "response": {
  4289. // "$ref": "ListCollectionIdsResponse"
  4290. // },
  4291. // "scopes": [
  4292. // "https://www.googleapis.com/auth/cloud-platform",
  4293. // "https://www.googleapis.com/auth/datastore"
  4294. // ]
  4295. // }
  4296. }
  4297. // Pages invokes f for each page of results.
  4298. // A non-nil error returned from f will halt the iteration.
  4299. // The provided context supersedes any context provided to the Context method.
  4300. func (c *ProjectsDatabasesDocumentsListCollectionIdsCall) Pages(ctx context.Context, f func(*ListCollectionIdsResponse) error) error {
  4301. c.ctx_ = ctx
  4302. defer func(pt string) { c.listcollectionidsrequest.PageToken = pt }(c.listcollectionidsrequest.PageToken) // reset paging to original point
  4303. for {
  4304. x, err := c.Do()
  4305. if err != nil {
  4306. return err
  4307. }
  4308. if err := f(x); err != nil {
  4309. return err
  4310. }
  4311. if x.NextPageToken == "" {
  4312. return nil
  4313. }
  4314. c.listcollectionidsrequest.PageToken = x.NextPageToken
  4315. }
  4316. }
  4317. // method id "firestore.projects.databases.documents.listen":
  4318. type ProjectsDatabasesDocumentsListenCall struct {
  4319. s *Service
  4320. database string
  4321. listenrequest *ListenRequest
  4322. urlParams_ gensupport.URLParams
  4323. ctx_ context.Context
  4324. header_ http.Header
  4325. }
  4326. // Listen: Listens to changes.
  4327. func (r *ProjectsDatabasesDocumentsService) Listen(database string, listenrequest *ListenRequest) *ProjectsDatabasesDocumentsListenCall {
  4328. c := &ProjectsDatabasesDocumentsListenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4329. c.database = database
  4330. c.listenrequest = listenrequest
  4331. return c
  4332. }
  4333. // Fields allows partial responses to be retrieved. See
  4334. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4335. // for more information.
  4336. func (c *ProjectsDatabasesDocumentsListenCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsListenCall {
  4337. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4338. return c
  4339. }
  4340. // Context sets the context to be used in this call's Do method. Any
  4341. // pending HTTP request will be aborted if the provided context is
  4342. // canceled.
  4343. func (c *ProjectsDatabasesDocumentsListenCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsListenCall {
  4344. c.ctx_ = ctx
  4345. return c
  4346. }
  4347. // Header returns an http.Header that can be modified by the caller to
  4348. // add HTTP headers to the request.
  4349. func (c *ProjectsDatabasesDocumentsListenCall) Header() http.Header {
  4350. if c.header_ == nil {
  4351. c.header_ = make(http.Header)
  4352. }
  4353. return c.header_
  4354. }
  4355. func (c *ProjectsDatabasesDocumentsListenCall) doRequest(alt string) (*http.Response, error) {
  4356. reqHeaders := make(http.Header)
  4357. for k, v := range c.header_ {
  4358. reqHeaders[k] = v
  4359. }
  4360. reqHeaders.Set("User-Agent", c.s.userAgent())
  4361. var body io.Reader = nil
  4362. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listenrequest)
  4363. if err != nil {
  4364. return nil, err
  4365. }
  4366. reqHeaders.Set("Content-Type", "application/json")
  4367. c.urlParams_.Set("alt", alt)
  4368. c.urlParams_.Set("prettyPrint", "false")
  4369. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:listen")
  4370. urls += "?" + c.urlParams_.Encode()
  4371. req, err := http.NewRequest("POST", urls, body)
  4372. if err != nil {
  4373. return nil, err
  4374. }
  4375. req.Header = reqHeaders
  4376. googleapi.Expand(req.URL, map[string]string{
  4377. "database": c.database,
  4378. })
  4379. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4380. }
  4381. // Do executes the "firestore.projects.databases.documents.listen" call.
  4382. // Exactly one of *ListenResponse or error will be non-nil. Any non-2xx
  4383. // status code is an error. Response headers are in either
  4384. // *ListenResponse.ServerResponse.Header or (if a response was returned
  4385. // at all) in error.(*googleapi.Error).Header. Use
  4386. // googleapi.IsNotModified to check whether the returned error was
  4387. // because http.StatusNotModified was returned.
  4388. func (c *ProjectsDatabasesDocumentsListenCall) Do(opts ...googleapi.CallOption) (*ListenResponse, error) {
  4389. gensupport.SetOptions(c.urlParams_, opts...)
  4390. res, err := c.doRequest("json")
  4391. if res != nil && res.StatusCode == http.StatusNotModified {
  4392. if res.Body != nil {
  4393. res.Body.Close()
  4394. }
  4395. return nil, &googleapi.Error{
  4396. Code: res.StatusCode,
  4397. Header: res.Header,
  4398. }
  4399. }
  4400. if err != nil {
  4401. return nil, err
  4402. }
  4403. defer googleapi.CloseBody(res)
  4404. if err := googleapi.CheckResponse(res); err != nil {
  4405. return nil, err
  4406. }
  4407. ret := &ListenResponse{
  4408. ServerResponse: googleapi.ServerResponse{
  4409. Header: res.Header,
  4410. HTTPStatusCode: res.StatusCode,
  4411. },
  4412. }
  4413. target := &ret
  4414. if err := gensupport.DecodeResponse(target, res); err != nil {
  4415. return nil, err
  4416. }
  4417. return ret, nil
  4418. // {
  4419. // "description": "Listens to changes.",
  4420. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:listen",
  4421. // "httpMethod": "POST",
  4422. // "id": "firestore.projects.databases.documents.listen",
  4423. // "parameterOrder": [
  4424. // "database"
  4425. // ],
  4426. // "parameters": {
  4427. // "database": {
  4428. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.",
  4429. // "location": "path",
  4430. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  4431. // "required": true,
  4432. // "type": "string"
  4433. // }
  4434. // },
  4435. // "path": "v1beta1/{+database}/documents:listen",
  4436. // "request": {
  4437. // "$ref": "ListenRequest"
  4438. // },
  4439. // "response": {
  4440. // "$ref": "ListenResponse"
  4441. // },
  4442. // "scopes": [
  4443. // "https://www.googleapis.com/auth/cloud-platform",
  4444. // "https://www.googleapis.com/auth/datastore"
  4445. // ]
  4446. // }
  4447. }
  4448. // method id "firestore.projects.databases.documents.patch":
  4449. type ProjectsDatabasesDocumentsPatchCall struct {
  4450. s *Service
  4451. name string
  4452. document *Document
  4453. urlParams_ gensupport.URLParams
  4454. ctx_ context.Context
  4455. header_ http.Header
  4456. }
  4457. // Patch: Updates or inserts a document.
  4458. func (r *ProjectsDatabasesDocumentsService) Patch(name string, document *Document) *ProjectsDatabasesDocumentsPatchCall {
  4459. c := &ProjectsDatabasesDocumentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4460. c.name = name
  4461. c.document = document
  4462. return c
  4463. }
  4464. // CurrentDocumentExists sets the optional parameter
  4465. // "currentDocument.exists": When set to `true`, the target document
  4466. // must exist.
  4467. // When set to `false`, the target document must not exist.
  4468. func (c *ProjectsDatabasesDocumentsPatchCall) CurrentDocumentExists(currentDocumentExists bool) *ProjectsDatabasesDocumentsPatchCall {
  4469. c.urlParams_.Set("currentDocument.exists", fmt.Sprint(currentDocumentExists))
  4470. return c
  4471. }
  4472. // CurrentDocumentUpdateTime sets the optional parameter
  4473. // "currentDocument.updateTime": When set, the target document must
  4474. // exist and have been last updated at
  4475. // that time.
  4476. func (c *ProjectsDatabasesDocumentsPatchCall) CurrentDocumentUpdateTime(currentDocumentUpdateTime string) *ProjectsDatabasesDocumentsPatchCall {
  4477. c.urlParams_.Set("currentDocument.updateTime", currentDocumentUpdateTime)
  4478. return c
  4479. }
  4480. // MaskFieldPaths sets the optional parameter "mask.fieldPaths": The
  4481. // list of field paths in the mask. See Document.fields for a field
  4482. // path syntax reference.
  4483. func (c *ProjectsDatabasesDocumentsPatchCall) MaskFieldPaths(maskFieldPaths ...string) *ProjectsDatabasesDocumentsPatchCall {
  4484. c.urlParams_.SetMulti("mask.fieldPaths", append([]string{}, maskFieldPaths...))
  4485. return c
  4486. }
  4487. // UpdateMaskFieldPaths sets the optional parameter
  4488. // "updateMask.fieldPaths": The list of field paths in the mask. See
  4489. // Document.fields for a field
  4490. // path syntax reference.
  4491. func (c *ProjectsDatabasesDocumentsPatchCall) UpdateMaskFieldPaths(updateMaskFieldPaths ...string) *ProjectsDatabasesDocumentsPatchCall {
  4492. c.urlParams_.SetMulti("updateMask.fieldPaths", append([]string{}, updateMaskFieldPaths...))
  4493. return c
  4494. }
  4495. // Fields allows partial responses to be retrieved. See
  4496. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4497. // for more information.
  4498. func (c *ProjectsDatabasesDocumentsPatchCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsPatchCall {
  4499. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4500. return c
  4501. }
  4502. // Context sets the context to be used in this call's Do method. Any
  4503. // pending HTTP request will be aborted if the provided context is
  4504. // canceled.
  4505. func (c *ProjectsDatabasesDocumentsPatchCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsPatchCall {
  4506. c.ctx_ = ctx
  4507. return c
  4508. }
  4509. // Header returns an http.Header that can be modified by the caller to
  4510. // add HTTP headers to the request.
  4511. func (c *ProjectsDatabasesDocumentsPatchCall) Header() http.Header {
  4512. if c.header_ == nil {
  4513. c.header_ = make(http.Header)
  4514. }
  4515. return c.header_
  4516. }
  4517. func (c *ProjectsDatabasesDocumentsPatchCall) doRequest(alt string) (*http.Response, error) {
  4518. reqHeaders := make(http.Header)
  4519. for k, v := range c.header_ {
  4520. reqHeaders[k] = v
  4521. }
  4522. reqHeaders.Set("User-Agent", c.s.userAgent())
  4523. var body io.Reader = nil
  4524. body, err := googleapi.WithoutDataWrapper.JSONReader(c.document)
  4525. if err != nil {
  4526. return nil, err
  4527. }
  4528. reqHeaders.Set("Content-Type", "application/json")
  4529. c.urlParams_.Set("alt", alt)
  4530. c.urlParams_.Set("prettyPrint", "false")
  4531. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  4532. urls += "?" + c.urlParams_.Encode()
  4533. req, err := http.NewRequest("PATCH", urls, body)
  4534. if err != nil {
  4535. return nil, err
  4536. }
  4537. req.Header = reqHeaders
  4538. googleapi.Expand(req.URL, map[string]string{
  4539. "name": c.name,
  4540. })
  4541. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4542. }
  4543. // Do executes the "firestore.projects.databases.documents.patch" call.
  4544. // Exactly one of *Document or error will be non-nil. Any non-2xx status
  4545. // code is an error. Response headers are in either
  4546. // *Document.ServerResponse.Header or (if a response was returned at
  4547. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4548. // to check whether the returned error was because
  4549. // http.StatusNotModified was returned.
  4550. func (c *ProjectsDatabasesDocumentsPatchCall) Do(opts ...googleapi.CallOption) (*Document, error) {
  4551. gensupport.SetOptions(c.urlParams_, opts...)
  4552. res, err := c.doRequest("json")
  4553. if res != nil && res.StatusCode == http.StatusNotModified {
  4554. if res.Body != nil {
  4555. res.Body.Close()
  4556. }
  4557. return nil, &googleapi.Error{
  4558. Code: res.StatusCode,
  4559. Header: res.Header,
  4560. }
  4561. }
  4562. if err != nil {
  4563. return nil, err
  4564. }
  4565. defer googleapi.CloseBody(res)
  4566. if err := googleapi.CheckResponse(res); err != nil {
  4567. return nil, err
  4568. }
  4569. ret := &Document{
  4570. ServerResponse: googleapi.ServerResponse{
  4571. Header: res.Header,
  4572. HTTPStatusCode: res.StatusCode,
  4573. },
  4574. }
  4575. target := &ret
  4576. if err := gensupport.DecodeResponse(target, res); err != nil {
  4577. return nil, err
  4578. }
  4579. return ret, nil
  4580. // {
  4581. // "description": "Updates or inserts a document.",
  4582. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}",
  4583. // "httpMethod": "PATCH",
  4584. // "id": "firestore.projects.databases.documents.patch",
  4585. // "parameterOrder": [
  4586. // "name"
  4587. // ],
  4588. // "parameters": {
  4589. // "currentDocument.exists": {
  4590. // "description": "When set to `true`, the target document must exist.\nWhen set to `false`, the target document must not exist.",
  4591. // "location": "query",
  4592. // "type": "boolean"
  4593. // },
  4594. // "currentDocument.updateTime": {
  4595. // "description": "When set, the target document must exist and have been last updated at\nthat time.",
  4596. // "format": "google-datetime",
  4597. // "location": "query",
  4598. // "type": "string"
  4599. // },
  4600. // "mask.fieldPaths": {
  4601. // "description": "The list of field paths in the mask. See Document.fields for a field\npath syntax reference.",
  4602. // "location": "query",
  4603. // "repeated": true,
  4604. // "type": "string"
  4605. // },
  4606. // "name": {
  4607. // "description": "The resource name of the document, for example\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.",
  4608. // "location": "path",
  4609. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  4610. // "required": true,
  4611. // "type": "string"
  4612. // },
  4613. // "updateMask.fieldPaths": {
  4614. // "description": "The list of field paths in the mask. See Document.fields for a field\npath syntax reference.",
  4615. // "location": "query",
  4616. // "repeated": true,
  4617. // "type": "string"
  4618. // }
  4619. // },
  4620. // "path": "v1beta1/{+name}",
  4621. // "request": {
  4622. // "$ref": "Document"
  4623. // },
  4624. // "response": {
  4625. // "$ref": "Document"
  4626. // },
  4627. // "scopes": [
  4628. // "https://www.googleapis.com/auth/cloud-platform",
  4629. // "https://www.googleapis.com/auth/datastore"
  4630. // ]
  4631. // }
  4632. }
  4633. // method id "firestore.projects.databases.documents.rollback":
  4634. type ProjectsDatabasesDocumentsRollbackCall struct {
  4635. s *Service
  4636. database string
  4637. rollbackrequest *RollbackRequest
  4638. urlParams_ gensupport.URLParams
  4639. ctx_ context.Context
  4640. header_ http.Header
  4641. }
  4642. // Rollback: Rolls back a transaction.
  4643. func (r *ProjectsDatabasesDocumentsService) Rollback(database string, rollbackrequest *RollbackRequest) *ProjectsDatabasesDocumentsRollbackCall {
  4644. c := &ProjectsDatabasesDocumentsRollbackCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4645. c.database = database
  4646. c.rollbackrequest = rollbackrequest
  4647. return c
  4648. }
  4649. // Fields allows partial responses to be retrieved. See
  4650. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4651. // for more information.
  4652. func (c *ProjectsDatabasesDocumentsRollbackCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsRollbackCall {
  4653. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4654. return c
  4655. }
  4656. // Context sets the context to be used in this call's Do method. Any
  4657. // pending HTTP request will be aborted if the provided context is
  4658. // canceled.
  4659. func (c *ProjectsDatabasesDocumentsRollbackCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsRollbackCall {
  4660. c.ctx_ = ctx
  4661. return c
  4662. }
  4663. // Header returns an http.Header that can be modified by the caller to
  4664. // add HTTP headers to the request.
  4665. func (c *ProjectsDatabasesDocumentsRollbackCall) Header() http.Header {
  4666. if c.header_ == nil {
  4667. c.header_ = make(http.Header)
  4668. }
  4669. return c.header_
  4670. }
  4671. func (c *ProjectsDatabasesDocumentsRollbackCall) doRequest(alt string) (*http.Response, error) {
  4672. reqHeaders := make(http.Header)
  4673. for k, v := range c.header_ {
  4674. reqHeaders[k] = v
  4675. }
  4676. reqHeaders.Set("User-Agent", c.s.userAgent())
  4677. var body io.Reader = nil
  4678. body, err := googleapi.WithoutDataWrapper.JSONReader(c.rollbackrequest)
  4679. if err != nil {
  4680. return nil, err
  4681. }
  4682. reqHeaders.Set("Content-Type", "application/json")
  4683. c.urlParams_.Set("alt", alt)
  4684. c.urlParams_.Set("prettyPrint", "false")
  4685. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:rollback")
  4686. urls += "?" + c.urlParams_.Encode()
  4687. req, err := http.NewRequest("POST", urls, body)
  4688. if err != nil {
  4689. return nil, err
  4690. }
  4691. req.Header = reqHeaders
  4692. googleapi.Expand(req.URL, map[string]string{
  4693. "database": c.database,
  4694. })
  4695. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4696. }
  4697. // Do executes the "firestore.projects.databases.documents.rollback" call.
  4698. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4699. // code is an error. Response headers are in either
  4700. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4701. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4702. // check whether the returned error was because http.StatusNotModified
  4703. // was returned.
  4704. func (c *ProjectsDatabasesDocumentsRollbackCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4705. gensupport.SetOptions(c.urlParams_, opts...)
  4706. res, err := c.doRequest("json")
  4707. if res != nil && res.StatusCode == http.StatusNotModified {
  4708. if res.Body != nil {
  4709. res.Body.Close()
  4710. }
  4711. return nil, &googleapi.Error{
  4712. Code: res.StatusCode,
  4713. Header: res.Header,
  4714. }
  4715. }
  4716. if err != nil {
  4717. return nil, err
  4718. }
  4719. defer googleapi.CloseBody(res)
  4720. if err := googleapi.CheckResponse(res); err != nil {
  4721. return nil, err
  4722. }
  4723. ret := &Empty{
  4724. ServerResponse: googleapi.ServerResponse{
  4725. Header: res.Header,
  4726. HTTPStatusCode: res.StatusCode,
  4727. },
  4728. }
  4729. target := &ret
  4730. if err := gensupport.DecodeResponse(target, res); err != nil {
  4731. return nil, err
  4732. }
  4733. return ret, nil
  4734. // {
  4735. // "description": "Rolls back a transaction.",
  4736. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:rollback",
  4737. // "httpMethod": "POST",
  4738. // "id": "firestore.projects.databases.documents.rollback",
  4739. // "parameterOrder": [
  4740. // "database"
  4741. // ],
  4742. // "parameters": {
  4743. // "database": {
  4744. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.",
  4745. // "location": "path",
  4746. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  4747. // "required": true,
  4748. // "type": "string"
  4749. // }
  4750. // },
  4751. // "path": "v1beta1/{+database}/documents:rollback",
  4752. // "request": {
  4753. // "$ref": "RollbackRequest"
  4754. // },
  4755. // "response": {
  4756. // "$ref": "Empty"
  4757. // },
  4758. // "scopes": [
  4759. // "https://www.googleapis.com/auth/cloud-platform",
  4760. // "https://www.googleapis.com/auth/datastore"
  4761. // ]
  4762. // }
  4763. }
  4764. // method id "firestore.projects.databases.documents.runQuery":
  4765. type ProjectsDatabasesDocumentsRunQueryCall struct {
  4766. s *Service
  4767. parent string
  4768. runqueryrequest *RunQueryRequest
  4769. urlParams_ gensupport.URLParams
  4770. ctx_ context.Context
  4771. header_ http.Header
  4772. }
  4773. // RunQuery: Runs a query.
  4774. func (r *ProjectsDatabasesDocumentsService) RunQuery(parent string, runqueryrequest *RunQueryRequest) *ProjectsDatabasesDocumentsRunQueryCall {
  4775. c := &ProjectsDatabasesDocumentsRunQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4776. c.parent = parent
  4777. c.runqueryrequest = runqueryrequest
  4778. return c
  4779. }
  4780. // Fields allows partial responses to be retrieved. See
  4781. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4782. // for more information.
  4783. func (c *ProjectsDatabasesDocumentsRunQueryCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsRunQueryCall {
  4784. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4785. return c
  4786. }
  4787. // Context sets the context to be used in this call's Do method. Any
  4788. // pending HTTP request will be aborted if the provided context is
  4789. // canceled.
  4790. func (c *ProjectsDatabasesDocumentsRunQueryCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsRunQueryCall {
  4791. c.ctx_ = ctx
  4792. return c
  4793. }
  4794. // Header returns an http.Header that can be modified by the caller to
  4795. // add HTTP headers to the request.
  4796. func (c *ProjectsDatabasesDocumentsRunQueryCall) Header() http.Header {
  4797. if c.header_ == nil {
  4798. c.header_ = make(http.Header)
  4799. }
  4800. return c.header_
  4801. }
  4802. func (c *ProjectsDatabasesDocumentsRunQueryCall) doRequest(alt string) (*http.Response, error) {
  4803. reqHeaders := make(http.Header)
  4804. for k, v := range c.header_ {
  4805. reqHeaders[k] = v
  4806. }
  4807. reqHeaders.Set("User-Agent", c.s.userAgent())
  4808. var body io.Reader = nil
  4809. body, err := googleapi.WithoutDataWrapper.JSONReader(c.runqueryrequest)
  4810. if err != nil {
  4811. return nil, err
  4812. }
  4813. reqHeaders.Set("Content-Type", "application/json")
  4814. c.urlParams_.Set("alt", alt)
  4815. c.urlParams_.Set("prettyPrint", "false")
  4816. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:runQuery")
  4817. urls += "?" + c.urlParams_.Encode()
  4818. req, err := http.NewRequest("POST", urls, body)
  4819. if err != nil {
  4820. return nil, err
  4821. }
  4822. req.Header = reqHeaders
  4823. googleapi.Expand(req.URL, map[string]string{
  4824. "parent": c.parent,
  4825. })
  4826. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4827. }
  4828. // Do executes the "firestore.projects.databases.documents.runQuery" call.
  4829. // Exactly one of *RunQueryResponse or error will be non-nil. Any
  4830. // non-2xx status code is an error. Response headers are in either
  4831. // *RunQueryResponse.ServerResponse.Header or (if a response was
  4832. // returned at all) in error.(*googleapi.Error).Header. Use
  4833. // googleapi.IsNotModified to check whether the returned error was
  4834. // because http.StatusNotModified was returned.
  4835. func (c *ProjectsDatabasesDocumentsRunQueryCall) Do(opts ...googleapi.CallOption) (*RunQueryResponse, error) {
  4836. gensupport.SetOptions(c.urlParams_, opts...)
  4837. res, err := c.doRequest("json")
  4838. if res != nil && res.StatusCode == http.StatusNotModified {
  4839. if res.Body != nil {
  4840. res.Body.Close()
  4841. }
  4842. return nil, &googleapi.Error{
  4843. Code: res.StatusCode,
  4844. Header: res.Header,
  4845. }
  4846. }
  4847. if err != nil {
  4848. return nil, err
  4849. }
  4850. defer googleapi.CloseBody(res)
  4851. if err := googleapi.CheckResponse(res); err != nil {
  4852. return nil, err
  4853. }
  4854. ret := &RunQueryResponse{
  4855. ServerResponse: googleapi.ServerResponse{
  4856. Header: res.Header,
  4857. HTTPStatusCode: res.StatusCode,
  4858. },
  4859. }
  4860. target := &ret
  4861. if err := gensupport.DecodeResponse(target, res); err != nil {
  4862. return nil, err
  4863. }
  4864. return ret, nil
  4865. // {
  4866. // "description": "Runs a query.",
  4867. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents/{documentsId}/{documentsId1}:runQuery",
  4868. // "httpMethod": "POST",
  4869. // "id": "firestore.projects.databases.documents.runQuery",
  4870. // "parameterOrder": [
  4871. // "parent"
  4872. // ],
  4873. // "parameters": {
  4874. // "parent": {
  4875. // "description": "The parent resource name. In the format:\n`projects/{project_id}/databases/{database_id}/documents` or\n`projects/{project_id}/databases/{database_id}/documents/{document_path}`.\nFor example:\n`projects/my-project/databases/my-database/documents` or\n`projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`",
  4876. // "location": "path",
  4877. // "pattern": "^projects/[^/]+/databases/[^/]+/documents/[^/]+/.+$",
  4878. // "required": true,
  4879. // "type": "string"
  4880. // }
  4881. // },
  4882. // "path": "v1beta1/{+parent}:runQuery",
  4883. // "request": {
  4884. // "$ref": "RunQueryRequest"
  4885. // },
  4886. // "response": {
  4887. // "$ref": "RunQueryResponse"
  4888. // },
  4889. // "scopes": [
  4890. // "https://www.googleapis.com/auth/cloud-platform",
  4891. // "https://www.googleapis.com/auth/datastore"
  4892. // ]
  4893. // }
  4894. }
  4895. // method id "firestore.projects.databases.documents.write":
  4896. type ProjectsDatabasesDocumentsWriteCall struct {
  4897. s *Service
  4898. database string
  4899. writerequest *WriteRequest
  4900. urlParams_ gensupport.URLParams
  4901. ctx_ context.Context
  4902. header_ http.Header
  4903. }
  4904. // Write: Streams batches of document updates and deletes, in order.
  4905. func (r *ProjectsDatabasesDocumentsService) Write(database string, writerequest *WriteRequest) *ProjectsDatabasesDocumentsWriteCall {
  4906. c := &ProjectsDatabasesDocumentsWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4907. c.database = database
  4908. c.writerequest = writerequest
  4909. return c
  4910. }
  4911. // Fields allows partial responses to be retrieved. See
  4912. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4913. // for more information.
  4914. func (c *ProjectsDatabasesDocumentsWriteCall) Fields(s ...googleapi.Field) *ProjectsDatabasesDocumentsWriteCall {
  4915. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4916. return c
  4917. }
  4918. // Context sets the context to be used in this call's Do method. Any
  4919. // pending HTTP request will be aborted if the provided context is
  4920. // canceled.
  4921. func (c *ProjectsDatabasesDocumentsWriteCall) Context(ctx context.Context) *ProjectsDatabasesDocumentsWriteCall {
  4922. c.ctx_ = ctx
  4923. return c
  4924. }
  4925. // Header returns an http.Header that can be modified by the caller to
  4926. // add HTTP headers to the request.
  4927. func (c *ProjectsDatabasesDocumentsWriteCall) Header() http.Header {
  4928. if c.header_ == nil {
  4929. c.header_ = make(http.Header)
  4930. }
  4931. return c.header_
  4932. }
  4933. func (c *ProjectsDatabasesDocumentsWriteCall) doRequest(alt string) (*http.Response, error) {
  4934. reqHeaders := make(http.Header)
  4935. for k, v := range c.header_ {
  4936. reqHeaders[k] = v
  4937. }
  4938. reqHeaders.Set("User-Agent", c.s.userAgent())
  4939. var body io.Reader = nil
  4940. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writerequest)
  4941. if err != nil {
  4942. return nil, err
  4943. }
  4944. reqHeaders.Set("Content-Type", "application/json")
  4945. c.urlParams_.Set("alt", alt)
  4946. c.urlParams_.Set("prettyPrint", "false")
  4947. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+database}/documents:write")
  4948. urls += "?" + c.urlParams_.Encode()
  4949. req, err := http.NewRequest("POST", urls, body)
  4950. if err != nil {
  4951. return nil, err
  4952. }
  4953. req.Header = reqHeaders
  4954. googleapi.Expand(req.URL, map[string]string{
  4955. "database": c.database,
  4956. })
  4957. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4958. }
  4959. // Do executes the "firestore.projects.databases.documents.write" call.
  4960. // Exactly one of *WriteResponse or error will be non-nil. Any non-2xx
  4961. // status code is an error. Response headers are in either
  4962. // *WriteResponse.ServerResponse.Header or (if a response was returned
  4963. // at all) in error.(*googleapi.Error).Header. Use
  4964. // googleapi.IsNotModified to check whether the returned error was
  4965. // because http.StatusNotModified was returned.
  4966. func (c *ProjectsDatabasesDocumentsWriteCall) Do(opts ...googleapi.CallOption) (*WriteResponse, error) {
  4967. gensupport.SetOptions(c.urlParams_, opts...)
  4968. res, err := c.doRequest("json")
  4969. if res != nil && res.StatusCode == http.StatusNotModified {
  4970. if res.Body != nil {
  4971. res.Body.Close()
  4972. }
  4973. return nil, &googleapi.Error{
  4974. Code: res.StatusCode,
  4975. Header: res.Header,
  4976. }
  4977. }
  4978. if err != nil {
  4979. return nil, err
  4980. }
  4981. defer googleapi.CloseBody(res)
  4982. if err := googleapi.CheckResponse(res); err != nil {
  4983. return nil, err
  4984. }
  4985. ret := &WriteResponse{
  4986. ServerResponse: googleapi.ServerResponse{
  4987. Header: res.Header,
  4988. HTTPStatusCode: res.StatusCode,
  4989. },
  4990. }
  4991. target := &ret
  4992. if err := gensupport.DecodeResponse(target, res); err != nil {
  4993. return nil, err
  4994. }
  4995. return ret, nil
  4996. // {
  4997. // "description": "Streams batches of document updates and deletes, in order.",
  4998. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/documents:write",
  4999. // "httpMethod": "POST",
  5000. // "id": "firestore.projects.databases.documents.write",
  5001. // "parameterOrder": [
  5002. // "database"
  5003. // ],
  5004. // "parameters": {
  5005. // "database": {
  5006. // "description": "The database name. In the format:\n`projects/{project_id}/databases/{database_id}`.\nThis is only required in the first message.",
  5007. // "location": "path",
  5008. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  5009. // "required": true,
  5010. // "type": "string"
  5011. // }
  5012. // },
  5013. // "path": "v1beta1/{+database}/documents:write",
  5014. // "request": {
  5015. // "$ref": "WriteRequest"
  5016. // },
  5017. // "response": {
  5018. // "$ref": "WriteResponse"
  5019. // },
  5020. // "scopes": [
  5021. // "https://www.googleapis.com/auth/cloud-platform",
  5022. // "https://www.googleapis.com/auth/datastore"
  5023. // ]
  5024. // }
  5025. }
  5026. // method id "firestore.projects.databases.indexes.create":
  5027. type ProjectsDatabasesIndexesCreateCall struct {
  5028. s *Service
  5029. parent string
  5030. googlefirestoreadminv1beta1index *GoogleFirestoreAdminV1beta1Index
  5031. urlParams_ gensupport.URLParams
  5032. ctx_ context.Context
  5033. header_ http.Header
  5034. }
  5035. // Create: Creates the specified index.
  5036. // A newly created index's initial state is `CREATING`. On completion of
  5037. // the
  5038. // returned google.longrunning.Operation, the state will be `READY`.
  5039. // If the index already exists, the call will return an
  5040. // `ALREADY_EXISTS`
  5041. // status.
  5042. //
  5043. // During creation, the process could result in an error, in which case
  5044. // the
  5045. // index will move to the `ERROR` state. The process can be recovered
  5046. // by
  5047. // fixing the data that caused the error, removing the index
  5048. // with
  5049. // delete, then re-creating the index with
  5050. // create.
  5051. //
  5052. // Indexes with a single field cannot be created.
  5053. func (r *ProjectsDatabasesIndexesService) Create(parent string, googlefirestoreadminv1beta1index *GoogleFirestoreAdminV1beta1Index) *ProjectsDatabasesIndexesCreateCall {
  5054. c := &ProjectsDatabasesIndexesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5055. c.parent = parent
  5056. c.googlefirestoreadminv1beta1index = googlefirestoreadminv1beta1index
  5057. return c
  5058. }
  5059. // Fields allows partial responses to be retrieved. See
  5060. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5061. // for more information.
  5062. func (c *ProjectsDatabasesIndexesCreateCall) Fields(s ...googleapi.Field) *ProjectsDatabasesIndexesCreateCall {
  5063. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5064. return c
  5065. }
  5066. // Context sets the context to be used in this call's Do method. Any
  5067. // pending HTTP request will be aborted if the provided context is
  5068. // canceled.
  5069. func (c *ProjectsDatabasesIndexesCreateCall) Context(ctx context.Context) *ProjectsDatabasesIndexesCreateCall {
  5070. c.ctx_ = ctx
  5071. return c
  5072. }
  5073. // Header returns an http.Header that can be modified by the caller to
  5074. // add HTTP headers to the request.
  5075. func (c *ProjectsDatabasesIndexesCreateCall) Header() http.Header {
  5076. if c.header_ == nil {
  5077. c.header_ = make(http.Header)
  5078. }
  5079. return c.header_
  5080. }
  5081. func (c *ProjectsDatabasesIndexesCreateCall) doRequest(alt string) (*http.Response, error) {
  5082. reqHeaders := make(http.Header)
  5083. for k, v := range c.header_ {
  5084. reqHeaders[k] = v
  5085. }
  5086. reqHeaders.Set("User-Agent", c.s.userAgent())
  5087. var body io.Reader = nil
  5088. body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlefirestoreadminv1beta1index)
  5089. if err != nil {
  5090. return nil, err
  5091. }
  5092. reqHeaders.Set("Content-Type", "application/json")
  5093. c.urlParams_.Set("alt", alt)
  5094. c.urlParams_.Set("prettyPrint", "false")
  5095. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/indexes")
  5096. urls += "?" + c.urlParams_.Encode()
  5097. req, err := http.NewRequest("POST", urls, body)
  5098. if err != nil {
  5099. return nil, err
  5100. }
  5101. req.Header = reqHeaders
  5102. googleapi.Expand(req.URL, map[string]string{
  5103. "parent": c.parent,
  5104. })
  5105. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5106. }
  5107. // Do executes the "firestore.projects.databases.indexes.create" call.
  5108. // Exactly one of *GoogleLongrunningOperation or error will be non-nil.
  5109. // Any non-2xx status code is an error. Response headers are in either
  5110. // *GoogleLongrunningOperation.ServerResponse.Header or (if a response
  5111. // was returned at all) in error.(*googleapi.Error).Header. Use
  5112. // googleapi.IsNotModified to check whether the returned error was
  5113. // because http.StatusNotModified was returned.
  5114. func (c *ProjectsDatabasesIndexesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
  5115. gensupport.SetOptions(c.urlParams_, opts...)
  5116. res, err := c.doRequest("json")
  5117. if res != nil && res.StatusCode == http.StatusNotModified {
  5118. if res.Body != nil {
  5119. res.Body.Close()
  5120. }
  5121. return nil, &googleapi.Error{
  5122. Code: res.StatusCode,
  5123. Header: res.Header,
  5124. }
  5125. }
  5126. if err != nil {
  5127. return nil, err
  5128. }
  5129. defer googleapi.CloseBody(res)
  5130. if err := googleapi.CheckResponse(res); err != nil {
  5131. return nil, err
  5132. }
  5133. ret := &GoogleLongrunningOperation{
  5134. ServerResponse: googleapi.ServerResponse{
  5135. Header: res.Header,
  5136. HTTPStatusCode: res.StatusCode,
  5137. },
  5138. }
  5139. target := &ret
  5140. if err := gensupport.DecodeResponse(target, res); err != nil {
  5141. return nil, err
  5142. }
  5143. return ret, nil
  5144. // {
  5145. // "description": "Creates the specified index.\nA newly created index's initial state is `CREATING`. On completion of the\nreturned google.longrunning.Operation, the state will be `READY`.\nIf the index already exists, the call will return an `ALREADY_EXISTS`\nstatus.\n\nDuring creation, the process could result in an error, in which case the\nindex will move to the `ERROR` state. The process can be recovered by\nfixing the data that caused the error, removing the index with\ndelete, then re-creating the index with\ncreate.\n\nIndexes with a single field cannot be created.",
  5146. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/indexes",
  5147. // "httpMethod": "POST",
  5148. // "id": "firestore.projects.databases.indexes.create",
  5149. // "parameterOrder": [
  5150. // "parent"
  5151. // ],
  5152. // "parameters": {
  5153. // "parent": {
  5154. // "description": "The name of the database this index will apply to. For example:\n`projects/{project_id}/databases/{database_id}`",
  5155. // "location": "path",
  5156. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  5157. // "required": true,
  5158. // "type": "string"
  5159. // }
  5160. // },
  5161. // "path": "v1beta1/{+parent}/indexes",
  5162. // "request": {
  5163. // "$ref": "GoogleFirestoreAdminV1beta1Index"
  5164. // },
  5165. // "response": {
  5166. // "$ref": "GoogleLongrunningOperation"
  5167. // },
  5168. // "scopes": [
  5169. // "https://www.googleapis.com/auth/cloud-platform",
  5170. // "https://www.googleapis.com/auth/datastore"
  5171. // ]
  5172. // }
  5173. }
  5174. // method id "firestore.projects.databases.indexes.delete":
  5175. type ProjectsDatabasesIndexesDeleteCall struct {
  5176. s *Service
  5177. name string
  5178. urlParams_ gensupport.URLParams
  5179. ctx_ context.Context
  5180. header_ http.Header
  5181. }
  5182. // Delete: Deletes an index.
  5183. func (r *ProjectsDatabasesIndexesService) Delete(name string) *ProjectsDatabasesIndexesDeleteCall {
  5184. c := &ProjectsDatabasesIndexesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5185. c.name = name
  5186. return c
  5187. }
  5188. // Fields allows partial responses to be retrieved. See
  5189. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5190. // for more information.
  5191. func (c *ProjectsDatabasesIndexesDeleteCall) Fields(s ...googleapi.Field) *ProjectsDatabasesIndexesDeleteCall {
  5192. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5193. return c
  5194. }
  5195. // Context sets the context to be used in this call's Do method. Any
  5196. // pending HTTP request will be aborted if the provided context is
  5197. // canceled.
  5198. func (c *ProjectsDatabasesIndexesDeleteCall) Context(ctx context.Context) *ProjectsDatabasesIndexesDeleteCall {
  5199. c.ctx_ = ctx
  5200. return c
  5201. }
  5202. // Header returns an http.Header that can be modified by the caller to
  5203. // add HTTP headers to the request.
  5204. func (c *ProjectsDatabasesIndexesDeleteCall) Header() http.Header {
  5205. if c.header_ == nil {
  5206. c.header_ = make(http.Header)
  5207. }
  5208. return c.header_
  5209. }
  5210. func (c *ProjectsDatabasesIndexesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5211. reqHeaders := make(http.Header)
  5212. for k, v := range c.header_ {
  5213. reqHeaders[k] = v
  5214. }
  5215. reqHeaders.Set("User-Agent", c.s.userAgent())
  5216. var body io.Reader = nil
  5217. c.urlParams_.Set("alt", alt)
  5218. c.urlParams_.Set("prettyPrint", "false")
  5219. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  5220. urls += "?" + c.urlParams_.Encode()
  5221. req, err := http.NewRequest("DELETE", urls, body)
  5222. if err != nil {
  5223. return nil, err
  5224. }
  5225. req.Header = reqHeaders
  5226. googleapi.Expand(req.URL, map[string]string{
  5227. "name": c.name,
  5228. })
  5229. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5230. }
  5231. // Do executes the "firestore.projects.databases.indexes.delete" call.
  5232. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5233. // code is an error. Response headers are in either
  5234. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5235. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5236. // check whether the returned error was because http.StatusNotModified
  5237. // was returned.
  5238. func (c *ProjectsDatabasesIndexesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5239. gensupport.SetOptions(c.urlParams_, opts...)
  5240. res, err := c.doRequest("json")
  5241. if res != nil && res.StatusCode == http.StatusNotModified {
  5242. if res.Body != nil {
  5243. res.Body.Close()
  5244. }
  5245. return nil, &googleapi.Error{
  5246. Code: res.StatusCode,
  5247. Header: res.Header,
  5248. }
  5249. }
  5250. if err != nil {
  5251. return nil, err
  5252. }
  5253. defer googleapi.CloseBody(res)
  5254. if err := googleapi.CheckResponse(res); err != nil {
  5255. return nil, err
  5256. }
  5257. ret := &Empty{
  5258. ServerResponse: googleapi.ServerResponse{
  5259. Header: res.Header,
  5260. HTTPStatusCode: res.StatusCode,
  5261. },
  5262. }
  5263. target := &ret
  5264. if err := gensupport.DecodeResponse(target, res); err != nil {
  5265. return nil, err
  5266. }
  5267. return ret, nil
  5268. // {
  5269. // "description": "Deletes an index.",
  5270. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/indexes/{indexesId}",
  5271. // "httpMethod": "DELETE",
  5272. // "id": "firestore.projects.databases.indexes.delete",
  5273. // "parameterOrder": [
  5274. // "name"
  5275. // ],
  5276. // "parameters": {
  5277. // "name": {
  5278. // "description": "The index name. For example:\n`projects/{project_id}/databases/{database_id}/indexes/{index_id}`",
  5279. // "location": "path",
  5280. // "pattern": "^projects/[^/]+/databases/[^/]+/indexes/[^/]+$",
  5281. // "required": true,
  5282. // "type": "string"
  5283. // }
  5284. // },
  5285. // "path": "v1beta1/{+name}",
  5286. // "response": {
  5287. // "$ref": "Empty"
  5288. // },
  5289. // "scopes": [
  5290. // "https://www.googleapis.com/auth/cloud-platform",
  5291. // "https://www.googleapis.com/auth/datastore"
  5292. // ]
  5293. // }
  5294. }
  5295. // method id "firestore.projects.databases.indexes.get":
  5296. type ProjectsDatabasesIndexesGetCall struct {
  5297. s *Service
  5298. name string
  5299. urlParams_ gensupport.URLParams
  5300. ifNoneMatch_ string
  5301. ctx_ context.Context
  5302. header_ http.Header
  5303. }
  5304. // Get: Gets an index.
  5305. func (r *ProjectsDatabasesIndexesService) Get(name string) *ProjectsDatabasesIndexesGetCall {
  5306. c := &ProjectsDatabasesIndexesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5307. c.name = name
  5308. return c
  5309. }
  5310. // Fields allows partial responses to be retrieved. See
  5311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5312. // for more information.
  5313. func (c *ProjectsDatabasesIndexesGetCall) Fields(s ...googleapi.Field) *ProjectsDatabasesIndexesGetCall {
  5314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5315. return c
  5316. }
  5317. // IfNoneMatch sets the optional parameter which makes the operation
  5318. // fail if the object's ETag matches the given value. This is useful for
  5319. // getting updates only after the object has changed since the last
  5320. // request. Use googleapi.IsNotModified to check whether the response
  5321. // error from Do is the result of In-None-Match.
  5322. func (c *ProjectsDatabasesIndexesGetCall) IfNoneMatch(entityTag string) *ProjectsDatabasesIndexesGetCall {
  5323. c.ifNoneMatch_ = entityTag
  5324. return c
  5325. }
  5326. // Context sets the context to be used in this call's Do method. Any
  5327. // pending HTTP request will be aborted if the provided context is
  5328. // canceled.
  5329. func (c *ProjectsDatabasesIndexesGetCall) Context(ctx context.Context) *ProjectsDatabasesIndexesGetCall {
  5330. c.ctx_ = ctx
  5331. return c
  5332. }
  5333. // Header returns an http.Header that can be modified by the caller to
  5334. // add HTTP headers to the request.
  5335. func (c *ProjectsDatabasesIndexesGetCall) Header() http.Header {
  5336. if c.header_ == nil {
  5337. c.header_ = make(http.Header)
  5338. }
  5339. return c.header_
  5340. }
  5341. func (c *ProjectsDatabasesIndexesGetCall) doRequest(alt string) (*http.Response, error) {
  5342. reqHeaders := make(http.Header)
  5343. for k, v := range c.header_ {
  5344. reqHeaders[k] = v
  5345. }
  5346. reqHeaders.Set("User-Agent", c.s.userAgent())
  5347. if c.ifNoneMatch_ != "" {
  5348. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5349. }
  5350. var body io.Reader = nil
  5351. c.urlParams_.Set("alt", alt)
  5352. c.urlParams_.Set("prettyPrint", "false")
  5353. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  5354. urls += "?" + c.urlParams_.Encode()
  5355. req, err := http.NewRequest("GET", urls, body)
  5356. if err != nil {
  5357. return nil, err
  5358. }
  5359. req.Header = reqHeaders
  5360. googleapi.Expand(req.URL, map[string]string{
  5361. "name": c.name,
  5362. })
  5363. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5364. }
  5365. // Do executes the "firestore.projects.databases.indexes.get" call.
  5366. // Exactly one of *GoogleFirestoreAdminV1beta1Index or error will be
  5367. // non-nil. Any non-2xx status code is an error. Response headers are in
  5368. // either *GoogleFirestoreAdminV1beta1Index.ServerResponse.Header or (if
  5369. // a response was returned at all) in error.(*googleapi.Error).Header.
  5370. // Use googleapi.IsNotModified to check whether the returned error was
  5371. // because http.StatusNotModified was returned.
  5372. func (c *ProjectsDatabasesIndexesGetCall) Do(opts ...googleapi.CallOption) (*GoogleFirestoreAdminV1beta1Index, error) {
  5373. gensupport.SetOptions(c.urlParams_, opts...)
  5374. res, err := c.doRequest("json")
  5375. if res != nil && res.StatusCode == http.StatusNotModified {
  5376. if res.Body != nil {
  5377. res.Body.Close()
  5378. }
  5379. return nil, &googleapi.Error{
  5380. Code: res.StatusCode,
  5381. Header: res.Header,
  5382. }
  5383. }
  5384. if err != nil {
  5385. return nil, err
  5386. }
  5387. defer googleapi.CloseBody(res)
  5388. if err := googleapi.CheckResponse(res); err != nil {
  5389. return nil, err
  5390. }
  5391. ret := &GoogleFirestoreAdminV1beta1Index{
  5392. ServerResponse: googleapi.ServerResponse{
  5393. Header: res.Header,
  5394. HTTPStatusCode: res.StatusCode,
  5395. },
  5396. }
  5397. target := &ret
  5398. if err := gensupport.DecodeResponse(target, res); err != nil {
  5399. return nil, err
  5400. }
  5401. return ret, nil
  5402. // {
  5403. // "description": "Gets an index.",
  5404. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/indexes/{indexesId}",
  5405. // "httpMethod": "GET",
  5406. // "id": "firestore.projects.databases.indexes.get",
  5407. // "parameterOrder": [
  5408. // "name"
  5409. // ],
  5410. // "parameters": {
  5411. // "name": {
  5412. // "description": "The name of the index. For example:\n`projects/{project_id}/databases/{database_id}/indexes/{index_id}`",
  5413. // "location": "path",
  5414. // "pattern": "^projects/[^/]+/databases/[^/]+/indexes/[^/]+$",
  5415. // "required": true,
  5416. // "type": "string"
  5417. // }
  5418. // },
  5419. // "path": "v1beta1/{+name}",
  5420. // "response": {
  5421. // "$ref": "GoogleFirestoreAdminV1beta1Index"
  5422. // },
  5423. // "scopes": [
  5424. // "https://www.googleapis.com/auth/cloud-platform",
  5425. // "https://www.googleapis.com/auth/datastore"
  5426. // ]
  5427. // }
  5428. }
  5429. // method id "firestore.projects.databases.indexes.list":
  5430. type ProjectsDatabasesIndexesListCall struct {
  5431. s *Service
  5432. parent string
  5433. urlParams_ gensupport.URLParams
  5434. ifNoneMatch_ string
  5435. ctx_ context.Context
  5436. header_ http.Header
  5437. }
  5438. // List: Lists the indexes that match the specified filters.
  5439. func (r *ProjectsDatabasesIndexesService) List(parent string) *ProjectsDatabasesIndexesListCall {
  5440. c := &ProjectsDatabasesIndexesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5441. c.parent = parent
  5442. return c
  5443. }
  5444. // Filter sets the optional parameter "filter":
  5445. func (c *ProjectsDatabasesIndexesListCall) Filter(filter string) *ProjectsDatabasesIndexesListCall {
  5446. c.urlParams_.Set("filter", filter)
  5447. return c
  5448. }
  5449. // PageSize sets the optional parameter "pageSize": The standard List
  5450. // page size.
  5451. func (c *ProjectsDatabasesIndexesListCall) PageSize(pageSize int64) *ProjectsDatabasesIndexesListCall {
  5452. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5453. return c
  5454. }
  5455. // PageToken sets the optional parameter "pageToken": The standard List
  5456. // page token.
  5457. func (c *ProjectsDatabasesIndexesListCall) PageToken(pageToken string) *ProjectsDatabasesIndexesListCall {
  5458. c.urlParams_.Set("pageToken", pageToken)
  5459. return c
  5460. }
  5461. // Fields allows partial responses to be retrieved. See
  5462. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5463. // for more information.
  5464. func (c *ProjectsDatabasesIndexesListCall) Fields(s ...googleapi.Field) *ProjectsDatabasesIndexesListCall {
  5465. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5466. return c
  5467. }
  5468. // IfNoneMatch sets the optional parameter which makes the operation
  5469. // fail if the object's ETag matches the given value. This is useful for
  5470. // getting updates only after the object has changed since the last
  5471. // request. Use googleapi.IsNotModified to check whether the response
  5472. // error from Do is the result of In-None-Match.
  5473. func (c *ProjectsDatabasesIndexesListCall) IfNoneMatch(entityTag string) *ProjectsDatabasesIndexesListCall {
  5474. c.ifNoneMatch_ = entityTag
  5475. return c
  5476. }
  5477. // Context sets the context to be used in this call's Do method. Any
  5478. // pending HTTP request will be aborted if the provided context is
  5479. // canceled.
  5480. func (c *ProjectsDatabasesIndexesListCall) Context(ctx context.Context) *ProjectsDatabasesIndexesListCall {
  5481. c.ctx_ = ctx
  5482. return c
  5483. }
  5484. // Header returns an http.Header that can be modified by the caller to
  5485. // add HTTP headers to the request.
  5486. func (c *ProjectsDatabasesIndexesListCall) Header() http.Header {
  5487. if c.header_ == nil {
  5488. c.header_ = make(http.Header)
  5489. }
  5490. return c.header_
  5491. }
  5492. func (c *ProjectsDatabasesIndexesListCall) doRequest(alt string) (*http.Response, error) {
  5493. reqHeaders := make(http.Header)
  5494. for k, v := range c.header_ {
  5495. reqHeaders[k] = v
  5496. }
  5497. reqHeaders.Set("User-Agent", c.s.userAgent())
  5498. if c.ifNoneMatch_ != "" {
  5499. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5500. }
  5501. var body io.Reader = nil
  5502. c.urlParams_.Set("alt", alt)
  5503. c.urlParams_.Set("prettyPrint", "false")
  5504. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/indexes")
  5505. urls += "?" + c.urlParams_.Encode()
  5506. req, err := http.NewRequest("GET", urls, body)
  5507. if err != nil {
  5508. return nil, err
  5509. }
  5510. req.Header = reqHeaders
  5511. googleapi.Expand(req.URL, map[string]string{
  5512. "parent": c.parent,
  5513. })
  5514. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5515. }
  5516. // Do executes the "firestore.projects.databases.indexes.list" call.
  5517. // Exactly one of *GoogleFirestoreAdminV1beta1ListIndexesResponse or
  5518. // error will be non-nil. Any non-2xx status code is an error. Response
  5519. // headers are in either
  5520. // *GoogleFirestoreAdminV1beta1ListIndexesResponse.ServerResponse.Header
  5521. // or (if a response was returned at all) in
  5522. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5523. // whether the returned error was because http.StatusNotModified was
  5524. // returned.
  5525. func (c *ProjectsDatabasesIndexesListCall) Do(opts ...googleapi.CallOption) (*GoogleFirestoreAdminV1beta1ListIndexesResponse, error) {
  5526. gensupport.SetOptions(c.urlParams_, opts...)
  5527. res, err := c.doRequest("json")
  5528. if res != nil && res.StatusCode == http.StatusNotModified {
  5529. if res.Body != nil {
  5530. res.Body.Close()
  5531. }
  5532. return nil, &googleapi.Error{
  5533. Code: res.StatusCode,
  5534. Header: res.Header,
  5535. }
  5536. }
  5537. if err != nil {
  5538. return nil, err
  5539. }
  5540. defer googleapi.CloseBody(res)
  5541. if err := googleapi.CheckResponse(res); err != nil {
  5542. return nil, err
  5543. }
  5544. ret := &GoogleFirestoreAdminV1beta1ListIndexesResponse{
  5545. ServerResponse: googleapi.ServerResponse{
  5546. Header: res.Header,
  5547. HTTPStatusCode: res.StatusCode,
  5548. },
  5549. }
  5550. target := &ret
  5551. if err := gensupport.DecodeResponse(target, res); err != nil {
  5552. return nil, err
  5553. }
  5554. return ret, nil
  5555. // {
  5556. // "description": "Lists the indexes that match the specified filters.",
  5557. // "flatPath": "v1beta1/projects/{projectsId}/databases/{databasesId}/indexes",
  5558. // "httpMethod": "GET",
  5559. // "id": "firestore.projects.databases.indexes.list",
  5560. // "parameterOrder": [
  5561. // "parent"
  5562. // ],
  5563. // "parameters": {
  5564. // "filter": {
  5565. // "location": "query",
  5566. // "type": "string"
  5567. // },
  5568. // "pageSize": {
  5569. // "description": "The standard List page size.",
  5570. // "format": "int32",
  5571. // "location": "query",
  5572. // "type": "integer"
  5573. // },
  5574. // "pageToken": {
  5575. // "description": "The standard List page token.",
  5576. // "location": "query",
  5577. // "type": "string"
  5578. // },
  5579. // "parent": {
  5580. // "description": "The database name. For example:\n`projects/{project_id}/databases/{database_id}`",
  5581. // "location": "path",
  5582. // "pattern": "^projects/[^/]+/databases/[^/]+$",
  5583. // "required": true,
  5584. // "type": "string"
  5585. // }
  5586. // },
  5587. // "path": "v1beta1/{+parent}/indexes",
  5588. // "response": {
  5589. // "$ref": "GoogleFirestoreAdminV1beta1ListIndexesResponse"
  5590. // },
  5591. // "scopes": [
  5592. // "https://www.googleapis.com/auth/cloud-platform",
  5593. // "https://www.googleapis.com/auth/datastore"
  5594. // ]
  5595. // }
  5596. }
  5597. // Pages invokes f for each page of results.
  5598. // A non-nil error returned from f will halt the iteration.
  5599. // The provided context supersedes any context provided to the Context method.
  5600. func (c *ProjectsDatabasesIndexesListCall) Pages(ctx context.Context, f func(*GoogleFirestoreAdminV1beta1ListIndexesResponse) error) error {
  5601. c.ctx_ = ctx
  5602. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5603. for {
  5604. x, err := c.Do()
  5605. if err != nil {
  5606. return err
  5607. }
  5608. if err := f(x); err != nil {
  5609. return err
  5610. }
  5611. if x.NextPageToken == "" {
  5612. return nil
  5613. }
  5614. c.PageToken(x.NextPageToken)
  5615. }
  5616. }