open static method

Future<GooglePlayClient> open(
  1. GooglePlayCredentials credentials, {
  2. Client? baseClient,
})

Authenticates a service account for Android Publisher access.

Implementation

static Future<GooglePlayClient> open(
  GooglePlayCredentials credentials, {
  http.Client? baseClient,
}) async {
  try {
    final serviceAccount = ServiceAccountCredentials.fromJson(
      credentials.serviceAccountJson,
    );
    final client = await clientViaServiceAccount(
      serviceAccount,
      const <String>[play.AndroidPublisherApi.androidpublisherScope],
      baseClient: baseClient,
    );
    return GooglePlayClient._(
      client,
      play.AndroidPublisherApi(client),
    );
  } on Object catch (error) {
    throw SmfError(
      'Could not authenticate the Google Play service account.',
      SmfErrorCode.googlePlayAuth,
      cause: error,
    );
  }
}