From 4603769ca6fb33877dd15eedf5ea3dd1fbcdb152 Mon Sep 17 00:00:00 2001 From: Guy Taylor Date: Thu, 27 Sep 2018 16:40:40 +0100 Subject: [PATCH] chore(manually_added): Add support for adding unlisted APIs The photoslibrary API is not listed however is still available. This adds a method of manually adding APIs to the shared.yaml and adds the photoslibary API info. Fixes #198 --- etc/api/shared.yaml | 4 ++++ src/mako/deps.mako | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index ce378d207c..0704c08239 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -29,6 +29,10 @@ api: - slides # invalid code generation - syntax error - poly + manually_added: + - name: photoslibrary + version: v1 + discovery_rest_url: https://photoslibrary.googleapis.com/$discovery/rest?version=v1 terms: # how to actually do something with the API action: doit diff --git a/src/mako/deps.mako b/src/mako/deps.mako index ca78b2db18..673c046fa5 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -22,6 +22,14 @@ discovery_url = 'https://www.googleapis.com/discovery/v1/' apis = json.loads(urllib2.urlopen(discovery_url + "apis").read()) + + for manualy_api in api.get('manually_added', list()): + apis['items'].append({ + 'name': manualy_api['name'], + 'version': manualy_api['version'], + 'discoveryRestUrl': manualy_api['discovery_rest_url'] + }) + json_api_targets = [] suffix = make.target_suffix