Esempio n. 1
0
        private static FirestoreDb Create()
        {
            var creds   = CredProvider.GetCreds().ToChannelCredentials();
            var channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), creds);

            var client = FirestoreClient.Create(channel);
            var db     = FirestoreDb.Create(ConfigValues.project, client);

            return(db);
        }
Esempio n. 2
0
        static HttpClientProvider()
        {
            var credential = CredProvider.GetCreds();

            // Inject the Cloud Platform scope if required.
            if (credential.IsCreateScopedRequired)
            {
                credential = credential.CreateScoped(new[]
                {
                    "https://www.googleapis.com/auth/cloud-platform"
                });
            }
            Client = new Google.Apis.Http.HttpClientFactory()
                     .CreateHttpClient(
                new Google.Apis.Http.CreateHttpClientArgs()
            {
                ApplicationName = "Google Cloud Platform Firestore Sample",
                GZipEnabled     = true,
                Initializers    = { credential },
            });
        }