Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: began merging variant client samples #696

Merged
merged 1 commit into from Jul 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -43,19 +43,10 @@ public class Quickstart {

private Firestore db;

/**
* Initialize Firestore using default project ID.
*/
public Quickstart() {
// [START fs_initialize]
// [START firestore_setup_client_create]
Firestore db = FirestoreOptions.getDefaultInstance().getService();
// [END firestore_setup_client_create]
// [END fs_initialize]
this.db = db;
}

public Quickstart(String projectId) throws Exception {
// [START firestore_setup_client_create]
// Option 1: Initialize a Firestore client with a specific `projectId` and
// authorization credential.
// [START fs_initialize_project_id]
// [START firestore_setup_client_create_with_project_id]
FirestoreOptions firestoreOptions =
Expand All @@ -64,8 +55,24 @@ public Quickstart(String projectId) throws Exception {
.setCredentials(GoogleCredentials.getApplicationDefault())
.build();
Firestore db = firestoreOptions.getService();
// [END firestore_setup_client_create_with_project_id]
// [END fs_initialize_project_id]
// [END firestore_setup_client_create_with_project_id]
// [END firestore_setup_client_create]
this.db = db;
}

/**
* Initialize Firestore using default project ID.
*/
public Quickstart() {
// [START firestore_setup_client_create]

// Option 2: Initialize a Firestore client with default values inferred from
// your environment.
// [START fs_initialize]
Firestore db = FirestoreOptions.getDefaultInstance().getService();
// [END firestore_setup_client_create]
// [END fs_initialize]
this.db = db;
}

Expand Down