std::vector BundleTemplate()

in firestore/integration_test_internal/src/util/bundle_builder.cc [42:207]


std::vector<std::string> BundleTemplate() {
  std::string metadata =
      R"|({
   "metadata":{
      "id":"test-bundle",
      "createTime":{
         "seconds":1001,
         "nanos":9999
      },
      "version":1,
      "totalDocuments":2,
      "totalBytes":{totalBytes}
   }
})|";

  std::string named_query1 =
      R"|({
   "namedQuery":{
      "name":"limit",
      "readTime":{
         "seconds":1000,
         "nanos":9999
      },
      "bundledQuery":{
         "parent":"projects/{projectId}/databases/(default)/documents",
         "structuredQuery":{
            "from":[
               {
                  "collectionId":"coll-1"
               }
            ],
            "orderBy":[
               {
                  "field":{
                     "fieldPath":"bar"
                  },
                  "direction":"DESCENDING"
               },
               {
                  "field":{
                     "fieldPath":"__name__"
                  },
                  "direction":"DESCENDING"
               }
            ],
            "limit":{
               "value":1
            }
         },
         "limitType":"FIRST"
      }
   }
})|";

  std::string named_query2 =
      R"|({
   "namedQuery":{
      "name":"limit-to-last",
      "readTime":{
         "seconds":1000,
         "nanos":9999
      },
      "bundledQuery":{
         "parent":"projects/{projectId}/databases/(default)/documents",
         "structuredQuery":{
            "from":[
               {
                  "collectionId":"coll-1"
               }
            ],
            "orderBy":[
               {
                  "field":{
                     "fieldPath":"bar"
                  },
                  "direction":"DESCENDING"
               },
               {
                  "field":{
                     "fieldPath":"__name__"
                  },
                  "direction":"DESCENDING"
               }
            ],
            "limit":{
               "value":1
            }
         },
         "limitType":"LAST"
      }
   }
})|";

  std::string document_metadata1 =
      R"|({
   "documentMetadata":{
      "name":"projects/{projectId}/databases/(default)/documents/coll-1/a",
      "readTime":{
         "seconds":1000,
         "nanos":9999
      },
      "exists":true
   }
})|";

  std::string document_1 =
      R"|({
   "document":{
      "name":"projects/{projectId}/databases/(default)/documents/coll-1/a",
      "createTime":{
         "seconds":1,
         "nanos":9
      },
      "updateTime":{
         "seconds":1,
         "nanos":9
      },
      "fields":{
         "k":{
            "stringValue":"a"
         },
         "bar":{
            "integerValue":1
         }
      }
   }
})|";

  std::string document_metadata2 =
      R"|({
   "documentMetadata":{
      "name":"projects/{projectId}/databases/(default)/documents/coll-1/b",
      "readTime":{
         "seconds":1000,
         "nanos":9999
      },
      "exists":true
   }
})|";

  std::string document_2 =
      R"|({
   "document":{
      "name":"projects/{projectId}/databases/(default)/documents/coll-1/b",
      "createTime":{
         "seconds":1,
         "nanos":9
      },
      "updateTime":{
         "seconds":1,
         "nanos":9
      },
      "fields":{
         "k":{
            "stringValue":"b"
         },
         "bar":{
            "integerValue":2
         }
      }
   }
})|";

  return {metadata,   named_query1,       named_query2, document_metadata1,
          document_1, document_metadata2, document_2};
}