diff --git a/.travis.yml b/.travis.yml
index 16fafc25b9a3..97631cbabadd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ jobs:
- composer self-update
- travis_retry composer install
- ./dev/google-cloud credentials
- - composer --no-interaction --dev remove google/protobuf google/gax google/proto-client
+ - composer --no-interaction --dev remove google/protobuf google/gax
- stage: "Push Docs"
php: 7.2
diff --git a/Firestore/metadata/V1/Common.php b/Firestore/metadata/V1/Common.php
new file mode 100644
index 000000000000..765faa2f7f8a
--- /dev/null
+++ b/Firestore/metadata/V1/Common.php
@@ -0,0 +1,49 @@
+internalAddGeneratedFile(hex2bin(
+ "0ac0050a20676f6f676c652f6669726573746f72652f76312f636f6d6d6f" .
+ "6e2e70726f746f1213676f6f676c652e6669726573746f72652e76311a1f" .
+ "676f6f676c652f70726f746f6275662f74696d657374616d702e70726f74" .
+ "6f22230a0c446f63756d656e744d61736b12130a0b6669656c645f706174" .
+ "687318012003280922650a0c507265636f6e646974696f6e12100a066578" .
+ "69737473180120012808480012310a0b7570646174655f74696d65180220" .
+ "01280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d" .
+ "70480042100a0e636f6e646974696f6e5f7479706522a9020a125472616e" .
+ "73616374696f6e4f7074696f6e7312450a09726561645f6f6e6c79180220" .
+ "01280b32302e676f6f676c652e6669726573746f72652e76312e5472616e" .
+ "73616374696f6e4f7074696f6e732e526561644f6e6c79480012470a0a72" .
+ "6561645f777269746518032001280b32312e676f6f676c652e6669726573" .
+ "746f72652e76312e5472616e73616374696f6e4f7074696f6e732e526561" .
+ "64577269746548001a260a0952656164577269746512190a117265747279" .
+ "5f7472616e73616374696f6e18012001280c1a530a08526561644f6e6c79" .
+ "122f0a09726561645f74696d6518022001280b321a2e676f6f676c652e70" .
+ "726f746f6275662e54696d657374616d70480042160a14636f6e73697374" .
+ "656e63795f73656c6563746f7242060a046d6f646542a5010a17636f6d2e" .
+ "676f6f676c652e6669726573746f72652e7631420b436f6d6d6f6e50726f" .
+ "746f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e70726f" .
+ "746f2f676f6f676c65617069732f6669726573746f72652f76313b666972" .
+ "6573746f7265a2020447434653aa0219476f6f676c652e436c6f75642e46" .
+ "69726573746f72652e5631ca0219476f6f676c655c436c6f75645c466972" .
+ "6573746f72655c5631620670726f746f33"
+ ));
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Firestore/metadata/V1/Document.php b/Firestore/metadata/V1/Document.php
new file mode 100644
index 000000000000..74727634e5fa
--- /dev/null
+++ b/Firestore/metadata/V1/Document.php
@@ -0,0 +1,68 @@
+internalAddGeneratedFile(hex2bin(
+ "0ac5090a22676f6f676c652f6669726573746f72652f76312f646f63756d" .
+ "656e742e70726f746f1213676f6f676c652e6669726573746f72652e7631" .
+ "1a1c676f6f676c652f70726f746f6275662f7374727563742e70726f746f" .
+ "1a1f676f6f676c652f70726f746f6275662f74696d657374616d702e7072" .
+ "6f746f1a18676f6f676c652f747970652f6c61746c6e672e70726f746f22" .
+ "80020a08446f63756d656e74120c0a046e616d6518012001280912390a06" .
+ "6669656c647318022003280b32292e676f6f676c652e6669726573746f72" .
+ "652e76312e446f63756d656e742e4669656c6473456e747279122f0a0b63" .
+ "72656174655f74696d6518032001280b321a2e676f6f676c652e70726f74" .
+ "6f6275662e54696d657374616d70122f0a0b7570646174655f74696d6518" .
+ "042001280b321a2e676f6f676c652e70726f746f6275662e54696d657374" .
+ "616d701a490a0b4669656c6473456e747279120b0a036b65791801200128" .
+ "0912290a0576616c756518022001280b321a2e676f6f676c652e66697265" .
+ "73746f72652e76312e56616c75653a02380122ae030a0556616c75651230" .
+ "0a0a6e756c6c5f76616c7565180b2001280e321a2e676f6f676c652e7072" .
+ "6f746f6275662e4e756c6c56616c7565480012170a0d626f6f6c65616e5f" .
+ "76616c7565180120012808480012170a0d696e74656765725f76616c7565" .
+ "180220012803480012160a0c646f75626c655f76616c7565180320012801" .
+ "480012350a0f74696d657374616d705f76616c7565180a2001280b321a2e" .
+ "676f6f676c652e70726f746f6275662e54696d657374616d70480012160a" .
+ "0c737472696e675f76616c7565181120012809480012150a0b6279746573" .
+ "5f76616c756518122001280c480012190a0f7265666572656e63655f7661" .
+ "6c75651805200128094800122e0a0f67656f5f706f696e745f76616c7565" .
+ "18082001280b32132e676f6f676c652e747970652e4c61744c6e67480012" .
+ "360a0b61727261795f76616c756518092001280b321f2e676f6f676c652e" .
+ "6669726573746f72652e76312e417272617956616c7565480012320a096d" .
+ "61705f76616c756518062001280b321d2e676f6f676c652e666972657374" .
+ "6f72652e76312e4d617056616c75654800420c0a0a76616c75655f747970" .
+ "6522380a0a417272617956616c7565122a0a0676616c7565731801200328" .
+ "0b321a2e676f6f676c652e6669726573746f72652e76312e56616c756522" .
+ "90010a084d617056616c756512390a066669656c647318012003280b3229" .
+ "2e676f6f676c652e6669726573746f72652e76312e4d617056616c75652e" .
+ "4669656c6473456e7472791a490a0b4669656c6473456e747279120b0a03" .
+ "6b657918012001280912290a0576616c756518022001280b321a2e676f6f" .
+ "676c652e6669726573746f72652e76312e56616c75653a02380142a7010a" .
+ "17636f6d2e676f6f676c652e6669726573746f72652e7631420d446f6375" .
+ "6d656e7450726f746f50015a3c676f6f676c652e676f6c616e672e6f7267" .
+ "2f67656e70726f746f2f676f6f676c65617069732f6669726573746f7265" .
+ "2f76313b6669726573746f7265a2020447434653aa0219476f6f676c652e" .
+ "436c6f75642e4669726573746f72652e5631ca0219476f6f676c655c436c" .
+ "6f75645c4669726573746f72655c5631620670726f746f33"
+ ));
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Firestore/metadata/V1/Firestore.php b/Firestore/metadata/V1/Firestore.php
new file mode 100644
index 000000000000..18533833f906
--- /dev/null
+++ b/Firestore/metadata/V1/Firestore.php
@@ -0,0 +1,267 @@
+internalAddGeneratedFile(hex2bin(
+ "0a92370a23676f6f676c652f6669726573746f72652f76312f6669726573" .
+ "746f72652e70726f746f1213676f6f676c652e6669726573746f72652e76" .
+ "311a20676f6f676c652f6669726573746f72652f76312f636f6d6d6f6e2e" .
+ "70726f746f1a22676f6f676c652f6669726573746f72652f76312f646f63" .
+ "756d656e742e70726f746f1a1f676f6f676c652f6669726573746f72652f" .
+ "76312f71756572792e70726f746f1a1f676f6f676c652f6669726573746f" .
+ "72652f76312f77726974652e70726f746f1a1b676f6f676c652f70726f74" .
+ "6f6275662f656d7074792e70726f746f1a1f676f6f676c652f70726f746f" .
+ "6275662f74696d657374616d702e70726f746f1a17676f6f676c652f7270" .
+ "632f7374617475732e70726f746f22b3010a12476574446f63756d656e74" .
+ "52657175657374120c0a046e616d65180120012809122f0a046d61736b18" .
+ "022001280b32212e676f6f676c652e6669726573746f72652e76312e446f" .
+ "63756d656e744d61736b12150a0b7472616e73616374696f6e1803200128" .
+ "0c4800122f0a09726561645f74696d6518052001280b321a2e676f6f676c" .
+ "652e70726f746f6275662e54696d657374616d70480042160a14636f6e73" .
+ "697374656e63795f73656c6563746f72229d020a144c697374446f63756d" .
+ "656e747352657175657374120e0a06706172656e7418012001280912150a" .
+ "0d636f6c6c656374696f6e5f696418022001280912110a09706167655f73" .
+ "697a6518032001280512120a0a706167655f746f6b656e18042001280912" .
+ "100a086f726465725f6279180620012809122f0a046d61736b1807200128" .
+ "0b32212e676f6f676c652e6669726573746f72652e76312e446f63756d65" .
+ "6e744d61736b12150a0b7472616e73616374696f6e18082001280c480012" .
+ "2f0a09726561645f74696d65180a2001280b321a2e676f6f676c652e7072" .
+ "6f746f6275662e54696d657374616d70480012140a0c73686f775f6d6973" .
+ "73696e67180c2001280842160a14636f6e73697374656e63795f73656c65" .
+ "63746f7222620a154c697374446f63756d656e7473526573706f6e736512" .
+ "300a09646f63756d656e747318012003280b321d2e676f6f676c652e6669" .
+ "726573746f72652e76312e446f63756d656e7412170a0f6e6578745f7061" .
+ "67655f746f6b656e18022001280922b5010a15437265617465446f63756d" .
+ "656e7452657175657374120e0a06706172656e7418012001280912150a0d" .
+ "636f6c6c656374696f6e5f696418022001280912130a0b646f63756d656e" .
+ "745f6964180320012809122f0a08646f63756d656e7418042001280b321d" .
+ "2e676f6f676c652e6669726573746f72652e76312e446f63756d656e7412" .
+ "2f0a046d61736b18052001280b32212e676f6f676c652e6669726573746f" .
+ "72652e76312e446f63756d656e744d61736b22ee010a1555706461746544" .
+ "6f63756d656e7452657175657374122f0a08646f63756d656e7418012001" .
+ "280b321d2e676f6f676c652e6669726573746f72652e76312e446f63756d" .
+ "656e7412360a0b7570646174655f6d61736b18022001280b32212e676f6f" .
+ "676c652e6669726573746f72652e76312e446f63756d656e744d61736b12" .
+ "2f0a046d61736b18032001280b32212e676f6f676c652e6669726573746f" .
+ "72652e76312e446f63756d656e744d61736b123b0a1063757272656e745f" .
+ "646f63756d656e7418042001280b32212e676f6f676c652e666972657374" .
+ "6f72652e76312e507265636f6e646974696f6e22620a1544656c65746544" .
+ "6f63756d656e7452657175657374120c0a046e616d65180120012809123b" .
+ "0a1063757272656e745f646f63756d656e7418022001280b32212e676f6f" .
+ "676c652e6669726573746f72652e76312e507265636f6e646974696f6e22" .
+ "94020a184261746368476574446f63756d656e7473526571756573741210" .
+ "0a08646174616261736518012001280912110a09646f63756d656e747318" .
+ "0220032809122f0a046d61736b18032001280b32212e676f6f676c652e66" .
+ "69726573746f72652e76312e446f63756d656e744d61736b12150a0b7472" .
+ "616e73616374696f6e18042001280c480012420a0f6e65775f7472616e73" .
+ "616374696f6e18052001280b32272e676f6f676c652e6669726573746f72" .
+ "652e76312e5472616e73616374696f6e4f7074696f6e734800122f0a0972" .
+ "6561645f74696d6518072001280b321a2e676f6f676c652e70726f746f62" .
+ "75662e54696d657374616d70480042160a14636f6e73697374656e63795f" .
+ "73656c6563746f7222ac010a194261746368476574446f63756d656e7473" .
+ "526573706f6e7365122e0a05666f756e6418012001280b321d2e676f6f67" .
+ "6c652e6669726573746f72652e76312e446f63756d656e74480012110a07" .
+ "6d697373696e67180220012809480012130a0b7472616e73616374696f6e" .
+ "18032001280c122d0a09726561645f74696d6518042001280b321a2e676f" .
+ "6f676c652e70726f746f6275662e54696d657374616d7042080a06726573" .
+ "756c7422650a17426567696e5472616e73616374696f6e52657175657374" .
+ "12100a08646174616261736518012001280912380a076f7074696f6e7318" .
+ "022001280b32272e676f6f676c652e6669726573746f72652e76312e5472" .
+ "616e73616374696f6e4f7074696f6e73222f0a18426567696e5472616e73" .
+ "616374696f6e526573706f6e736512130a0b7472616e73616374696f6e18" .
+ "012001280c22620a0d436f6d6d69745265717565737412100a0864617461" .
+ "62617365180120012809122a0a0677726974657318022003280b321a2e67" .
+ "6f6f676c652e6669726573746f72652e76312e577269746512130a0b7472" .
+ "616e73616374696f6e18032001280c227a0a0e436f6d6d6974526573706f" .
+ "6e736512370a0d77726974655f726573756c747318012003280b32202e67" .
+ "6f6f676c652e6669726573746f72652e76312e5772697465526573756c74" .
+ "122f0a0b636f6d6d69745f74696d6518022001280b321a2e676f6f676c65" .
+ "2e70726f746f6275662e54696d657374616d7022380a0f526f6c6c626163" .
+ "6b5265717565737412100a08646174616261736518012001280912130a0b" .
+ "7472616e73616374696f6e18022001280c2295020a0f52756e5175657279" .
+ "52657175657374120e0a06706172656e7418012001280912400a10737472" .
+ "756374757265645f717565727918022001280b32242e676f6f676c652e66" .
+ "69726573746f72652e76312e537472756374757265645175657279480012" .
+ "150a0b7472616e73616374696f6e18052001280c480112420a0f6e65775f" .
+ "7472616e73616374696f6e18062001280b32272e676f6f676c652e666972" .
+ "6573746f72652e76312e5472616e73616374696f6e4f7074696f6e734801" .
+ "122f0a09726561645f74696d6518072001280b321a2e676f6f676c652e70" .
+ "726f746f6275662e54696d657374616d704801420c0a0a71756572795f74" .
+ "79706542160a14636f6e73697374656e63795f73656c6563746f7222a001" .
+ "0a1052756e5175657279526573706f6e736512130a0b7472616e73616374" .
+ "696f6e18022001280c122f0a08646f63756d656e7418012001280b321d2e" .
+ "676f6f676c652e6669726573746f72652e76312e446f63756d656e74122d" .
+ "0a09726561645f74696d6518032001280b321a2e676f6f676c652e70726f" .
+ "746f6275662e54696d657374616d7012170a0f736b69707065645f726573" .
+ "756c747318042001280522e3010a0c57726974655265717565737412100a" .
+ "08646174616261736518012001280912110a0973747265616d5f69641802" .
+ "20012809122a0a0677726974657318032003280b321a2e676f6f676c652e" .
+ "6669726573746f72652e76312e577269746512140a0c73747265616d5f74" .
+ "6f6b656e18042001280c123d0a066c6162656c7318052003280b322d2e67" .
+ "6f6f676c652e6669726573746f72652e76312e5772697465526571756573" .
+ "742e4c6162656c73456e7472791a2d0a0b4c6162656c73456e747279120b" .
+ "0a036b6579180120012809120d0a0576616c75651802200128093a023801" .
+ "22a2010a0d5772697465526573706f6e736512110a0973747265616d5f69" .
+ "6418012001280912140a0c73747265616d5f746f6b656e18022001280c12" .
+ "370a0d77726974655f726573756c747318032003280b32202e676f6f676c" .
+ "652e6669726573746f72652e76312e5772697465526573756c74122f0a0b" .
+ "636f6d6d69745f74696d6518042001280b321a2e676f6f676c652e70726f" .
+ "746f6275662e54696d657374616d7022ed010a0d4c697374656e52657175" .
+ "65737412100a08646174616261736518012001280912310a0a6164645f74" .
+ "617267657418022001280b321b2e676f6f676c652e6669726573746f7265" .
+ "2e76312e546172676574480012170a0d72656d6f76655f74617267657418" .
+ "03200128054800123e0a066c6162656c7318042003280b322e2e676f6f67" .
+ "6c652e6669726573746f72652e76312e4c697374656e526571756573742e" .
+ "4c6162656c73456e7472791a2d0a0b4c6162656c73456e747279120b0a03" .
+ "6b6579180120012809120d0a0576616c75651802200128093a023801420f" .
+ "0a0d7461726765745f6368616e676522d5020a0e4c697374656e52657370" .
+ "6f6e7365123a0a0d7461726765745f6368616e676518022001280b32212e" .
+ "676f6f676c652e6669726573746f72652e76312e5461726765744368616e" .
+ "67654800123e0a0f646f63756d656e745f6368616e676518032001280b32" .
+ "232e676f6f676c652e6669726573746f72652e76312e446f63756d656e74" .
+ "4368616e67654800123e0a0f646f63756d656e745f64656c657465180420" .
+ "01280b32232e676f6f676c652e6669726573746f72652e76312e446f6375" .
+ "6d656e7444656c6574654800123e0a0f646f63756d656e745f72656d6f76" .
+ "6518062001280b32232e676f6f676c652e6669726573746f72652e76312e" .
+ "446f63756d656e7452656d6f7665480012360a0666696c74657218052001" .
+ "280b32242e676f6f676c652e6669726573746f72652e76312e4578697374" .
+ "656e636546696c7465724800420f0a0d726573706f6e73655f7479706522" .
+ "a1030a0654617267657412380a05717565727918022001280b32272e676f" .
+ "6f676c652e6669726573746f72652e76312e5461726765742e5175657279" .
+ "546172676574480012400a09646f63756d656e747318032001280b322b2e" .
+ "676f6f676c652e6669726573746f72652e76312e5461726765742e446f63" .
+ "756d656e7473546172676574480012160a0c726573756d655f746f6b656e" .
+ "18042001280c4801122f0a09726561645f74696d65180b2001280b321a2e" .
+ "676f6f676c652e70726f746f6275662e54696d657374616d70480112110a" .
+ "097461726765745f6964180520012805120c0a046f6e6365180620012808" .
+ "1a240a0f446f63756d656e747354617267657412110a09646f63756d656e" .
+ "74731802200328091a6d0a0b5175657279546172676574120e0a06706172" .
+ "656e7418012001280912400a10737472756374757265645f717565727918" .
+ "022001280b32242e676f6f676c652e6669726573746f72652e76312e5374" .
+ "727563747572656451756572794800420c0a0a71756572795f7479706542" .
+ "0d0a0b7461726765745f74797065420d0a0b726573756d655f7479706522" .
+ "aa020a0c5461726765744368616e6765124e0a127461726765745f636861" .
+ "6e67655f7479706518012001280e32322e676f6f676c652e666972657374" .
+ "6f72652e76312e5461726765744368616e67652e5461726765744368616e" .
+ "67655479706512120a0a7461726765745f69647318022003280512210a05" .
+ "636175736518032001280b32122e676f6f676c652e7270632e5374617475" .
+ "7312140a0c726573756d655f746f6b656e18042001280c122d0a09726561" .
+ "645f74696d6518062001280b321a2e676f6f676c652e70726f746f627566" .
+ "2e54696d657374616d70224e0a105461726765744368616e676554797065" .
+ "120d0a094e4f5f4348414e4745100012070a034144441001120a0a065245" .
+ "4d4f56451002120b0a0743555252454e54100312090a0552455345541004" .
+ "22510a184c697374436f6c6c656374696f6e49647352657175657374120e" .
+ "0a06706172656e7418012001280912110a09706167655f73697a65180220" .
+ "01280512120a0a706167655f746f6b656e180320012809224c0a194c6973" .
+ "74436f6c6c656374696f6e496473526573706f6e736512160a0e636f6c6c" .
+ "656374696f6e5f69647318012003280912170a0f6e6578745f706167655f" .
+ "746f6b656e1802200128093284120a094669726573746f7265128f010a0b" .
+ "476574446f63756d656e7412272e676f6f676c652e6669726573746f7265" .
+ "2e76312e476574446f63756d656e74526571756573741a1d2e676f6f676c" .
+ "652e6669726573746f72652e76312e446f63756d656e74223882d3e49302" .
+ "3212302f76312f7b6e616d653d70726f6a656374732f2a2f646174616261" .
+ "7365732f2a2f646f63756d656e74732f2a2f2a2a7d12b2010a0d4c697374" .
+ "446f63756d656e747312292e676f6f676c652e6669726573746f72652e76" .
+ "312e4c697374446f63756d656e7473526571756573741a2a2e676f6f676c" .
+ "652e6669726573746f72652e76312e4c697374446f63756d656e74735265" .
+ "73706f6e7365224a82d3e493024412422f76312f7b706172656e743d7072" .
+ "6f6a656374732f2a2f6461746162617365732f2a2f646f63756d656e7473" .
+ "2f2a2f2a2a7d2f7b636f6c6c656374696f6e5f69647d12af010a0e437265" .
+ "617465446f63756d656e74122a2e676f6f676c652e6669726573746f7265" .
+ "2e76312e437265617465446f63756d656e74526571756573741a1d2e676f" .
+ "6f676c652e6669726573746f72652e76312e446f63756d656e74225282d3" .
+ "e493024c22402f76312f7b706172656e743d70726f6a656374732f2a2f64" .
+ "61746162617365732f2a2f646f63756d656e74732f2a2a7d2f7b636f6c6c" .
+ "656374696f6e5f69647d3a08646f63756d656e7412a8010a0e5570646174" .
+ "65446f63756d656e74122a2e676f6f676c652e6669726573746f72652e76" .
+ "312e557064617465446f63756d656e74526571756573741a1d2e676f6f67" .
+ "6c652e6669726573746f72652e76312e446f63756d656e74224b82d3e493" .
+ "024532392f76312f7b646f63756d656e742e6e616d653d70726f6a656374" .
+ "732f2a2f6461746162617365732f2a2f646f63756d656e74732f2a2f2a2a" .
+ "7d3a08646f63756d656e74128e010a0e44656c657465446f63756d656e74" .
+ "122a2e676f6f676c652e6669726573746f72652e76312e44656c65746544" .
+ "6f63756d656e74526571756573741a162e676f6f676c652e70726f746f62" .
+ "75662e456d707479223882d3e49302322a302f76312f7b6e616d653d7072" .
+ "6f6a656374732f2a2f6461746162617365732f2a2f646f63756d656e7473" .
+ "2f2a2f2a2a7d12b9010a114261746368476574446f63756d656e7473122d" .
+ "2e676f6f676c652e6669726573746f72652e76312e426174636847657444" .
+ "6f63756d656e7473526571756573741a2e2e676f6f676c652e6669726573" .
+ "746f72652e76312e4261746368476574446f63756d656e7473526573706f" .
+ "6e7365224382d3e493023d22382f76312f7b64617461626173653d70726f" .
+ "6a656374732f2a2f6461746162617365732f2a7d2f646f63756d656e7473" .
+ "3a62617463684765743a012a300112bc010a10426567696e5472616e7361" .
+ "6374696f6e122c2e676f6f676c652e6669726573746f72652e76312e4265" .
+ "67696e5472616e73616374696f6e526571756573741a2d2e676f6f676c65" .
+ "2e6669726573746f72652e76312e426567696e5472616e73616374696f6e" .
+ "526573706f6e7365224b82d3e493024522402f76312f7b64617461626173" .
+ "653d70726f6a656374732f2a2f6461746162617365732f2a7d2f646f6375" .
+ "6d656e74733a626567696e5472616e73616374696f6e3a012a1294010a06" .
+ "436f6d6d697412222e676f6f676c652e6669726573746f72652e76312e43" .
+ "6f6d6d6974526571756573741a232e676f6f676c652e6669726573746f72" .
+ "652e76312e436f6d6d6974526573706f6e7365224182d3e493023b22362f" .
+ "76312f7b64617461626173653d70726f6a656374732f2a2f646174616261" .
+ "7365732f2a7d2f646f63756d656e74733a636f6d6d69743a012a128d010a" .
+ "08526f6c6c6261636b12242e676f6f676c652e6669726573746f72652e76" .
+ "312e526f6c6c6261636b526571756573741a162e676f6f676c652e70726f" .
+ "746f6275662e456d707479224382d3e493023d22382f76312f7b64617461" .
+ "626173653d70726f6a656374732f2a2f6461746162617365732f2a7d2f64" .
+ "6f63756d656e74733a726f6c6c6261636b3a012a12df010a0852756e5175" .
+ "65727912242e676f6f676c652e6669726573746f72652e76312e52756e51" .
+ "75657279526571756573741a252e676f6f676c652e6669726573746f7265" .
+ "2e76312e52756e5175657279526573706f6e736522830182d3e493027d22" .
+ "362f76312f7b706172656e743d70726f6a656374732f2a2f646174616261" .
+ "7365732f2a2f646f63756d656e74737d3a72756e51756572793a012a5a40" .
+ "223b2f76312f7b706172656e743d70726f6a656374732f2a2f6461746162" .
+ "617365732f2a2f646f63756d656e74732f2a2f2a2a7d3a72756e51756572" .
+ "793a012a30011294010a05577269746512212e676f6f676c652e66697265" .
+ "73746f72652e76312e5772697465526571756573741a222e676f6f676c65" .
+ "2e6669726573746f72652e76312e5772697465526573706f6e7365224082" .
+ "d3e493023a22352f76312f7b64617461626173653d70726f6a656374732f" .
+ "2a2f6461746162617365732f2a7d2f646f63756d656e74733a7772697465" .
+ "3a012a280130011298010a064c697374656e12222e676f6f676c652e6669" .
+ "726573746f72652e76312e4c697374656e526571756573741a232e676f6f" .
+ "676c652e6669726573746f72652e76312e4c697374656e526573706f6e73" .
+ "65224182d3e493023b22362f76312f7b64617461626173653d70726f6a65" .
+ "6374732f2a2f6461746162617365732f2a7d2f646f63756d656e74733a6c" .
+ "697374656e3a012a28013001128b020a114c697374436f6c6c656374696f" .
+ "6e496473122d2e676f6f676c652e6669726573746f72652e76312e4c6973" .
+ "74436f6c6c656374696f6e496473526571756573741a2e2e676f6f676c65" .
+ "2e6669726573746f72652e76312e4c697374436f6c6c656374696f6e4964" .
+ "73526573706f6e736522960182d3e493028f01223f2f76312f7b70617265" .
+ "6e743d70726f6a656374732f2a2f6461746162617365732f2a2f646f6375" .
+ "6d656e74737d3a6c697374436f6c6c656374696f6e4964733a012a5a4922" .
+ "442f76312f7b706172656e743d70726f6a656374732f2a2f646174616261" .
+ "7365732f2a2f646f63756d656e74732f2a2f2a2a7d3a6c697374436f6c6c" .
+ "656374696f6e4964733a012a42a8010a17636f6d2e676f6f676c652e6669" .
+ "726573746f72652e7631420e4669726573746f726550726f746f50015a3c" .
+ "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" .
+ "676c65617069732f6669726573746f72652f76313b6669726573746f7265" .
+ "a2020447434653aa0219476f6f676c652e436c6f75642e4669726573746f" .
+ "72652e5631ca0219476f6f676c655c436c6f75645c4669726573746f7265" .
+ "5c5631620670726f746f33"
+ ));
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Firestore/metadata/V1/Query.php b/Firestore/metadata/V1/Query.php
new file mode 100644
index 000000000000..afc64f429787
--- /dev/null
+++ b/Firestore/metadata/V1/Query.php
@@ -0,0 +1,102 @@
+internalAddGeneratedFile(hex2bin(
+ "0acc110a1f676f6f676c652f6669726573746f72652f76312f7175657279" .
+ "2e70726f746f1213676f6f676c652e6669726573746f72652e76311a2267" .
+ "6f6f676c652f6669726573746f72652f76312f646f63756d656e742e7072" .
+ "6f746f1a1e676f6f676c652f70726f746f6275662f77726170706572732e" .
+ "70726f746f22da0e0a0f537472756374757265645175657279123f0a0673" .
+ "656c65637418012001280b322f2e676f6f676c652e6669726573746f7265" .
+ "2e76312e5374727563747572656451756572792e50726f6a656374696f6e" .
+ "12450a0466726f6d18022003280b32372e676f6f676c652e666972657374" .
+ "6f72652e76312e5374727563747572656451756572792e436f6c6c656374" .
+ "696f6e53656c6563746f72123a0a05776865726518032001280b322b2e67" .
+ "6f6f676c652e6669726573746f72652e76312e5374727563747572656451" .
+ "756572792e46696c746572123c0a086f726465725f627918042003280b32" .
+ "2a2e676f6f676c652e6669726573746f72652e76312e5374727563747572" .
+ "656451756572792e4f72646572122d0a0873746172745f61741807200128" .
+ "0b321b2e676f6f676c652e6669726573746f72652e76312e437572736f72" .
+ "122b0a06656e645f617418082001280b321b2e676f6f676c652e66697265" .
+ "73746f72652e76312e437572736f72120e0a066f66667365741806200128" .
+ "05122a0a056c696d697418052001280b321b2e676f6f676c652e70726f74" .
+ "6f6275662e496e74333256616c75651a440a12436f6c6c656374696f6e53" .
+ "656c6563746f7212150a0d636f6c6c656374696f6e5f6964180220012809" .
+ "12170a0f616c6c5f64657363656e64616e74731803200128081afd010a06" .
+ "46696c74657212500a10636f6d706f736974655f66696c74657218012001" .
+ "280b32342e676f6f676c652e6669726573746f72652e76312e5374727563" .
+ "747572656451756572792e436f6d706f7369746546696c74657248001248" .
+ "0a0c6669656c645f66696c74657218022001280b32302e676f6f676c652e" .
+ "6669726573746f72652e76312e5374727563747572656451756572792e46" .
+ "69656c6446696c746572480012480a0c756e6172795f66696c7465721803" .
+ "2001280b32302e676f6f676c652e6669726573746f72652e76312e537472" .
+ "7563747572656451756572792e556e61727946696c7465724800420d0a0b" .
+ "66696c7465725f747970651ac9010a0f436f6d706f7369746546696c7465" .
+ "7212490a026f7018012001280e323d2e676f6f676c652e6669726573746f" .
+ "72652e76312e5374727563747572656451756572792e436f6d706f736974" .
+ "6546696c7465722e4f70657261746f72123c0a0766696c74657273180220" .
+ "03280b322b2e676f6f676c652e6669726573746f72652e76312e53747275" .
+ "63747572656451756572792e46696c746572222d0a084f70657261746f72" .
+ "12180a144f50455241544f525f554e535045434946494544100012070a03" .
+ "414e4410011add020a0b4669656c6446696c74657212420a056669656c64" .
+ "18012001280b32332e676f6f676c652e6669726573746f72652e76312e53" .
+ "74727563747572656451756572792e4669656c645265666572656e636512" .
+ "450a026f7018022001280e32392e676f6f676c652e6669726573746f7265" .
+ "2e76312e5374727563747572656451756572792e4669656c6446696c7465" .
+ "722e4f70657261746f7212290a0576616c756518032001280b321a2e676f" .
+ "6f676c652e6669726573746f72652e76312e56616c75652297010a084f70" .
+ "657261746f7212180a144f50455241544f525f554e535045434946494544" .
+ "1000120d0a094c4553535f5448414e100112160a124c4553535f5448414e" .
+ "5f4f525f455155414c100212100a0c475245415445525f5448414e100312" .
+ "190a15475245415445525f5448414e5f4f525f455155414c100412090a05" .
+ "455155414c100512120a0e41525241595f434f4e5441494e5310071ae901" .
+ "0a0b556e61727946696c74657212450a026f7018012001280e32392e676f" .
+ "6f676c652e6669726573746f72652e76312e537472756374757265645175" .
+ "6572792e556e61727946696c7465722e4f70657261746f7212440a056669" .
+ "656c6418022001280b32332e676f6f676c652e6669726573746f72652e76" .
+ "312e5374727563747572656451756572792e4669656c645265666572656e" .
+ "63654800223d0a084f70657261746f7212180a144f50455241544f525f55" .
+ "4e5350454349464945441000120a0a0649535f4e414e1002120b0a074953" .
+ "5f4e554c4c1003420e0a0c6f706572616e645f747970651a8e010a054f72" .
+ "64657212420a056669656c6418012001280b32332e676f6f676c652e6669" .
+ "726573746f72652e76312e5374727563747572656451756572792e466965" .
+ "6c645265666572656e636512410a09646972656374696f6e18022001280e" .
+ "322e2e676f6f676c652e6669726573746f72652e76312e53747275637475" .
+ "72656451756572792e446972656374696f6e1a240a0e4669656c64526566" .
+ "6572656e636512120a0a6669656c645f706174681802200128091a510a0a" .
+ "50726f6a656374696f6e12430a066669656c647318022003280b32332e67" .
+ "6f6f676c652e6669726573746f72652e76312e5374727563747572656451" .
+ "756572792e4669656c645265666572656e636522450a0944697265637469" .
+ "6f6e12190a15444952454354494f4e5f554e535045434946494544100012" .
+ "0d0a09415343454e44494e471001120e0a0a44455343454e44494e471002" .
+ "22440a06437572736f72122a0a0676616c75657318012003280b321a2e67" .
+ "6f6f676c652e6669726573746f72652e76312e56616c7565120e0a066265" .
+ "666f726518022001280842a4010a17636f6d2e676f6f676c652e66697265" .
+ "73746f72652e7631420a517565727950726f746f50015a3c676f6f676c65" .
+ "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" .
+ "732f6669726573746f72652f76313b6669726573746f7265a20204474346" .
+ "53aa0219476f6f676c652e436c6f75642e4669726573746f72652e5631ca" .
+ "0219476f6f676c655c436c6f75645c4669726573746f72655c5631620670" .
+ "726f746f33"
+ ));
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Firestore/metadata/V1/Write.php b/Firestore/metadata/V1/Write.php
new file mode 100644
index 000000000000..73dff190da37
--- /dev/null
+++ b/Firestore/metadata/V1/Write.php
@@ -0,0 +1,85 @@
+internalAddGeneratedFile(hex2bin(
+ "0abd0d0a1f676f6f676c652f6669726573746f72652f76312f7772697465" .
+ "2e70726f746f1213676f6f676c652e6669726573746f72652e76311a2067" .
+ "6f6f676c652f6669726573746f72652f76312f636f6d6d6f6e2e70726f74" .
+ "6f1a22676f6f676c652f6669726573746f72652f76312f646f63756d656e" .
+ "742e70726f746f1a1f676f6f676c652f70726f746f6275662f74696d6573" .
+ "74616d702e70726f746f2289020a055772697465122f0a06757064617465" .
+ "18012001280b321d2e676f6f676c652e6669726573746f72652e76312e44" .
+ "6f63756d656e74480012100a0664656c6574651802200128094800123b0a" .
+ "097472616e73666f726d18062001280b32262e676f6f676c652e66697265" .
+ "73746f72652e76312e446f63756d656e745472616e73666f726d48001236" .
+ "0a0b7570646174655f6d61736b18032001280b32212e676f6f676c652e66" .
+ "69726573746f72652e76312e446f63756d656e744d61736b123b0a106375" .
+ "7272656e745f646f63756d656e7418042001280b32212e676f6f676c652e" .
+ "6669726573746f72652e76312e507265636f6e646974696f6e420b0a096f" .
+ "7065726174696f6e22e5040a11446f63756d656e745472616e73666f726d" .
+ "12100a08646f63756d656e74180120012809124f0a106669656c645f7472" .
+ "616e73666f726d7318022003280b32352e676f6f676c652e666972657374" .
+ "6f72652e76312e446f63756d656e745472616e73666f726d2e4669656c64" .
+ "5472616e73666f726d1aec030a0e4669656c645472616e73666f726d1212" .
+ "0a0a6669656c645f7061746818012001280912600a137365745f746f5f73" .
+ "65727665725f76616c756518022001280e32412e676f6f676c652e666972" .
+ "6573746f72652e76312e446f63756d656e745472616e73666f726d2e4669" .
+ "656c645472616e73666f726d2e53657276657256616c75654800122f0a09" .
+ "696e6372656d656e7418032001280b321a2e676f6f676c652e6669726573" .
+ "746f72652e76312e56616c75654800122d0a076d6178696d756d18042001" .
+ "280b321a2e676f6f676c652e6669726573746f72652e76312e56616c7565" .
+ "4800122d0a076d696e696d756d18052001280b321a2e676f6f676c652e66" .
+ "69726573746f72652e76312e56616c7565480012420a17617070656e645f" .
+ "6d697373696e675f656c656d656e747318062001280b321f2e676f6f676c" .
+ "652e6669726573746f72652e76312e417272617956616c7565480012400a" .
+ "1572656d6f76655f616c6c5f66726f6d5f617272617918072001280b321f" .
+ "2e676f6f676c652e6669726573746f72652e76312e417272617956616c75" .
+ "654800223d0a0b53657276657256616c7565121c0a185345525645525f56" .
+ "414c55455f554e535045434946494544100012100a0c524551554553545f" .
+ "54494d45100142100a0e7472616e73666f726d5f7479706522750a0b5772" .
+ "697465526573756c74122f0a0b7570646174655f74696d6518012001280b" .
+ "321a2e676f6f676c652e70726f746f6275662e54696d657374616d701235" .
+ "0a117472616e73666f726d5f726573756c747318022003280b321a2e676f" .
+ "6f676c652e6669726573746f72652e76312e56616c756522710a0e446f63" .
+ "756d656e744368616e6765122f0a08646f63756d656e7418012001280b32" .
+ "1d2e676f6f676c652e6669726573746f72652e76312e446f63756d656e74" .
+ "12120a0a7461726765745f696473180520032805121a0a1272656d6f7665" .
+ "645f7461726765745f696473180620032805226d0a0e446f63756d656e74" .
+ "44656c65746512100a08646f63756d656e74180120012809121a0a127265" .
+ "6d6f7665645f7461726765745f696473180620032805122d0a0972656164" .
+ "5f74696d6518042001280b321a2e676f6f676c652e70726f746f6275662e" .
+ "54696d657374616d70226d0a0e446f63756d656e7452656d6f766512100a" .
+ "08646f63756d656e74180120012809121a0a1272656d6f7665645f746172" .
+ "6765745f696473180220032805122d0a09726561645f74696d6518042001" .
+ "280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d70" .
+ "22330a0f4578697374656e636546696c74657212110a097461726765745f" .
+ "6964180120012805120d0a05636f756e7418022001280542a4010a17636f" .
+ "6d2e676f6f676c652e6669726573746f72652e7631420a57726974655072" .
+ "6f746f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e7072" .
+ "6f746f2f676f6f676c65617069732f6669726573746f72652f76313b6669" .
+ "726573746f7265a2020447434653aa0219476f6f676c652e436c6f75642e" .
+ "4669726573746f72652e5631ca0219476f6f676c655c436c6f75645c4669" .
+ "726573746f72655c5631620670726f746f33"
+ ));
+
+ static::$is_initialized = true;
+ }
+}
+
diff --git a/Firestore/src/CollectionReference.php b/Firestore/src/CollectionReference.php
index 343ea1336e4e..5f979940828e 100644
--- a/Firestore/src/CollectionReference.php
+++ b/Firestore/src/CollectionReference.php
@@ -19,8 +19,6 @@
use Google\Cloud\Core\ArrayTrait;
use Google\Cloud\Core\DebugInfoTrait;
-use Google\Cloud\Core\Iterator\ItemIterator;
-use Google\Cloud\Core\Iterator\PageIterator;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
/**
diff --git a/Firestore/src/Connection/Grpc.php b/Firestore/src/Connection/Grpc.php
index c6c4c4661bb4..7ccd92b802e9 100644
--- a/Firestore/src/Connection/Grpc.php
+++ b/Firestore/src/Connection/Grpc.php
@@ -19,13 +19,12 @@
use Google\Cloud\Core\GrpcTrait;
use Google\Cloud\Core\GrpcRequestWrapper;
-use Google\Cloud\Firestore\V1beta1\FirestoreClient;
+use Google\Cloud\Firestore\V1\FirestoreClient;
use Google\Cloud\Firestore\FirestoreClient as ManualFirestoreClient;
-use Google\Cloud\Firestore\V1beta1\DocumentMask;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery;
-use Google\Cloud\Firestore\V1beta1\TransactionOptions;
-use Google\Cloud\Firestore\V1beta1\TransactionOptions\ReadWrite;
-use Google\Cloud\Firestore\V1beta1\Write;
+use Google\Cloud\Firestore\V1\StructuredQuery;
+use Google\Cloud\Firestore\V1\TransactionOptions;
+use Google\Cloud\Firestore\V1\TransactionOptions\ReadWrite;
+use Google\Cloud\Firestore\V1\Write;
use Google\ApiCore\Serializer;
/**
diff --git a/Firestore/src/DocumentReference.php b/Firestore/src/DocumentReference.php
index 4d49b6bf5729..16eb65cc70a8 100644
--- a/Firestore/src/DocumentReference.php
+++ b/Firestore/src/DocumentReference.php
@@ -20,8 +20,6 @@
use Google\Cloud\Core\DebugInfoTrait;
use Google\Cloud\Core\Iterator\ItemIterator;
use Google\Cloud\Core\Iterator\PageIterator;
-use Google\Cloud\Core\Exception\NotFoundException;
-use Google\Cloud\Core\Exception\ConflictException;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
/**
diff --git a/Firestore/src/FieldValue/DeleteFieldValue.php b/Firestore/src/FieldValue/DeleteFieldValue.php
index ad32c11650b6..cd8780279db9 100644
--- a/Firestore/src/FieldValue/DeleteFieldValue.php
+++ b/Firestore/src/FieldValue/DeleteFieldValue.php
@@ -17,8 +17,6 @@
namespace Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\FieldPath;
-
/**
* Represents a field to be deleted.
*
diff --git a/Firestore/src/FieldValue/DocumentTransformInterface.php b/Firestore/src/FieldValue/DocumentTransformInterface.php
index 58c4bfc0cba0..c142a44bf5c8 100644
--- a/Firestore/src/FieldValue/DocumentTransformInterface.php
+++ b/Firestore/src/FieldValue/DocumentTransformInterface.php
@@ -21,7 +21,7 @@
* Represents a DocumentTransform value.
*
* A DocumentTransformInterface instance defines the structure of a
- * {@see Google\Cloud\Firestore\V1beta1\DocumentTransform\FieldTransform}
+ * {@see Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform}
* message. `$key` defines the `oneof transformType` key, and `$args` defines
* the transformType message data.
*/
diff --git a/Firestore/src/FieldValue/DocumentTransformTrait.php b/Firestore/src/FieldValue/DocumentTransformTrait.php
index 1b35cdb4b0fd..004546e4a0a7 100644
--- a/Firestore/src/FieldValue/DocumentTransformTrait.php
+++ b/Firestore/src/FieldValue/DocumentTransformTrait.php
@@ -17,8 +17,6 @@
namespace Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\FieldPath;
-
/**
* Common methods for DocumentTransforms.
*/
diff --git a/Firestore/src/FieldValue/ServerTimestampValue.php b/Firestore/src/FieldValue/ServerTimestampValue.php
index b901bf71a721..f8a060b2f7ac 100644
--- a/Firestore/src/FieldValue/ServerTimestampValue.php
+++ b/Firestore/src/FieldValue/ServerTimestampValue.php
@@ -17,7 +17,7 @@
namespace Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\V1beta1\DocumentTransform\FieldTransform\ServerValue;
+use Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform\ServerValue;
/**
* Represents a ServerTimestamp DocumentTransform.
diff --git a/Firestore/src/FirestoreClient.php b/Firestore/src/FirestoreClient.php
index 67c1d5ca322a..4a640e0227b0 100644
--- a/Firestore/src/FirestoreClient.php
+++ b/Firestore/src/FirestoreClient.php
@@ -17,7 +17,6 @@
namespace Google\Cloud\Firestore;
-use Google\Cloud\Core\ArrayTrait;
use Google\Cloud\Core\Blob;
use Google\Cloud\Core\ClientTrait;
use Google\Cloud\Core\Exception\AbortedException;
diff --git a/Firestore/src/PathTrait.php b/Firestore/src/PathTrait.php
index 751f3fb9ad85..09ae94f8969a 100644
--- a/Firestore/src/PathTrait.php
+++ b/Firestore/src/PathTrait.php
@@ -18,7 +18,7 @@
namespace Google\Cloud\Firestore;
use Google\ApiCore\ValidationException;
-use Google\Cloud\Firestore\V1beta1\FirestoreClient as FirestoreGapicClient;
+use Google\Cloud\Firestore\V1\FirestoreClient as FirestoreGapicClient;
use Ramsey\Uuid\Uuid;
/**
diff --git a/Firestore/src/Query.php b/Firestore/src/Query.php
index daa11d29ffc6..60a7765ff255 100644
--- a/Firestore/src/Query.php
+++ b/Firestore/src/Query.php
@@ -23,10 +23,10 @@
use Google\Cloud\Firestore\DocumentSnapshot;
use Google\Cloud\Firestore\FieldValue\FieldValueInterface;
use Google\Cloud\Firestore\SnapshotTrait;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\CompositeFilter\Operator;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\Direction;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\FieldFilter\Operator as FieldFilterOperator;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\UnaryFilter\Operator as UnaryFilterOperator;
+use Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter\Operator;
+use Google\Cloud\Firestore\V1\StructuredQuery\Direction;
+use Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter\Operator as FieldFilterOperator;
+use Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter\Operator as UnaryFilterOperator;
/**
* A Cloud Firestore Query.
diff --git a/Firestore/src/Transaction.php b/Firestore/src/Transaction.php
index 65f031585758..0773669fec26 100644
--- a/Firestore/src/Transaction.php
+++ b/Firestore/src/Transaction.php
@@ -18,7 +18,6 @@
namespace Google\Cloud\Firestore;
use Google\Cloud\Core\DebugInfoTrait;
-use Google\Cloud\Core\Exception\NotFoundException;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
/**
diff --git a/Firestore/src/V1/ArrayValue.php b/Firestore/src/V1/ArrayValue.php
new file mode 100644
index 000000000000..1b6d013166af
--- /dev/null
+++ b/Firestore/src/V1/ArrayValue.php
@@ -0,0 +1,67 @@
+google.firestore.v1.ArrayValue
+ */
+class ArrayValue extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Values in the array.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ */
+ private $values;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $values
+ * Values in the array.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Document::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Values in the array.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getValues()
+ {
+ return $this->values;
+ }
+
+ /**
+ * Values in the array.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setValues($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
+ $this->values = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/BatchGetDocumentsRequest.php b/Firestore/src/V1/BatchGetDocumentsRequest.php
new file mode 100644
index 000000000000..24ad56f521e9
--- /dev/null
+++ b/Firestore/src/V1/BatchGetDocumentsRequest.php
@@ -0,0 +1,264 @@
+google.firestore.v1.BatchGetDocumentsRequest
+ */
+class BatchGetDocumentsRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of the
+ * given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ */
+ private $documents;
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field will
+ * not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ */
+ private $mask = null;
+ protected $consistency_selector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $documents
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of the
+ * given `database`. Duplicate names will be elided.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field will
+ * not be returned in the response.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type \Google\Cloud\Firestore\V1\TransactionOptions $new_transaction
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of the
+ * given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getDocuments()
+ {
+ return $this->documents;
+ }
+
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of the
+ * given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setDocuments($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->documents = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field will
+ * not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getMask()
+ {
+ return $this->mask;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field will
+ * not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 4;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->readOneof(4);
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(4, $var);
+
+ return $this;
+ }
+
+ /**
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions new_transaction = 5;
+ * @return \Google\Cloud\Firestore\V1\TransactionOptions
+ */
+ public function getNewTransaction()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions new_transaction = 5;
+ * @param \Google\Cloud\Firestore\V1\TransactionOptions $var
+ * @return $this
+ */
+ public function setNewTransaction($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions::class);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 7;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(7);
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 7;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(7, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConsistencySelector()
+ {
+ return $this->whichOneof("consistency_selector");
+ }
+
+}
+
diff --git a/Firestore/src/V1/BatchGetDocumentsResponse.php b/Firestore/src/V1/BatchGetDocumentsResponse.php
new file mode 100644
index 000000000000..1708b9efc368
--- /dev/null
+++ b/Firestore/src/V1/BatchGetDocumentsResponse.php
@@ -0,0 +1,189 @@
+google.firestore.v1.BatchGetDocumentsResponse
+ */
+class BatchGetDocumentsResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The transaction that was started as part of this request.
+ * Will only be set in the first response, and only if
+ * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction] was set in the request.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ */
+ private $transaction = '';
+ /**
+ * The time at which the document was read.
+ * This may be monotically increasing, in this case the previous documents in
+ * the result stream are guaranteed not to have changed between their
+ * read_time and this one.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ */
+ private $read_time = null;
+ protected $result;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Document $found
+ * A document that was requested.
+ * @type string $missing
+ * A document name that was requested but does not exist. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type string $transaction
+ * The transaction that was started as part of this request.
+ * Will only be set in the first response, and only if
+ * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction] was set in the request.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * The time at which the document was read.
+ * This may be monotically increasing, in this case the previous documents in
+ * the result stream are guaranteed not to have changed between their
+ * read_time and this one.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * A document that was requested.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document found = 1;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getFound()
+ {
+ return $this->readOneof(1);
+ }
+
+ /**
+ * A document that was requested.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document found = 1;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setFound($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->writeOneof(1, $var);
+
+ return $this;
+ }
+
+ /**
+ * A document name that was requested but does not exist. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string missing = 2;
+ * @return string
+ */
+ public function getMissing()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A document name that was requested but does not exist. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string missing = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setMissing($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * The transaction that was started as part of this request.
+ * Will only be set in the first response, and only if
+ * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction] was set in the request.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * The transaction that was started as part of this request.
+ * Will only be set in the first response, and only if
+ * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction] was set in the request.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->transaction = $var;
+
+ return $this;
+ }
+
+ /**
+ * The time at which the document was read.
+ * This may be monotically increasing, in this case the previous documents in
+ * the result stream are guaranteed not to have changed between their
+ * read_time and this one.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->read_time;
+ }
+
+ /**
+ * The time at which the document was read.
+ * This may be monotically increasing, in this case the previous documents in
+ * the result stream are guaranteed not to have changed between their
+ * read_time and this one.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->read_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getResult()
+ {
+ return $this->whichOneof("result");
+ }
+
+}
+
diff --git a/Firestore/src/V1/BeginTransactionRequest.php b/Firestore/src/V1/BeginTransactionRequest.php
new file mode 100644
index 000000000000..fefe79fcd5e9
--- /dev/null
+++ b/Firestore/src/V1/BeginTransactionRequest.php
@@ -0,0 +1,109 @@
+google.firestore.v1.BeginTransactionRequest
+ */
+class BeginTransactionRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * The options for the transaction.
+ * Defaults to a read-write transaction.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions options = 2;
+ */
+ private $options = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @type \Google\Cloud\Firestore\V1\TransactionOptions $options
+ * The options for the transaction.
+ * Defaults to a read-write transaction.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * The options for the transaction.
+ * Defaults to a read-write transaction.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions options = 2;
+ * @return \Google\Cloud\Firestore\V1\TransactionOptions
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * The options for the transaction.
+ * Defaults to a read-write transaction.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions options = 2;
+ * @param \Google\Cloud\Firestore\V1\TransactionOptions $var
+ * @return $this
+ */
+ public function setOptions($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions::class);
+ $this->options = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/BeginTransactionResponse.php b/Firestore/src/V1/BeginTransactionResponse.php
new file mode 100644
index 000000000000..027ba6df488d
--- /dev/null
+++ b/Firestore/src/V1/BeginTransactionResponse.php
@@ -0,0 +1,67 @@
+google.firestore.v1.BeginTransactionResponse
+ */
+class BeginTransactionResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The transaction that was started.
+ *
+ * Generated from protobuf field bytes transaction = 1;
+ */
+ private $transaction = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $transaction
+ * The transaction that was started.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The transaction that was started.
+ *
+ * Generated from protobuf field bytes transaction = 1;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * The transaction that was started.
+ *
+ * Generated from protobuf field bytes transaction = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->transaction = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/CommitRequest.php b/Firestore/src/V1/CommitRequest.php
new file mode 100644
index 000000000000..d08155038758
--- /dev/null
+++ b/Firestore/src/V1/CommitRequest.php
@@ -0,0 +1,143 @@
+google.firestore.v1.CommitRequest
+ */
+class CommitRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 2;
+ */
+ private $writes;
+ /**
+ * If set, applies all writes in this transaction, and commits it.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ */
+ private $transaction = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @type \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $writes
+ * The writes to apply.
+ * Always executed atomically and in order.
+ * @type string $transaction
+ * If set, applies all writes in this transaction, and commits it.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getWrites()
+ {
+ return $this->writes;
+ }
+
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 2;
+ * @param \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setWrites($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Write::class);
+ $this->writes = $arr;
+
+ return $this;
+ }
+
+ /**
+ * If set, applies all writes in this transaction, and commits it.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * If set, applies all writes in this transaction, and commits it.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->transaction = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/CommitResponse.php b/Firestore/src/V1/CommitResponse.php
new file mode 100644
index 000000000000..10fcb7ae3a47
--- /dev/null
+++ b/Firestore/src/V1/CommitResponse.php
@@ -0,0 +1,109 @@
+google.firestore.v1.CommitResponse
+ */
+class CommitResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 1;
+ */
+ private $write_results;
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 2;
+ */
+ private $commit_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $write_results
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ * @type \Google\Protobuf\Timestamp $commit_time
+ * The time at which the commit occurred.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getWriteResults()
+ {
+ return $this->write_results;
+ }
+
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 1;
+ * @param \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setWriteResults($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\WriteResult::class);
+ $this->write_results = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 2;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getCommitTime()
+ {
+ return $this->commit_time;
+ }
+
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 2;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCommitTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->commit_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/CreateDocumentRequest.php b/Firestore/src/V1/CreateDocumentRequest.php
new file mode 100644
index 000000000000..d6ebf62ff5f6
--- /dev/null
+++ b/Firestore/src/V1/CreateDocumentRequest.php
@@ -0,0 +1,223 @@
+google.firestore.v1.CreateDocumentRequest
+ */
+class CreateDocumentRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parent resource. For example:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
+ *
+ * Generated from protobuf field string parent = 1;
+ */
+ private $parent = '';
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ */
+ private $collection_id = '';
+ /**
+ * The client-assigned document ID to use for this document.
+ * Optional. If not specified, an ID will be assigned by the service.
+ *
+ * Generated from protobuf field string document_id = 3;
+ */
+ private $document_id = '';
+ /**
+ * The document to create. `name` must not be set.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 4;
+ */
+ private $document = null;
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 5;
+ */
+ private $mask = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * The parent resource. For example:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
+ * @type string $collection_id
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`.
+ * @type string $document_id
+ * The client-assigned document ID to use for this document.
+ * Optional. If not specified, an ID will be assigned by the service.
+ * @type \Google\Cloud\Firestore\V1\Document $document
+ * The document to create. `name` must not be set.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The parent resource. For example:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * The parent resource. For example:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @return string
+ */
+ public function getCollectionId()
+ {
+ return $this->collection_id;
+ }
+
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setCollectionId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->collection_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * The client-assigned document ID to use for this document.
+ * Optional. If not specified, an ID will be assigned by the service.
+ *
+ * Generated from protobuf field string document_id = 3;
+ * @return string
+ */
+ public function getDocumentId()
+ {
+ return $this->document_id;
+ }
+
+ /**
+ * The client-assigned document ID to use for this document.
+ * Optional. If not specified, an ID will be assigned by the service.
+ *
+ * Generated from protobuf field string document_id = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setDocumentId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->document_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * The document to create. `name` must not be set.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 4;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The document to create. `name` must not be set.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 4;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 5;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getMask()
+ {
+ return $this->mask;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 5;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->mask = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/Cursor.php b/Firestore/src/V1/Cursor.php
new file mode 100644
index 000000000000..2a4679feede2
--- /dev/null
+++ b/Firestore/src/V1/Cursor.php
@@ -0,0 +1,113 @@
+google.firestore.v1.Cursor
+ */
+class Cursor extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The values that represent a position, in the order they appear in
+ * the order by clause of a query.
+ * Can contain fewer values than specified in the order by clause.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ */
+ private $values;
+ /**
+ * If the position is just before or just after the given values, relative
+ * to the sort order defined by the query.
+ *
+ * Generated from protobuf field bool before = 2;
+ */
+ private $before = false;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $values
+ * The values that represent a position, in the order they appear in
+ * the order by clause of a query.
+ * Can contain fewer values than specified in the order by clause.
+ * @type bool $before
+ * If the position is just before or just after the given values, relative
+ * to the sort order defined by the query.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The values that represent a position, in the order they appear in
+ * the order by clause of a query.
+ * Can contain fewer values than specified in the order by clause.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getValues()
+ {
+ return $this->values;
+ }
+
+ /**
+ * The values that represent a position, in the order they appear in
+ * the order by clause of a query.
+ * Can contain fewer values than specified in the order by clause.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value values = 1;
+ * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setValues($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
+ $this->values = $arr;
+
+ return $this;
+ }
+
+ /**
+ * If the position is just before or just after the given values, relative
+ * to the sort order defined by the query.
+ *
+ * Generated from protobuf field bool before = 2;
+ * @return bool
+ */
+ public function getBefore()
+ {
+ return $this->before;
+ }
+
+ /**
+ * If the position is just before or just after the given values, relative
+ * to the sort order defined by the query.
+ *
+ * Generated from protobuf field bool before = 2;
+ * @param bool $var
+ * @return $this
+ */
+ public function setBefore($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->before = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DeleteDocumentRequest.php b/Firestore/src/V1/DeleteDocumentRequest.php
new file mode 100644
index 000000000000..80bb097cd368
--- /dev/null
+++ b/Firestore/src/V1/DeleteDocumentRequest.php
@@ -0,0 +1,109 @@
+google.firestore.v1.DeleteDocumentRequest
+ */
+class DeleteDocumentRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the Document to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ */
+ private $name = '';
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 2;
+ */
+ private $current_document = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The resource name of the Document to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type \Google\Cloud\Firestore\V1\Precondition $current_document
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the Document to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * The resource name of the Document to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 2;
+ * @return \Google\Cloud\Firestore\V1\Precondition
+ */
+ public function getCurrentDocument()
+ {
+ return $this->current_document;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 2;
+ * @param \Google\Cloud\Firestore\V1\Precondition $var
+ * @return $this
+ */
+ public function setCurrentDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Precondition::class);
+ $this->current_document = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/Document.php b/Firestore/src/V1/Document.php
new file mode 100644
index 000000000000..7fdaef3b805a
--- /dev/null
+++ b/Firestore/src/V1/Document.php
@@ -0,0 +1,270 @@
+google.firestore.v1.Document
+ */
+class Document extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the document, for example
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ */
+ private $name = '';
+ /**
+ * The document's fields.
+ * The map keys represent field names.
+ * A simple field name contains only characters `a` to `z`, `A` to `Z`,
+ * `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
+ * `foo_bar_17`.
+ * Field names matching the regular expression `__.*__` are reserved. Reserved
+ * field names are forbidden except in certain documented contexts. The map
+ * keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
+ * empty.
+ * Field paths may be used in other contexts to refer to structured fields
+ * defined here. For `map_value`, the field path is represented by the simple
+ * or quoted field names of the containing fields, delimited by `.`. For
+ * example, the structured field
+ * `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
+ * represented by the field path `foo.x&y`.
+ * Within a field path, a quoted field name starts and ends with `` ` `` and
+ * may contain any character. Some characters, including `` ` ``, must be
+ * escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
+ * `` `bak\`tik` `` represents `` bak`tik ``.
+ *
+ * Generated from protobuf field map fields = 2;
+ */
+ private $fields;
+ /**
+ * Output only. The time at which the document was created.
+ * This value increases monotonically when a document is deleted then
+ * recreated. It can also be compared to values from other documents and
+ * the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 3;
+ */
+ private $create_time = null;
+ /**
+ * Output only. The time at which the document was last changed.
+ * This value is initially set to the `create_time` then increases
+ * monotonically with each change to the document. It can also be
+ * compared to values from other documents and the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 4;
+ */
+ private $update_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The resource name of the document, for example
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type array|\Google\Protobuf\Internal\MapField $fields
+ * The document's fields.
+ * The map keys represent field names.
+ * A simple field name contains only characters `a` to `z`, `A` to `Z`,
+ * `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
+ * `foo_bar_17`.
+ * Field names matching the regular expression `__.*__` are reserved. Reserved
+ * field names are forbidden except in certain documented contexts. The map
+ * keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
+ * empty.
+ * Field paths may be used in other contexts to refer to structured fields
+ * defined here. For `map_value`, the field path is represented by the simple
+ * or quoted field names of the containing fields, delimited by `.`. For
+ * example, the structured field
+ * `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
+ * represented by the field path `foo.x&y`.
+ * Within a field path, a quoted field name starts and ends with `` ` `` and
+ * may contain any character. Some characters, including `` ` ``, must be
+ * escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
+ * `` `bak\`tik` `` represents `` bak`tik ``.
+ * @type \Google\Protobuf\Timestamp $create_time
+ * Output only. The time at which the document was created.
+ * This value increases monotonically when a document is deleted then
+ * recreated. It can also be compared to values from other documents and
+ * the `read_time` of a query.
+ * @type \Google\Protobuf\Timestamp $update_time
+ * Output only. The time at which the document was last changed.
+ * This value is initially set to the `create_time` then increases
+ * monotonically with each change to the document. It can also be
+ * compared to values from other documents and the `read_time` of a query.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Document::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the document, for example
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * The resource name of the document, for example
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The document's fields.
+ * The map keys represent field names.
+ * A simple field name contains only characters `a` to `z`, `A` to `Z`,
+ * `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
+ * `foo_bar_17`.
+ * Field names matching the regular expression `__.*__` are reserved. Reserved
+ * field names are forbidden except in certain documented contexts. The map
+ * keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
+ * empty.
+ * Field paths may be used in other contexts to refer to structured fields
+ * defined here. For `map_value`, the field path is represented by the simple
+ * or quoted field names of the containing fields, delimited by `.`. For
+ * example, the structured field
+ * `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
+ * represented by the field path `foo.x&y`.
+ * Within a field path, a quoted field name starts and ends with `` ` `` and
+ * may contain any character. Some characters, including `` ` ``, must be
+ * escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
+ * `` `bak\`tik` `` represents `` bak`tik ``.
+ *
+ * Generated from protobuf field map fields = 2;
+ * @return \Google\Protobuf\Internal\MapField
+ */
+ public function getFields()
+ {
+ return $this->fields;
+ }
+
+ /**
+ * The document's fields.
+ * The map keys represent field names.
+ * A simple field name contains only characters `a` to `z`, `A` to `Z`,
+ * `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
+ * `foo_bar_17`.
+ * Field names matching the regular expression `__.*__` are reserved. Reserved
+ * field names are forbidden except in certain documented contexts. The map
+ * keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
+ * empty.
+ * Field paths may be used in other contexts to refer to structured fields
+ * defined here. For `map_value`, the field path is represented by the simple
+ * or quoted field names of the containing fields, delimited by `.`. For
+ * example, the structured field
+ * `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
+ * represented by the field path `foo.x&y`.
+ * Within a field path, a quoted field name starts and ends with `` ` `` and
+ * may contain any character. Some characters, including `` ` ``, must be
+ * escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
+ * `` `bak\`tik` `` represents `` bak`tik ``.
+ *
+ * Generated from protobuf field map fields = 2;
+ * @param array|\Google\Protobuf\Internal\MapField $var
+ * @return $this
+ */
+ public function setFields($var)
+ {
+ $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
+ $this->fields = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Output only. The time at which the document was created.
+ * This value increases monotonically when a document is deleted then
+ * recreated. It can also be compared to values from other documents and
+ * the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 3;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getCreateTime()
+ {
+ return $this->create_time;
+ }
+
+ /**
+ * Output only. The time at which the document was created.
+ * This value increases monotonically when a document is deleted then
+ * recreated. It can also be compared to values from other documents and
+ * the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp create_time = 3;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCreateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->create_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. The time at which the document was last changed.
+ * This value is initially set to the `create_time` then increases
+ * monotonically with each change to the document. It can also be
+ * compared to values from other documents and the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 4;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getUpdateTime()
+ {
+ return $this->update_time;
+ }
+
+ /**
+ * Output only. The time at which the document was last changed.
+ * This value is initially set to the `create_time` then increases
+ * monotonically with each change to the document. It can also be
+ * compared to values from other documents and the `read_time` of a query.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 4;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->update_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentChange.php b/Firestore/src/V1/DocumentChange.php
new file mode 100644
index 000000000000..644cf38beb4c
--- /dev/null
+++ b/Firestore/src/V1/DocumentChange.php
@@ -0,0 +1,143 @@
+google.firestore.v1.DocumentChange
+ */
+class DocumentChange extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The new state of the [Document][google.firestore.v1.Document].
+ * If `mask` is set, contains only fields that were updated or added.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ */
+ private $document = null;
+ /**
+ * A set of target IDs of targets that match this document.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 5;
+ */
+ private $target_ids;
+ /**
+ * A set of target IDs for targets that no longer match this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ */
+ private $removed_target_ids;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Document $document
+ * The new state of the [Document][google.firestore.v1.Document].
+ * If `mask` is set, contains only fields that were updated or added.
+ * @type int[]|\Google\Protobuf\Internal\RepeatedField $target_ids
+ * A set of target IDs of targets that match this document.
+ * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids
+ * A set of target IDs for targets that no longer match this document.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The new state of the [Document][google.firestore.v1.Document].
+ * If `mask` is set, contains only fields that were updated or added.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The new state of the [Document][google.firestore.v1.Document].
+ * If `mask` is set, contains only fields that were updated or added.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * A set of target IDs of targets that match this document.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 5;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getTargetIds()
+ {
+ return $this->target_ids;
+ }
+
+ /**
+ * A set of target IDs of targets that match this document.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 5;
+ * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setTargetIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->target_ids = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A set of target IDs for targets that no longer match this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getRemovedTargetIds()
+ {
+ return $this->removed_target_ids;
+ }
+
+ /**
+ * A set of target IDs for targets that no longer match this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setRemovedTargetIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->removed_target_ids = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentDelete.php b/Firestore/src/V1/DocumentDelete.php
new file mode 100644
index 000000000000..1ababaf476c1
--- /dev/null
+++ b/Firestore/src/V1/DocumentDelete.php
@@ -0,0 +1,143 @@
+google.firestore.v1.DocumentDelete
+ */
+class DocumentDelete extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that was deleted.
+ *
+ * Generated from protobuf field string document = 1;
+ */
+ private $document = '';
+ /**
+ * A set of target IDs for targets that previously matched this entity.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ */
+ private $removed_target_ids;
+ /**
+ * The read timestamp at which the delete was observed.
+ * Greater or equal to the `commit_time` of the delete.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ */
+ private $read_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $document
+ * The resource name of the [Document][google.firestore.v1.Document] that was deleted.
+ * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids
+ * A set of target IDs for targets that previously matched this entity.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * The read timestamp at which the delete was observed.
+ * Greater or equal to the `commit_time` of the delete.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that was deleted.
+ *
+ * Generated from protobuf field string document = 1;
+ * @return string
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that was deleted.
+ *
+ * Generated from protobuf field string document = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * A set of target IDs for targets that previously matched this entity.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getRemovedTargetIds()
+ {
+ return $this->removed_target_ids;
+ }
+
+ /**
+ * A set of target IDs for targets that previously matched this entity.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 6;
+ * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setRemovedTargetIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->removed_target_ids = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The read timestamp at which the delete was observed.
+ * Greater or equal to the `commit_time` of the delete.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->read_time;
+ }
+
+ /**
+ * The read timestamp at which the delete was observed.
+ * Greater or equal to the `commit_time` of the delete.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->read_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentMask.php b/Firestore/src/V1/DocumentMask.php
new file mode 100644
index 000000000000..c23c41020111
--- /dev/null
+++ b/Firestore/src/V1/DocumentMask.php
@@ -0,0 +1,75 @@
+google.firestore.v1.DocumentMask
+ */
+class DocumentMask extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
+ * path syntax reference.
+ *
+ * Generated from protobuf field repeated string field_paths = 1;
+ */
+ private $field_paths;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $field_paths
+ * The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
+ * path syntax reference.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
+ * path syntax reference.
+ *
+ * Generated from protobuf field repeated string field_paths = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getFieldPaths()
+ {
+ return $this->field_paths;
+ }
+
+ /**
+ * The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
+ * path syntax reference.
+ *
+ * Generated from protobuf field repeated string field_paths = 1;
+ * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setFieldPaths($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->field_paths = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentRemove.php b/Firestore/src/V1/DocumentRemove.php
new file mode 100644
index 000000000000..b04b0de4873e
--- /dev/null
+++ b/Firestore/src/V1/DocumentRemove.php
@@ -0,0 +1,144 @@
+google.firestore.v1.DocumentRemove
+ */
+class DocumentRemove extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that has gone out of view.
+ *
+ * Generated from protobuf field string document = 1;
+ */
+ private $document = '';
+ /**
+ * A set of target IDs for targets that previously matched this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 2;
+ */
+ private $removed_target_ids;
+ /**
+ * The read timestamp at which the remove was observed.
+ * Greater or equal to the `commit_time` of the change/delete/remove.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ */
+ private $read_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $document
+ * The resource name of the [Document][google.firestore.v1.Document] that has gone out of view.
+ * @type int[]|\Google\Protobuf\Internal\RepeatedField $removed_target_ids
+ * A set of target IDs for targets that previously matched this document.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * The read timestamp at which the remove was observed.
+ * Greater or equal to the `commit_time` of the change/delete/remove.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that has gone out of view.
+ *
+ * Generated from protobuf field string document = 1;
+ * @return string
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The resource name of the [Document][google.firestore.v1.Document] that has gone out of view.
+ *
+ * Generated from protobuf field string document = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * A set of target IDs for targets that previously matched this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getRemovedTargetIds()
+ {
+ return $this->removed_target_ids;
+ }
+
+ /**
+ * A set of target IDs for targets that previously matched this document.
+ *
+ * Generated from protobuf field repeated int32 removed_target_ids = 2;
+ * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setRemovedTargetIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->removed_target_ids = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The read timestamp at which the remove was observed.
+ * Greater or equal to the `commit_time` of the change/delete/remove.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->read_time;
+ }
+
+ /**
+ * The read timestamp at which the remove was observed.
+ * Greater or equal to the `commit_time` of the change/delete/remove.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 4;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->read_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentTransform.php b/Firestore/src/V1/DocumentTransform.php
new file mode 100644
index 000000000000..44a8efb3e237
--- /dev/null
+++ b/Firestore/src/V1/DocumentTransform.php
@@ -0,0 +1,109 @@
+google.firestore.v1.DocumentTransform
+ */
+class DocumentTransform extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The name of the document to transform.
+ *
+ * Generated from protobuf field string document = 1;
+ */
+ private $document = '';
+ /**
+ * The list of transformations to apply to the fields of the document, in
+ * order.
+ * This must not be empty.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.DocumentTransform.FieldTransform field_transforms = 2;
+ */
+ private $field_transforms;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $document
+ * The name of the document to transform.
+ * @type \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $field_transforms
+ * The list of transformations to apply to the fields of the document, in
+ * order.
+ * This must not be empty.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The name of the document to transform.
+ *
+ * Generated from protobuf field string document = 1;
+ * @return string
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The name of the document to transform.
+ *
+ * Generated from protobuf field string document = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * The list of transformations to apply to the fields of the document, in
+ * order.
+ * This must not be empty.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.DocumentTransform.FieldTransform field_transforms = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getFieldTransforms()
+ {
+ return $this->field_transforms;
+ }
+
+ /**
+ * The list of transformations to apply to the fields of the document, in
+ * order.
+ * This must not be empty.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.DocumentTransform.FieldTransform field_transforms = 2;
+ * @param \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setFieldTransforms($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform::class);
+ $this->field_transforms = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/DocumentTransform/FieldTransform.php b/Firestore/src/V1/DocumentTransform/FieldTransform.php
new file mode 100644
index 000000000000..7f21dadb62fe
--- /dev/null
+++ b/Firestore/src/V1/DocumentTransform/FieldTransform.php
@@ -0,0 +1,383 @@
+google.firestore.v1.DocumentTransform.FieldTransform
+ */
+class FieldTransform extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The path of the field. See [Document.fields][google.firestore.v1.Document.fields] for the field path syntax
+ * reference.
+ *
+ * Generated from protobuf field string field_path = 1;
+ */
+ private $field_path = '';
+ protected $transform_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $field_path
+ * The path of the field. See [Document.fields][google.firestore.v1.Document.fields] for the field path syntax
+ * reference.
+ * @type int $set_to_server_value
+ * Sets the field to the given server value.
+ * @type \Google\Cloud\Firestore\V1\Value $increment
+ * Adds the given value to the field's current value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If either of the given value or the current field value are doubles,
+ * both values will be interpreted as doubles. Double arithmetic and
+ * representation of double values follow IEEE 754 semantics.
+ * If there is positive/negative integer overflow, the field is resolved
+ * to the largest magnitude positive/negative integer.
+ * @type \Google\Cloud\Firestore\V1\Value $maximum
+ * Sets the field to the maximum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If a maximum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the larger operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
+ * zero input value is always the stored value.
+ * The maximum of any numeric value x and NaN is NaN.
+ * @type \Google\Cloud\Firestore\V1\Value $minimum
+ * Sets the field to the minimum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the input value.
+ * If a minimum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the smaller operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
+ * zero input value is always the stored value.
+ * The minimum of any numeric value x and NaN is NaN.
+ * @type \Google\Cloud\Firestore\V1\ArrayValue $append_missing_elements
+ * Append the given elements in order if they are not already present in
+ * the current field value.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * first set to the empty array.
+ * Equivalent numbers of different types (e.g. 3L and 3.0) are
+ * considered equal when checking if a value is missing.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * If the input contains multiple equivalent values, only the first will
+ * be considered.
+ * The corresponding transform_result will be the null value.
+ * @type \Google\Cloud\Firestore\V1\ArrayValue $remove_all_from_array
+ * Remove all of the given elements from the array in the field.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * set to the empty array.
+ * Equivalent numbers of the different types (e.g. 3L and 3.0) are
+ * considered equal when deciding whether an element should be removed.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * This will remove all equivalent values if there are duplicates.
+ * The corresponding transform_result will be the null value.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The path of the field. See [Document.fields][google.firestore.v1.Document.fields] for the field path syntax
+ * reference.
+ *
+ * Generated from protobuf field string field_path = 1;
+ * @return string
+ */
+ public function getFieldPath()
+ {
+ return $this->field_path;
+ }
+
+ /**
+ * The path of the field. See [Document.fields][google.firestore.v1.Document.fields] for the field path syntax
+ * reference.
+ *
+ * Generated from protobuf field string field_path = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setFieldPath($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->field_path = $var;
+
+ return $this;
+ }
+
+ /**
+ * Sets the field to the given server value.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentTransform.FieldTransform.ServerValue set_to_server_value = 2;
+ * @return int
+ */
+ public function getSetToServerValue()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * Sets the field to the given server value.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentTransform.FieldTransform.ServerValue set_to_server_value = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setSetToServerValue($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\DocumentTransform_FieldTransform_ServerValue::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * Adds the given value to the field's current value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If either of the given value or the current field value are doubles,
+ * both values will be interpreted as doubles. Double arithmetic and
+ * representation of double values follow IEEE 754 semantics.
+ * If there is positive/negative integer overflow, the field is resolved
+ * to the largest magnitude positive/negative integer.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value increment = 3;
+ * @return \Google\Cloud\Firestore\V1\Value
+ */
+ public function getIncrement()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * Adds the given value to the field's current value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If either of the given value or the current field value are doubles,
+ * both values will be interpreted as doubles. Double arithmetic and
+ * representation of double values follow IEEE 754 semantics.
+ * If there is positive/negative integer overflow, the field is resolved
+ * to the largest magnitude positive/negative integer.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value increment = 3;
+ * @param \Google\Cloud\Firestore\V1\Value $var
+ * @return $this
+ */
+ public function setIncrement($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Value::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * Sets the field to the maximum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If a maximum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the larger operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
+ * zero input value is always the stored value.
+ * The maximum of any numeric value x and NaN is NaN.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value maximum = 4;
+ * @return \Google\Cloud\Firestore\V1\Value
+ */
+ public function getMaximum()
+ {
+ return $this->readOneof(4);
+ }
+
+ /**
+ * Sets the field to the maximum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the given value.
+ * If a maximum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the larger operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
+ * zero input value is always the stored value.
+ * The maximum of any numeric value x and NaN is NaN.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value maximum = 4;
+ * @param \Google\Cloud\Firestore\V1\Value $var
+ * @return $this
+ */
+ public function setMaximum($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Value::class);
+ $this->writeOneof(4, $var);
+
+ return $this;
+ }
+
+ /**
+ * Sets the field to the minimum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the input value.
+ * If a minimum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the smaller operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
+ * zero input value is always the stored value.
+ * The minimum of any numeric value x and NaN is NaN.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value minimum = 5;
+ * @return \Google\Cloud\Firestore\V1\Value
+ */
+ public function getMinimum()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * Sets the field to the minimum of its current value and the given value.
+ * This must be an integer or a double value.
+ * If the field is not an integer or double, or if the field does not yet
+ * exist, the transformation will set the field to the input value.
+ * If a minimum operation is applied where the field and the input value
+ * are of mixed types (that is - one is an integer and one is a double)
+ * the field takes on the type of the smaller operand. If the operands are
+ * equivalent (e.g. 3 and 3.0), the field does not change.
+ * 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
+ * zero input value is always the stored value.
+ * The minimum of any numeric value x and NaN is NaN.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value minimum = 5;
+ * @param \Google\Cloud\Firestore\V1\Value $var
+ * @return $this
+ */
+ public function setMinimum($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Value::class);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * Append the given elements in order if they are not already present in
+ * the current field value.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * first set to the empty array.
+ * Equivalent numbers of different types (e.g. 3L and 3.0) are
+ * considered equal when checking if a value is missing.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * If the input contains multiple equivalent values, only the first will
+ * be considered.
+ * The corresponding transform_result will be the null value.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue append_missing_elements = 6;
+ * @return \Google\Cloud\Firestore\V1\ArrayValue
+ */
+ public function getAppendMissingElements()
+ {
+ return $this->readOneof(6);
+ }
+
+ /**
+ * Append the given elements in order if they are not already present in
+ * the current field value.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * first set to the empty array.
+ * Equivalent numbers of different types (e.g. 3L and 3.0) are
+ * considered equal when checking if a value is missing.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * If the input contains multiple equivalent values, only the first will
+ * be considered.
+ * The corresponding transform_result will be the null value.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue append_missing_elements = 6;
+ * @param \Google\Cloud\Firestore\V1\ArrayValue $var
+ * @return $this
+ */
+ public function setAppendMissingElements($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\ArrayValue::class);
+ $this->writeOneof(6, $var);
+
+ return $this;
+ }
+
+ /**
+ * Remove all of the given elements from the array in the field.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * set to the empty array.
+ * Equivalent numbers of the different types (e.g. 3L and 3.0) are
+ * considered equal when deciding whether an element should be removed.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * This will remove all equivalent values if there are duplicates.
+ * The corresponding transform_result will be the null value.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue remove_all_from_array = 7;
+ * @return \Google\Cloud\Firestore\V1\ArrayValue
+ */
+ public function getRemoveAllFromArray()
+ {
+ return $this->readOneof(7);
+ }
+
+ /**
+ * Remove all of the given elements from the array in the field.
+ * If the field is not an array, or if the field does not yet exist, it is
+ * set to the empty array.
+ * Equivalent numbers of the different types (e.g. 3L and 3.0) are
+ * considered equal when deciding whether an element should be removed.
+ * NaN is equal to NaN, and Null is equal to Null.
+ * This will remove all equivalent values if there are duplicates.
+ * The corresponding transform_result will be the null value.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue remove_all_from_array = 7;
+ * @param \Google\Cloud\Firestore\V1\ArrayValue $var
+ * @return $this
+ */
+ public function setRemoveAllFromArray($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\ArrayValue::class);
+ $this->writeOneof(7, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTransformType()
+ {
+ return $this->whichOneof("transform_type");
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(FieldTransform::class, \Google\Cloud\Firestore\V1\DocumentTransform_FieldTransform::class);
+
diff --git a/Firestore/src/V1/DocumentTransform/FieldTransform/ServerValue.php b/Firestore/src/V1/DocumentTransform/FieldTransform/ServerValue.php
new file mode 100644
index 000000000000..1eadfdac26c2
--- /dev/null
+++ b/Firestore/src/V1/DocumentTransform/FieldTransform/ServerValue.php
@@ -0,0 +1,31 @@
+google.firestore.v1.DocumentTransform.FieldTransform.ServerValue
+ */
+class ServerValue
+{
+ /**
+ * Unspecified. This value must not be used.
+ *
+ * Generated from protobuf enum SERVER_VALUE_UNSPECIFIED = 0;
+ */
+ const SERVER_VALUE_UNSPECIFIED = 0;
+ /**
+ * The time at which the server processed the request, with millisecond
+ * precision.
+ *
+ * Generated from protobuf enum REQUEST_TIME = 1;
+ */
+ const REQUEST_TIME = 1;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(ServerValue::class, \Google\Cloud\Firestore\V1\DocumentTransform_FieldTransform_ServerValue::class);
+
diff --git a/Firestore/src/V1/DocumentTransform_FieldTransform.php b/Firestore/src/V1/DocumentTransform_FieldTransform.php
new file mode 100644
index 000000000000..3dcdd419d300
--- /dev/null
+++ b/Firestore/src/V1/DocumentTransform_FieldTransform.php
@@ -0,0 +1,16 @@
+google.firestore.v1.ExistenceFilter
+ */
+class ExistenceFilter extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The target ID to which this filter applies.
+ *
+ * Generated from protobuf field int32 target_id = 1;
+ */
+ private $target_id = 0;
+ /**
+ * The total count of documents that match [target_id][google.firestore.v1.ExistenceFilter.target_id].
+ * If different from the count of documents in the client that match, the
+ * client must manually determine which documents no longer match the target.
+ *
+ * Generated from protobuf field int32 count = 2;
+ */
+ private $count = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $target_id
+ * The target ID to which this filter applies.
+ * @type int $count
+ * The total count of documents that match [target_id][google.firestore.v1.ExistenceFilter.target_id].
+ * If different from the count of documents in the client that match, the
+ * client must manually determine which documents no longer match the target.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The target ID to which this filter applies.
+ *
+ * Generated from protobuf field int32 target_id = 1;
+ * @return int
+ */
+ public function getTargetId()
+ {
+ return $this->target_id;
+ }
+
+ /**
+ * The target ID to which this filter applies.
+ *
+ * Generated from protobuf field int32 target_id = 1;
+ * @param int $var
+ * @return $this
+ */
+ public function setTargetId($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->target_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * The total count of documents that match [target_id][google.firestore.v1.ExistenceFilter.target_id].
+ * If different from the count of documents in the client that match, the
+ * client must manually determine which documents no longer match the target.
+ *
+ * Generated from protobuf field int32 count = 2;
+ * @return int
+ */
+ public function getCount()
+ {
+ return $this->count;
+ }
+
+ /**
+ * The total count of documents that match [target_id][google.firestore.v1.ExistenceFilter.target_id].
+ * If different from the count of documents in the client that match, the
+ * client must manually determine which documents no longer match the target.
+ *
+ * Generated from protobuf field int32 count = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setCount($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->count = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/FirestoreClient.php b/Firestore/src/V1/FirestoreClient.php
new file mode 100644
index 000000000000..402f87d01b45
--- /dev/null
+++ b/Firestore/src/V1/FirestoreClient.php
@@ -0,0 +1,38 @@
+_simpleRequest('/google.firestore.v1.Firestore/GetDocument',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\Document', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Lists documents.
+ * @param \Google\Cloud\Firestore\V1\ListDocumentsRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function ListDocuments(\Google\Cloud\Firestore\V1\ListDocumentsRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/ListDocuments',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\ListDocumentsResponse', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Creates a new document.
+ * @param \Google\Cloud\Firestore\V1\CreateDocumentRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function CreateDocument(\Google\Cloud\Firestore\V1\CreateDocumentRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/CreateDocument',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\Document', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Updates or inserts a document.
+ * @param \Google\Cloud\Firestore\V1\UpdateDocumentRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function UpdateDocument(\Google\Cloud\Firestore\V1\UpdateDocumentRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/UpdateDocument',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\Document', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Deletes a document.
+ * @param \Google\Cloud\Firestore\V1\DeleteDocumentRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function DeleteDocument(\Google\Cloud\Firestore\V1\DeleteDocumentRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/DeleteDocument',
+ $argument,
+ ['\Google\Protobuf\GPBEmpty', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Gets multiple documents.
+ *
+ * Documents returned by this method are not guaranteed to be returned in the
+ * same order that they were requested.
+ * @param \Google\Cloud\Firestore\V1\BatchGetDocumentsRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function BatchGetDocuments(\Google\Cloud\Firestore\V1\BatchGetDocumentsRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_serverStreamRequest('/google.firestore.v1.Firestore/BatchGetDocuments',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\BatchGetDocumentsResponse', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Starts a new transaction.
+ * @param \Google\Cloud\Firestore\V1\BeginTransactionRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function BeginTransaction(\Google\Cloud\Firestore\V1\BeginTransactionRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/BeginTransaction',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\BeginTransactionResponse', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Commits a transaction, while optionally updating documents.
+ * @param \Google\Cloud\Firestore\V1\CommitRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function Commit(\Google\Cloud\Firestore\V1\CommitRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/Commit',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\CommitResponse', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Rolls back a transaction.
+ * @param \Google\Cloud\Firestore\V1\RollbackRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function Rollback(\Google\Cloud\Firestore\V1\RollbackRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/Rollback',
+ $argument,
+ ['\Google\Protobuf\GPBEmpty', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Runs a query.
+ * @param \Google\Cloud\Firestore\V1\RunQueryRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function RunQuery(\Google\Cloud\Firestore\V1\RunQueryRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_serverStreamRequest('/google.firestore.v1.Firestore/RunQuery',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\RunQueryResponse', 'decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Streams batches of document updates and deletes, in order.
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function Write($metadata = [], $options = []) {
+ return $this->_bidiRequest('/google.firestore.v1.Firestore/Write',
+ ['\Google\Cloud\Firestore\V1\WriteResponse','decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Listens to changes.
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function Listen($metadata = [], $options = []) {
+ return $this->_bidiRequest('/google.firestore.v1.Firestore/Listen',
+ ['\Google\Cloud\Firestore\V1\ListenResponse','decode'],
+ $metadata, $options);
+ }
+
+ /**
+ * Lists all the collection IDs underneath a document.
+ * @param \Google\Cloud\Firestore\V1\ListCollectionIdsRequest $argument input argument
+ * @param array $metadata metadata
+ * @param array $options call options
+ */
+ public function ListCollectionIds(\Google\Cloud\Firestore\V1\ListCollectionIdsRequest $argument,
+ $metadata = [], $options = []) {
+ return $this->_simpleRequest('/google.firestore.v1.Firestore/ListCollectionIds',
+ $argument,
+ ['\Google\Cloud\Firestore\V1\ListCollectionIdsResponse', 'decode'],
+ $metadata, $options);
+ }
+
+}
diff --git a/Firestore/src/V1/Gapic/FirestoreGapicClient.php b/Firestore/src/V1/Gapic/FirestoreGapicClient.php
new file mode 100644
index 000000000000..9fda0bd30a78
--- /dev/null
+++ b/Firestore/src/V1/Gapic/FirestoreGapicClient.php
@@ -0,0 +1,1266 @@
+anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * $response = $firestoreClient->getDocument($formattedName);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parseName method to extract the individual identifiers contained within formatted names
+ * that are returned by the API.
+ *
+ * @experimental
+ */
+class FirestoreGapicClient
+{
+ use GapicClientTrait;
+
+ /**
+ * The name of the service.
+ */
+ const SERVICE_NAME = 'google.firestore.v1.Firestore';
+
+ /**
+ * The default address of the service.
+ */
+ const SERVICE_ADDRESS = 'firestore.googleapis.com';
+
+ /**
+ * The default port of the service.
+ */
+ const DEFAULT_SERVICE_PORT = 443;
+
+ /**
+ * The name of the code generator, to be included in the agent header.
+ */
+ const CODEGEN_NAME = 'gapic';
+
+ /**
+ * The default scopes required by the service.
+ */
+ public static $serviceScopes = [
+ 'https://www.googleapis.com/auth/cloud-platform',
+ 'https://www.googleapis.com/auth/datastore',
+ ];
+ private static $databaseRootNameTemplate;
+ private static $documentRootNameTemplate;
+ private static $documentPathNameTemplate;
+ private static $anyPathNameTemplate;
+ private static $pathTemplateMap;
+
+ private static function getClientDefaults()
+ {
+ return [
+ 'serviceName' => self::SERVICE_NAME,
+ 'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT,
+ 'clientConfig' => __DIR__.'/../resources/firestore_client_config.json',
+ 'descriptorsConfigPath' => __DIR__.'/../resources/firestore_descriptor_config.php',
+ 'gcpApiConfigPath' => __DIR__.'/../resources/firestore_grpc_config.json',
+ 'credentialsConfig' => [
+ 'scopes' => self::$serviceScopes,
+ ],
+ 'transportConfig' => [
+ 'rest' => [
+ 'restClientConfigPath' => __DIR__.'/../resources/firestore_rest_client_config.php',
+ ],
+ ],
+ ];
+ }
+
+ private static function getDatabaseRootNameTemplate()
+ {
+ if (self::$databaseRootNameTemplate == null) {
+ self::$databaseRootNameTemplate = new PathTemplate('projects/{project}/databases/{database}');
+ }
+
+ return self::$databaseRootNameTemplate;
+ }
+
+ private static function getDocumentRootNameTemplate()
+ {
+ if (self::$documentRootNameTemplate == null) {
+ self::$documentRootNameTemplate = new PathTemplate('projects/{project}/databases/{database}/documents');
+ }
+
+ return self::$documentRootNameTemplate;
+ }
+
+ private static function getDocumentPathNameTemplate()
+ {
+ if (self::$documentPathNameTemplate == null) {
+ self::$documentPathNameTemplate = new PathTemplate('projects/{project}/databases/{database}/documents/{document_path=**}');
+ }
+
+ return self::$documentPathNameTemplate;
+ }
+
+ private static function getAnyPathNameTemplate()
+ {
+ if (self::$anyPathNameTemplate == null) {
+ self::$anyPathNameTemplate = new PathTemplate('projects/{project}/databases/{database}/documents/{document}/{any_path=**}');
+ }
+
+ return self::$anyPathNameTemplate;
+ }
+
+ private static function getPathTemplateMap()
+ {
+ if (self::$pathTemplateMap == null) {
+ self::$pathTemplateMap = [
+ 'databaseRoot' => self::getDatabaseRootNameTemplate(),
+ 'documentRoot' => self::getDocumentRootNameTemplate(),
+ 'documentPath' => self::getDocumentPathNameTemplate(),
+ 'anyPath' => self::getAnyPathNameTemplate(),
+ ];
+ }
+
+ return self::$pathTemplateMap;
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent
+ * a database_root resource.
+ *
+ * @param string $project
+ * @param string $database
+ *
+ * @return string The formatted database_root resource.
+ * @experimental
+ */
+ public static function databaseRootName($project, $database)
+ {
+ return self::getDatabaseRootNameTemplate()->render([
+ 'project' => $project,
+ 'database' => $database,
+ ]);
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent
+ * a document_root resource.
+ *
+ * @param string $project
+ * @param string $database
+ *
+ * @return string The formatted document_root resource.
+ * @experimental
+ */
+ public static function documentRootName($project, $database)
+ {
+ return self::getDocumentRootNameTemplate()->render([
+ 'project' => $project,
+ 'database' => $database,
+ ]);
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent
+ * a document_path resource.
+ *
+ * @param string $project
+ * @param string $database
+ * @param string $documentPath
+ *
+ * @return string The formatted document_path resource.
+ * @experimental
+ */
+ public static function documentPathName($project, $database, $documentPath)
+ {
+ return self::getDocumentPathNameTemplate()->render([
+ 'project' => $project,
+ 'database' => $database,
+ 'document_path' => $documentPath,
+ ]);
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent
+ * a any_path resource.
+ *
+ * @param string $project
+ * @param string $database
+ * @param string $document
+ * @param string $anyPath
+ *
+ * @return string The formatted any_path resource.
+ * @experimental
+ */
+ public static function anyPathName($project, $database, $document, $anyPath)
+ {
+ return self::getAnyPathNameTemplate()->render([
+ 'project' => $project,
+ 'database' => $database,
+ 'document' => $document,
+ 'any_path' => $anyPath,
+ ]);
+ }
+
+ /**
+ * Parses a formatted name string and returns an associative array of the components in the name.
+ * The following name formats are supported:
+ * Template: Pattern
+ * - databaseRoot: projects/{project}/databases/{database}
+ * - documentRoot: projects/{project}/databases/{database}/documents
+ * - documentPath: projects/{project}/databases/{database}/documents/{document_path=**}
+ * - anyPath: projects/{project}/databases/{database}/documents/{document}/{any_path=**}.
+ *
+ * The optional $template argument can be supplied to specify a particular pattern, and must
+ * match one of the templates listed above. If no $template argument is provided, or if the
+ * $template argument does not match one of the templates listed, then parseName will check
+ * each of the supported templates, and return the first match.
+ *
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
+ *
+ * @return array An associative array from name component IDs to component values.
+ *
+ * @throws ValidationException If $formattedName could not be matched.
+ * @experimental
+ */
+ public static function parseName($formattedName, $template = null)
+ {
+ $templateMap = self::getPathTemplateMap();
+
+ if ($template) {
+ if (!isset($templateMap[$template])) {
+ throw new ValidationException("Template name $template does not exist");
+ }
+
+ return $templateMap[$template]->match($formattedName);
+ }
+
+ foreach ($templateMap as $templateName => $pathTemplate) {
+ try {
+ return $pathTemplate->match($formattedName);
+ } catch (ValidationException $ex) {
+ // Swallow the exception to continue trying other path templates
+ }
+ }
+ throw new ValidationException("Input did not match any known format. Input: $formattedName");
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $options {
+ * Optional. Options for configuring the service API wrapper.
+ *
+ * @type string $serviceAddress
+ * The address of the API remote host. May optionally include the port, formatted
+ * as ":". Default 'firestore.googleapis.com:443'.
+ * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
+ * The credentials to be used by the client to authorize API calls. This option
+ * accepts either a path to a credentials file, or a decoded credentials file as a
+ * PHP array.
+ * *Advanced usage*: In addition, this option can also accept a pre-constructed
+ * {@see \Google\Auth\FetchAuthTokenInterface} object or
+ * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
+ * objects are provided, any settings in $credentialsConfig will be ignored.
+ * @type array $credentialsConfig
+ * Options used to configure credentials, including auth token caching, for the client.
+ * For a full list of supporting configuration options, see
+ * {@see \Google\ApiCore\CredentialsWrapper::build()}.
+ * @type bool $disableRetries
+ * Determines whether or not retries defined by the client configuration should be
+ * disabled. Defaults to `false`.
+ * @type string|array $clientConfig
+ * Client method configuration, including retry settings. This option can be either a
+ * path to a JSON file, or a PHP array containing the decoded JSON data.
+ * By default this settings points to the default client config file, which is provided
+ * in the resources folder.
+ * @type string|TransportInterface $transport
+ * The transport used for executing network requests. May be either the string `rest`
+ * or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
+ * *Advanced usage*: Additionally, it is possible to pass in an already instantiated
+ * {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this
+ * object is provided, any settings in $transportConfig, and any $serviceAddress
+ * setting, will be ignored.
+ * @type array $transportConfig
+ * Configuration options that will be used to construct the transport. Options for
+ * each supported transport type should be passed in a key for that transport. For
+ * example:
+ * $transportConfig = [
+ * 'grpc' => [...],
+ * 'rest' => [...]
+ * ];
+ * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
+ * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
+ * supported options.
+ * }
+ *
+ * @throws ValidationException
+ * @experimental
+ */
+ public function __construct(array $options = [])
+ {
+ $clientOptions = $this->buildClientOptions($options);
+ $this->setClientOptions($clientOptions);
+ }
+
+ /**
+ * Gets a single document.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedName = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * $response = $firestoreClient->getDocument($formattedName);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $name The resource name of the Document to get. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ *
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type string $transaction
+ * Reads the document in a transaction.
+ * @type Timestamp $readTime
+ * Reads the version of the document at the given time.
+ * This may not be older than 60 seconds.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Firestore\V1\Document
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function getDocument($name, array $optionalArgs = [])
+ {
+ $request = new GetDocumentRequest();
+ $request->setName($name);
+ if (isset($optionalArgs['mask'])) {
+ $request->setMask($optionalArgs['mask']);
+ }
+ if (isset($optionalArgs['transaction'])) {
+ $request->setTransaction($optionalArgs['transaction']);
+ }
+ if (isset($optionalArgs['readTime'])) {
+ $request->setReadTime($optionalArgs['readTime']);
+ }
+
+ return $this->startCall(
+ 'GetDocument',
+ Document::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Lists documents.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedParent = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * $collectionId = '';
+ * // Iterate over pages of elements
+ * $pagedResponse = $firestoreClient->listDocuments($formattedParent, $collectionId);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ *
+ *
+ * // Alternatively:
+ *
+ * // Iterate through all elements
+ * $pagedResponse = $firestoreClient->listDocuments($formattedParent, $collectionId);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @param string $collectionId The collection ID, relative to `parent`, to list. For example: `chatrooms`
+ * or `messages`.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type string $orderBy
+ * The order to sort results by. For example: `priority desc, name`.
+ * @type DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ *
+ * If a document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type Timestamp $readTime
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * @type bool $showMissing
+ * If the list should show missing documents. A missing document is a
+ * document that does not exist but has sub-documents. These documents will
+ * be returned with a key but will not have fields, [Document.create_time][google.firestore.v1.Document.create_time],
+ * or [Document.update_time][google.firestore.v1.Document.update_time] set.
+ *
+ * Requests with `show_missing` may not specify `where` or
+ * `order_by`.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function listDocuments($parent, $collectionId, array $optionalArgs = [])
+ {
+ $request = new ListDocumentsRequest();
+ $request->setParent($parent);
+ $request->setCollectionId($collectionId);
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+ if (isset($optionalArgs['orderBy'])) {
+ $request->setOrderBy($optionalArgs['orderBy']);
+ }
+ if (isset($optionalArgs['mask'])) {
+ $request->setMask($optionalArgs['mask']);
+ }
+ if (isset($optionalArgs['transaction'])) {
+ $request->setTransaction($optionalArgs['transaction']);
+ }
+ if (isset($optionalArgs['readTime'])) {
+ $request->setReadTime($optionalArgs['readTime']);
+ }
+ if (isset($optionalArgs['showMissing'])) {
+ $request->setShowMissing($optionalArgs['showMissing']);
+ }
+
+ return $this->getPagedListResponse(
+ 'ListDocuments',
+ $optionalArgs,
+ ListDocumentsResponse::class,
+ $request
+ );
+ }
+
+ /**
+ * Creates a new document.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedParent = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * $collectionId = '';
+ * $documentId = '';
+ * $document = new Document();
+ * $response = $firestoreClient->createDocument($formattedParent, $collectionId, $documentId, $document);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent The parent resource. For example:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
+ * @param string $collectionId The collection ID, relative to `parent`, to list. For example: `chatrooms`.
+ * @param string $documentId The client-assigned document ID to use for this document.
+ *
+ * Optional. If not specified, an ID will be assigned by the service.
+ * @param Document $document The document to create. `name` must not be set.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ *
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Firestore\V1\Document
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function createDocument($parent, $collectionId, $documentId, $document, array $optionalArgs = [])
+ {
+ $request = new CreateDocumentRequest();
+ $request->setParent($parent);
+ $request->setCollectionId($collectionId);
+ $request->setDocumentId($documentId);
+ $request->setDocument($document);
+ if (isset($optionalArgs['mask'])) {
+ $request->setMask($optionalArgs['mask']);
+ }
+
+ return $this->startCall(
+ 'CreateDocument',
+ Document::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Updates or inserts a document.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $document = new Document();
+ * $updateMask = new DocumentMask();
+ * $response = $firestoreClient->updateDocument($document, $updateMask);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param Document $document The updated document.
+ * Creates the document if it does not already exist.
+ * @param DocumentMask $updateMask The fields to update.
+ * None of the field paths in the mask may contain a reserved name.
+ *
+ * If the document exists on the server and has fields not referenced in the
+ * mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ *
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type Precondition $currentDocument
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Firestore\V1\Document
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function updateDocument($document, $updateMask, array $optionalArgs = [])
+ {
+ $request = new UpdateDocumentRequest();
+ $request->setDocument($document);
+ $request->setUpdateMask($updateMask);
+ if (isset($optionalArgs['mask'])) {
+ $request->setMask($optionalArgs['mask']);
+ }
+ if (isset($optionalArgs['currentDocument'])) {
+ $request->setCurrentDocument($optionalArgs['currentDocument']);
+ }
+
+ return $this->startCall(
+ 'UpdateDocument',
+ Document::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Deletes a document.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedName = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * $firestoreClient->deleteDocument($formattedName);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $name The resource name of the Document to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type Precondition $currentDocument
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function deleteDocument($name, array $optionalArgs = [])
+ {
+ $request = new DeleteDocumentRequest();
+ $request->setName($name);
+ if (isset($optionalArgs['currentDocument'])) {
+ $request->setCurrentDocument($optionalArgs['currentDocument']);
+ }
+
+ return $this->startCall(
+ 'DeleteDocument',
+ GPBEmpty::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Gets multiple documents.
+ *
+ * Documents returned by this method are not guaranteed to be returned in the
+ * same order that they were requested.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $documents = [];
+ * // Read all responses until the stream is complete
+ * $stream = $firestoreClient->batchGetDocuments($formattedDatabase, $documents);
+ * foreach ($stream->readAll() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $database The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @param string[] $documents The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of the
+ * given `database`. Duplicate names will be elided.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ *
+ * If a document has a field that is not present in this mask, that field will
+ * not be returned in the response.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type TransactionOptions $newTransaction
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ * @type Timestamp $readTime
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * @type int $timeoutMillis
+ * Timeout to use for this call.
+ * }
+ *
+ * @return \Google\ApiCore\ServerStream
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function batchGetDocuments($database, $documents, array $optionalArgs = [])
+ {
+ $request = new BatchGetDocumentsRequest();
+ $request->setDatabase($database);
+ $request->setDocuments($documents);
+ if (isset($optionalArgs['mask'])) {
+ $request->setMask($optionalArgs['mask']);
+ }
+ if (isset($optionalArgs['transaction'])) {
+ $request->setTransaction($optionalArgs['transaction']);
+ }
+ if (isset($optionalArgs['newTransaction'])) {
+ $request->setNewTransaction($optionalArgs['newTransaction']);
+ }
+ if (isset($optionalArgs['readTime'])) {
+ $request->setReadTime($optionalArgs['readTime']);
+ }
+
+ return $this->startCall(
+ 'BatchGetDocuments',
+ BatchGetDocumentsResponse::class,
+ $optionalArgs,
+ $request,
+ Call::SERVER_STREAMING_CALL
+ );
+ }
+
+ /**
+ * Starts a new transaction.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $response = $firestoreClient->beginTransaction($formattedDatabase);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $database The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type TransactionOptions $options
+ * The options for the transaction.
+ * Defaults to a read-write transaction.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Firestore\V1\BeginTransactionResponse
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function beginTransaction($database, array $optionalArgs = [])
+ {
+ $request = new BeginTransactionRequest();
+ $request->setDatabase($database);
+ if (isset($optionalArgs['options'])) {
+ $request->setOptions($optionalArgs['options']);
+ }
+
+ return $this->startCall(
+ 'BeginTransaction',
+ BeginTransactionResponse::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Commits a transaction, while optionally updating documents.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $writes = [];
+ * $response = $firestoreClient->commit($formattedDatabase, $writes);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $database The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @param Write[] $writes The writes to apply.
+ *
+ * Always executed atomically and in order.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type string $transaction
+ * If set, applies all writes in this transaction, and commits it.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\Firestore\V1\CommitResponse
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function commit($database, $writes, array $optionalArgs = [])
+ {
+ $request = new CommitRequest();
+ $request->setDatabase($database);
+ $request->setWrites($writes);
+ if (isset($optionalArgs['transaction'])) {
+ $request->setTransaction($optionalArgs['transaction']);
+ }
+
+ return $this->startCall(
+ 'Commit',
+ CommitResponse::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Rolls back a transaction.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $transaction = '';
+ * $firestoreClient->rollback($formattedDatabase, $transaction);
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $database The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @param string $transaction The transaction to roll back.
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function rollback($database, $transaction, array $optionalArgs = [])
+ {
+ $request = new RollbackRequest();
+ $request->setDatabase($database);
+ $request->setTransaction($transaction);
+
+ return $this->startCall(
+ 'Rollback',
+ GPBEmpty::class,
+ $optionalArgs,
+ $request
+ )->wait();
+ }
+
+ /**
+ * Runs a query.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedParent = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * // Read all responses until the stream is complete
+ * $stream = $firestoreClient->runQuery($formattedParent);
+ * foreach ($stream->readAll() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type StructuredQuery $structuredQuery
+ * A structured query.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type TransactionOptions $newTransaction
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ * @type Timestamp $readTime
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * @type int $timeoutMillis
+ * Timeout to use for this call.
+ * }
+ *
+ * @return \Google\ApiCore\ServerStream
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function runQuery($parent, array $optionalArgs = [])
+ {
+ $request = new RunQueryRequest();
+ $request->setParent($parent);
+ if (isset($optionalArgs['structuredQuery'])) {
+ $request->setStructuredQuery($optionalArgs['structuredQuery']);
+ }
+ if (isset($optionalArgs['transaction'])) {
+ $request->setTransaction($optionalArgs['transaction']);
+ }
+ if (isset($optionalArgs['newTransaction'])) {
+ $request->setNewTransaction($optionalArgs['newTransaction']);
+ }
+ if (isset($optionalArgs['readTime'])) {
+ $request->setReadTime($optionalArgs['readTime']);
+ }
+
+ return $this->startCall(
+ 'RunQuery',
+ RunQueryResponse::class,
+ $optionalArgs,
+ $request,
+ Call::SERVER_STREAMING_CALL
+ );
+ }
+
+ /**
+ * Streams batches of document updates and deletes, in order.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $request = new WriteRequest();
+ * $request->setDatabase($formattedDatabase);
+ * // Write all requests to the server, then read all responses until the
+ * // stream is complete
+ * $requests = [$request];
+ * $stream = $firestoreClient->write();
+ * $stream->writeAll($requests);
+ * foreach ($stream->closeWriteAndReadAll() as $element) {
+ * // doSomethingWith($element);
+ * }
+ *
+ *
+ * // Alternatively:
+ *
+ * // Write requests individually, making read() calls if
+ * // required. Call closeWrite() once writes are complete, and read the
+ * // remaining responses from the server.
+ * $requests = [$request];
+ * $stream = $firestoreClient->write();
+ * foreach ($requests as $request) {
+ * $stream->write($request);
+ * // if required, read a single response from the stream
+ * $element = $stream->read();
+ * // doSomethingWith($element)
+ * }
+ * $stream->closeWrite();
+ * $element = $stream->read();
+ * while (!is_null($element)) {
+ * // doSomethingWith($element)
+ * $element = $stream->read();
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $timeoutMillis
+ * Timeout to use for this call.
+ * }
+ *
+ * @return \Google\ApiCore\BidiStream
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function write(array $optionalArgs = [])
+ {
+ return $this->startCall(
+ 'Write',
+ WriteResponse::class,
+ $optionalArgs,
+ null,
+ Call::BIDI_STREAMING_CALL
+ );
+ }
+
+ /**
+ * Listens to changes.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedDatabase = $firestoreClient->databaseRootName('[PROJECT]', '[DATABASE]');
+ * $request = new ListenRequest();
+ * $request->setDatabase($formattedDatabase);
+ * // Write all requests to the server, then read all responses until the
+ * // stream is complete
+ * $requests = [$request];
+ * $stream = $firestoreClient->listen();
+ * $stream->writeAll($requests);
+ * foreach ($stream->closeWriteAndReadAll() as $element) {
+ * // doSomethingWith($element);
+ * }
+ *
+ *
+ * // Alternatively:
+ *
+ * // Write requests individually, making read() calls if
+ * // required. Call closeWrite() once writes are complete, and read the
+ * // remaining responses from the server.
+ * $requests = [$request];
+ * $stream = $firestoreClient->listen();
+ * foreach ($requests as $request) {
+ * $stream->write($request);
+ * // if required, read a single response from the stream
+ * $element = $stream->read();
+ * // doSomethingWith($element)
+ * }
+ * $stream->closeWrite();
+ * $element = $stream->read();
+ * while (!is_null($element)) {
+ * // doSomethingWith($element)
+ * $element = $stream->read();
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $timeoutMillis
+ * Timeout to use for this call.
+ * }
+ *
+ * @return \Google\ApiCore\BidiStream
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function listen(array $optionalArgs = [])
+ {
+ return $this->startCall(
+ 'Listen',
+ ListenResponse::class,
+ $optionalArgs,
+ null,
+ Call::BIDI_STREAMING_CALL
+ );
+ }
+
+ /**
+ * Lists all the collection IDs underneath a document.
+ *
+ * Sample code:
+ * ```
+ * $firestoreClient = new FirestoreClient();
+ * try {
+ * $formattedParent = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ * // Iterate over pages of elements
+ * $pagedResponse = $firestoreClient->listCollectionIds($formattedParent);
+ * foreach ($pagedResponse->iteratePages() as $page) {
+ * foreach ($page as $element) {
+ * // doSomethingWith($element);
+ * }
+ * }
+ *
+ *
+ * // Alternatively:
+ *
+ * // Iterate through all elements
+ * $pagedResponse = $firestoreClient->listCollectionIds($formattedParent);
+ * foreach ($pagedResponse->iterateAllElements() as $element) {
+ * // doSomethingWith($element);
+ * }
+ * } finally {
+ * $firestoreClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent The parent document. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type int $pageSize
+ * The maximum number of resources contained in the underlying API
+ * response. The API may return fewer values in a page, even if
+ * there are additional values to be retrieved.
+ * @type string $pageToken
+ * A page token is used to specify a page of values to be returned.
+ * If no page token is specified (the default), the first page
+ * of values will be returned. Any page token used here must have
+ * been generated by a previous call to the API.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a
+ * {@see Google\ApiCore\RetrySettings} object, or an associative array
+ * of retry settings parameters. See the documentation on
+ * {@see Google\ApiCore\RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\ApiCore\PagedListResponse
+ *
+ * @throws ApiException if the remote call fails
+ * @experimental
+ */
+ public function listCollectionIds($parent, array $optionalArgs = [])
+ {
+ $request = new ListCollectionIdsRequest();
+ $request->setParent($parent);
+ if (isset($optionalArgs['pageSize'])) {
+ $request->setPageSize($optionalArgs['pageSize']);
+ }
+ if (isset($optionalArgs['pageToken'])) {
+ $request->setPageToken($optionalArgs['pageToken']);
+ }
+
+ return $this->getPagedListResponse(
+ 'ListCollectionIds',
+ $optionalArgs,
+ ListCollectionIdsResponse::class,
+ $request
+ );
+ }
+}
diff --git a/Firestore/src/V1/GetDocumentRequest.php b/Firestore/src/V1/GetDocumentRequest.php
new file mode 100644
index 000000000000..505be618bda9
--- /dev/null
+++ b/Firestore/src/V1/GetDocumentRequest.php
@@ -0,0 +1,181 @@
+google.firestore.v1.GetDocumentRequest
+ */
+class GetDocumentRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The resource name of the Document to get. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ */
+ private $name = '';
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 2;
+ */
+ private $mask = null;
+ protected $consistency_selector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The resource name of the Document to get. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type string $transaction
+ * Reads the document in a transaction.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Reads the version of the document at the given time.
+ * This may not be older than 60 seconds.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The resource name of the Document to get. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * The resource name of the Document to get. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string name = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 2;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getMask()
+ {
+ return $this->mask;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 2;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * Reads the document in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * Reads the document in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * Reads the version of the document at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 5;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * Reads the version of the document at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 5;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConsistencySelector()
+ {
+ return $this->whichOneof("consistency_selector");
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListCollectionIdsRequest.php b/Firestore/src/V1/ListCollectionIdsRequest.php
new file mode 100644
index 000000000000..43045540b5a4
--- /dev/null
+++ b/Firestore/src/V1/ListCollectionIdsRequest.php
@@ -0,0 +1,151 @@
+google.firestore.v1.ListCollectionIdsRequest
+ */
+class ListCollectionIdsRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parent document. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ */
+ private $parent = '';
+ /**
+ * The maximum number of results to return.
+ *
+ * Generated from protobuf field int32 page_size = 2;
+ */
+ private $page_size = 0;
+ /**
+ * A page token. Must be a value from
+ * [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
+ *
+ * Generated from protobuf field string page_token = 3;
+ */
+ private $page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * The parent document. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @type int $page_size
+ * The maximum number of results to return.
+ * @type string $page_token
+ * A page token. Must be a value from
+ * [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The parent document. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * The parent document. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * The maximum number of results to return.
+ *
+ * Generated from protobuf field int32 page_size = 2;
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * The maximum number of results to return.
+ *
+ * Generated from protobuf field int32 page_size = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * A page token. Must be a value from
+ * [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
+ *
+ * Generated from protobuf field string page_token = 3;
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * A page token. Must be a value from
+ * [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
+ *
+ * Generated from protobuf field string page_token = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListCollectionIdsResponse.php b/Firestore/src/V1/ListCollectionIdsResponse.php
new file mode 100644
index 000000000000..554401013af8
--- /dev/null
+++ b/Firestore/src/V1/ListCollectionIdsResponse.php
@@ -0,0 +1,101 @@
+google.firestore.v1.ListCollectionIdsResponse
+ */
+class ListCollectionIdsResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The collection ids.
+ *
+ * Generated from protobuf field repeated string collection_ids = 1;
+ */
+ private $collection_ids;
+ /**
+ * A page token that may be used to continue the list.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $collection_ids
+ * The collection ids.
+ * @type string $next_page_token
+ * A page token that may be used to continue the list.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The collection ids.
+ *
+ * Generated from protobuf field repeated string collection_ids = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getCollectionIds()
+ {
+ return $this->collection_ids;
+ }
+
+ /**
+ * The collection ids.
+ *
+ * Generated from protobuf field repeated string collection_ids = 1;
+ * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setCollectionIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->collection_ids = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A page token that may be used to continue the list.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * A page token that may be used to continue the list.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListDocumentsRequest.php b/Firestore/src/V1/ListDocumentsRequest.php
new file mode 100644
index 000000000000..64565d5c149e
--- /dev/null
+++ b/Firestore/src/V1/ListDocumentsRequest.php
@@ -0,0 +1,391 @@
+google.firestore.v1.ListDocumentsRequest
+ */
+class ListDocumentsRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ */
+ private $parent = '';
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`
+ * or `messages`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ */
+ private $collection_id = '';
+ /**
+ * The maximum number of documents to return.
+ *
+ * Generated from protobuf field int32 page_size = 3;
+ */
+ private $page_size = 0;
+ /**
+ * The `next_page_token` value returned from a previous List request, if any.
+ *
+ * Generated from protobuf field string page_token = 4;
+ */
+ private $page_token = '';
+ /**
+ * The order to sort results by. For example: `priority desc, name`.
+ *
+ * Generated from protobuf field string order_by = 6;
+ */
+ private $order_by = '';
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 7;
+ */
+ private $mask = null;
+ /**
+ * If the list should show missing documents. A missing document is a
+ * document that does not exist but has sub-documents. These documents will
+ * be returned with a key but will not have fields, [Document.create_time][google.firestore.v1.Document.create_time],
+ * or [Document.update_time][google.firestore.v1.Document.update_time] set.
+ * Requests with `show_missing` may not specify `where` or
+ * `order_by`.
+ *
+ * Generated from protobuf field bool show_missing = 12;
+ */
+ private $show_missing = false;
+ protected $consistency_selector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @type string $collection_id
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`
+ * or `messages`.
+ * @type int $page_size
+ * The maximum number of documents to return.
+ * @type string $page_token
+ * The `next_page_token` value returned from a previous List request, if any.
+ * @type string $order_by
+ * The order to sort results by. For example: `priority desc, name`.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * @type bool $show_missing
+ * If the list should show missing documents. A missing document is a
+ * document that does not exist but has sub-documents. These documents will
+ * be returned with a key but will not have fields, [Document.create_time][google.firestore.v1.Document.create_time],
+ * or [Document.update_time][google.firestore.v1.Document.update_time] set.
+ * Requests with `show_missing` may not specify `where` or
+ * `order_by`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`
+ * or `messages`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @return string
+ */
+ public function getCollectionId()
+ {
+ return $this->collection_id;
+ }
+
+ /**
+ * The collection ID, relative to `parent`, to list. For example: `chatrooms`
+ * or `messages`.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setCollectionId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->collection_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * The maximum number of documents to return.
+ *
+ * Generated from protobuf field int32 page_size = 3;
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * The maximum number of documents to return.
+ *
+ * Generated from protobuf field int32 page_size = 3;
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * The `next_page_token` value returned from a previous List request, if any.
+ *
+ * Generated from protobuf field string page_token = 4;
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * The `next_page_token` value returned from a previous List request, if any.
+ *
+ * Generated from protobuf field string page_token = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
+ /**
+ * The order to sort results by. For example: `priority desc, name`.
+ *
+ * Generated from protobuf field string order_by = 6;
+ * @return string
+ */
+ public function getOrderBy()
+ {
+ return $this->order_by;
+ }
+
+ /**
+ * The order to sort results by. For example: `priority desc, name`.
+ *
+ * Generated from protobuf field string order_by = 6;
+ * @param string $var
+ * @return $this
+ */
+ public function setOrderBy($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->order_by = $var;
+
+ return $this;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 7;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getMask()
+ {
+ return $this->mask;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If a document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 7;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 8;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->readOneof(8);
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 8;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(8, $var);
+
+ return $this;
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 10;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(10);
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 10;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(10, $var);
+
+ return $this;
+ }
+
+ /**
+ * If the list should show missing documents. A missing document is a
+ * document that does not exist but has sub-documents. These documents will
+ * be returned with a key but will not have fields, [Document.create_time][google.firestore.v1.Document.create_time],
+ * or [Document.update_time][google.firestore.v1.Document.update_time] set.
+ * Requests with `show_missing` may not specify `where` or
+ * `order_by`.
+ *
+ * Generated from protobuf field bool show_missing = 12;
+ * @return bool
+ */
+ public function getShowMissing()
+ {
+ return $this->show_missing;
+ }
+
+ /**
+ * If the list should show missing documents. A missing document is a
+ * document that does not exist but has sub-documents. These documents will
+ * be returned with a key but will not have fields, [Document.create_time][google.firestore.v1.Document.create_time],
+ * or [Document.update_time][google.firestore.v1.Document.update_time] set.
+ * Requests with `show_missing` may not specify `where` or
+ * `order_by`.
+ *
+ * Generated from protobuf field bool show_missing = 12;
+ * @param bool $var
+ * @return $this
+ */
+ public function setShowMissing($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->show_missing = $var;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConsistencySelector()
+ {
+ return $this->whichOneof("consistency_selector");
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListDocumentsResponse.php b/Firestore/src/V1/ListDocumentsResponse.php
new file mode 100644
index 000000000000..7e66be61b2e0
--- /dev/null
+++ b/Firestore/src/V1/ListDocumentsResponse.php
@@ -0,0 +1,101 @@
+google.firestore.v1.ListDocumentsResponse
+ */
+class ListDocumentsResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The Documents found.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Document documents = 1;
+ */
+ private $documents;
+ /**
+ * The next page token.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ */
+ private $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Document[]|\Google\Protobuf\Internal\RepeatedField $documents
+ * The Documents found.
+ * @type string $next_page_token
+ * The next page token.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The Documents found.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Document documents = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getDocuments()
+ {
+ return $this->documents;
+ }
+
+ /**
+ * The Documents found.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Document documents = 1;
+ * @param \Google\Cloud\Firestore\V1\Document[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setDocuments($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Document::class);
+ $this->documents = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The next page token.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * The next page token.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListenRequest.php b/Firestore/src/V1/ListenRequest.php
new file mode 100644
index 000000000000..b0fc4b35d806
--- /dev/null
+++ b/Firestore/src/V1/ListenRequest.php
@@ -0,0 +1,170 @@
+google.firestore.v1.ListenRequest
+ */
+class ListenRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * Labels associated with this target change.
+ *
+ * Generated from protobuf field map labels = 4;
+ */
+ private $labels;
+ protected $target_change;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @type \Google\Cloud\Firestore\V1\Target $add_target
+ * A target to add to this stream.
+ * @type int $remove_target
+ * The ID of a target to remove from this stream.
+ * @type array|\Google\Protobuf\Internal\MapField $labels
+ * Labels associated with this target change.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * A target to add to this stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target add_target = 2;
+ * @return \Google\Cloud\Firestore\V1\Target
+ */
+ public function getAddTarget()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A target to add to this stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target add_target = 2;
+ * @param \Google\Cloud\Firestore\V1\Target $var
+ * @return $this
+ */
+ public function setAddTarget($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * The ID of a target to remove from this stream.
+ *
+ * Generated from protobuf field int32 remove_target = 3;
+ * @return int
+ */
+ public function getRemoveTarget()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * The ID of a target to remove from this stream.
+ *
+ * Generated from protobuf field int32 remove_target = 3;
+ * @param int $var
+ * @return $this
+ */
+ public function setRemoveTarget($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * Labels associated with this target change.
+ *
+ * Generated from protobuf field map labels = 4;
+ * @return \Google\Protobuf\Internal\MapField
+ */
+ public function getLabels()
+ {
+ return $this->labels;
+ }
+
+ /**
+ * Labels associated with this target change.
+ *
+ * Generated from protobuf field map labels = 4;
+ * @param array|\Google\Protobuf\Internal\MapField $var
+ * @return $this
+ */
+ public function setLabels($var)
+ {
+ $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->labels = $arr;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTargetChange()
+ {
+ return $this->whichOneof("target_change");
+ }
+
+}
+
diff --git a/Firestore/src/V1/ListenResponse.php b/Firestore/src/V1/ListenResponse.php
new file mode 100644
index 000000000000..3b0049706899
--- /dev/null
+++ b/Firestore/src/V1/ListenResponse.php
@@ -0,0 +1,194 @@
+google.firestore.v1.ListenResponse
+ */
+class ListenResponse extends \Google\Protobuf\Internal\Message
+{
+ protected $response_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\TargetChange $target_change
+ * Targets have changed.
+ * @type \Google\Cloud\Firestore\V1\DocumentChange $document_change
+ * A [Document][google.firestore.v1.Document] has changed.
+ * @type \Google\Cloud\Firestore\V1\DocumentDelete $document_delete
+ * A [Document][google.firestore.v1.Document] has been deleted.
+ * @type \Google\Cloud\Firestore\V1\DocumentRemove $document_remove
+ * A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
+ * relevant to that target).
+ * @type \Google\Cloud\Firestore\V1\ExistenceFilter $filter
+ * A filter to apply to the set of documents previously returned for the
+ * given target.
+ * Returned when documents may have been removed from the given target, but
+ * the exact documents are unknown.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Targets have changed.
+ *
+ * Generated from protobuf field .google.firestore.v1.TargetChange target_change = 2;
+ * @return \Google\Cloud\Firestore\V1\TargetChange
+ */
+ public function getTargetChange()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * Targets have changed.
+ *
+ * Generated from protobuf field .google.firestore.v1.TargetChange target_change = 2;
+ * @param \Google\Cloud\Firestore\V1\TargetChange $var
+ * @return $this
+ */
+ public function setTargetChange($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TargetChange::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has changed.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentChange document_change = 3;
+ * @return \Google\Cloud\Firestore\V1\DocumentChange
+ */
+ public function getDocumentChange()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has changed.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentChange document_change = 3;
+ * @param \Google\Cloud\Firestore\V1\DocumentChange $var
+ * @return $this
+ */
+ public function setDocumentChange($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentChange::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has been deleted.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentDelete document_delete = 4;
+ * @return \Google\Cloud\Firestore\V1\DocumentDelete
+ */
+ public function getDocumentDelete()
+ {
+ return $this->readOneof(4);
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has been deleted.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentDelete document_delete = 4;
+ * @param \Google\Cloud\Firestore\V1\DocumentDelete $var
+ * @return $this
+ */
+ public function setDocumentDelete($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentDelete::class);
+ $this->writeOneof(4, $var);
+
+ return $this;
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
+ * relevant to that target).
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentRemove document_remove = 6;
+ * @return \Google\Cloud\Firestore\V1\DocumentRemove
+ */
+ public function getDocumentRemove()
+ {
+ return $this->readOneof(6);
+ }
+
+ /**
+ * A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
+ * relevant to that target).
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentRemove document_remove = 6;
+ * @param \Google\Cloud\Firestore\V1\DocumentRemove $var
+ * @return $this
+ */
+ public function setDocumentRemove($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentRemove::class);
+ $this->writeOneof(6, $var);
+
+ return $this;
+ }
+
+ /**
+ * A filter to apply to the set of documents previously returned for the
+ * given target.
+ * Returned when documents may have been removed from the given target, but
+ * the exact documents are unknown.
+ *
+ * Generated from protobuf field .google.firestore.v1.ExistenceFilter filter = 5;
+ * @return \Google\Cloud\Firestore\V1\ExistenceFilter
+ */
+ public function getFilter()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * A filter to apply to the set of documents previously returned for the
+ * given target.
+ * Returned when documents may have been removed from the given target, but
+ * the exact documents are unknown.
+ *
+ * Generated from protobuf field .google.firestore.v1.ExistenceFilter filter = 5;
+ * @param \Google\Cloud\Firestore\V1\ExistenceFilter $var
+ * @return $this
+ */
+ public function setFilter($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\ExistenceFilter::class);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getResponseType()
+ {
+ return $this->whichOneof("response_type");
+ }
+
+}
+
diff --git a/Firestore/src/V1/MapValue.php b/Firestore/src/V1/MapValue.php
new file mode 100644
index 000000000000..fa811000207c
--- /dev/null
+++ b/Firestore/src/V1/MapValue.php
@@ -0,0 +1,83 @@
+google.firestore.v1.MapValue
+ */
+class MapValue extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The map's fields.
+ * The map keys represent field names. Field names matching the regular
+ * expression `__.*__` are reserved. Reserved field names are forbidden except
+ * in certain documented contexts. The map keys, represented as UTF-8, must
+ * not exceed 1,500 bytes and cannot be empty.
+ *
+ * Generated from protobuf field map fields = 1;
+ */
+ private $fields;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array|\Google\Protobuf\Internal\MapField $fields
+ * The map's fields.
+ * The map keys represent field names. Field names matching the regular
+ * expression `__.*__` are reserved. Reserved field names are forbidden except
+ * in certain documented contexts. The map keys, represented as UTF-8, must
+ * not exceed 1,500 bytes and cannot be empty.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Document::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The map's fields.
+ * The map keys represent field names. Field names matching the regular
+ * expression `__.*__` are reserved. Reserved field names are forbidden except
+ * in certain documented contexts. The map keys, represented as UTF-8, must
+ * not exceed 1,500 bytes and cannot be empty.
+ *
+ * Generated from protobuf field map fields = 1;
+ * @return \Google\Protobuf\Internal\MapField
+ */
+ public function getFields()
+ {
+ return $this->fields;
+ }
+
+ /**
+ * The map's fields.
+ * The map keys represent field names. Field names matching the regular
+ * expression `__.*__` are reserved. Reserved field names are forbidden except
+ * in certain documented contexts. The map keys, represented as UTF-8, must
+ * not exceed 1,500 bytes and cannot be empty.
+ *
+ * Generated from protobuf field map fields = 1;
+ * @param array|\Google\Protobuf\Internal\MapField $var
+ * @return $this
+ */
+ public function setFields($var)
+ {
+ $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
+ $this->fields = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/Precondition.php b/Firestore/src/V1/Precondition.php
new file mode 100644
index 000000000000..7df66f1bfdd0
--- /dev/null
+++ b/Firestore/src/V1/Precondition.php
@@ -0,0 +1,104 @@
+google.firestore.v1.Precondition
+ */
+class Precondition extends \Google\Protobuf\Internal\Message
+{
+ protected $condition_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type bool $exists
+ * When set to `true`, the target document must exist.
+ * When set to `false`, the target document must not exist.
+ * @type \Google\Protobuf\Timestamp $update_time
+ * When set, the target document must exist and have been last updated at
+ * that time.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * When set to `true`, the target document must exist.
+ * When set to `false`, the target document must not exist.
+ *
+ * Generated from protobuf field bool exists = 1;
+ * @return bool
+ */
+ public function getExists()
+ {
+ return $this->readOneof(1);
+ }
+
+ /**
+ * When set to `true`, the target document must exist.
+ * When set to `false`, the target document must not exist.
+ *
+ * Generated from protobuf field bool exists = 1;
+ * @param bool $var
+ * @return $this
+ */
+ public function setExists($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->writeOneof(1, $var);
+
+ return $this;
+ }
+
+ /**
+ * When set, the target document must exist and have been last updated at
+ * that time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 2;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getUpdateTime()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * When set, the target document must exist and have been last updated at
+ * that time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 2;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConditionType()
+ {
+ return $this->whichOneof("condition_type");
+ }
+
+}
+
diff --git a/Firestore/src/V1/README.md b/Firestore/src/V1/README.md
new file mode 100644
index 000000000000..ef70b457ab43
--- /dev/null
+++ b/Firestore/src/V1/README.md
@@ -0,0 +1,18 @@
+# Cloud Firestore V1 generated client for PHP
+
+### Sample
+
+```php
+require 'vendor/autoload.php';
+
+use Google\Cloud\Firestore\V1\FirestoreClient;
+
+$firestoreClient = new FirestoreClient();
+try {
+ $formattedName = $firestoreClient->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ $response = $firestoreClient->getDocument($formattedName);
+} finally {
+ $firestoreClient->close();
+}
+```
+
diff --git a/Firestore/src/V1/RollbackRequest.php b/Firestore/src/V1/RollbackRequest.php
new file mode 100644
index 000000000000..dcd0b7fdd77c
--- /dev/null
+++ b/Firestore/src/V1/RollbackRequest.php
@@ -0,0 +1,105 @@
+google.firestore.v1.RollbackRequest
+ */
+class RollbackRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * The transaction to roll back.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ */
+ private $transaction = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * @type string $transaction
+ * The transaction to roll back.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * The transaction to roll back.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * The transaction to roll back.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->transaction = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/RunQueryRequest.php b/Firestore/src/V1/RunQueryRequest.php
new file mode 100644
index 000000000000..ec5819b80891
--- /dev/null
+++ b/Firestore/src/V1/RunQueryRequest.php
@@ -0,0 +1,229 @@
+google.firestore.v1.RunQueryRequest
+ */
+class RunQueryRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ */
+ private $parent = '';
+ protected $query_type;
+ protected $consistency_selector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery $structured_query
+ * A structured query.
+ * @type string $transaction
+ * Reads documents in a transaction.
+ * @type \Google\Cloud\Firestore\V1\TransactionOptions $new_transaction
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * A structured query.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery structured_query = 2;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery
+ */
+ public function getStructuredQuery()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A structured query.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery structured_query = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery $var
+ * @return $this
+ */
+ public function setStructuredQuery($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 5;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * Reads documents in a transaction.
+ *
+ * Generated from protobuf field bytes transaction = 5;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions new_transaction = 6;
+ * @return \Google\Cloud\Firestore\V1\TransactionOptions
+ */
+ public function getNewTransaction()
+ {
+ return $this->readOneof(6);
+ }
+
+ /**
+ * Starts a new transaction and reads the documents.
+ * Defaults to a read-only transaction.
+ * The new transaction ID will be returned as the first response in the
+ * stream.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions new_transaction = 6;
+ * @param \Google\Cloud\Firestore\V1\TransactionOptions $var
+ * @return $this
+ */
+ public function setNewTransaction($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions::class);
+ $this->writeOneof(6, $var);
+
+ return $this;
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 7;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(7);
+ }
+
+ /**
+ * Reads documents as they were at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 7;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(7, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getQueryType()
+ {
+ return $this->whichOneof("query_type");
+ }
+
+ /**
+ * @return string
+ */
+ public function getConsistencySelector()
+ {
+ return $this->whichOneof("consistency_selector");
+ }
+
+}
+
diff --git a/Firestore/src/V1/RunQueryResponse.php b/Firestore/src/V1/RunQueryResponse.php
new file mode 100644
index 000000000000..5c012caf7eee
--- /dev/null
+++ b/Firestore/src/V1/RunQueryResponse.php
@@ -0,0 +1,209 @@
+google.firestore.v1.RunQueryResponse
+ */
+class RunQueryResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The transaction that was started as part of this request.
+ * Can only be set in the first response, and only if
+ * [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction] was set in the request.
+ * If set, no other fields will be set in this response.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ */
+ private $transaction = '';
+ /**
+ * A query result.
+ * Not set when reporting partial progress.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ */
+ private $document = null;
+ /**
+ * The time at which the document was read. This may be monotonically
+ * increasing; in this case, the previous documents in the result stream are
+ * guaranteed not to have changed between their `read_time` and this one.
+ * If the query returns no results, a response with `read_time` and no
+ * `document` will be sent, and this represents the time at which the query
+ * was run.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 3;
+ */
+ private $read_time = null;
+ /**
+ * The number of results that have been skipped due to an offset between
+ * the last response and the current response.
+ *
+ * Generated from protobuf field int32 skipped_results = 4;
+ */
+ private $skipped_results = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $transaction
+ * The transaction that was started as part of this request.
+ * Can only be set in the first response, and only if
+ * [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction] was set in the request.
+ * If set, no other fields will be set in this response.
+ * @type \Google\Cloud\Firestore\V1\Document $document
+ * A query result.
+ * Not set when reporting partial progress.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * The time at which the document was read. This may be monotonically
+ * increasing; in this case, the previous documents in the result stream are
+ * guaranteed not to have changed between their `read_time` and this one.
+ * If the query returns no results, a response with `read_time` and no
+ * `document` will be sent, and this represents the time at which the query
+ * was run.
+ * @type int $skipped_results
+ * The number of results that have been skipped due to an offset between
+ * the last response and the current response.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The transaction that was started as part of this request.
+ * Can only be set in the first response, and only if
+ * [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction] was set in the request.
+ * If set, no other fields will be set in this response.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ * @return string
+ */
+ public function getTransaction()
+ {
+ return $this->transaction;
+ }
+
+ /**
+ * The transaction that was started as part of this request.
+ * Can only be set in the first response, and only if
+ * [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction] was set in the request.
+ * If set, no other fields will be set in this response.
+ *
+ * Generated from protobuf field bytes transaction = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->transaction = $var;
+
+ return $this;
+ }
+
+ /**
+ * A query result.
+ * Not set when reporting partial progress.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * A query result.
+ * Not set when reporting partial progress.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * The time at which the document was read. This may be monotonically
+ * increasing; in this case, the previous documents in the result stream are
+ * guaranteed not to have changed between their `read_time` and this one.
+ * If the query returns no results, a response with `read_time` and no
+ * `document` will be sent, and this represents the time at which the query
+ * was run.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 3;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->read_time;
+ }
+
+ /**
+ * The time at which the document was read. This may be monotonically
+ * increasing; in this case, the previous documents in the result stream are
+ * guaranteed not to have changed between their `read_time` and this one.
+ * If the query returns no results, a response with `read_time` and no
+ * `document` will be sent, and this represents the time at which the query
+ * was run.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 3;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->read_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * The number of results that have been skipped due to an offset between
+ * the last response and the current response.
+ *
+ * Generated from protobuf field int32 skipped_results = 4;
+ * @return int
+ */
+ public function getSkippedResults()
+ {
+ return $this->skipped_results;
+ }
+
+ /**
+ * The number of results that have been skipped due to an offset between
+ * the last response and the current response.
+ *
+ * Generated from protobuf field int32 skipped_results = 4;
+ * @param int $var
+ * @return $this
+ */
+ public function setSkippedResults($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->skipped_results = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/StructuredQuery.php b/Firestore/src/V1/StructuredQuery.php
new file mode 100644
index 000000000000..daaa511c5bfc
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery.php
@@ -0,0 +1,373 @@
+google.firestore.v1.StructuredQuery
+ */
+class StructuredQuery extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The projection to return.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Projection select = 1;
+ */
+ private $select = null;
+ /**
+ * The collections to query.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
+ */
+ private $from;
+ /**
+ * The filter to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Filter where = 3;
+ */
+ private $where = null;
+ /**
+ * The order to apply to the query results.
+ * Firestore guarantees a stable ordering through the following rules:
+ * * Any field required to appear in `order_by`, that is not already
+ * specified in `order_by`, is appended to the order in field name order
+ * by default.
+ * * If an order on `__name__` is not specified, it is appended by default.
+ * Fields are appended with the same sort direction as the last order
+ * specified, or 'ASCENDING' if no order was specified. For example:
+ * * `SELECT * FROM Foo ORDER BY A` becomes
+ * `SELECT * FROM Foo ORDER BY A, __name__`
+ * * `SELECT * FROM Foo ORDER BY A DESC` becomes
+ * `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
+ * * `SELECT * FROM Foo WHERE A > 1` becomes
+ * `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
+ */
+ private $order_by;
+ /**
+ * A starting point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor start_at = 7;
+ */
+ private $start_at = null;
+ /**
+ * A end point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor end_at = 8;
+ */
+ private $end_at = null;
+ /**
+ * The number of results to skip.
+ * Applies before limit, but after all other constraints. Must be >= 0 if
+ * specified.
+ *
+ * Generated from protobuf field int32 offset = 6;
+ */
+ private $offset = 0;
+ /**
+ * The maximum number of results to return.
+ * Applies after all other constraints.
+ * Must be >= 0 if specified.
+ *
+ * Generated from protobuf field .google.protobuf.Int32Value limit = 5;
+ */
+ private $limit = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\Projection $select
+ * The projection to return.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector[]|\Google\Protobuf\Internal\RepeatedField $from
+ * The collections to query.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\Filter $where
+ * The filter to apply.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\Order[]|\Google\Protobuf\Internal\RepeatedField $order_by
+ * The order to apply to the query results.
+ * Firestore guarantees a stable ordering through the following rules:
+ * * Any field required to appear in `order_by`, that is not already
+ * specified in `order_by`, is appended to the order in field name order
+ * by default.
+ * * If an order on `__name__` is not specified, it is appended by default.
+ * Fields are appended with the same sort direction as the last order
+ * specified, or 'ASCENDING' if no order was specified. For example:
+ * * `SELECT * FROM Foo ORDER BY A` becomes
+ * `SELECT * FROM Foo ORDER BY A, __name__`
+ * * `SELECT * FROM Foo ORDER BY A DESC` becomes
+ * `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
+ * * `SELECT * FROM Foo WHERE A > 1` becomes
+ * `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
+ * @type \Google\Cloud\Firestore\V1\Cursor $start_at
+ * A starting point for the query results.
+ * @type \Google\Cloud\Firestore\V1\Cursor $end_at
+ * A end point for the query results.
+ * @type int $offset
+ * The number of results to skip.
+ * Applies before limit, but after all other constraints. Must be >= 0 if
+ * specified.
+ * @type \Google\Protobuf\Int32Value $limit
+ * The maximum number of results to return.
+ * Applies after all other constraints.
+ * Must be >= 0 if specified.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The projection to return.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Projection select = 1;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\Projection
+ */
+ public function getSelect()
+ {
+ return $this->select;
+ }
+
+ /**
+ * The projection to return.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Projection select = 1;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\Projection $var
+ * @return $this
+ */
+ public function setSelect($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_Projection::class);
+ $this->select = $var;
+
+ return $this;
+ }
+
+ /**
+ * The collections to query.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getFrom()
+ {
+ return $this->from;
+ }
+
+ /**
+ * The collections to query.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setFrom($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\StructuredQuery\CollectionSelector::class);
+ $this->from = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The filter to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Filter where = 3;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\Filter
+ */
+ public function getWhere()
+ {
+ return $this->where;
+ }
+
+ /**
+ * The filter to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Filter where = 3;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\Filter $var
+ * @return $this
+ */
+ public function setWhere($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_Filter::class);
+ $this->where = $var;
+
+ return $this;
+ }
+
+ /**
+ * The order to apply to the query results.
+ * Firestore guarantees a stable ordering through the following rules:
+ * * Any field required to appear in `order_by`, that is not already
+ * specified in `order_by`, is appended to the order in field name order
+ * by default.
+ * * If an order on `__name__` is not specified, it is appended by default.
+ * Fields are appended with the same sort direction as the last order
+ * specified, or 'ASCENDING' if no order was specified. For example:
+ * * `SELECT * FROM Foo ORDER BY A` becomes
+ * `SELECT * FROM Foo ORDER BY A, __name__`
+ * * `SELECT * FROM Foo ORDER BY A DESC` becomes
+ * `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
+ * * `SELECT * FROM Foo WHERE A > 1` becomes
+ * `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getOrderBy()
+ {
+ return $this->order_by;
+ }
+
+ /**
+ * The order to apply to the query results.
+ * Firestore guarantees a stable ordering through the following rules:
+ * * Any field required to appear in `order_by`, that is not already
+ * specified in `order_by`, is appended to the order in field name order
+ * by default.
+ * * If an order on `__name__` is not specified, it is appended by default.
+ * Fields are appended with the same sort direction as the last order
+ * specified, or 'ASCENDING' if no order was specified. For example:
+ * * `SELECT * FROM Foo ORDER BY A` becomes
+ * `SELECT * FROM Foo ORDER BY A, __name__`
+ * * `SELECT * FROM Foo ORDER BY A DESC` becomes
+ * `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
+ * * `SELECT * FROM Foo WHERE A > 1` becomes
+ * `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\Order[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setOrderBy($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\StructuredQuery\Order::class);
+ $this->order_by = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A starting point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor start_at = 7;
+ * @return \Google\Cloud\Firestore\V1\Cursor
+ */
+ public function getStartAt()
+ {
+ return $this->start_at;
+ }
+
+ /**
+ * A starting point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor start_at = 7;
+ * @param \Google\Cloud\Firestore\V1\Cursor $var
+ * @return $this
+ */
+ public function setStartAt($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Cursor::class);
+ $this->start_at = $var;
+
+ return $this;
+ }
+
+ /**
+ * A end point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor end_at = 8;
+ * @return \Google\Cloud\Firestore\V1\Cursor
+ */
+ public function getEndAt()
+ {
+ return $this->end_at;
+ }
+
+ /**
+ * A end point for the query results.
+ *
+ * Generated from protobuf field .google.firestore.v1.Cursor end_at = 8;
+ * @param \Google\Cloud\Firestore\V1\Cursor $var
+ * @return $this
+ */
+ public function setEndAt($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Cursor::class);
+ $this->end_at = $var;
+
+ return $this;
+ }
+
+ /**
+ * The number of results to skip.
+ * Applies before limit, but after all other constraints. Must be >= 0 if
+ * specified.
+ *
+ * Generated from protobuf field int32 offset = 6;
+ * @return int
+ */
+ public function getOffset()
+ {
+ return $this->offset;
+ }
+
+ /**
+ * The number of results to skip.
+ * Applies before limit, but after all other constraints. Must be >= 0 if
+ * specified.
+ *
+ * Generated from protobuf field int32 offset = 6;
+ * @param int $var
+ * @return $this
+ */
+ public function setOffset($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->offset = $var;
+
+ return $this;
+ }
+
+ /**
+ * The maximum number of results to return.
+ * Applies after all other constraints.
+ * Must be >= 0 if specified.
+ *
+ * Generated from protobuf field .google.protobuf.Int32Value limit = 5;
+ * @return \Google\Protobuf\Int32Value
+ */
+ public function getLimit()
+ {
+ return $this->limit;
+ }
+
+ /**
+ * The maximum number of results to return.
+ * Applies after all other constraints.
+ * Must be >= 0 if specified.
+ *
+ * Generated from protobuf field .google.protobuf.Int32Value limit = 5;
+ * @param \Google\Protobuf\Int32Value $var
+ * @return $this
+ */
+ public function setLimit($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class);
+ $this->limit = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/StructuredQuery/CollectionSelector.php b/Firestore/src/V1/StructuredQuery/CollectionSelector.php
new file mode 100644
index 000000000000..d02f82a80217
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/CollectionSelector.php
@@ -0,0 +1,116 @@
+google.firestore.v1.StructuredQuery.CollectionSelector
+ */
+class CollectionSelector extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The collection ID.
+ * When set, selects only collections with this ID.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ */
+ private $collection_id = '';
+ /**
+ * When false, selects only collections that are immediate children of
+ * the `parent` specified in the containing `RunQueryRequest`.
+ * When true, selects all descendant collections.
+ *
+ * Generated from protobuf field bool all_descendants = 3;
+ */
+ private $all_descendants = false;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $collection_id
+ * The collection ID.
+ * When set, selects only collections with this ID.
+ * @type bool $all_descendants
+ * When false, selects only collections that are immediate children of
+ * the `parent` specified in the containing `RunQueryRequest`.
+ * When true, selects all descendant collections.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The collection ID.
+ * When set, selects only collections with this ID.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @return string
+ */
+ public function getCollectionId()
+ {
+ return $this->collection_id;
+ }
+
+ /**
+ * The collection ID.
+ * When set, selects only collections with this ID.
+ *
+ * Generated from protobuf field string collection_id = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setCollectionId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->collection_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * When false, selects only collections that are immediate children of
+ * the `parent` specified in the containing `RunQueryRequest`.
+ * When true, selects all descendant collections.
+ *
+ * Generated from protobuf field bool all_descendants = 3;
+ * @return bool
+ */
+ public function getAllDescendants()
+ {
+ return $this->all_descendants;
+ }
+
+ /**
+ * When false, selects only collections that are immediate children of
+ * the `parent` specified in the containing `RunQueryRequest`.
+ * When true, selects all descendant collections.
+ *
+ * Generated from protobuf field bool all_descendants = 3;
+ * @param bool $var
+ * @return $this
+ */
+ public function setAllDescendants($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->all_descendants = $var;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(CollectionSelector::class, \Google\Cloud\Firestore\V1\StructuredQuery_CollectionSelector::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/CompositeFilter.php b/Firestore/src/V1/StructuredQuery/CompositeFilter.php
new file mode 100644
index 000000000000..c5bf1fa47a22
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/CompositeFilter.php
@@ -0,0 +1,108 @@
+google.firestore.v1.StructuredQuery.CompositeFilter
+ */
+class CompositeFilter extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The operator for combining multiple filters.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;
+ */
+ private $op = 0;
+ /**
+ * The list of filters to combine.
+ * Must contain at least one filter.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;
+ */
+ private $filters;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $op
+ * The operator for combining multiple filters.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\Filter[]|\Google\Protobuf\Internal\RepeatedField $filters
+ * The list of filters to combine.
+ * Must contain at least one filter.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The operator for combining multiple filters.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;
+ * @return int
+ */
+ public function getOp()
+ {
+ return $this->op;
+ }
+
+ /**
+ * The operator for combining multiple filters.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;
+ * @param int $var
+ * @return $this
+ */
+ public function setOp($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\StructuredQuery_CompositeFilter_Operator::class);
+ $this->op = $var;
+
+ return $this;
+ }
+
+ /**
+ * The list of filters to combine.
+ * Must contain at least one filter.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getFilters()
+ {
+ return $this->filters;
+ }
+
+ /**
+ * The list of filters to combine.
+ * Must contain at least one filter.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\Filter[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setFilters($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\StructuredQuery\Filter::class);
+ $this->filters = $arr;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(CompositeFilter::class, \Google\Cloud\Firestore\V1\StructuredQuery_CompositeFilter::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php b/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php
new file mode 100644
index 000000000000..9f8d00f76707
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/CompositeFilter/Operator.php
@@ -0,0 +1,30 @@
+google.firestore.v1.StructuredQuery.CompositeFilter.Operator
+ */
+class Operator
+{
+ /**
+ * Unspecified. This value must not be used.
+ *
+ * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0;
+ */
+ const OPERATOR_UNSPECIFIED = 0;
+ /**
+ * The results are required to satisfy each of the combined filters.
+ *
+ * Generated from protobuf enum AND = 1;
+ */
+ const PBAND = 1;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Operator::class, \Google\Cloud\Firestore\V1\StructuredQuery_CompositeFilter_Operator::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/Direction.php b/Firestore/src/V1/StructuredQuery/Direction.php
new file mode 100644
index 000000000000..43a21a4797b2
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/Direction.php
@@ -0,0 +1,36 @@
+google.firestore.v1.StructuredQuery.Direction
+ */
+class Direction
+{
+ /**
+ * Unspecified.
+ *
+ * Generated from protobuf enum DIRECTION_UNSPECIFIED = 0;
+ */
+ const DIRECTION_UNSPECIFIED = 0;
+ /**
+ * Ascending.
+ *
+ * Generated from protobuf enum ASCENDING = 1;
+ */
+ const ASCENDING = 1;
+ /**
+ * Descending.
+ *
+ * Generated from protobuf enum DESCENDING = 2;
+ */
+ const DESCENDING = 2;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Direction::class, \Google\Cloud\Firestore\V1\StructuredQuery_Direction::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/FieldFilter.php b/Firestore/src/V1/StructuredQuery/FieldFilter.php
new file mode 100644
index 000000000000..611670454e23
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/FieldFilter.php
@@ -0,0 +1,138 @@
+google.firestore.v1.StructuredQuery.FieldFilter
+ */
+class FieldFilter extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The field to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ */
+ private $field = null;
+ /**
+ * The operator to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;
+ */
+ private $op = 0;
+ /**
+ * The value to compare to.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value value = 3;
+ */
+ private $value = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $field
+ * The field to filter by.
+ * @type int $op
+ * The operator to filter by.
+ * @type \Google\Cloud\Firestore\V1\Value $value
+ * The value to compare to.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The field to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
+ */
+ public function getField()
+ {
+ return $this->field;
+ }
+
+ /**
+ * The field to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $var
+ * @return $this
+ */
+ public function setField($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_FieldReference::class);
+ $this->field = $var;
+
+ return $this;
+ }
+
+ /**
+ * The operator to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;
+ * @return int
+ */
+ public function getOp()
+ {
+ return $this->op;
+ }
+
+ /**
+ * The operator to filter by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setOp($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\StructuredQuery_FieldFilter_Operator::class);
+ $this->op = $var;
+
+ return $this;
+ }
+
+ /**
+ * The value to compare to.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value value = 3;
+ * @return \Google\Cloud\Firestore\V1\Value
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * The value to compare to.
+ *
+ * Generated from protobuf field .google.firestore.v1.Value value = 3;
+ * @param \Google\Cloud\Firestore\V1\Value $var
+ * @return $this
+ */
+ public function setValue($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Value::class);
+ $this->value = $var;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(FieldFilter::class, \Google\Cloud\Firestore\V1\StructuredQuery_FieldFilter::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/FieldFilter/Operator.php b/Firestore/src/V1/StructuredQuery/FieldFilter/Operator.php
new file mode 100644
index 000000000000..953efe7f0e3f
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/FieldFilter/Operator.php
@@ -0,0 +1,61 @@
+google.firestore.v1.StructuredQuery.FieldFilter.Operator
+ */
+class Operator
+{
+ /**
+ * Unspecified. This value must not be used.
+ *
+ * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0;
+ */
+ const OPERATOR_UNSPECIFIED = 0;
+ /**
+ * Less than. Requires that the field come first in `order_by`.
+ *
+ * Generated from protobuf enum LESS_THAN = 1;
+ */
+ const LESS_THAN = 1;
+ /**
+ * Less than or equal. Requires that the field come first in `order_by`.
+ *
+ * Generated from protobuf enum LESS_THAN_OR_EQUAL = 2;
+ */
+ const LESS_THAN_OR_EQUAL = 2;
+ /**
+ * Greater than. Requires that the field come first in `order_by`.
+ *
+ * Generated from protobuf enum GREATER_THAN = 3;
+ */
+ const GREATER_THAN = 3;
+ /**
+ * Greater than or equal. Requires that the field come first in
+ * `order_by`.
+ *
+ * Generated from protobuf enum GREATER_THAN_OR_EQUAL = 4;
+ */
+ const GREATER_THAN_OR_EQUAL = 4;
+ /**
+ * Equal.
+ *
+ * Generated from protobuf enum EQUAL = 5;
+ */
+ const EQUAL = 5;
+ /**
+ * Contains. Requires that the field is an array.
+ *
+ * Generated from protobuf enum ARRAY_CONTAINS = 7;
+ */
+ const ARRAY_CONTAINS = 7;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Operator::class, \Google\Cloud\Firestore\V1\StructuredQuery_FieldFilter_Operator::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/FieldReference.php b/Firestore/src/V1/StructuredQuery/FieldReference.php
new file mode 100644
index 000000000000..dfd14dcb5975
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/FieldReference.php
@@ -0,0 +1,63 @@
+google.firestore.v1.StructuredQuery.FieldReference
+ */
+class FieldReference extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Generated from protobuf field string field_path = 2;
+ */
+ private $field_path = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $field_path
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Generated from protobuf field string field_path = 2;
+ * @return string
+ */
+ public function getFieldPath()
+ {
+ return $this->field_path;
+ }
+
+ /**
+ * Generated from protobuf field string field_path = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setFieldPath($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->field_path = $var;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(FieldReference::class, \Google\Cloud\Firestore\V1\StructuredQuery_FieldReference::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/Filter.php b/Firestore/src/V1/StructuredQuery/Filter.php
new file mode 100644
index 000000000000..c71e09b10b0a
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/Filter.php
@@ -0,0 +1,129 @@
+google.firestore.v1.StructuredQuery.Filter
+ */
+class Filter extends \Google\Protobuf\Internal\Message
+{
+ protected $filter_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter $composite_filter
+ * A composite filter.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter $field_filter
+ * A filter on a document field.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter $unary_filter
+ * A filter that takes exactly one argument.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * A composite filter.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter
+ */
+ public function getCompositeFilter()
+ {
+ return $this->readOneof(1);
+ }
+
+ /**
+ * A composite filter.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter $var
+ * @return $this
+ */
+ public function setCompositeFilter($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_CompositeFilter::class);
+ $this->writeOneof(1, $var);
+
+ return $this;
+ }
+
+ /**
+ * A filter on a document field.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter
+ */
+ public function getFieldFilter()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A filter on a document field.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter $var
+ * @return $this
+ */
+ public function setFieldFilter($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_FieldFilter::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * A filter that takes exactly one argument.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter
+ */
+ public function getUnaryFilter()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * A filter that takes exactly one argument.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter $var
+ * @return $this
+ */
+ public function setUnaryFilter($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_UnaryFilter::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFilterType()
+ {
+ return $this->whichOneof("filter_type");
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Filter::class, \Google\Cloud\Firestore\V1\StructuredQuery_Filter::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/Order.php b/Firestore/src/V1/StructuredQuery/Order.php
new file mode 100644
index 000000000000..ab703c57dfb3
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/Order.php
@@ -0,0 +1,104 @@
+google.firestore.v1.StructuredQuery.Order
+ */
+class Order extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The field to order by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ */
+ private $field = null;
+ /**
+ * The direction to order by. Defaults to `ASCENDING`.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Direction direction = 2;
+ */
+ private $direction = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $field
+ * The field to order by.
+ * @type int $direction
+ * The direction to order by. Defaults to `ASCENDING`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The field to order by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
+ */
+ public function getField()
+ {
+ return $this->field;
+ }
+
+ /**
+ * The field to order by.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 1;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $var
+ * @return $this
+ */
+ public function setField($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_FieldReference::class);
+ $this->field = $var;
+
+ return $this;
+ }
+
+ /**
+ * The direction to order by. Defaults to `ASCENDING`.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Direction direction = 2;
+ * @return int
+ */
+ public function getDirection()
+ {
+ return $this->direction;
+ }
+
+ /**
+ * The direction to order by. Defaults to `ASCENDING`.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.Direction direction = 2;
+ * @param int $var
+ * @return $this
+ */
+ public function setDirection($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\StructuredQuery_Direction::class);
+ $this->direction = $var;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Order::class, \Google\Cloud\Firestore\V1\StructuredQuery_Order::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/Projection.php b/Firestore/src/V1/StructuredQuery/Projection.php
new file mode 100644
index 000000000000..1383b8218f51
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/Projection.php
@@ -0,0 +1,78 @@
+google.firestore.v1.StructuredQuery.Projection
+ */
+class Projection extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The fields to return.
+ * If empty, all fields are returned. To only return the name
+ * of the document, use `['__name__']`.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;
+ */
+ private $fields;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $fields
+ * The fields to return.
+ * If empty, all fields are returned. To only return the name
+ * of the document, use `['__name__']`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The fields to return.
+ * If empty, all fields are returned. To only return the name
+ * of the document, use `['__name__']`.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getFields()
+ {
+ return $this->fields;
+ }
+
+ /**
+ * The fields to return.
+ * If empty, all fields are returned. To only return the name
+ * of the document, use `['__name__']`.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setFields($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference::class);
+ $this->fields = $arr;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Projection::class, \Google\Cloud\Firestore\V1\StructuredQuery_Projection::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/UnaryFilter.php b/Firestore/src/V1/StructuredQuery/UnaryFilter.php
new file mode 100644
index 000000000000..1a2130ba057b
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/UnaryFilter.php
@@ -0,0 +1,107 @@
+google.firestore.v1.StructuredQuery.UnaryFilter
+ */
+class UnaryFilter extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The unary operator to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;
+ */
+ private $op = 0;
+ protected $operand_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $op
+ * The unary operator to apply.
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $field
+ * The field to which to apply the operator.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Query::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The unary operator to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;
+ * @return int
+ */
+ public function getOp()
+ {
+ return $this->op;
+ }
+
+ /**
+ * The unary operator to apply.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;
+ * @param int $var
+ * @return $this
+ */
+ public function setOp($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\StructuredQuery_UnaryFilter_Operator::class);
+ $this->op = $var;
+
+ return $this;
+ }
+
+ /**
+ * The field to which to apply the operator.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 2;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
+ */
+ public function getField()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * The field to which to apply the operator.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery.FieldReference field = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldReference $var
+ * @return $this
+ */
+ public function setField($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery_FieldReference::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getOperandType()
+ {
+ return $this->whichOneof("operand_type");
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(UnaryFilter::class, \Google\Cloud\Firestore\V1\StructuredQuery_UnaryFilter::class);
+
diff --git a/Firestore/src/V1/StructuredQuery/UnaryFilter/Operator.php b/Firestore/src/V1/StructuredQuery/UnaryFilter/Operator.php
new file mode 100644
index 000000000000..942b3410ce9a
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery/UnaryFilter/Operator.php
@@ -0,0 +1,36 @@
+google.firestore.v1.StructuredQuery.UnaryFilter.Operator
+ */
+class Operator
+{
+ /**
+ * Unspecified. This value must not be used.
+ *
+ * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0;
+ */
+ const OPERATOR_UNSPECIFIED = 0;
+ /**
+ * Test if a field is equal to NaN.
+ *
+ * Generated from protobuf enum IS_NAN = 2;
+ */
+ const IS_NAN = 2;
+ /**
+ * Test if an exprestion evaluates to Null.
+ *
+ * Generated from protobuf enum IS_NULL = 3;
+ */
+ const IS_NULL = 3;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Operator::class, \Google\Cloud\Firestore\V1\StructuredQuery_UnaryFilter_Operator::class);
+
diff --git a/Firestore/src/V1/StructuredQuery_CollectionSelector.php b/Firestore/src/V1/StructuredQuery_CollectionSelector.php
new file mode 100644
index 000000000000..8e2ecf4083c8
--- /dev/null
+++ b/Firestore/src/V1/StructuredQuery_CollectionSelector.php
@@ -0,0 +1,16 @@
+google.firestore.v1.Target
+ */
+class Target extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * A client provided target ID.
+ * If not set, the server will assign an ID for the target.
+ * Used for resuming a target without changing IDs. The IDs can either be
+ * client-assigned or be server-assigned in a previous stream. All targets
+ * with client provided IDs must be added before adding a target that needs
+ * a server-assigned id.
+ *
+ * Generated from protobuf field int32 target_id = 5;
+ */
+ private $target_id = 0;
+ /**
+ * If the target should be removed once it is current and consistent.
+ *
+ * Generated from protobuf field bool once = 6;
+ */
+ private $once = false;
+ protected $target_type;
+ protected $resume_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Target\QueryTarget $query
+ * A target specified by a query.
+ * @type \Google\Cloud\Firestore\V1\Target\DocumentsTarget $documents
+ * A target specified by a set of document names.
+ * @type string $resume_token
+ * A resume token from a prior [TargetChange][google.firestore.v1.TargetChange] for an identical target.
+ * Using a resume token with a different target is unsupported and may fail.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Start listening after a specific `read_time`.
+ * The client must know the state of matching documents at this time.
+ * @type int $target_id
+ * A client provided target ID.
+ * If not set, the server will assign an ID for the target.
+ * Used for resuming a target without changing IDs. The IDs can either be
+ * client-assigned or be server-assigned in a previous stream. All targets
+ * with client provided IDs must be added before adding a target that needs
+ * a server-assigned id.
+ * @type bool $once
+ * If the target should be removed once it is current and consistent.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * A target specified by a query.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target.QueryTarget query = 2;
+ * @return \Google\Cloud\Firestore\V1\Target\QueryTarget
+ */
+ public function getQuery()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A target specified by a query.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target.QueryTarget query = 2;
+ * @param \Google\Cloud\Firestore\V1\Target\QueryTarget $var
+ * @return $this
+ */
+ public function setQuery($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_QueryTarget::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * A target specified by a set of document names.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target.DocumentsTarget documents = 3;
+ * @return \Google\Cloud\Firestore\V1\Target\DocumentsTarget
+ */
+ public function getDocuments()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * A target specified by a set of document names.
+ *
+ * Generated from protobuf field .google.firestore.v1.Target.DocumentsTarget documents = 3;
+ * @param \Google\Cloud\Firestore\V1\Target\DocumentsTarget $var
+ * @return $this
+ */
+ public function setDocuments($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Target_DocumentsTarget::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * A resume token from a prior [TargetChange][google.firestore.v1.TargetChange] for an identical target.
+ * Using a resume token with a different target is unsupported and may fail.
+ *
+ * Generated from protobuf field bytes resume_token = 4;
+ * @return string
+ */
+ public function getResumeToken()
+ {
+ return $this->readOneof(4);
+ }
+
+ /**
+ * A resume token from a prior [TargetChange][google.firestore.v1.TargetChange] for an identical target.
+ * Using a resume token with a different target is unsupported and may fail.
+ *
+ * Generated from protobuf field bytes resume_token = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setResumeToken($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(4, $var);
+
+ return $this;
+ }
+
+ /**
+ * Start listening after a specific `read_time`.
+ * The client must know the state of matching documents at this time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 11;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(11);
+ }
+
+ /**
+ * Start listening after a specific `read_time`.
+ * The client must know the state of matching documents at this time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 11;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(11, $var);
+
+ return $this;
+ }
+
+ /**
+ * A client provided target ID.
+ * If not set, the server will assign an ID for the target.
+ * Used for resuming a target without changing IDs. The IDs can either be
+ * client-assigned or be server-assigned in a previous stream. All targets
+ * with client provided IDs must be added before adding a target that needs
+ * a server-assigned id.
+ *
+ * Generated from protobuf field int32 target_id = 5;
+ * @return int
+ */
+ public function getTargetId()
+ {
+ return $this->target_id;
+ }
+
+ /**
+ * A client provided target ID.
+ * If not set, the server will assign an ID for the target.
+ * Used for resuming a target without changing IDs. The IDs can either be
+ * client-assigned or be server-assigned in a previous stream. All targets
+ * with client provided IDs must be added before adding a target that needs
+ * a server-assigned id.
+ *
+ * Generated from protobuf field int32 target_id = 5;
+ * @param int $var
+ * @return $this
+ */
+ public function setTargetId($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->target_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * If the target should be removed once it is current and consistent.
+ *
+ * Generated from protobuf field bool once = 6;
+ * @return bool
+ */
+ public function getOnce()
+ {
+ return $this->once;
+ }
+
+ /**
+ * If the target should be removed once it is current and consistent.
+ *
+ * Generated from protobuf field bool once = 6;
+ * @param bool $var
+ * @return $this
+ */
+ public function setOnce($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->once = $var;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTargetType()
+ {
+ return $this->whichOneof("target_type");
+ }
+
+ /**
+ * @return string
+ */
+ public function getResumeType()
+ {
+ return $this->whichOneof("resume_type");
+ }
+
+}
+
diff --git a/Firestore/src/V1/Target/DocumentsTarget.php b/Firestore/src/V1/Target/DocumentsTarget.php
new file mode 100644
index 000000000000..38ac0c9b89cf
--- /dev/null
+++ b/Firestore/src/V1/Target/DocumentsTarget.php
@@ -0,0 +1,82 @@
+google.firestore.v1.Target.DocumentsTarget
+ */
+class DocumentsTarget extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of
+ * the given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ */
+ private $documents;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $documents
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of
+ * the given `database`. Duplicate names will be elided.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of
+ * the given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getDocuments()
+ {
+ return $this->documents;
+ }
+
+ /**
+ * The names of the documents to retrieve. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * The request will fail if any of the document is not a child resource of
+ * the given `database`. Duplicate names will be elided.
+ *
+ * Generated from protobuf field repeated string documents = 2;
+ * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setDocuments($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->documents = $arr;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(DocumentsTarget::class, \Google\Cloud\Firestore\V1\Target_DocumentsTarget::class);
+
diff --git a/Firestore/src/V1/Target/QueryTarget.php b/Firestore/src/V1/Target/QueryTarget.php
new file mode 100644
index 000000000000..e1996c3e2530
--- /dev/null
+++ b/Firestore/src/V1/Target/QueryTarget.php
@@ -0,0 +1,127 @@
+google.firestore.v1.Target.QueryTarget
+ */
+class QueryTarget extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ */
+ private $parent = '';
+ protected $query_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ * @type \Google\Cloud\Firestore\V1\StructuredQuery $structured_query
+ * A structured query.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * The parent resource name. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents` or
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * For example:
+ * `projects/my-project/databases/my-database/documents` or
+ * `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
+ *
+ * Generated from protobuf field string parent = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * A structured query.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery structured_query = 2;
+ * @return \Google\Cloud\Firestore\V1\StructuredQuery
+ */
+ public function getStructuredQuery()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A structured query.
+ *
+ * Generated from protobuf field .google.firestore.v1.StructuredQuery structured_query = 2;
+ * @param \Google\Cloud\Firestore\V1\StructuredQuery $var
+ * @return $this
+ */
+ public function setStructuredQuery($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getQueryType()
+ {
+ return $this->whichOneof("query_type");
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(QueryTarget::class, \Google\Cloud\Firestore\V1\Target_QueryTarget::class);
+
diff --git a/Firestore/src/V1/TargetChange.php b/Firestore/src/V1/TargetChange.php
new file mode 100644
index 000000000000..8ee99fb2df27
--- /dev/null
+++ b/Firestore/src/V1/TargetChange.php
@@ -0,0 +1,259 @@
+google.firestore.v1.TargetChange
+ */
+class TargetChange extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The type of change that occurred.
+ *
+ * Generated from protobuf field .google.firestore.v1.TargetChange.TargetChangeType target_change_type = 1;
+ */
+ private $target_change_type = 0;
+ /**
+ * The target IDs of targets that have changed.
+ * If empty, the change applies to all targets.
+ * For `target_change_type=ADD`, the order of the target IDs matches the order
+ * of the requests to add the targets. This allows clients to unambiguously
+ * associate server-assigned target IDs with added targets.
+ * For other states, the order of the target IDs is not defined.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 2;
+ */
+ private $target_ids;
+ /**
+ * The error that resulted in this change, if applicable.
+ *
+ * Generated from protobuf field .google.rpc.Status cause = 3;
+ */
+ private $cause = null;
+ /**
+ * A token that can be used to resume the stream for the given `target_ids`,
+ * or all targets if `target_ids` is empty.
+ * Not set on every target change.
+ *
+ * Generated from protobuf field bytes resume_token = 4;
+ */
+ private $resume_token = '';
+ /**
+ * The consistent `read_time` for the given `target_ids` (omitted when the
+ * target_ids are not at a consistent snapshot).
+ * The stream is guaranteed to send a `read_time` with `target_ids` empty
+ * whenever the entire stream reaches a new consistent snapshot. ADD,
+ * CURRENT, and RESET messages are guaranteed to (eventually) result in a
+ * new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
+ * For a given stream, `read_time` is guaranteed to be monotonically
+ * increasing.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 6;
+ */
+ private $read_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $target_change_type
+ * The type of change that occurred.
+ * @type int[]|\Google\Protobuf\Internal\RepeatedField $target_ids
+ * The target IDs of targets that have changed.
+ * If empty, the change applies to all targets.
+ * For `target_change_type=ADD`, the order of the target IDs matches the order
+ * of the requests to add the targets. This allows clients to unambiguously
+ * associate server-assigned target IDs with added targets.
+ * For other states, the order of the target IDs is not defined.
+ * @type \Google\Rpc\Status $cause
+ * The error that resulted in this change, if applicable.
+ * @type string $resume_token
+ * A token that can be used to resume the stream for the given `target_ids`,
+ * or all targets if `target_ids` is empty.
+ * Not set on every target change.
+ * @type \Google\Protobuf\Timestamp $read_time
+ * The consistent `read_time` for the given `target_ids` (omitted when the
+ * target_ids are not at a consistent snapshot).
+ * The stream is guaranteed to send a `read_time` with `target_ids` empty
+ * whenever the entire stream reaches a new consistent snapshot. ADD,
+ * CURRENT, and RESET messages are guaranteed to (eventually) result in a
+ * new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
+ * For a given stream, `read_time` is guaranteed to be monotonically
+ * increasing.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The type of change that occurred.
+ *
+ * Generated from protobuf field .google.firestore.v1.TargetChange.TargetChangeType target_change_type = 1;
+ * @return int
+ */
+ public function getTargetChangeType()
+ {
+ return $this->target_change_type;
+ }
+
+ /**
+ * The type of change that occurred.
+ *
+ * Generated from protobuf field .google.firestore.v1.TargetChange.TargetChangeType target_change_type = 1;
+ * @param int $var
+ * @return $this
+ */
+ public function setTargetChangeType($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1\TargetChange_TargetChangeType::class);
+ $this->target_change_type = $var;
+
+ return $this;
+ }
+
+ /**
+ * The target IDs of targets that have changed.
+ * If empty, the change applies to all targets.
+ * For `target_change_type=ADD`, the order of the target IDs matches the order
+ * of the requests to add the targets. This allows clients to unambiguously
+ * associate server-assigned target IDs with added targets.
+ * For other states, the order of the target IDs is not defined.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getTargetIds()
+ {
+ return $this->target_ids;
+ }
+
+ /**
+ * The target IDs of targets that have changed.
+ * If empty, the change applies to all targets.
+ * For `target_change_type=ADD`, the order of the target IDs matches the order
+ * of the requests to add the targets. This allows clients to unambiguously
+ * associate server-assigned target IDs with added targets.
+ * For other states, the order of the target IDs is not defined.
+ *
+ * Generated from protobuf field repeated int32 target_ids = 2;
+ * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setTargetIds($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->target_ids = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The error that resulted in this change, if applicable.
+ *
+ * Generated from protobuf field .google.rpc.Status cause = 3;
+ * @return \Google\Rpc\Status
+ */
+ public function getCause()
+ {
+ return $this->cause;
+ }
+
+ /**
+ * The error that resulted in this change, if applicable.
+ *
+ * Generated from protobuf field .google.rpc.Status cause = 3;
+ * @param \Google\Rpc\Status $var
+ * @return $this
+ */
+ public function setCause($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
+ $this->cause = $var;
+
+ return $this;
+ }
+
+ /**
+ * A token that can be used to resume the stream for the given `target_ids`,
+ * or all targets if `target_ids` is empty.
+ * Not set on every target change.
+ *
+ * Generated from protobuf field bytes resume_token = 4;
+ * @return string
+ */
+ public function getResumeToken()
+ {
+ return $this->resume_token;
+ }
+
+ /**
+ * A token that can be used to resume the stream for the given `target_ids`,
+ * or all targets if `target_ids` is empty.
+ * Not set on every target change.
+ *
+ * Generated from protobuf field bytes resume_token = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setResumeToken($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->resume_token = $var;
+
+ return $this;
+ }
+
+ /**
+ * The consistent `read_time` for the given `target_ids` (omitted when the
+ * target_ids are not at a consistent snapshot).
+ * The stream is guaranteed to send a `read_time` with `target_ids` empty
+ * whenever the entire stream reaches a new consistent snapshot. ADD,
+ * CURRENT, and RESET messages are guaranteed to (eventually) result in a
+ * new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
+ * For a given stream, `read_time` is guaranteed to be monotonically
+ * increasing.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 6;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->read_time;
+ }
+
+ /**
+ * The consistent `read_time` for the given `target_ids` (omitted when the
+ * target_ids are not at a consistent snapshot).
+ * The stream is guaranteed to send a `read_time` with `target_ids` empty
+ * whenever the entire stream reaches a new consistent snapshot. ADD,
+ * CURRENT, and RESET messages are guaranteed to (eventually) result in a
+ * new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
+ * For a given stream, `read_time` is guaranteed to be monotonically
+ * increasing.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 6;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->read_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/TargetChange/TargetChangeType.php b/Firestore/src/V1/TargetChange/TargetChangeType.php
new file mode 100644
index 000000000000..fd16d9298cd0
--- /dev/null
+++ b/Firestore/src/V1/TargetChange/TargetChangeType.php
@@ -0,0 +1,56 @@
+google.firestore.v1.TargetChange.TargetChangeType
+ */
+class TargetChangeType
+{
+ /**
+ * No change has occurred. Used only to send an updated `resume_token`.
+ *
+ * Generated from protobuf enum NO_CHANGE = 0;
+ */
+ const NO_CHANGE = 0;
+ /**
+ * The targets have been added.
+ *
+ * Generated from protobuf enum ADD = 1;
+ */
+ const ADD = 1;
+ /**
+ * The targets have been removed.
+ *
+ * Generated from protobuf enum REMOVE = 2;
+ */
+ const REMOVE = 2;
+ /**
+ * The targets reflect all changes committed before the targets were added
+ * to the stream.
+ * This will be sent after or with a `read_time` that is greater than or
+ * equal to the time at which the targets were added.
+ * Listeners can wait for this change if read-after-write semantics
+ * are desired.
+ *
+ * Generated from protobuf enum CURRENT = 3;
+ */
+ const CURRENT = 3;
+ /**
+ * The targets have been reset, and a new initial state for the targets
+ * will be returned in subsequent changes.
+ * After the initial state is complete, `CURRENT` will be returned even
+ * if the target was previously indicated to be `CURRENT`.
+ *
+ * Generated from protobuf enum RESET = 4;
+ */
+ const RESET = 4;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(TargetChangeType::class, \Google\Cloud\Firestore\V1\TargetChange_TargetChangeType::class);
+
diff --git a/Firestore/src/V1/TargetChange_TargetChangeType.php b/Firestore/src/V1/TargetChange_TargetChangeType.php
new file mode 100644
index 000000000000..32530a519a92
--- /dev/null
+++ b/Firestore/src/V1/TargetChange_TargetChangeType.php
@@ -0,0 +1,16 @@
+google.firestore.v1.TransactionOptions
+ */
+class TransactionOptions extends \Google\Protobuf\Internal\Message
+{
+ protected $mode;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly $read_only
+ * The transaction can only be used for read operations.
+ * @type \Google\Cloud\Firestore\V1\TransactionOptions\ReadWrite $read_write
+ * The transaction can be used for both read and write operations.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The transaction can only be used for read operations.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadOnly read_only = 2;
+ * @return \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly
+ */
+ public function getReadOnly()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * The transaction can only be used for read operations.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadOnly read_only = 2;
+ * @param \Google\Cloud\Firestore\V1\TransactionOptions\ReadOnly $var
+ * @return $this
+ */
+ public function setReadOnly($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * The transaction can be used for both read and write operations.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadWrite read_write = 3;
+ * @return \Google\Cloud\Firestore\V1\TransactionOptions\ReadWrite
+ */
+ public function getReadWrite()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * The transaction can be used for both read and write operations.
+ *
+ * Generated from protobuf field .google.firestore.v1.TransactionOptions.ReadWrite read_write = 3;
+ * @param \Google\Cloud\Firestore\V1\TransactionOptions\ReadWrite $var
+ * @return $this
+ */
+ public function setReadWrite($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TransactionOptions_ReadWrite::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getMode()
+ {
+ return $this->whichOneof("mode");
+ }
+
+}
+
diff --git a/Firestore/src/V1/TransactionOptions/ReadOnly.php b/Firestore/src/V1/TransactionOptions/ReadOnly.php
new file mode 100644
index 000000000000..76d3ab685b87
--- /dev/null
+++ b/Firestore/src/V1/TransactionOptions/ReadOnly.php
@@ -0,0 +1,76 @@
+google.firestore.v1.TransactionOptions.ReadOnly
+ */
+class ReadOnly extends \Google\Protobuf\Internal\Message
+{
+ protected $consistency_selector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Protobuf\Timestamp $read_time
+ * Reads documents at the given time.
+ * This may not be older than 60 seconds.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Reads documents at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 2;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getReadTime()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * Reads documents at the given time.
+ * This may not be older than 60 seconds.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp read_time = 2;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setReadTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConsistencySelector()
+ {
+ return $this->whichOneof("consistency_selector");
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(ReadOnly::class, \Google\Cloud\Firestore\V1\TransactionOptions_ReadOnly::class);
+
diff --git a/Firestore/src/V1/TransactionOptions/ReadWrite.php b/Firestore/src/V1/TransactionOptions/ReadWrite.php
new file mode 100644
index 000000000000..36a43ada5b61
--- /dev/null
+++ b/Firestore/src/V1/TransactionOptions/ReadWrite.php
@@ -0,0 +1,70 @@
+google.firestore.v1.TransactionOptions.ReadWrite
+ */
+class ReadWrite extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * An optional transaction to retry.
+ *
+ * Generated from protobuf field bytes retry_transaction = 1;
+ */
+ private $retry_transaction = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $retry_transaction
+ * An optional transaction to retry.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Common::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * An optional transaction to retry.
+ *
+ * Generated from protobuf field bytes retry_transaction = 1;
+ * @return string
+ */
+ public function getRetryTransaction()
+ {
+ return $this->retry_transaction;
+ }
+
+ /**
+ * An optional transaction to retry.
+ *
+ * Generated from protobuf field bytes retry_transaction = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setRetryTransaction($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->retry_transaction = $var;
+
+ return $this;
+ }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(ReadWrite::class, \Google\Cloud\Firestore\V1\TransactionOptions_ReadWrite::class);
+
diff --git a/Firestore/src/V1/TransactionOptions_ReadOnly.php b/Firestore/src/V1/TransactionOptions_ReadOnly.php
new file mode 100644
index 000000000000..9d30839ab38a
--- /dev/null
+++ b/Firestore/src/V1/TransactionOptions_ReadOnly.php
@@ -0,0 +1,16 @@
+google.firestore.v1.UpdateDocumentRequest
+ */
+class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The updated document.
+ * Creates the document if it does not already exist.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ */
+ private $document = null;
+ /**
+ * The fields to update.
+ * None of the field paths in the mask may contain a reserved name.
+ * If the document exists on the server and has fields not referenced in the
+ * mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 2;
+ */
+ private $update_mask = null;
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ */
+ private $mask = null;
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ */
+ private $current_document = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Document $document
+ * The updated document.
+ * Creates the document if it does not already exist.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $update_mask
+ * The fields to update.
+ * None of the field paths in the mask may contain a reserved name.
+ * If the document exists on the server and has fields not referenced in the
+ * mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $mask
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ * @type \Google\Cloud\Firestore\V1\Precondition $current_document
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The updated document.
+ * Creates the document if it does not already exist.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getDocument()
+ {
+ return $this->document;
+ }
+
+ /**
+ * The updated document.
+ * Creates the document if it does not already exist.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document document = 1;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->document = $var;
+
+ return $this;
+ }
+
+ /**
+ * The fields to update.
+ * None of the field paths in the mask may contain a reserved name.
+ * If the document exists on the server and has fields not referenced in the
+ * mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 2;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getUpdateMask()
+ {
+ return $this->update_mask;
+ }
+
+ /**
+ * The fields to update.
+ * None of the field paths in the mask may contain a reserved name.
+ * If the document exists on the server and has fields not referenced in the
+ * mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 2;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setUpdateMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->update_mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getMask()
+ {
+ return $this->mask;
+ }
+
+ /**
+ * The fields to return. If not set, returns all fields.
+ * If the document has a field that is not present in this mask, that field
+ * will not be returned in the response.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask mask = 3;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ * @return \Google\Cloud\Firestore\V1\Precondition
+ */
+ public function getCurrentDocument()
+ {
+ return $this->current_document;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The request will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ * @param \Google\Cloud\Firestore\V1\Precondition $var
+ * @return $this
+ */
+ public function setCurrentDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Precondition::class);
+ $this->current_document = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/Value.php b/Firestore/src/V1/Value.php
new file mode 100644
index 000000000000..362fb18f5be1
--- /dev/null
+++ b/Firestore/src/V1/Value.php
@@ -0,0 +1,380 @@
+google.firestore.v1.Value
+ */
+class Value extends \Google\Protobuf\Internal\Message
+{
+ protected $value_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $null_value
+ * A null value.
+ * @type bool $boolean_value
+ * A boolean value.
+ * @type int|string $integer_value
+ * An integer value.
+ * @type float $double_value
+ * A double value.
+ * @type \Google\Protobuf\Timestamp $timestamp_value
+ * A timestamp value.
+ * Precise only to microseconds. When stored, any additional precision is
+ * rounded down.
+ * @type string $string_value
+ * A string value.
+ * The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes of the UTF-8 representation are considered by
+ * queries.
+ * @type string $bytes_value
+ * A bytes value.
+ * Must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes are considered by queries.
+ * @type string $reference_value
+ * A reference to a document. For example:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type \Google\Type\LatLng $geo_point_value
+ * A geo point value representing a point on the surface of Earth.
+ * @type \Google\Cloud\Firestore\V1\ArrayValue $array_value
+ * An array value.
+ * Cannot directly contain another array value, though can contain an
+ * map which contains another array.
+ * @type \Google\Cloud\Firestore\V1\MapValue $map_value
+ * A map value.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Document::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * A null value.
+ *
+ * Generated from protobuf field .google.protobuf.NullValue null_value = 11;
+ * @return int
+ */
+ public function getNullValue()
+ {
+ return $this->readOneof(11);
+ }
+
+ /**
+ * A null value.
+ *
+ * Generated from protobuf field .google.protobuf.NullValue null_value = 11;
+ * @param int $var
+ * @return $this
+ */
+ public function setNullValue($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Protobuf\NullValue::class);
+ $this->writeOneof(11, $var);
+
+ return $this;
+ }
+
+ /**
+ * A boolean value.
+ *
+ * Generated from protobuf field bool boolean_value = 1;
+ * @return bool
+ */
+ public function getBooleanValue()
+ {
+ return $this->readOneof(1);
+ }
+
+ /**
+ * A boolean value.
+ *
+ * Generated from protobuf field bool boolean_value = 1;
+ * @param bool $var
+ * @return $this
+ */
+ public function setBooleanValue($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->writeOneof(1, $var);
+
+ return $this;
+ }
+
+ /**
+ * An integer value.
+ *
+ * Generated from protobuf field int64 integer_value = 2;
+ * @return int|string
+ */
+ public function getIntegerValue()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * An integer value.
+ *
+ * Generated from protobuf field int64 integer_value = 2;
+ * @param int|string $var
+ * @return $this
+ */
+ public function setIntegerValue($var)
+ {
+ GPBUtil::checkInt64($var);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * A double value.
+ *
+ * Generated from protobuf field double double_value = 3;
+ * @return float
+ */
+ public function getDoubleValue()
+ {
+ return $this->readOneof(3);
+ }
+
+ /**
+ * A double value.
+ *
+ * Generated from protobuf field double double_value = 3;
+ * @param float $var
+ * @return $this
+ */
+ public function setDoubleValue($var)
+ {
+ GPBUtil::checkDouble($var);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * A timestamp value.
+ * Precise only to microseconds. When stored, any additional precision is
+ * rounded down.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 10;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getTimestampValue()
+ {
+ return $this->readOneof(10);
+ }
+
+ /**
+ * A timestamp value.
+ * Precise only to microseconds. When stored, any additional precision is
+ * rounded down.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 10;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setTimestampValue($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->writeOneof(10, $var);
+
+ return $this;
+ }
+
+ /**
+ * A string value.
+ * The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes of the UTF-8 representation are considered by
+ * queries.
+ *
+ * Generated from protobuf field string string_value = 17;
+ * @return string
+ */
+ public function getStringValue()
+ {
+ return $this->readOneof(17);
+ }
+
+ /**
+ * A string value.
+ * The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes of the UTF-8 representation are considered by
+ * queries.
+ *
+ * Generated from protobuf field string string_value = 17;
+ * @param string $var
+ * @return $this
+ */
+ public function setStringValue($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->writeOneof(17, $var);
+
+ return $this;
+ }
+
+ /**
+ * A bytes value.
+ * Must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes are considered by queries.
+ *
+ * Generated from protobuf field bytes bytes_value = 18;
+ * @return string
+ */
+ public function getBytesValue()
+ {
+ return $this->readOneof(18);
+ }
+
+ /**
+ * A bytes value.
+ * Must not exceed 1 MiB - 89 bytes.
+ * Only the first 1,500 bytes are considered by queries.
+ *
+ * Generated from protobuf field bytes bytes_value = 18;
+ * @param string $var
+ * @return $this
+ */
+ public function setBytesValue($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->writeOneof(18, $var);
+
+ return $this;
+ }
+
+ /**
+ * A reference to a document. For example:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string reference_value = 5;
+ * @return string
+ */
+ public function getReferenceValue()
+ {
+ return $this->readOneof(5);
+ }
+
+ /**
+ * A reference to a document. For example:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string reference_value = 5;
+ * @param string $var
+ * @return $this
+ */
+ public function setReferenceValue($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->writeOneof(5, $var);
+
+ return $this;
+ }
+
+ /**
+ * A geo point value representing a point on the surface of Earth.
+ *
+ * Generated from protobuf field .google.type.LatLng geo_point_value = 8;
+ * @return \Google\Type\LatLng
+ */
+ public function getGeoPointValue()
+ {
+ return $this->readOneof(8);
+ }
+
+ /**
+ * A geo point value representing a point on the surface of Earth.
+ *
+ * Generated from protobuf field .google.type.LatLng geo_point_value = 8;
+ * @param \Google\Type\LatLng $var
+ * @return $this
+ */
+ public function setGeoPointValue($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Type\LatLng::class);
+ $this->writeOneof(8, $var);
+
+ return $this;
+ }
+
+ /**
+ * An array value.
+ * Cannot directly contain another array value, though can contain an
+ * map which contains another array.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue array_value = 9;
+ * @return \Google\Cloud\Firestore\V1\ArrayValue
+ */
+ public function getArrayValue()
+ {
+ return $this->readOneof(9);
+ }
+
+ /**
+ * An array value.
+ * Cannot directly contain another array value, though can contain an
+ * map which contains another array.
+ *
+ * Generated from protobuf field .google.firestore.v1.ArrayValue array_value = 9;
+ * @param \Google\Cloud\Firestore\V1\ArrayValue $var
+ * @return $this
+ */
+ public function setArrayValue($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\ArrayValue::class);
+ $this->writeOneof(9, $var);
+
+ return $this;
+ }
+
+ /**
+ * A map value.
+ *
+ * Generated from protobuf field .google.firestore.v1.MapValue map_value = 6;
+ * @return \Google\Cloud\Firestore\V1\MapValue
+ */
+ public function getMapValue()
+ {
+ return $this->readOneof(6);
+ }
+
+ /**
+ * A map value.
+ *
+ * Generated from protobuf field .google.firestore.v1.MapValue map_value = 6;
+ * @param \Google\Cloud\Firestore\V1\MapValue $var
+ * @return $this
+ */
+ public function setMapValue($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\MapValue::class);
+ $this->writeOneof(6, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getValueType()
+ {
+ return $this->whichOneof("value_type");
+ }
+
+}
+
diff --git a/Firestore/src/V1/Write.php b/Firestore/src/V1/Write.php
new file mode 100644
index 000000000000..4e8216869bcd
--- /dev/null
+++ b/Firestore/src/V1/Write.php
@@ -0,0 +1,242 @@
+google.firestore.v1.Write
+ */
+class Write extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The fields to update in this write.
+ * This field can be set only when the operation is `update`.
+ * If the mask is not set for an `update` and the document exists, any
+ * existing data will be overwritten.
+ * If the mask is set and the document on the server has fields not covered by
+ * the mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * The field paths in this mask must not contain a reserved field name.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 3;
+ */
+ private $update_mask = null;
+ /**
+ * An optional precondition on the document.
+ * The write will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ */
+ private $current_document = null;
+ protected $operation;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Firestore\V1\Document $update
+ * A document to write.
+ * @type string $delete
+ * A document name to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ * @type \Google\Cloud\Firestore\V1\DocumentTransform $transform
+ * Applies a tranformation to a document.
+ * At most one `transform` per document is allowed in a given request.
+ * An `update` cannot follow a `transform` on the same document in a given
+ * request.
+ * @type \Google\Cloud\Firestore\V1\DocumentMask $update_mask
+ * The fields to update in this write.
+ * This field can be set only when the operation is `update`.
+ * If the mask is not set for an `update` and the document exists, any
+ * existing data will be overwritten.
+ * If the mask is set and the document on the server has fields not covered by
+ * the mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * The field paths in this mask must not contain a reserved field name.
+ * @type \Google\Cloud\Firestore\V1\Precondition $current_document
+ * An optional precondition on the document.
+ * The write will fail if this is set and not met by the target document.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * A document to write.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document update = 1;
+ * @return \Google\Cloud\Firestore\V1\Document
+ */
+ public function getUpdate()
+ {
+ return $this->readOneof(1);
+ }
+
+ /**
+ * A document to write.
+ *
+ * Generated from protobuf field .google.firestore.v1.Document update = 1;
+ * @param \Google\Cloud\Firestore\V1\Document $var
+ * @return $this
+ */
+ public function setUpdate($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
+ $this->writeOneof(1, $var);
+
+ return $this;
+ }
+
+ /**
+ * A document name to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string delete = 2;
+ * @return string
+ */
+ public function getDelete()
+ {
+ return $this->readOneof(2);
+ }
+
+ /**
+ * A document name to delete. In the format:
+ * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
+ *
+ * Generated from protobuf field string delete = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setDelete($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * Applies a tranformation to a document.
+ * At most one `transform` per document is allowed in a given request.
+ * An `update` cannot follow a `transform` on the same document in a given
+ * request.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentTransform transform = 6;
+ * @return \Google\Cloud\Firestore\V1\DocumentTransform
+ */
+ public function getTransform()
+ {
+ return $this->readOneof(6);
+ }
+
+ /**
+ * Applies a tranformation to a document.
+ * At most one `transform` per document is allowed in a given request.
+ * An `update` cannot follow a `transform` on the same document in a given
+ * request.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentTransform transform = 6;
+ * @param \Google\Cloud\Firestore\V1\DocumentTransform $var
+ * @return $this
+ */
+ public function setTransform($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentTransform::class);
+ $this->writeOneof(6, $var);
+
+ return $this;
+ }
+
+ /**
+ * The fields to update in this write.
+ * This field can be set only when the operation is `update`.
+ * If the mask is not set for an `update` and the document exists, any
+ * existing data will be overwritten.
+ * If the mask is set and the document on the server has fields not covered by
+ * the mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * The field paths in this mask must not contain a reserved field name.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 3;
+ * @return \Google\Cloud\Firestore\V1\DocumentMask
+ */
+ public function getUpdateMask()
+ {
+ return $this->update_mask;
+ }
+
+ /**
+ * The fields to update in this write.
+ * This field can be set only when the operation is `update`.
+ * If the mask is not set for an `update` and the document exists, any
+ * existing data will be overwritten.
+ * If the mask is set and the document on the server has fields not covered by
+ * the mask, they are left unchanged.
+ * Fields referenced in the mask, but not present in the input document, are
+ * deleted from the document on the server.
+ * The field paths in this mask must not contain a reserved field name.
+ *
+ * Generated from protobuf field .google.firestore.v1.DocumentMask update_mask = 3;
+ * @param \Google\Cloud\Firestore\V1\DocumentMask $var
+ * @return $this
+ */
+ public function setUpdateMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentMask::class);
+ $this->update_mask = $var;
+
+ return $this;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The write will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ * @return \Google\Cloud\Firestore\V1\Precondition
+ */
+ public function getCurrentDocument()
+ {
+ return $this->current_document;
+ }
+
+ /**
+ * An optional precondition on the document.
+ * The write will fail if this is set and not met by the target document.
+ *
+ * Generated from protobuf field .google.firestore.v1.Precondition current_document = 4;
+ * @param \Google\Cloud\Firestore\V1\Precondition $var
+ * @return $this
+ */
+ public function setCurrentDocument($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Precondition::class);
+ $this->current_document = $var;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getOperation()
+ {
+ return $this->whichOneof("operation");
+ }
+
+}
+
diff --git a/Firestore/src/V1/WriteRequest.php b/Firestore/src/V1/WriteRequest.php
new file mode 100644
index 000000000000..5dda989b0bba
--- /dev/null
+++ b/Firestore/src/V1/WriteRequest.php
@@ -0,0 +1,277 @@
+google.firestore.v1.WriteRequest
+ */
+class WriteRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * This is only required in the first message.
+ *
+ * Generated from protobuf field string database = 1;
+ */
+ private $database = '';
+ /**
+ * The ID of the write stream to resume.
+ * This may only be set in the first message. When left empty, a new write
+ * stream will be created.
+ *
+ * Generated from protobuf field string stream_id = 2;
+ */
+ private $stream_id = '';
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ * This must be empty on the first request.
+ * This may be empty on the last request.
+ * This must not be empty on all other requests.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 3;
+ */
+ private $writes;
+ /**
+ * A stream token that was previously sent by the server.
+ * The client should set this field to the token from the most recent
+ * [WriteResponse][google.firestore.v1.WriteResponse] it has received. This acknowledges that the client has
+ * received responses up to this token. After sending this token, earlier
+ * tokens may not be used anymore.
+ * The server may close the stream if there are too many unacknowledged
+ * responses.
+ * Leave this field unset when creating a new stream. To resume a stream at
+ * a specific point, set this field and the `stream_id` field.
+ * Leave this field unset when creating a new stream.
+ *
+ * Generated from protobuf field bytes stream_token = 4;
+ */
+ private $stream_token = '';
+ /**
+ * Labels associated with this write request.
+ *
+ * Generated from protobuf field map labels = 5;
+ */
+ private $labels;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $database
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * This is only required in the first message.
+ * @type string $stream_id
+ * The ID of the write stream to resume.
+ * This may only be set in the first message. When left empty, a new write
+ * stream will be created.
+ * @type \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $writes
+ * The writes to apply.
+ * Always executed atomically and in order.
+ * This must be empty on the first request.
+ * This may be empty on the last request.
+ * This must not be empty on all other requests.
+ * @type string $stream_token
+ * A stream token that was previously sent by the server.
+ * The client should set this field to the token from the most recent
+ * [WriteResponse][google.firestore.v1.WriteResponse] it has received. This acknowledges that the client has
+ * received responses up to this token. After sending this token, earlier
+ * tokens may not be used anymore.
+ * The server may close the stream if there are too many unacknowledged
+ * responses.
+ * Leave this field unset when creating a new stream. To resume a stream at
+ * a specific point, set this field and the `stream_id` field.
+ * Leave this field unset when creating a new stream.
+ * @type array|\Google\Protobuf\Internal\MapField $labels
+ * Labels associated with this write request.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * This is only required in the first message.
+ *
+ * Generated from protobuf field string database = 1;
+ * @return string
+ */
+ public function getDatabase()
+ {
+ return $this->database;
+ }
+
+ /**
+ * The database name. In the format:
+ * `projects/{project_id}/databases/{database_id}`.
+ * This is only required in the first message.
+ *
+ * Generated from protobuf field string database = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setDatabase($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->database = $var;
+
+ return $this;
+ }
+
+ /**
+ * The ID of the write stream to resume.
+ * This may only be set in the first message. When left empty, a new write
+ * stream will be created.
+ *
+ * Generated from protobuf field string stream_id = 2;
+ * @return string
+ */
+ public function getStreamId()
+ {
+ return $this->stream_id;
+ }
+
+ /**
+ * The ID of the write stream to resume.
+ * This may only be set in the first message. When left empty, a new write
+ * stream will be created.
+ *
+ * Generated from protobuf field string stream_id = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setStreamId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->stream_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ * This must be empty on the first request.
+ * This may be empty on the last request.
+ * This must not be empty on all other requests.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 3;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getWrites()
+ {
+ return $this->writes;
+ }
+
+ /**
+ * The writes to apply.
+ * Always executed atomically and in order.
+ * This must be empty on the first request.
+ * This may be empty on the last request.
+ * This must not be empty on all other requests.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Write writes = 3;
+ * @param \Google\Cloud\Firestore\V1\Write[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setWrites($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Write::class);
+ $this->writes = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A stream token that was previously sent by the server.
+ * The client should set this field to the token from the most recent
+ * [WriteResponse][google.firestore.v1.WriteResponse] it has received. This acknowledges that the client has
+ * received responses up to this token. After sending this token, earlier
+ * tokens may not be used anymore.
+ * The server may close the stream if there are too many unacknowledged
+ * responses.
+ * Leave this field unset when creating a new stream. To resume a stream at
+ * a specific point, set this field and the `stream_id` field.
+ * Leave this field unset when creating a new stream.
+ *
+ * Generated from protobuf field bytes stream_token = 4;
+ * @return string
+ */
+ public function getStreamToken()
+ {
+ return $this->stream_token;
+ }
+
+ /**
+ * A stream token that was previously sent by the server.
+ * The client should set this field to the token from the most recent
+ * [WriteResponse][google.firestore.v1.WriteResponse] it has received. This acknowledges that the client has
+ * received responses up to this token. After sending this token, earlier
+ * tokens may not be used anymore.
+ * The server may close the stream if there are too many unacknowledged
+ * responses.
+ * Leave this field unset when creating a new stream. To resume a stream at
+ * a specific point, set this field and the `stream_id` field.
+ * Leave this field unset when creating a new stream.
+ *
+ * Generated from protobuf field bytes stream_token = 4;
+ * @param string $var
+ * @return $this
+ */
+ public function setStreamToken($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->stream_token = $var;
+
+ return $this;
+ }
+
+ /**
+ * Labels associated with this write request.
+ *
+ * Generated from protobuf field map labels = 5;
+ * @return \Google\Protobuf\Internal\MapField
+ */
+ public function getLabels()
+ {
+ return $this->labels;
+ }
+
+ /**
+ * Labels associated with this write request.
+ *
+ * Generated from protobuf field map labels = 5;
+ * @param array|\Google\Protobuf\Internal\MapField $var
+ * @return $this
+ */
+ public function setLabels($var)
+ {
+ $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->labels = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/WriteResponse.php b/Firestore/src/V1/WriteResponse.php
new file mode 100644
index 000000000000..3b7dc441bcbd
--- /dev/null
+++ b/Firestore/src/V1/WriteResponse.php
@@ -0,0 +1,189 @@
+google.firestore.v1.WriteResponse
+ */
+class WriteResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The ID of the stream.
+ * Only set on the first message, when a new stream was created.
+ *
+ * Generated from protobuf field string stream_id = 1;
+ */
+ private $stream_id = '';
+ /**
+ * A token that represents the position of this response in the stream.
+ * This can be used by a client to resume the stream at this point.
+ * This field is always set.
+ *
+ * Generated from protobuf field bytes stream_token = 2;
+ */
+ private $stream_token = '';
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 3;
+ */
+ private $write_results;
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 4;
+ */
+ private $commit_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $stream_id
+ * The ID of the stream.
+ * Only set on the first message, when a new stream was created.
+ * @type string $stream_token
+ * A token that represents the position of this response in the stream.
+ * This can be used by a client to resume the stream at this point.
+ * This field is always set.
+ * @type \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $write_results
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ * @type \Google\Protobuf\Timestamp $commit_time
+ * The time at which the commit occurred.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The ID of the stream.
+ * Only set on the first message, when a new stream was created.
+ *
+ * Generated from protobuf field string stream_id = 1;
+ * @return string
+ */
+ public function getStreamId()
+ {
+ return $this->stream_id;
+ }
+
+ /**
+ * The ID of the stream.
+ * Only set on the first message, when a new stream was created.
+ *
+ * Generated from protobuf field string stream_id = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setStreamId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->stream_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * A token that represents the position of this response in the stream.
+ * This can be used by a client to resume the stream at this point.
+ * This field is always set.
+ *
+ * Generated from protobuf field bytes stream_token = 2;
+ * @return string
+ */
+ public function getStreamToken()
+ {
+ return $this->stream_token;
+ }
+
+ /**
+ * A token that represents the position of this response in the stream.
+ * This can be used by a client to resume the stream at this point.
+ * This field is always set.
+ *
+ * Generated from protobuf field bytes stream_token = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setStreamToken($var)
+ {
+ GPBUtil::checkString($var, False);
+ $this->stream_token = $var;
+
+ return $this;
+ }
+
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 3;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getWriteResults()
+ {
+ return $this->write_results;
+ }
+
+ /**
+ * The result of applying the writes.
+ * This i-th write result corresponds to the i-th write in the
+ * request.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.WriteResult write_results = 3;
+ * @param \Google\Cloud\Firestore\V1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setWriteResults($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\WriteResult::class);
+ $this->write_results = $arr;
+
+ return $this;
+ }
+
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 4;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getCommitTime()
+ {
+ return $this->commit_time;
+ }
+
+ /**
+ * The time at which the commit occurred.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp commit_time = 4;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setCommitTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->commit_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/WriteResult.php b/Firestore/src/V1/WriteResult.php
new file mode 100644
index 000000000000..03fa2423c378
--- /dev/null
+++ b/Firestore/src/V1/WriteResult.php
@@ -0,0 +1,117 @@
+google.firestore.v1.WriteResult
+ */
+class WriteResult extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The last update time of the document after applying the write. Not set
+ * after a `delete`.
+ * If the write did not actually change the document, this will be the
+ * previous update_time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 1;
+ */
+ private $update_time = null;
+ /**
+ * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the
+ * same order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value transform_results = 2;
+ */
+ private $transform_results;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Protobuf\Timestamp $update_time
+ * The last update time of the document after applying the write. Not set
+ * after a `delete`.
+ * If the write did not actually change the document, this will be the
+ * previous update_time.
+ * @type \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $transform_results
+ * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the
+ * same order.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Firestore\V1\Write::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The last update time of the document after applying the write. Not set
+ * after a `delete`.
+ * If the write did not actually change the document, this will be the
+ * previous update_time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 1;
+ * @return \Google\Protobuf\Timestamp
+ */
+ public function getUpdateTime()
+ {
+ return $this->update_time;
+ }
+
+ /**
+ * The last update time of the document after applying the write. Not set
+ * after a `delete`.
+ * If the write did not actually change the document, this will be the
+ * previous update_time.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp update_time = 1;
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setUpdateTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->update_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the
+ * same order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value transform_results = 2;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getTransformResults()
+ {
+ return $this->transform_results;
+ }
+
+ /**
+ * The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform], in the
+ * same order.
+ *
+ * Generated from protobuf field repeated .google.firestore.v1.Value transform_results = 2;
+ * @param \Google\Cloud\Firestore\V1\Value[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setTransformResults($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Value::class);
+ $this->transform_results = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/Firestore/src/V1/resources/firestore_client_config.json b/Firestore/src/V1/resources/firestore_client_config.json
new file mode 100644
index 000000000000..c87008304b4d
--- /dev/null
+++ b/Firestore/src/V1/resources/firestore_client_config.json
@@ -0,0 +1,92 @@
+{
+ "interfaces": {
+ "google.firestore.v1.Firestore": {
+ "retry_codes": {
+ "idempotent": [
+ "DEADLINE_EXCEEDED",
+ "UNAVAILABLE"
+ ],
+ "non_idempotent": []
+ },
+ "retry_params": {
+ "default": {
+ "initial_retry_delay_millis": 100,
+ "retry_delay_multiplier": 1.3,
+ "max_retry_delay_millis": 60000,
+ "initial_rpc_timeout_millis": 20000,
+ "rpc_timeout_multiplier": 1.0,
+ "max_rpc_timeout_millis": 20000,
+ "total_timeout_millis": 600000
+ },
+ "streaming": {
+ "initial_retry_delay_millis": 100,
+ "retry_delay_multiplier": 1.3,
+ "max_retry_delay_millis": 60000,
+ "initial_rpc_timeout_millis": 300000,
+ "rpc_timeout_multiplier": 1.0,
+ "max_rpc_timeout_millis": 300000,
+ "total_timeout_millis": 600000
+ }
+ },
+ "methods": {
+ "GetDocument": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ },
+ "ListDocuments": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ },
+ "CreateDocument": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "non_idempotent",
+ "retry_params_name": "default"
+ },
+ "UpdateDocument": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "non_idempotent",
+ "retry_params_name": "default"
+ },
+ "DeleteDocument": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ },
+ "BatchGetDocuments": {
+ "timeout_millis": 300000
+ },
+ "BeginTransaction": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ },
+ "Commit": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "non_idempotent",
+ "retry_params_name": "default"
+ },
+ "Rollback": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ },
+ "RunQuery": {
+ "timeout_millis": 60000
+ },
+ "Write": {
+ "timeout_millis": 86400000
+ },
+ "Listen": {
+ "timeout_millis": 86400000
+ },
+ "ListCollectionIds": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "idempotent",
+ "retry_params_name": "default"
+ }
+ }
+ }
+ }
+}
diff --git a/Firestore/src/V1/resources/firestore_descriptor_config.php b/Firestore/src/V1/resources/firestore_descriptor_config.php
new file mode 100644
index 000000000000..bd6b291e77b5
--- /dev/null
+++ b/Firestore/src/V1/resources/firestore_descriptor_config.php
@@ -0,0 +1,48 @@
+ [
+ 'google.firestore.v1.Firestore' => [
+ 'ListDocuments' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getDocuments',
+ ],
+ ],
+ 'ListCollectionIds' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getCollectionIds',
+ ],
+ ],
+ 'BatchGetDocuments' => [
+ 'grpcStreaming' => [
+ 'grpcStreamingType' => 'ServerStreaming',
+ ],
+ ],
+ 'RunQuery' => [
+ 'grpcStreaming' => [
+ 'grpcStreamingType' => 'ServerStreaming',
+ ],
+ ],
+ 'Write' => [
+ 'grpcStreaming' => [
+ 'grpcStreamingType' => 'BidiStreaming',
+ ],
+ ],
+ 'Listen' => [
+ 'grpcStreaming' => [
+ 'grpcStreamingType' => 'BidiStreaming',
+ ],
+ ],
+ ],
+ ],
+];
diff --git a/Firestore/src/V1/resources/firestore_rest_client_config.php b/Firestore/src/V1/resources/firestore_rest_client_config.php
new file mode 100644
index 000000000000..ccd2c5a51167
--- /dev/null
+++ b/Firestore/src/V1/resources/firestore_rest_client_config.php
@@ -0,0 +1,131 @@
+ [
+ 'google.firestore.v1.Firestore' => [
+ 'GetDocument' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1/{name=projects/*/databases/*/documents/*/**}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'ListDocuments' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}',
+ 'placeholders' => [
+ 'collection_id' => [
+ 'getters' => [
+ 'getCollectionId',
+ ],
+ ],
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'CreateDocument' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}',
+ 'body' => 'document',
+ 'placeholders' => [
+ 'collection_id' => [
+ 'getters' => [
+ 'getCollectionId',
+ ],
+ ],
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'UpdateDocument' => [
+ 'method' => 'patch',
+ 'uriTemplate' => '/v1/{document.name=projects/*/databases/*/documents/*/**}',
+ 'body' => 'document',
+ 'placeholders' => [
+ 'document.name' => [
+ 'getters' => [
+ 'getDocument',
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'DeleteDocument' => [
+ 'method' => 'delete',
+ 'uriTemplate' => '/v1/{name=projects/*/databases/*/documents/*/**}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'BeginTransaction' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{database=projects/*/databases/*}/documents:beginTransaction',
+ 'body' => '*',
+ 'placeholders' => [
+ 'database' => [
+ 'getters' => [
+ 'getDatabase',
+ ],
+ ],
+ ],
+ ],
+ 'Commit' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{database=projects/*/databases/*}/documents:commit',
+ 'body' => '*',
+ 'placeholders' => [
+ 'database' => [
+ 'getters' => [
+ 'getDatabase',
+ ],
+ ],
+ ],
+ ],
+ 'Rollback' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{database=projects/*/databases/*}/documents:rollback',
+ 'body' => '*',
+ 'placeholders' => [
+ 'database' => [
+ 'getters' => [
+ 'getDatabase',
+ ],
+ ],
+ ],
+ ],
+ 'ListCollectionIds' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=projects/*/databases/*/documents}:listCollectionIds',
+ 'body' => '*',
+ 'additionalBindings' => [
+ [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds',
+ 'body' => '*',
+ ],
+ ],
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+];
diff --git a/Firestore/synth.metadata b/Firestore/synth.metadata
index d6f4effbef13..948aaf9f1a10 100644
--- a/Firestore/synth.metadata
+++ b/Firestore/synth.metadata
@@ -1,23 +1,33 @@
{
- "updateTime": "2019-01-16T11:10:04.018450Z",
+ "updateTime": "2019-01-28T17:55:24.105889Z",
"sources": [
{
"generator": {
"name": "artman",
- "version": "0.16.5",
- "dockerImage": "googleapis/artman@sha256:5a96c2c5c6f9570cc9556b63dc9ce1838777fd9166b5b64e43ad8e0ecee2fe2c"
+ "version": "0.16.7",
+ "dockerImage": "googleapis/artman@sha256:d6c8ced606eb49973ca95d2af7c55a681acc042db0f87d135968349e7bf6dd80"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "7a81902f287a4ac2ac130994889c80f87f91d035",
- "internalRef": "229452079"
+ "sha": "a6b4398490269577fc511f297b85763ba4701403",
+ "internalRef": "230969086"
}
}
],
"destinations": [
+ {
+ "client": {
+ "source": "googleapis",
+ "apiName": "firestore",
+ "apiVersion": "v1",
+ "language": "php",
+ "generator": "gapic",
+ "config": "google/firestore/artman_firestore_v1.yaml"
+ }
+ },
{
"client": {
"source": "googleapis",
@@ -29,4 +39,4 @@
}
}
]
-}
\ No newline at end of file
+}
diff --git a/Firestore/synth.py b/Firestore/synth.py
index 8953932bd7b6..17394f7c20ba 100644
--- a/Firestore/synth.py
+++ b/Firestore/synth.py
@@ -23,25 +23,34 @@
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
-library = gapic.php_library(
- service='firestore',
- version='v1beta1',
- config_path='/google/firestore/artman_firestore.yaml',
- artman_output_name='google-cloud-firestore-v1beta1')
+versions = []
+versions.append({'version': 'V1', 'config': '/google/firestore/artman_firestore_v1.yaml'})
+versions.append({'version': 'V1beta1', 'config': '/google/firestore/artman_firestore.yaml'})
-# copy all src including partial veneer classes
-s.move(library / 'src')
+for v in versions:
+ ver = v['version']
+ lower_version = ver.lower()
-# copy proto files to src also
-s.move(library / 'proto/src/Google/Cloud/Firestore', 'src/')
-s.move(library / 'tests/')
+ library = gapic.php_library(
+ service='firestore',
+ version=lower_version,
+ config_path=v['config'],
+ artman_output_name=f'google-cloud-firestore-{lower_version}')
-# copy GPBMetadata file to metadata
-s.move(library / 'proto/src/GPBMetadata/Google/Firestore', 'metadata/')
+ # copy all src except partial veneer classes
+ s.move(library / f'src/{ver}/Gapic')
+ s.move(library / f'src/{ver}/resources')
+
+ # copy proto files to src also
+ s.move(library / f'proto/src/Google/Cloud/Firestore', f'src/')
+ s.move(library / f'tests/')
+
+ # copy GPBMetadata file to metadata
+ s.move(library / f'proto/src/GPBMetadata/Google/Firestore', f'metadata/')
# fix year
s.replace(
- '**/Gapic/*GapicClient.php',
+ '**/V1beta1/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2017')
s.replace(
@@ -52,3 +61,17 @@
'tests/**/V1beta1/*Test.php',
r'Copyright \d{4}',
'Copyright 2018')
+
+# fix year
+s.replace(
+ '**/V1/Gapic/*GapicClient.php',
+ r'Copyright \d{4}',
+ 'Copyright 2019')
+s.replace(
+ '**/V1/FirestoreClient.php',
+ r'Copyright \d{4}',
+ 'Copyright 2019')
+s.replace(
+ 'tests/**/V1/*Test.php',
+ r'Copyright \d{4}',
+ 'Copyright 2019')
diff --git a/Firestore/tests/Snippet/CollectionReferenceTest.php b/Firestore/tests/Snippet/CollectionReferenceTest.php
index 63c0119aff80..eeb09db990e7 100644
--- a/Firestore/tests/Snippet/CollectionReferenceTest.php
+++ b/Firestore/tests/Snippet/CollectionReferenceTest.php
@@ -23,7 +23,6 @@
use Google\Cloud\Firestore\CollectionReference;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\DocumentReference;
-use Google\Cloud\Firestore\Query;
use Google\Cloud\Firestore\ValueMapper;
use Prophecy\Argument;
diff --git a/Firestore/tests/Snippet/DocumentReferenceTest.php b/Firestore/tests/Snippet/DocumentReferenceTest.php
index 8c8a71422c24..9dff5f2fadd4 100644
--- a/Firestore/tests/Snippet/DocumentReferenceTest.php
+++ b/Firestore/tests/Snippet/DocumentReferenceTest.php
@@ -26,7 +26,6 @@
use Google\Cloud\Firestore\DocumentReference;
use Google\Cloud\Firestore\DocumentSnapshot;
use Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\FirestoreClient;
use Google\Cloud\Firestore\ValueMapper;
use Google\Cloud\Firestore\WriteBatch;
use Prophecy\Argument;
diff --git a/Firestore/tests/Snippet/FieldValueTest.php b/Firestore/tests/Snippet/FieldValueTest.php
index 774921cbd0ac..1aa38a0efa0a 100644
--- a/Firestore/tests/Snippet/FieldValueTest.php
+++ b/Firestore/tests/Snippet/FieldValueTest.php
@@ -23,8 +23,7 @@
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\FieldValue;
use Google\Cloud\Firestore\FirestoreClient;
-use Google\Cloud\Firestore\V1beta1\DocumentTransform\FieldTransform\ServerValue;
-use Prophecy\Argument;
+use Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform\ServerValue;
/**
* @group firestore
diff --git a/Firestore/tests/Snippet/FirestoreClientTest.php b/Firestore/tests/Snippet/FirestoreClientTest.php
index 31fe04b616d8..c92d4999bd44 100644
--- a/Firestore/tests/Snippet/FirestoreClientTest.php
+++ b/Firestore/tests/Snippet/FirestoreClientTest.php
@@ -30,7 +30,6 @@
use Google\Cloud\Firestore\DocumentSnapshot;
use Google\Cloud\Firestore\FieldPath;
use Google\Cloud\Firestore\FirestoreClient;
-use Google\Cloud\Firestore\Transaction;
use Google\Cloud\Firestore\WriteBatch;
use Prophecy\Argument;
diff --git a/Firestore/tests/Snippet/QuerySnapshotTest.php b/Firestore/tests/Snippet/QuerySnapshotTest.php
index 241838e00e0b..c5624403cb90 100644
--- a/Firestore/tests/Snippet/QuerySnapshotTest.php
+++ b/Firestore/tests/Snippet/QuerySnapshotTest.php
@@ -24,7 +24,6 @@
use Google\Cloud\Firestore\FirestoreClient;
use Google\Cloud\Firestore\Query;
use Google\Cloud\Firestore\QuerySnapshot;
-use Google\Cloud\Firestore\ValueMapper;
use Prophecy\Argument;
/**
diff --git a/Firestore/tests/Snippet/QueryTest.php b/Firestore/tests/Snippet/QueryTest.php
index fe3761fec3e4..d10d1409dd0f 100644
--- a/Firestore/tests/Snippet/QueryTest.php
+++ b/Firestore/tests/Snippet/QueryTest.php
@@ -25,7 +25,6 @@
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\Query;
use Google\Cloud\Firestore\QuerySnapshot;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery_CompositeFilter_Operator;
use Google\Cloud\Firestore\ValueMapper;
use Prophecy\Argument;
diff --git a/Firestore/tests/Snippet/TransactionTest.php b/Firestore/tests/Snippet/TransactionTest.php
index ee9975471011..25892c84886f 100644
--- a/Firestore/tests/Snippet/TransactionTest.php
+++ b/Firestore/tests/Snippet/TransactionTest.php
@@ -21,7 +21,6 @@
use Google\Cloud\Core\Testing\Snippet\SnippetTestCase;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Core\Timestamp;
-use Google\Cloud\Firestore\CollectionReference;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\DocumentReference;
use Google\Cloud\Firestore\DocumentSnapshot;
diff --git a/Firestore/tests/Snippet/WriteBatchTest.php b/Firestore/tests/Snippet/WriteBatchTest.php
index be10b23248d7..672a95c0d694 100644
--- a/Firestore/tests/Snippet/WriteBatchTest.php
+++ b/Firestore/tests/Snippet/WriteBatchTest.php
@@ -22,7 +22,7 @@
use Google\Cloud\Core\Testing\Snippet\SnippetTestCase;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
-use Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue;
+use Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform\ServerValue;
use Google\Cloud\Firestore\ValueMapper;
use Google\Cloud\Firestore\WriteBatch;
use Prophecy\Argument;
@@ -138,7 +138,7 @@ public function testUpdateSentinels()
'fieldTransforms' => [
[
'fieldPath' => 'lastLogin',
- 'setToServerValue' => DocumentTransform_FieldTransform_ServerValue::REQUEST_TIME
+ 'setToServerValue' => ServerValue::REQUEST_TIME
]
]
]
diff --git a/Firestore/tests/System/GetAllDocumentsTest.php b/Firestore/tests/System/GetAllDocumentsTest.php
index cce481849d40..a18fc948eb2a 100644
--- a/Firestore/tests/System/GetAllDocumentsTest.php
+++ b/Firestore/tests/System/GetAllDocumentsTest.php
@@ -17,7 +17,6 @@
namespace Google\Cloud\Firestore\Tests\System;
-use Google\Cloud\Firestore\DocumentReference;
use Google\Cloud\Firestore\DocumentSnapshot;
/**
diff --git a/Firestore/tests/System/QueryTest.php b/Firestore/tests/System/QueryTest.php
index e27dd8cbbdb0..f7fdebf2dfee 100644
--- a/Firestore/tests/System/QueryTest.php
+++ b/Firestore/tests/System/QueryTest.php
@@ -17,8 +17,6 @@
namespace Google\Cloud\Firestore\Tests\System;
-use Google\Cloud\Firestore\CollectionReference;
-
/**
* @group firestore
* @group firestore-query
diff --git a/Firestore/tests/Unit/Connection/GrpcTest.php b/Firestore/tests/Unit/Connection/GrpcTest.php
index e33f2717aa68..b43170b00ab4 100644
--- a/Firestore/tests/Unit/Connection/GrpcTest.php
+++ b/Firestore/tests/Unit/Connection/GrpcTest.php
@@ -21,15 +21,15 @@
use Google\Cloud\Core\GrpcTrait;
use Google\Cloud\Core\Testing\GrpcTestTrait;
use Google\Cloud\Firestore\Connection\Grpc;
-use Google\Cloud\Firestore\V1beta1\Document;
-use Google\Cloud\Firestore\V1beta1\DocumentMask;
-use Google\Cloud\Firestore\V1beta1\Precondition;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery_CollectionSelector;
-use Google\Cloud\Firestore\V1beta1\TransactionOptions;
-use Google\Cloud\Firestore\V1beta1\TransactionOptions_ReadWrite;
-use Google\Cloud\Firestore\V1beta1\Value;
-use Google\Cloud\Firestore\V1beta1\Write;
+use Google\Cloud\Firestore\V1\Document;
+use Google\Cloud\Firestore\V1\DocumentMask;
+use Google\Cloud\Firestore\V1\Precondition;
+use Google\Cloud\Firestore\V1\StructuredQuery;
+use Google\Cloud\Firestore\V1\StructuredQuery_CollectionSelector;
+use Google\Cloud\Firestore\V1\TransactionOptions;
+use Google\Cloud\Firestore\V1\TransactionOptions_ReadWrite;
+use Google\Cloud\Firestore\V1\Value;
+use Google\Cloud\Firestore\V1\Write;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
diff --git a/Firestore/tests/Unit/FieldPathTest.php b/Firestore/tests/Unit/FieldPathTest.php
index 32e329044732..592081bcc186 100644
--- a/Firestore/tests/Unit/FieldPathTest.php
+++ b/Firestore/tests/Unit/FieldPathTest.php
@@ -18,7 +18,6 @@
namespace Google\Cloud\Firestore\Tests\Unit;
use Google\Cloud\Firestore\FieldPath;
-use Google\Cloud\Firestore\FieldValue;
use PHPUnit\Framework\TestCase;
/**
diff --git a/Firestore/tests/Unit/FieldValueTest.php b/Firestore/tests/Unit/FieldValueTest.php
index 5688d38b43db..eaf662758d38 100644
--- a/Firestore/tests/Unit/FieldValueTest.php
+++ b/Firestore/tests/Unit/FieldValueTest.php
@@ -21,7 +21,7 @@
use Google\Cloud\Firestore\FieldValue\ArrayRemoveValue;
use Google\Cloud\Firestore\FieldValue\ArrayUnionValue;
use Google\Cloud\Firestore\FieldValue\ServerTimestampValue;
-use Google\Cloud\Firestore\V1beta1\DocumentTransform\FieldTransform\ServerValue;
+use Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform\ServerValue;
use PHPUnit\Framework\TestCase;
/**
diff --git a/Firestore/tests/Unit/QuerySnapshotTest.php b/Firestore/tests/Unit/QuerySnapshotTest.php
index b9d2e221a035..1a90af765f07 100644
--- a/Firestore/tests/Unit/QuerySnapshotTest.php
+++ b/Firestore/tests/Unit/QuerySnapshotTest.php
@@ -17,14 +17,11 @@
namespace Google\Cloud\Firestore\Tests\Unit;
-use Google\Cloud\Core\Exception\AbortedException;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\Query;
use Google\Cloud\Firestore\QuerySnapshot;
-use Google\Cloud\Firestore\ValueMapper;
use PHPUnit\Framework\TestCase;
-use Prophecy\Argument;
/**
* @group firestore
diff --git a/Firestore/tests/Unit/QueryTest.php b/Firestore/tests/Unit/QueryTest.php
index 8921826c48c9..0a6240cca66f 100644
--- a/Firestore/tests/Unit/QueryTest.php
+++ b/Firestore/tests/Unit/QueryTest.php
@@ -25,11 +25,10 @@
use Google\Cloud\Firestore\DocumentReference;
use Google\Cloud\Firestore\DocumentSnapshot;
use Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\FirestoreClient;
use Google\Cloud\Firestore\Query;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\CompositeFilter\Operator;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\Direction;
-use Google\Cloud\Firestore\V1beta1\StructuredQuery\FieldFilter\Operator as FieldFilterOperator;
+use Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter\Operator;
+use Google\Cloud\Firestore\V1\StructuredQuery\Direction;
+use Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter\Operator as FieldFilterOperator;
use Google\Cloud\Firestore\ValueMapper;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
diff --git a/Firestore/tests/Unit/V1/FirestoreClientTest.php b/Firestore/tests/Unit/V1/FirestoreClientTest.php
new file mode 100644
index 000000000000..41219a0c348b
--- /dev/null
+++ b/Firestore/tests/Unit/V1/FirestoreClientTest.php
@@ -0,0 +1,1206 @@
+ $this->getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock(),
+ ];
+
+ return new FirestoreClient($options);
+ }
+
+ /**
+ * @test
+ */
+ public function getDocumentTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $expectedResponse = new Document();
+ $expectedResponse->setName($name2);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedName = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ $response = $client->getDocument($formattedName);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/GetDocument', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getName();
+
+ $this->assertProtobufEquals($formattedName, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function getDocumentExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedName = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ try {
+ $client->getDocument($formattedName);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listDocumentsTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $nextPageToken = '';
+ $documentsElement = new Document();
+ $documents = [$documentsElement];
+ $expectedResponse = new ListDocumentsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setDocuments($documents);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ $collectionId = 'collectionId-821242276';
+
+ $response = $client->listDocuments($formattedParent, $collectionId);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getDocuments()[0], $resources[0]);
+
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/ListDocuments', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getParent();
+
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getCollectionId();
+
+ $this->assertProtobufEquals($collectionId, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listDocumentsExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ $collectionId = 'collectionId-821242276';
+
+ try {
+ $client->listDocuments($formattedParent, $collectionId);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function createDocumentTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $name = 'name3373707';
+ $expectedResponse = new Document();
+ $expectedResponse->setName($name);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ $collectionId = 'collectionId-821242276';
+ $documentId = 'documentId506676927';
+ $document = new Document();
+
+ $response = $client->createDocument($formattedParent, $collectionId, $documentId, $document);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/CreateDocument', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getParent();
+
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $actualValue = $actualRequestObject->getCollectionId();
+
+ $this->assertProtobufEquals($collectionId, $actualValue);
+ $actualValue = $actualRequestObject->getDocumentId();
+
+ $this->assertProtobufEquals($documentId, $actualValue);
+ $actualValue = $actualRequestObject->getDocument();
+
+ $this->assertProtobufEquals($document, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function createDocumentExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+ $collectionId = 'collectionId-821242276';
+ $documentId = 'documentId506676927';
+ $document = new Document();
+
+ try {
+ $client->createDocument($formattedParent, $collectionId, $documentId, $document);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function updateDocumentTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $name = 'name3373707';
+ $expectedResponse = new Document();
+ $expectedResponse->setName($name);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $document = new Document();
+ $updateMask = new DocumentMask();
+
+ $response = $client->updateDocument($document, $updateMask);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/UpdateDocument', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getDocument();
+
+ $this->assertProtobufEquals($document, $actualValue);
+ $actualValue = $actualRequestObject->getUpdateMask();
+
+ $this->assertProtobufEquals($updateMask, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function updateDocumentExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $document = new Document();
+ $updateMask = new DocumentMask();
+
+ try {
+ $client->updateDocument($document, $updateMask);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function deleteDocumentTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedName = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ $client->deleteDocument($formattedName);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/DeleteDocument', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getName();
+
+ $this->assertProtobufEquals($formattedName, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function deleteDocumentExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedName = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ try {
+ $client->deleteDocument($formattedName);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function batchGetDocumentsTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $missing = 'missing1069449574';
+ $transaction = '-34';
+ $expectedResponse = new BatchGetDocumentsResponse();
+ $expectedResponse->setMissing($missing);
+ $expectedResponse->setTransaction($transaction);
+ $transport->addResponse($expectedResponse);
+ $missing2 = 'missing21243859865';
+ $transaction2 = '17';
+ $expectedResponse2 = new BatchGetDocumentsResponse();
+ $expectedResponse2->setMissing($missing2);
+ $expectedResponse2->setTransaction($transaction2);
+ $transport->addResponse($expectedResponse2);
+ $missing3 = 'missing31243859866';
+ $transaction3 = '18';
+ $expectedResponse3 = new BatchGetDocumentsResponse();
+ $expectedResponse3->setMissing($missing3);
+ $expectedResponse3->setTransaction($transaction3);
+ $transport->addResponse($expectedResponse3);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $documents = [];
+
+ $serverStream = $client->batchGetDocuments($formattedDatabase, $documents);
+ $this->assertInstanceOf(ServerStream::class, $serverStream);
+
+ $responses = iterator_to_array($serverStream->readAll());
+
+ $expectedResponses = [];
+ $expectedResponses[] = $expectedResponse;
+ $expectedResponses[] = $expectedResponse2;
+ $expectedResponses[] = $expectedResponse3;
+ $this->assertEquals($expectedResponses, $responses);
+
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/BatchGetDocuments', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getDatabase();
+
+ $this->assertProtobufEquals($formattedDatabase, $actualValue);
+ $actualValue = $actualRequestObject->getDocuments();
+
+ $this->assertProtobufEquals($documents, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function batchGetDocumentsExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+
+ $transport->setStreamingStatus($status);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $documents = [];
+
+ $serverStream = $client->batchGetDocuments($formattedDatabase, $documents);
+ $results = $serverStream->readAll();
+
+ try {
+ iterator_to_array($results);
+ // If the close stream method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function beginTransactionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $transaction = '-34';
+ $expectedResponse = new BeginTransactionResponse();
+ $expectedResponse->setTransaction($transaction);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+
+ $response = $client->beginTransaction($formattedDatabase);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/BeginTransaction', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getDatabase();
+
+ $this->assertProtobufEquals($formattedDatabase, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function beginTransactionExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+
+ try {
+ $client->beginTransaction($formattedDatabase);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function commitTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $expectedResponse = new CommitResponse();
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $writes = [];
+
+ $response = $client->commit($formattedDatabase, $writes);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/Commit', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getDatabase();
+
+ $this->assertProtobufEquals($formattedDatabase, $actualValue);
+ $actualValue = $actualRequestObject->getWrites();
+
+ $this->assertProtobufEquals($writes, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function commitExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $writes = [];
+
+ try {
+ $client->commit($formattedDatabase, $writes);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function rollbackTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $expectedResponse = new GPBEmpty();
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $transaction = '-34';
+
+ $client->rollback($formattedDatabase, $transaction);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/Rollback', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getDatabase();
+
+ $this->assertProtobufEquals($formattedDatabase, $actualValue);
+ $actualValue = $actualRequestObject->getTransaction();
+
+ $this->assertProtobufEquals($transaction, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function rollbackExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $transaction = '-34';
+
+ try {
+ $client->rollback($formattedDatabase, $transaction);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function runQueryTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $transaction = '-34';
+ $skippedResults = 880286183;
+ $expectedResponse = new RunQueryResponse();
+ $expectedResponse->setTransaction($transaction);
+ $expectedResponse->setSkippedResults($skippedResults);
+ $transport->addResponse($expectedResponse);
+ $transaction2 = '17';
+ $skippedResults2 = 153532454;
+ $expectedResponse2 = new RunQueryResponse();
+ $expectedResponse2->setTransaction($transaction2);
+ $expectedResponse2->setSkippedResults($skippedResults2);
+ $transport->addResponse($expectedResponse2);
+ $transaction3 = '18';
+ $skippedResults3 = 153532453;
+ $expectedResponse3 = new RunQueryResponse();
+ $expectedResponse3->setTransaction($transaction3);
+ $expectedResponse3->setSkippedResults($skippedResults3);
+ $transport->addResponse($expectedResponse3);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ $serverStream = $client->runQuery($formattedParent);
+ $this->assertInstanceOf(ServerStream::class, $serverStream);
+
+ $responses = iterator_to_array($serverStream->readAll());
+
+ $expectedResponses = [];
+ $expectedResponses[] = $expectedResponse;
+ $expectedResponses[] = $expectedResponse2;
+ $expectedResponses[] = $expectedResponse3;
+ $this->assertEquals($expectedResponses, $responses);
+
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/RunQuery', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getParent();
+
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function runQueryExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+
+ $transport->setStreamingStatus($status);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ $serverStream = $client->runQuery($formattedParent);
+ $results = $serverStream->readAll();
+
+ try {
+ iterator_to_array($results);
+ // If the close stream method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function writeTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $streamId = 'streamId-315624902';
+ $streamToken = '122';
+ $expectedResponse = new WriteResponse();
+ $expectedResponse->setStreamId($streamId);
+ $expectedResponse->setStreamToken($streamToken);
+ $transport->addResponse($expectedResponse);
+ $streamId2 = 'streamId21627150189';
+ $streamToken2 = '-83';
+ $expectedResponse2 = new WriteResponse();
+ $expectedResponse2->setStreamId($streamId2);
+ $expectedResponse2->setStreamToken($streamToken2);
+ $transport->addResponse($expectedResponse2);
+ $streamId3 = 'streamId31627150190';
+ $streamToken3 = '-82';
+ $expectedResponse3 = new WriteResponse();
+ $expectedResponse3->setStreamId($streamId3);
+ $expectedResponse3->setStreamToken($streamToken3);
+ $transport->addResponse($expectedResponse3);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request = new WriteRequest();
+ $request->setDatabase($formattedDatabase);
+ $formattedDatabase2 = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request2 = new WriteRequest();
+ $request2->setDatabase($formattedDatabase2);
+ $formattedDatabase3 = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request3 = new WriteRequest();
+ $request3->setDatabase($formattedDatabase3);
+
+ $bidi = $client->write();
+ $this->assertInstanceOf(BidiStream::class, $bidi);
+
+ $bidi->write($request);
+ $responses = [];
+ $responses[] = $bidi->read();
+
+ $bidi->writeAll([$request2, $request3]);
+ foreach ($bidi->closeWriteAndReadAll() as $response) {
+ $responses[] = $response;
+ }
+
+ $expectedResponses = [];
+ $expectedResponses[] = $expectedResponse;
+ $expectedResponses[] = $expectedResponse2;
+ $expectedResponses[] = $expectedResponse3;
+ $this->assertEquals($expectedResponses, $responses);
+
+ $createStreamRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($createStreamRequests));
+ $streamFuncCall = $createStreamRequests[0]->getFuncCall();
+ $streamRequestObject = $createStreamRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/Write', $streamFuncCall);
+ $this->assertNull($streamRequestObject);
+
+ $callObjects = $transport->popCallObjects();
+ $this->assertSame(1, count($callObjects));
+ $bidiCall = $callObjects[0];
+
+ $writeRequests = $bidiCall->popReceivedCalls();
+ $expectedRequests = [];
+ $expectedRequests[] = $request;
+ $expectedRequests[] = $request2;
+ $expectedRequests[] = $request3;
+ $this->assertEquals($expectedRequests, $writeRequests);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function writeExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+
+ $transport->setStreamingStatus($status);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $bidi = $client->write();
+ $results = $bidi->closeWriteAndReadAll();
+
+ try {
+ iterator_to_array($results);
+ // If the close stream method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listenTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $expectedResponse = new ListenResponse();
+ $transport->addResponse($expectedResponse);
+ $expectedResponse2 = new ListenResponse();
+ $transport->addResponse($expectedResponse2);
+ $expectedResponse3 = new ListenResponse();
+ $transport->addResponse($expectedResponse3);
+
+ // Mock request
+ $formattedDatabase = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request = new ListenRequest();
+ $request->setDatabase($formattedDatabase);
+ $formattedDatabase2 = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request2 = new ListenRequest();
+ $request2->setDatabase($formattedDatabase2);
+ $formattedDatabase3 = $client->databaseRootName('[PROJECT]', '[DATABASE]');
+ $request3 = new ListenRequest();
+ $request3->setDatabase($formattedDatabase3);
+
+ $bidi = $client->listen();
+ $this->assertInstanceOf(BidiStream::class, $bidi);
+
+ $bidi->write($request);
+ $responses = [];
+ $responses[] = $bidi->read();
+
+ $bidi->writeAll([$request2, $request3]);
+ foreach ($bidi->closeWriteAndReadAll() as $response) {
+ $responses[] = $response;
+ }
+
+ $expectedResponses = [];
+ $expectedResponses[] = $expectedResponse;
+ $expectedResponses[] = $expectedResponse2;
+ $expectedResponses[] = $expectedResponse3;
+ $this->assertEquals($expectedResponses, $responses);
+
+ $createStreamRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($createStreamRequests));
+ $streamFuncCall = $createStreamRequests[0]->getFuncCall();
+ $streamRequestObject = $createStreamRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/Listen', $streamFuncCall);
+ $this->assertNull($streamRequestObject);
+
+ $callObjects = $transport->popCallObjects();
+ $this->assertSame(1, count($callObjects));
+ $bidiCall = $callObjects[0];
+
+ $writeRequests = $bidiCall->popReceivedCalls();
+ $expectedRequests = [];
+ $expectedRequests[] = $request;
+ $expectedRequests[] = $request2;
+ $expectedRequests[] = $request3;
+ $this->assertEquals($expectedRequests, $writeRequests);
+
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listenExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+
+ $transport->setStreamingStatus($status);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $bidi = $client->listen();
+ $results = $bidi->closeWriteAndReadAll();
+
+ try {
+ iterator_to_array($results);
+ // If the close stream method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listCollectionIdsTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ // Mock response
+ $nextPageToken = '';
+ $collectionIdsElement = 'collectionIdsElement1368994900';
+ $collectionIds = [$collectionIdsElement];
+ $expectedResponse = new ListCollectionIdsResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setCollectionIds($collectionIds);
+ $transport->addResponse($expectedResponse);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ $response = $client->listCollectionIds($formattedParent);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getCollectionIds()[0], $resources[0]);
+
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.firestore.v1.Firestore/ListCollectionIds', $actualFuncCall);
+
+ $actualValue = $actualRequestObject->getParent();
+
+ $this->assertProtobufEquals($formattedParent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /**
+ * @test
+ */
+ public function listCollectionIdsExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $client = $this->createClient(['transport' => $transport]);
+
+ $this->assertTrue($transport->isExhausted());
+
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+
+ // Mock request
+ $formattedParent = $client->anyPathName('[PROJECT]', '[DATABASE]', '[DOCUMENT]', '[ANY_PATH]');
+
+ try {
+ $client->listCollectionIds($formattedParent);
+ // If the $client method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+}
diff --git a/Firestore/tests/Unit/ValueMapperTest.php b/Firestore/tests/Unit/ValueMapperTest.php
index 9117fbf5cec1..03af5f807fcc 100644
--- a/Firestore/tests/Unit/ValueMapperTest.php
+++ b/Firestore/tests/Unit/ValueMapperTest.php
@@ -26,8 +26,6 @@
use Google\Cloud\Firestore\CollectionReference;
use Google\Cloud\Firestore\Connection\ConnectionInterface;
use Google\Cloud\Firestore\DocumentReference;
-use Google\Cloud\Firestore\FieldPath;
-use Google\Cloud\Firestore\FieldValue;
use Google\Cloud\Firestore\ValueMapper;
use Google\Protobuf\NullValue;
use PHPUnit\Framework\TestCase;
diff --git a/Firestore/tests/Unit/WriteBatchTest.php b/Firestore/tests/Unit/WriteBatchTest.php
index 74b0cf933d7d..522d3cddf927 100644
--- a/Firestore/tests/Unit/WriteBatchTest.php
+++ b/Firestore/tests/Unit/WriteBatchTest.php
@@ -23,8 +23,7 @@
use Google\Cloud\Firestore\DocumentReference;
use Google\Cloud\Firestore\FieldPath;
use Google\Cloud\Firestore\FieldValue;
-use Google\Cloud\Firestore\FirestoreClient;
-use Google\Cloud\Firestore\V1beta1\DocumentTransform\FieldTransform\ServerValue;
+use Google\Cloud\Firestore\V1\DocumentTransform\FieldTransform\ServerValue;
use Google\Cloud\Firestore\ValueMapper;
use Google\Cloud\Firestore\WriteBatch;
use PHPUnit\Framework\TestCase;
diff --git a/docs/contents/cloud-firestore.json b/docs/contents/cloud-firestore.json
index f22073c86985..94c17d8b7479 100644
--- a/docs/contents/cloud-firestore.json
+++ b/docs/contents/cloud-firestore.json
@@ -35,6 +35,18 @@
}, {
"title": "FieldValue",
"type": "firestore/fieldvalue"
+ }, {
+ "title": "v1",
+ "type": "firestore/v1/readme",
+ "patterns": [
+ "firestore/v1/\\w{1,}"
+ ],
+ "nav": [
+ {
+ "title": "FirestoreClient",
+ "type": "firestore/v1/firestoreclient"
+ }
+ ]
}, {
"title": "v1beta1",
"type": "firestore/v1beta1/readme",