Update the configuration file googleapis generation
Looked through all APIs and added all non-beta APIs to google the
googleapis package. Added all beta APIs to the googleapis_beta package.
Added a comment URL for looking up the API web page (hopefuly they will
not become stale).
Removed the Dart code and added an initial README with instructions
to get started.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//539113002
diff --git a/README.md b/README.md
index f12e3ca..d7e3693 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,25 @@
## Google Cloud Platform
Repository for building the googleapis packages
+
+### Manual process
+
+This should be automated, but here is the current workflow
+
+- Clone the GitHub repro
+ https://github.com/dart-lang/discovery_api_dart_client_generator
+- Checkout the experimental branch
+- Generate from config file
+
+ $ dart ../discovery_api_dart_client_generator/bin/generate.dart run_config
+
+- Downloaded discovery documents directory 'discovery'
+- Generated packages in directory 'generated'
+
+- Diff with previous apis and determine wheter to do minor or major version
+ update
+- Update config.yaml with new version and generate again
+- Run tests
+
+- Upload packages to pub
+- Commit downloaded discovery documents and generated packages
diff --git a/config.yaml b/config.yaml
index 3ad29f5..6d779d9 100644
--- a/config.yaml
+++ b/config.yaml
@@ -6,18 +6,58 @@
readme: resources/README.md
license: resources/LICENSE
apis:
- - analytics:v3
- - bigquery:v2
- - blogger:v3
- - books:v1
- - calendar:v3
- - compute:v1
- - drive:v2
- - gmail:v1
- - plus:v1
- - storage:v1
- - urlshortener:v1
- - youtube:v3
+ - adexchangebuyer:v1.3 # https://developers.google.com/ad-exchange/buyer-rest/
+ - adexchangeseller:v1.1 # https://developers.google.com/ad-exchange/seller-rest/
+ - admin:directory_v1 # https://developers.google.com/admin-sdk/directory/
+ - admin:email_migration_v2 #https://developers.google.com/admin-sdk/email-migration/
+ - admin:reports_v1 # https://developers.google.com/admin-sdk/reports/
+ - adsense:v1.4 # https://developers.google.com/adsense/management/
+ - adsensehost:v4.1 # https://developers.google.com/adsense/host/
+ - analytics:v3 # https://developers.google.com/analytics/
+ - androidpublisher:v2 # https://developers.google.com/android-publisher/
+ - appsactivity:v1 # https://developers.google.com/google-apps/activity/
+ - appstate:v1 # https://developers.google.com/games/services/web/api/states
+ - bigquery:v2 # https://developers.google.com/bigquery/
+ - blogger:v3 # https://developers.google.com/blogger/
+ - books:v1 # https://developers.google.com/books/
+ - civicinfo:us_v1 # https://developers.google.com/civic-information/
+ - civicinfo:v1 # https://developers.google.com/civic-information/
+ - calendar:v3 # https://developers.google.com/google-apps/calendar/
+ - compute:v1 # https://developers.google.com/compute/
+ - content:v2 # https://developers.google.com/shopping-content/
+ - coordinate:v1 # https://google-developers.appspot.com/coordinate/
+ - customsearch:v1 # https://developers.google.com/custom-search/
+ - drive:v2 # https://developers.google.com/drive/v2/reference/
+ - dfareporting:v1.3 # https://developers.google.com/doubleclick-advertisers/reporting/
+ - doubleclickbidmanager:v1 # https://developers.google.com/bid-manager/
+ - doubleclicksearch:v2 # https://developers.google.com/doubleclick-search/
+ - freebase:v1 # https://developers.google.com/freebase/
+ - fusiontables:v1 # https://developers.google.com/fusiontables/
+ - games:v1 # https://developers.google.com/games/services/
+ - gamesManagement:v1management # https://developers.google.com/games/services/management/api/
+ - gmail:v1 # https://developers.google.com/gmail/
+ - groupsmigration:v1 # https://developers.google.com/admin-sdk/groups-migration/
+ - groupssettings:v1 # https://developers.google.com/admin-sdk/groups-settings/
+ - identitytoolkit:v3 # https://developers.google.com/identity-toolkit/
+ - licensing:v1 # https://developers.google.com/admin-sdk/licensing/v1/how-tos/using
+ - mapsengine:v1 # https://developers.google.com/maps-engine/
+ - mirror:v1 # https://developers.google.com/glass/develop/mirror/
+ - oauth2:v2 # https://developers.google.com/accounts/docs/OAuth2UserAgent
+ - orkut:v2 # https://developers.google.com/orkut/docs/off-site-apps/v2restapi
+ - pagespeedonline:v1 # https://developers.google.com/speed/docs/insights/about
+ - plus:v1 # https://developers.google.com/+/api/
+ - plusDomains:v1 # https://developers.google.com/+/domains/
+ - prediction:v1.6 # https://developers.google.com/prediction/
+ - qpxExpress:v1 # https://developers.google.com/qpx-express/
+ - reseller:v1 # https://developers.google.com/admin-sdk/reseller/
+ - siteVerification:v1 # https://developers.google.com/site-verification/
+ - storage:v1 # https://developers.google.com/storage/
+ - tasks:v1 # https://developers.google.com/google-apps/tasks/
+ - translate:v2 # https://developers.google.com/translate/
+ - urlshortener:v1 # https://developers.google.com/url-shortener/
+ - webfonts:v1 # https://developers.google.com/fonts/docs/developer_api
+ - youtube:v3 # https://developers.google.com/youtube/
+ - youtubeAnalytics:v1 # https://developers.google.com/youtube/analytics/
- googleapis_beta:
version: 0.1.0
@@ -26,89 +66,49 @@
readme: resources/README.md
license: resources/LICENSE
apis:
- - datastore:v1beta2
- - dns:v1beta1
- - pubsub:v1beta1
+ - autoscaler:v1beta2 # https://developers.google.com/compute/docs/autoscaler/ (Limited Preview)
+ - cloudmonitoring:v2beta1 # https://developers.google.com/cloud-monitoring/
+ - datastore:v1beta2 # https://developers.google.com/datastore/
+ - dns:v1beta1 # https://developers.google.com/cloud-dns/
+ - genomics:v1beta # https://developers.google.com/genomics/
+ - manager:v1beta2 # https://developers.google.com/deployment-manager/
+ - pubsub:v1beta1 # https://developers.google.com/pubsub/ (Limited Preview)
+ - replicapool:v1beta1 # https://developers.google.com/compute/docs/replica-pool/ (Limited Preview)
+ - resourceviews:v1beta1 # https://developers.google.com/compute/docs/resource-views/ (Limited Preview)
+ - sqladmin:v1beta3 # https://developers.google.com/cloud-sql/docs/admin-api/
+ - taskqueue:v1beta2 # https://developers.google.com/appengine/docs/python/taskqueue/rest/libraries
skipped_apis:
-- adexchangebuyer:v1
-- adexchangebuyer:v1.1
-- adexchangebuyer:v1.2
-- adexchangebuyer:v1.3
-- adexchangeseller:v1
-- adexchangeseller:v1.1
-- admin:directory_v1
-- admin:email_migration_v2
-- admin:reports_v1
-- adsense:v1.2
-- adsense:v1.3
-- adsense:v1.4
-- adsensehost:v4.1
-- analytics:v2.4
-- androidpublisher:v1
-- androidpublisher:v1.1
-- androidpublisher:v2
-- appsactivity:v1
-- appstate:v1
-- audit:v1
-- autoscaler:v1beta2
-- blogger:v2
-- civicinfo:us_v1
-- civicinfo:v1
-- cloudmonitoring:v2beta1
-- content:v2
-- coordinate:v1
-- customsearch:v1
-- datastore:v1beta1
-- dfareporting:v1
-- dfareporting:v1.1
-- dfareporting:v1.2
-- dfareporting:v1.3
-- discovery:v1
-- doubleclickbidmanager:v1
-- doubleclicksearch:v2
-- drive:v1
-- freebase:v1-sandbox
-- freebase:v1sandbox
-- freebase:v1
-- fusiontables:v1
-- games:v1
-- gamesManagement:v1management
-- gan:v1beta1
-- genomics:v1beta
-- groupsmigration:v1
-- groupssettings:v1
-- identitytoolkit:v3
-- licensing:v1
-- manager:v1beta2
-- mapsengine:exp2
-- mapsengine:v1
-- mirror:v1
-- oauth2:v1
-- oauth2:v2
-- orkut:v2
-- pagespeedonline:v1
-- plusDomains:v1
-- prediction:v1.2
-- prediction:v1.3
-- prediction:v1.4
-- prediction:v1.5
-- prediction:v1.6
-- qpxExpress:v1
-- replicapool:v1beta1
-- reseller:v1sandbox
-- reseller:v1
-- resourceviews:v1beta1
-- siteVerification:v1
-- spectrum:v1explorer
-- sqladmin:v1beta1
-- sqladmin:v1beta3
-- storage:v1beta1
-- storage:v1beta2
-- taskqueue:v1beta1
-- taskqueue:v1beta2
-- tasks:v1
-- translate:v2
-- webfonts:v1
-- youtubeAnalytics:v1
-- youtubeAnalytics:v1beta1
+- adexchangebuyer:v1 # v1.3 included
+- adexchangebuyer:v1.1 # v1.3 included
+- adexchangebuyer:v1.2 # v1.3 included
+- adexchangeseller:v1 # v1.1 included
+- adsense:v1.2 # v1.4 included
+- adsense:v1.3 # v1.4 included
+- analytics:v2.4 # v3 included
+- androidpublisher:v1 # v2 included
+- androidpublisher:v1.1 # v2 included
+- audit:v1 # Deprecated as of May 15, 2013, https://developers.google.com/google-apps/admin-audit/
+- blogger:v2 # v3 included
+- datastore:v1beta1 # v1beta2 included
+- dfareporting:v1 # v1.3 included
+- dfareporting:v1.1 # v1.3 included
+- dfareporting:v1.2 # v1.3 included
+- discovery:v1 # Not included
+- drive:v1 # v2 included
+- freebase:v1-sandbox # v1 included
+- freebase:v1sandbox # v1 included
+- gan:v1beta1 # Deprecated as of April 16, 2013, https://developers.google.com/affiliate-network/
+- mapsengine:exp2 # v1 included
+- oauth2:v1 # v2 included
+- prediction:v1.2 # v1.6 included
+- prediction:v1.3 # v1.6 included
+- prediction:v1.4 # v1.6 included
+- prediction:v1.5 # v1.6 included
+- reseller:v1sandbox # v1 included
+- spectrum:v1explorer # Not included, https://developers.google.com/spectrum/
+- sqladmin:v1beta1 # v1beta3 included
+- storage:v1beta1 # v1 included
+- storage:v1beta2 # v1 included
+- taskqueue:v1beta1 # v1beta2 included
+- youtubeAnalytics:v1beta1 # v1 included
diff --git a/main.dart b/main.dart
deleted file mode 100644
index 9cc17c2..0000000
--- a/main.dart
+++ /dev/null
@@ -1,262 +0,0 @@
-import "dart:io";
-import "dart:async";
-
-import '../discovery_api_dart_client_generator/lib/generator.dart';
-import 'package:google_discovery_v1_api/discovery_v1_api_client.dart';
-import 'package:yaml/yaml.dart';
-
-class Package {
- final String name;
- final List<String> apis;
- final Pubspec pubspec;
- final String readme;
- final String license;
-
- Package(this.name, this.apis, this.pubspec, this.readme, this.license);
-}
-
-/**
- * Configuration of a set of packages generated from a set of APIs exposed by
- * a Discovery Service.
- */
-class DiscoveryPackagesConfiguration {
- Map<String, Package> packages = {};
- Iterable<String> excessApis;
- Iterable<String> missingApis;
-
- /**
- * Create a new discovery packages configuration.
- *
- * [config] is the path to the YAML configuration file.
- *
- * [allApis] is the list of all supported APIs returned by the Discovery
- * Service.
- *
- * The format of a YAML document describing a number of packages looks
- * like this:
- *
- * packages:
- * - googleapis:
- * version: 0.1.0
- * author: Dart Team <misc@dartlang.org>
- * homepage: http://www.dartlang.org
- * readme: resources/README.md
- * license: resources/LICENSE
- * apis:
- * - analytics:v3
- * - bigquery:v2
- * - googleapis_beta:
- * version: 0.1.0
- * author: Dart Team <misc@dartlang.org>
- * homepage: http://www.dartlang.org
- * readme: resources/README.md
- * license: resources/LICENSE
- * apis:
- * - datastore:v1beta2
- * - dns:v1beta1
- * skipped_apis:
- * - adexchangebuyer:v1
- *
- * Each package to build is listed under the key `packages:`.
- *
- * The key `skipped_apis` is used to list APIs returned buy the Discovery
- * Service but is not part of any generated packages.
- *
- * The file names for the content of readme and license files are resolved
- * relative to the configuration file.
- */
- DiscoveryPackagesConfiguration(
- String configFile, List<DirectoryListItems> allApis) {
- var configYaml = new File(configFile).readAsStringSync();
- var yaml = loadYaml(configYaml);
- packages = _packagesFromYaml(yaml['packages'], configFile, allApis);
- var knownApis = _calculateKnownApis(packages,
- _listFromYaml(yaml['skipped_apis']));
- missingApis = _calculateMissingApis(knownApis, allApis);
- excessApis = _calculateExcessApis(knownApis, allApis);
- }
-
- /**
- * Generate packages from the configuration.
- *
- * [discoveryDocsDir] is the directory where all the downloaded discovery
- * documents are stored.
- *
- * [generatedApisDir] is the directory where the packages are generated.
- * Each package is generated in a sub-directory.
- */
- Future generate(String discoveryDocsDir, String generatedApisDir) {
- // Delete all downloaded discovery documents.
- var dir = new Directory(discoveryDocsDir);
- if (dir.existsSync()) dir.deleteSync(recursive: true);
-
- // Download the discovery documents for the packages to build.
- var futures = [];
- packages.forEach((name, package) {
- futures.add(downloadDiscoveryDocuments('$discoveryDocsDir/$name',
- ids: package.apis));
- });
-
- return Future.wait(futures).then((_) {
- packages.forEach((name, package) {
- generateAllLibraries('$discoveryDocsDir/$name',
- '$generatedApisDir/$name',
- package.pubspec);
- new File('$generatedApisDir/$name/README.md')
- .writeAsStringSync(package.readme);
- if (package.license != null) {
- new File('$generatedApisDir/$name/LICENSE')
- .writeAsStringSync(package.license);
- }
- });
- });
- }
-
- // Return empty list for YAML null value.
- static List _listFromYaml(value) => value != null ? value : [];
-
- static String _generateReadme(
- String readmeFile, List<DirectoryListItems> items) {
- var sb = new StringBuffer();
- if (readmeFile != null) {
- sb.write(new File(readmeFile).readAsStringSync());
- }
- sb.writeln('''
-
-## Available Google APIs
-
-The following is a list of APIs that are currently available inside this
-package.
-''');
- for (DirectoryListItems item in items) {
- sb.write("#### ");
- if (item.icons != null && item.icons.x16 != null) {
- sb.write(" ");
- }
- sb..writeln('${item.title} - ${item.name} ${item.version}')
- ..writeln()
- ..writeln('${item.description}')
- ..writeln();
- if (item.documentationLink != null) {
- sb.writeln(
- 'Official API documentation: ${item.documentationLink}');
- sb.writeln();
- }
- }
- return sb.toString();
- }
-
- static Map<String, Package>_packagesFromYaml(
- YamlList configPackages,
- String configFile,
- List<DirectoryListItems> allApis) {
- var supportedApis = [];
- var packages = {};
- configPackages.forEach((package) {
- package.forEach((name, values) {
- packages[name] = _packageFromYaml(name, values, configFile, allApis);
- });
- });
-
- return packages;
- }
-
- static Package _packageFromYaml(String name,
- YamlMap values,
- String configFile,
- List<DirectoryListItems> allApis) {
- var apis = _listFromYaml(values['apis']);
- var version =
- values['version'] != null ? values['version'] : '0.1.0-dev';
- var author = values['author'];
- var homepage = values['homepage'];
- var readmeFile;
- if (values['readme'] != null) {
- readmeFile = new Uri.file(configFile).resolve(values['readme']).path;
- }
- var licenseFile;
- if (values['license'] != null) {
- licenseFile =
- new Uri.file(configFile).resolve(values['license']).path;
- }
-
- // Generate package description.
- var apiDescriptions = [];
- var sb = new StringBuffer()
- ..write('"Auto-generated client libraries for accessing '
- 'the following APIs:\\n');
- allApis.forEach((DirectoryListItems apiDescription) {
- if (apis.contains(apiDescription.id)) {
- sb..writeln('')
- ..write(' ')
- ..write(apiDescription.id)
- ..write(' - ')
- ..write(apiDescription.description)
- ..write('\\n');
- apiDescriptions.add(apiDescription);
- }
- });
- sb.write('"');
-
- // Generate the README.md file content.
- var readme = _generateReadme(readmeFile, apiDescriptions);
-
- // Read the LICENSE
- var license = new File(licenseFile).readAsStringSync();
-
- // Create package description with pubspec.yaml information.
- var pubspec = new Pubspec(
- name, version, sb.toString(), author: author, homepage: homepage);
- return new Package(name, apis, pubspec, readme, license);
- }
-
- /// The known APIs are the APis mentioned in each package together with
- /// the APIs explicitly skipped.
- static Set<String> _calculateKnownApis(Map<String, Package> packages,
- YamlList skippedApis) {
- var knownApis = new Set();
- knownApis.addAll(skippedApis);
- packages.forEach((_, package) => knownApis.addAll(package.apis));
- return knownApis;
- }
-
- /// The missing APIs are the APIs returned from the Discovery Service
- /// but not mentioned in the configuration.
- static Iterable<String> _calculateMissingApis(
- Iterable<String> knownApis, List<DirectoryListItems> allApis) {
- return allApis
- .where((item) => !knownApis.contains(item.id))
- .map((item) => item.id);
- }
-
- /// The excess APIs are the APIs mentioned in the configuration but not
- /// returned from the Discovery Service.
- static Iterable<String> _calculateExcessApis(
- Iterable<String> knownApis, List<DirectoryListItems> allApis) {
- var excessApis = new Set.from(knownApis);
- allApis.forEach((item) => excessApis.remove(item.id));
- return excessApis;
- }
-}
-
-main() {
- listAllApis().then((List<DirectoryListItems> items) {
- var configuration = new DiscoveryPackagesConfiguration(
- Platform.script.resolve('config.yaml').path, items);
-
- // Print warnings for APIs not mentioned.
- if (configuration.missingApis.isNotEmpty) {
- print('WARNING: No configuration for the following APIs:');
- configuration.missingApis.forEach((id) => print('- $id'));
- }
- if (configuration.excessApis.isNotEmpty) {
- print('WARNING: The following APIs do not exist:');
- configuration.excessApis.forEach((id) => print('- $id'));
- }
-
- // Generate the packages.
- configuration.generate(Platform.script.resolve('discovery').path,
- Platform.script.resolve('generated').path)
- .then((_) => print('Done!'));
- });
-}
\ No newline at end of file
diff --git a/pubspec.lock b/pubspec.lock
deleted file mode 100644
index 2be945e..0000000
--- a/pubspec.lock
+++ /dev/null
@@ -1,75 +0,0 @@
-# Generated by pub
-# See http://pub.dartlang.org/doc/glossary.html#lockfile
-packages:
- asn1lib:
- description: asn1lib
- source: hosted
- version: "0.3.2"
- bignum:
- description: bignum
- source: hosted
- version: "0.0.5"
- cipher:
- description: cipher
- source: hosted
- version: "0.7.1"
- collection:
- description: collection
- source: hosted
- version: "0.9.4"
- crypto:
- description: crypto
- source: hosted
- version: "0.9.0"
- fixnum:
- description: fixnum
- source: hosted
- version: "0.9.0"
- google_discovery_v1_api:
- description: google_discovery_v1_api
- source: hosted
- version: "0.4.13"
- google_oauth2_client:
- description: google_oauth2_client
- source: hosted
- version: "0.3.9"
- http:
- description: http
- source: hosted
- version: "0.11.1+1"
- http_parser:
- description: http_parser
- source: hosted
- version: "0.0.2+4"
- json_web_token:
- description: json_web_token
- source: hosted
- version: "0.1.3"
- oauth2:
- description: oauth2
- source: hosted
- version: "0.9.3"
- path:
- description: path
- source: hosted
- version: "1.3.0"
- rsa_pkcs:
- description: rsa_pkcs
- source: hosted
- version: "0.1.1"
- source_span:
- description: source_span
- source: hosted
- version: "1.0.0"
- stack_trace:
- description: stack_trace
- source: hosted
- version: "1.0.2"
- string_scanner:
- description: string_scanner
- source: hosted
- version: "0.1.0"
- yaml:
- description: yaml
- source: hosted
- version: "2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
deleted file mode 100644
index 245e435..0000000
--- a/pubspec.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-name: googleapis_generator
-version: 0.0.1
-author: Dart Team <misc@dartlang.org>
-description: Create API Client libraries based on the APIs Discovery documentation
-environment:
- sdk: '>=1.0.0 <2.0.0'
-dependencies:
- google_discovery_v1_api: '>=0.4.12'
- yaml: any