diff --git a/.gitignore b/.gitignore index 4feace7a6c..83aa6a97eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .timestamp .pyenv +gen/ *.go *.pyc **target/ diff --git a/Makefile b/Makefile index 3ac983cb4b..ad3427355b 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ help: $(info using template engine: '$(TPL)') $(info ) $(info Targets) + $(info apis - make all APIs) $(info cargo - run cargo on all APIs, use ARGS="args ..." to specify cargo arguments) $(info regen-apis - clear out all generated apis, and regenerate them) $(info clean-apis - delete all generated APIs) diff --git a/etc/api/shared.yaml b/etc/api/shared.yaml index 7c488a232d..2c05a969a5 100644 --- a/etc/api/shared.yaml +++ b/etc/api/shared.yaml @@ -9,13 +9,173 @@ directories: # all mako source files mako_src: src/mako api: + blacklist: + - groupsmigration + - licensing + - groupssettings + - translate + - pagespeedonline # no oauth2 + - gan # no oauth2 + - sqladmin # ERROR + - dataflow # ERROR + - civicinfo # no oauth2 + - webmasters # no oauth2 + - doubleclickbidmanager # no oauth2 + - freebase # ERROR + - spectrum # no oauth2 + - analytics # ERROR + - qpxexpress # no oauth2 + - discovery # no oauth2 + - identitytoolkit # no oauth2 + - audit # no oauth2 + - admin # ERROR + - webfonts # no oauth2 + - customsearch # no oauth2 list: - - name: youtube - version: v3 - - name: drive - version: v2 - - name: gmail - version: v1 + # use etc/bin/api_version_to_yaml.py to update with latest available versions + # It's a semi-automated process ... for now + adexchangebuyer: + - v1.2 + adexchangeseller: + - v1 + admin: + - directory_v1 + adsense: + - v1.2 + adsensehost: + - v4.1 + analytics: + - v2.4 + androidpublisher: + - v1 + appsactivity: + - v1 + appstate: + - v1 + audit: + - v1 + autoscaler: + - v1beta2 + bigquery: + - v2 + blogger: + - v2 + books: + - v1 + calendar: + - v3 + civicinfo: + - us_v1 + cloudlatencytest: + - v2 + cloudmonitoring: + - v2beta2 + compute: + - v1 + container: + - v1beta1 + content: + - v2 + coordinate: + - v1 + customsearch: + - v1 + dataflow: + - v1b4 + datastore: + - v1beta1 + deploymentmanager: + - v2beta1 + dfareporting: + - v1 + discovery: + - v1 + dns: + - v1beta1 + doubleclickbidmanager: + - v1 + doubleclicksearch: + - v2 + drive: + - v1 + fitness: + - v1 + freebase: + - v1 + games: + - v1 + gamesconfiguration: + - v1configuration + gamesmanagement: + - v1management + gan: + - v1beta1 + genomics: + - v1beta + gmail: + - v1 + groupsmigration: + - v1 + groupssettings: + - v1 + identitytoolkit: + - v3 + licensing: + - v1 + manager: + - v1beta2 + mapsengine: + - exp2 + mirror: + - v1 + oauth2: + - v1 + pagespeedonline: + - v1 + plus: + - v1 + plusdomains: + - v1 + prediction: + - v1.2 + pubsub: + - v1beta1 + qpxexpress: + - v1 + replicapool: + - v1beta1 + replicapoolupdater: + - v1beta1 + reseller: + - v1 + resourceviews: + - v1beta1 + siteverification: + - v1 + spectrum: + - v1explorer + sqladmin: + - v1beta1 + storage: + - v1 + tagmanager: + - v1 + taskqueue: + - v1beta1 + tasks: + - v1 + translate: + - v2 + urlshortener: + - v1 + webfonts: + - v1 + webmasters: + - v3 + youtube: + - v3 + youtubeanalytics: + - v1 base_path: "etc/api" terms: # how to actually do something with the API diff --git a/etc/bin/api_version_to_yaml.py b/etc/bin/api_version_to_yaml.py new file mode 100755 index 0000000000..7c0afc3840 --- /dev/null +++ b/etc/bin/api_version_to_yaml.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Generate yaml output suitable for use in shared.yaml +# + +import sys +import os +import yaml + +isfile = os.path.isfile +isdir = os.path.isdir +join = os.path.join + +if __name__ != '__main__': + raise AssertionError("Not for import") + +if len(sys.argv) != 2: + sys.stderr.write("USAGE: , i.e. etc/api\n") + sys.exit(1) + +api_base = sys.argv[1] +if not isdir(api_base): + raise ValueError("Directory '%s' not accessible" % api_base) + +yaml_path = join(api_base, 'shared.yaml') +if not isfile(yaml_path): + raise AssertionError("Didn't find yaml data at '%s'" % yaml_path) + +api_data = list(yaml.load_all(open(yaml_path, 'r')))[0]['api']['list'] +for api_name in sorted(os.listdir(api_base)): + api_path = join(api_base, api_name) + if not isdir(api_path): + continue + last_version = list(sorted(v for v in os.listdir(api_path) if isdir(join(api_path, v)))) + if not last_version: + continue + + versions = api_data.get('api_name', list()) + if last_version not in versions: + versions.append(last_version[0]) + api_data[api_name] = list(sorted(versions)) +# end for each item in api-base + +yaml.dump(dict(api=dict(list=api_data)), sys.stdout, default_flow_style=False) + + diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index bf7bd91707..e35061f83a 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -5072,7 +5072,7 @@ impl<'a, C, NC, A> ActivityMethodsBuilder<'a, C, NC, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.i18n_language().list("part") -/// .hl("eos") +/// .hl("sit") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -5435,10 +5435,10 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel_section().list("part") -/// .on_behalf_of_content_owner("sed") -/// .mine(false) -/// .id("ipsum") -/// .channel_id("eos") +/// .on_behalf_of_content_owner("et") +/// .mine(true) +/// .id("kasd") +/// .channel_id("accusam") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -5656,8 +5656,8 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel_section().insert(&req) -/// .on_behalf_of_content_owner_channel("duo") -/// .on_behalf_of_content_owner("sadipscing") +/// .on_behalf_of_content_owner_channel("takimata") +/// .on_behalf_of_content_owner("justo") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -5855,7 +5855,7 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel_section().delete("id") -/// .on_behalf_of_content_owner("consetetur") +/// .on_behalf_of_content_owner("erat") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -6029,7 +6029,7 @@ impl<'a, C, NC, A> ChannelSectionDeleteMethodBuilder<'a, C, NC, A> where NC: hyp /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel_section().update(&req) -/// .on_behalf_of_content_owner("ea") +/// .on_behalf_of_content_owner("labore") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -6224,9 +6224,9 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.guide_category().list("part") -/// .region_code("sanctus") -/// .id("invidunt") -/// .hl("et") +/// .region_code("nonumy") +/// .id("dolores") +/// .hl("gubergren") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -6429,8 +6429,8 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist().insert(&req) -/// .on_behalf_of_content_owner_channel("sit") -/// .on_behalf_of_content_owner("takimata") +/// .on_behalf_of_content_owner_channel("sadipscing") +/// .on_behalf_of_content_owner("aliquyam") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -6643,13 +6643,13 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist().list("part") -/// .page_token("consetetur") -/// .on_behalf_of_content_owner_channel("elitr") -/// .on_behalf_of_content_owner("sed") +/// .page_token("no") +/// .on_behalf_of_content_owner_channel("justo") +/// .on_behalf_of_content_owner("justo") /// .mine(true) -/// .max_result(60) -/// .id("clita") -/// .channel_id("sed") +/// .max_result(84) +/// .id("diam") +/// .channel_id("ipsum") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -6888,7 +6888,7 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist().delete("id") -/// .on_behalf_of_content_owner("labore") +/// .on_behalf_of_content_owner("et") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -7062,7 +7062,7 @@ impl<'a, C, NC, A> PlaylistDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist().update(&req) -/// .on_behalf_of_content_owner("kasd") +/// .on_behalf_of_content_owner("duo") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -7247,7 +7247,7 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // execute the final call using `upload(...)`. /// // Values shown here are possibly random and not representative ! /// let result = hub.thumbnail().set("videoId") -/// .on_behalf_of_content_owner("kasd") +/// .on_behalf_of_content_owner("sea") /// .upload(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); /// // TODO: show how to handle the result ! /// # } @@ -7452,16 +7452,16 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video().list("part") -/// .video_category_id("kasd") -/// .region_code("ea") -/// .page_token("rebum.") +/// .video_category_id("eos") +/// .region_code("erat") +/// .page_token("sadipscing") /// .on_behalf_of_content_owner("dolor") -/// .my_rating("sadipscing") -/// .max_result(10) -/// .locale("sed") -/// .id("et") -/// .hl("gubergren") -/// .chart("diam") +/// .my_rating("eirmod") +/// .max_result(58) +/// .locale("amet") +/// .id("no") +/// .hl("labore") +/// .chart("eirmod") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -7745,7 +7745,7 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video().rate("id", "rating") -/// .on_behalf_of_content_owner("sed") +/// .on_behalf_of_content_owner("aliquyam") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -7911,7 +7911,7 @@ impl<'a, C, NC, A> VideoRateMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video().get_rating("id") -/// .on_behalf_of_content_owner("aliquyam") +/// .on_behalf_of_content_owner("Lorem") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -8065,7 +8065,7 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video().delete("id") -/// .on_behalf_of_content_owner("amet.") +/// .on_behalf_of_content_owner("et") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -8259,7 +8259,7 @@ impl<'a, C, NC, A> VideoDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video().update(&req) -/// .on_behalf_of_content_owner("clita") +/// .on_behalf_of_content_owner("duo") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -8508,10 +8508,10 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// // Values shown here are possibly random and not representative ! /// let result = hub.video().insert(&req) /// .stabilize(true) -/// .on_behalf_of_content_owner_channel("amet") -/// .on_behalf_of_content_owner("accusam") +/// .on_behalf_of_content_owner_channel("eirmod") +/// .on_behalf_of_content_owner("sanctus") /// .notify_subscriber(true) -/// .auto_level(false) +/// .auto_level(true) /// .upload_resumable(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); /// // TODO: show how to handle the result ! /// # } @@ -8995,16 +8995,16 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subscription().list("part") -/// .page_token("est") -/// .order("sit") -/// .on_behalf_of_content_owner_channel("ipsum") -/// .on_behalf_of_content_owner("erat") -/// .my_subscriber(false) +/// .page_token("consetetur") +/// .order("ut") +/// .on_behalf_of_content_owner_channel("ea") +/// .on_behalf_of_content_owner("sed") +/// .my_subscriber(true) /// .mine(true) -/// .max_result(40) -/// .id("voluptua.") -/// .for_channel_id("dolor") -/// .channel_id("amet") +/// .max_result(53) +/// .id("et") +/// .for_channel_id("consetetur") +/// .channel_id("amet.") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -9430,35 +9430,35 @@ impl<'a, C, NC, A> SubscriptionDeleteMethodBuilder<'a, C, NC, A> where NC: hyper /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.search().list("part") -/// .video_type("dolores") -/// .video_syndicated("diam") -/// .video_license("Lorem") -/// .video_embeddable("kasd") -/// .video_duration("elitr") -/// .video_dimension("At") -/// .video_definition("sit") -/// .video_category_id("clita") -/// .video_caption("sanctus") -/// .type_("dolor") -/// .topic_id("diam") -/// .safe_search("voluptua.") -/// .relevance_language("diam") -/// .related_to_video_id("nonumy") -/// .region_code("dolor") -/// .q("nonumy") -/// .published_before("sit") -/// .published_after("sed") -/// .page_token("ipsum") -/// .order("sed") -/// .on_behalf_of_content_owner("At") -/// .max_result(17) -/// .location_radiu("ea") -/// .location("ut") +/// .video_type("gubergren") +/// .video_syndicated("justo") +/// .video_license("sit") +/// .video_embeddable("vero") +/// .video_duration("diam") +/// .video_dimension("rebum.") +/// .video_definition("consetetur") +/// .video_category_id("sadipscing") +/// .video_caption("vero") +/// .type_("sadipscing") +/// .topic_id("invidunt") +/// .safe_search("consetetur") +/// .relevance_language("dolore") +/// .related_to_video_id("duo") +/// .region_code("aliquyam") +/// .q("Lorem") +/// .published_before("et") +/// .published_after("clita") +/// .page_token("consetetur") +/// .order("takimata") +/// .on_behalf_of_content_owner("nonumy") +/// .max_result(88) +/// .location_radiu("sanctus") +/// .location("takimata") /// .for_mine(true) -/// .for_content_owner(true) -/// .event_type("et") -/// .channel_type("ipsum") -/// .channel_id("eos") +/// .for_content_owner(false) +/// .event_type("invidunt") +/// .channel_type("ea") +/// .channel_id("sadipscing") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -9970,7 +9970,7 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.i18n_region().list("part") -/// .hl("ut") +/// .hl("dolore") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -10142,14 +10142,14 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// req.statu = Default::default(); // is LiveStreamStatus /// req.snippet = Default::default(); // is LiveStreamSnippet /// req.cdn = Default::default(); // is CdnSettings -/// req.id = Some("et".to_string()); +/// req.id = Some("nonumy".to_string()); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_stream().update(&req) -/// .on_behalf_of_content_owner_channel("elitr") -/// .on_behalf_of_content_owner("est") +/// .on_behalf_of_content_owner_channel("sed") +/// .on_behalf_of_content_owner("aliquyam") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -10353,8 +10353,8 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_stream().delete("id") -/// .on_behalf_of_content_owner_channel("justo") -/// .on_behalf_of_content_owner("et") +/// .on_behalf_of_content_owner_channel("eirmod") +/// .on_behalf_of_content_owner("consetetur") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -10538,12 +10538,12 @@ impl<'a, C, NC, A> LiveStreamDeleteMethodBuilder<'a, C, NC, A> where NC: hyper:: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_stream().list("part") -/// .page_token("et") -/// .on_behalf_of_content_owner_channel("gubergren") -/// .on_behalf_of_content_owner("est") -/// .mine(true) -/// .max_result(78) -/// .id("invidunt") +/// .page_token("sed") +/// .on_behalf_of_content_owner_channel("ea") +/// .on_behalf_of_content_owner("gubergren") +/// .mine(false) +/// .max_result(77) +/// .id("tempor") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -10783,14 +10783,14 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// req.statu = Default::default(); // is LiveStreamStatus /// req.snippet = Default::default(); // is LiveStreamSnippet /// req.cdn = Default::default(); // is CdnSettings -/// req.id = Some("dolore".to_string()); +/// req.id = Some("sea".to_string()); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_stream().insert(&req) -/// .on_behalf_of_content_owner_channel("accusam") -/// .on_behalf_of_content_owner("elitr") +/// .on_behalf_of_content_owner_channel("labore") +/// .on_behalf_of_content_owner("ipsum") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -11006,13 +11006,13 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: /// // Values shown here are possibly random and not representative ! /// let mut req: Channel = Default::default(); /// req.invideo_promotion = Default::default(); // is InvideoPromotion -/// req.id = Some("invidunt".to_string()); +/// req.id = Some("aliquyam".to_string()); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel().update(&req) -/// .on_behalf_of_content_owner("dolor") +/// .on_behalf_of_content_owner("dolores") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -11212,15 +11212,15 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.channel().list("part") -/// .page_token("sit") -/// .on_behalf_of_content_owner("justo") +/// .page_token("diam") +/// .on_behalf_of_content_owner("ut") /// .my_subscriber(false) -/// .mine(false) -/// .max_result(49) +/// .mine(true) +/// .max_result(55) /// .managed_by_me(true) -/// .id("diam") -/// .for_username("ipsum") -/// .category_id("voluptua.") +/// .id("clita") +/// .for_username("diam") +/// .category_id("justo") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -11633,12 +11633,12 @@ impl<'a, C, NC, A> PlaylistItemDeleteMethodBuilder<'a, C, NC, A> where NC: hyper /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist_item().list("part") -/// .video_id("et") -/// .playlist_id("sadipscing") -/// .page_token("At") -/// .on_behalf_of_content_owner("et") -/// .max_result(25) -/// .id("sanctus") +/// .video_id("invidunt") +/// .playlist_id("ut") +/// .page_token("dolores") +/// .on_behalf_of_content_owner("eos") +/// .max_result(23) +/// .id("duo") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -11883,7 +11883,7 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlist_item().insert(&req) -/// .on_behalf_of_content_owner("duo") +/// .on_behalf_of_content_owner("sed") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -12267,7 +12267,7 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper /// // execute the final call using `upload(...)`. /// // Values shown here are possibly random and not representative ! /// let result = hub.watermark().set(&req, "channelId") -/// .on_behalf_of_content_owner("sanctus") +/// .on_behalf_of_content_owner("ea") /// .upload(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); /// // TODO: show how to handle the result ! /// # } @@ -12458,7 +12458,7 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.watermark().unset("channelId") -/// .on_behalf_of_content_owner("justo") +/// .on_behalf_of_content_owner("et") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -12621,10 +12621,10 @@ impl<'a, C, NC, A> WatermarkUnsetMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().control("id", "part") -/// .walltime("Stet") -/// .on_behalf_of_content_owner_channel("et") -/// .on_behalf_of_content_owner("amet.") -/// .offset_time_m("ea") +/// .walltime("kasd") +/// .on_behalf_of_content_owner_channel("invidunt") +/// .on_behalf_of_content_owner("rebum.") +/// .offset_time_m("Lorem") /// .display_slate(false) /// .doit(); /// // TODO: show how to handle the result ! @@ -12869,14 +12869,14 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp /// req.statu = Default::default(); // is LiveBroadcastStatus /// req.snippet = Default::default(); // is LiveBroadcastSnippet /// req.content_detail = Default::default(); // is LiveBroadcastContentDetails -/// req.id = Some("sit".to_string()); +/// req.id = Some("invidunt".to_string()); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().update(&req) -/// .on_behalf_of_content_owner_channel("ipsum") -/// .on_behalf_of_content_owner("est") +/// .on_behalf_of_content_owner_channel("eirmod") +/// .on_behalf_of_content_owner("At") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -13095,14 +13095,14 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype /// req.statu = Default::default(); // is LiveBroadcastStatus /// req.snippet = Default::default(); // is LiveBroadcastSnippet /// req.content_detail = Default::default(); // is LiveBroadcastContentDetails -/// req.id = Some("et".to_string()); +/// req.id = Some("consetetur".to_string()); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().insert(&req) -/// .on_behalf_of_content_owner_channel("diam") -/// .on_behalf_of_content_owner("dolores") +/// .on_behalf_of_content_owner_channel("et") +/// .on_behalf_of_content_owner("sed") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -13315,9 +13315,9 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().bind("id", "part") -/// .stream_id("erat") -/// .on_behalf_of_content_owner_channel("erat") -/// .on_behalf_of_content_owner("invidunt") +/// .stream_id("elitr") +/// .on_behalf_of_content_owner_channel("nonumy") +/// .on_behalf_of_content_owner("rebum.") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -13532,13 +13532,13 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().list("part") -/// .page_token("justo") -/// .on_behalf_of_content_owner_channel("clita") -/// .on_behalf_of_content_owner("clita") +/// .page_token("Lorem") +/// .on_behalf_of_content_owner_channel("diam") +/// .on_behalf_of_content_owner("ut") /// .mine(true) -/// .max_result(75) -/// .id("magna") -/// .broadcast_statu("sanctus") +/// .max_result(50) +/// .id("ipsum") +/// .broadcast_statu("ut") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -13775,8 +13775,8 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().delete("id") -/// .on_behalf_of_content_owner_channel("clita") -/// .on_behalf_of_content_owner("ipsum") +/// .on_behalf_of_content_owner_channel("sea") +/// .on_behalf_of_content_owner("ut") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -13957,8 +13957,8 @@ impl<'a, C, NC, A> LiveBroadcastDeleteMethodBuilder<'a, C, NC, A> where NC: hype /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.live_broadcast().transition("broadcastStatus", "id", "part") -/// .on_behalf_of_content_owner_channel("et") -/// .on_behalf_of_content_owner("dolor") +/// .on_behalf_of_content_owner_channel("dolor") +/// .on_behalf_of_content_owner("et") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -14172,9 +14172,9 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.video_category().list("part") -/// .region_code("invidunt") -/// .id("aliquyam") -/// .hl("clita") +/// .region_code("vero") +/// .id("ut") +/// .hl("sed") /// .doit(); /// // TODO: show how to handle the result ! /// # } @@ -14368,14 +14368,14 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.activity().list("part") -/// .region_code("sanctus") -/// .published_before("no") -/// .published_after("sit") -/// .page_token("consetetur") +/// .region_code("ipsum") +/// .published_before("justo") +/// .published_after("dolore") +/// .page_token("vero") /// .mine(false) -/// .max_result(48) +/// .max_result(43) /// .home(true) -/// .channel_id("amet") +/// .channel_id("nonumy") /// .doit(); /// // TODO: show how to handle the result ! /// # } diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 90b9841fc6..de2d05f4d2 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -3,31 +3,36 @@ # DO NOT EDIT ! <%api_info=[]%>\ -% for a in api.list: +% for an, versions in api.list.iteritems(): +% if an in api.blacklist: +<% continue %>\ +% endif +% for version in versions: <% import util - gen_root = directories.output + '/' + a.name + util.to_api_version(a.version) + gen_root = directories.output + '/' + an + util.to_api_version(version) gen_root_stamp = gen_root + '/.timestamp' - api_name = util.library_name(a.name, a.version) + api_name = util.library_name(an, version) api_common = gen_root + '/src/cmn.rs' api_clean = api_name + '-clean' api_cargo = api_name + '-cargo' # source, destination of individual output files sds = [(directories.mako_src + '/' + i.source + '.mako', gen_root + '/' + i.get('output_dir', '') + '/' + i.source) for i in api.templates] - api_json = directories.api_base + '/' + a.name + '/' + a.version + '/' + a.name + '-api.json' + api_json = directories.api_base + '/' + an + '/' + version + '/' + an + '-api.json' api_json_inputs = api_json + " $(API_SHARED_INFO)" api_info.append((api_name, api_clean, api_cargo, gen_root)) space_join = lambda i: ' '.join(a[i] for a in api_info) %>\ -${api_common}: $(RUST_SRC)/cmn.rs $(lastword $(MAKEFILE_LIST)) +${api_common}: $(RUST_SRC)/cmn.rs $(lastword $(MAKEFILE_LIST)) ${gen_root_stamp} @ echo "// COPY OF '$<'" > $@ @ echo "// DO NOT EDIT" >> $@ @cat $< >> $@ ${gen_root_stamp}: ${' '.join(i[0] for i in sds)} ${api_json_inputs} $(MAKO_LIB_FILES) $(MAKO_RENDER) - PYTHONPATH=$(MAKO_LIB_DIR) $(TPL) --template-dir '.' --var OUTPUT_DIR=$@ -io ${' '.join("%s=%s" % (s, d) for s, d in sds)} --data-files ${api_json_inputs} + @echo Generating ${api_name} + @PYTHONPATH=$(MAKO_LIB_DIR) $(TPL) --template-dir '.' --var OUTPUT_DIR=$@ -io ${' '.join("%s=%s" % (s, d) for s, d in sds)} --data-files ${api_json_inputs} @touch $@ ${api_name}: ${gen_root_stamp} ${api_common} @@ -38,6 +43,7 @@ ${api_cargo}: ${api_name} ${api_clean}: -rm -Rf ${gen_root} % endfor +% endfor .PHONY += $(.PHONY) help-api clean-apis apis ${space_join(0)} ${space_join(1)} ${space_join(2)} diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index dd1d45c2d2..be233c0cb8 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -3,7 +3,7 @@ import os from random import (randint, random, choice, seed) import collections -seed(7337) +seed(1337) re_linestart = re.compile('^', flags=re.MULTILINE) re_first_4_spaces = re.compile('^ {1,4}', flags=re.MULTILINE) @@ -17,6 +17,7 @@ TYPE_MAP = {'boolean' : 'bool', 'double' : 'f64', 'float' : 'f32', 'int32' : 'i32', + 'any' : 'String', # TODO: Figure out how to handle it. It's 'interface' in Go ... 'int64' : 'i64', 'uint64' : 'u64', 'array' : 'Vec', @@ -483,7 +484,7 @@ def method_media_params(m): res = list() for pn, proto in mu.protocols.iteritems(): # the pi (proto-info) dict can be shown to the user - pi = {'multipart': proto.multipart and 'yes' or 'no', 'maxSize': mu.maxSize, 'validMimeTypes': mu.accept} + pi = {'multipart': proto.multipart and 'yes' or 'no', 'maxSize': mu.get('maxSize', '0kb'), 'validMimeTypes': mu.accept} try: ti = type(m)(PROTOCOL_TYPE_INFO[pn]) except KeyError: @@ -493,7 +494,7 @@ def method_media_params(m): 'path': proto.path, 'type': ti, 'description': ti.description, - 'max_size': size_to_bytes(mu.maxSize)}) + 'max_size': size_to_bytes(mu.get('maxSize', '0kb'))}) res.append(p) # end for each proto @@ -581,8 +582,10 @@ def new_context(resources): # Expects v to be 'v\d+', throws otherwise def to_api_version(v): - assert len(v) >= 2 and v[0] == 'v' - return v[1:].replace('.', 'p') + assert len(v) >= 2 + if v.startswith('v'): + v = v[1:] + return v.replace('.', 'p') # build a full library name (non-canonical) def library_name(name, version):