選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

5338 行
193 KiB

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