From ba98bee62fa2e067e9bc18f6f52db8be1da35161 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 3 Mar 2015 08:06:37 +0100 Subject: [PATCH] feat(lookup): LUTs and context to make better docs Now a context is passed to utility functions, which contains the state these may be interested in. This keeps it clean from global state. With the lookup tables, it is possible to figure out relations between types and document them accordingly. --- gen/youtube3/README.md | 3 + gen/youtube3/src/lib.rs | 483 +++++++++++++++++++++++++++++++++++++++ src/mako/lib.rs.mako | 22 +- src/mako/lib/lib.mako | 3 + src/mako/lib/schema.mako | 17 +- src/mako/lib/util.py | 81 ++++++- 6 files changed, 589 insertions(+), 20 deletions(-) diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 03ea76a32e..9a82a80649 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -3,6 +3,9 @@ The `youtube3` library allows access to all features of *YouTube*. TODO: Library level fully fledged documentation, incuding **summary** and **usage**. And another line, for testing +# Activities + + # License The **youtube3** library was generated by Sebastian Thiel, and is placed under the *MIT* license. diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index f878648237..8066550b27 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -1,6 +1,9 @@ //! TODO: Library level fully fledged documentation, incuding **summary** and **usage**. //! And another line, for testing //! +//! # Activities +//! +//! #![allow(non_snake_case)] extern crate cmn; @@ -9,7 +12,13 @@ extern crate "yup-oauth2" as oauth2; use std::collections::HashMap; +// ############ +// SCHEMAS ### +// ########## /// There is no detailed description. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoConversionPings { /// Pings that the app shall fire for a video (authenticated by biscotti cookie). Each ping has a context, in which the app must fire the ping, and a url identifying the ping. @@ -17,6 +26,12 @@ pub struct VideoConversionPings { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.subscriptions.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct SubscriptionListResponse { /// Serialized EventId of the request which produced this response. @@ -40,6 +55,9 @@ pub struct SubscriptionListResponse { } /// Information about a resource that received a positive (like) rating. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetailsLike { /// The resourceId object contains information that identifies the rated resource. @@ -47,6 +65,9 @@ pub struct ActivityContentDetailsLike { } /// There is no detailed description. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct LiveBroadcastSnippet { /// The date and time that the broadcast actually ended. This information is only available once the broadcast's state is complete. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. @@ -70,6 +91,9 @@ pub struct LiveBroadcastSnippet { } /// Describes original video file properties, including technical details about audio and video streams, but also metadata information like content length, digitization time, or geotagging information. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoFileDetails { /// The uploaded video file's combined (video and audio) bitrate in bits per second. @@ -98,6 +122,9 @@ pub struct VideoFileDetails { } /// Playlist localization setting +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistLocalization { /// The localized strings for playlist's description. @@ -116,6 +143,13 @@ pub struct PlaylistLocalization { /// - watch later To be more specific, these lists are associated with a channel, which is a collection of a person, group, or company's videos, playlists, and other YouTube information. You can retrieve the playlist IDs for each of these lists from the channel resource for a given channel. /// /// You can then use the playlistItems.list method to retrieve any of those lists. You can also add or remove items from those lists by calling the playlistItems.insert and playlistItems.delete methods. +/// +/// # Activities +/// +/// * youtube.playlists.insert +/// * youtube.playlists.update +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct Playlist { /// The status object contains status information for the playlist. @@ -137,6 +171,12 @@ pub struct Playlist { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.playlistItems.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistItemListResponse { /// Serialized EventId of the request which produced this response. @@ -160,6 +200,9 @@ pub struct PlaylistItemListResponse { } /// A pair Property / Value. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PropertyValue { /// A property. @@ -169,6 +212,9 @@ pub struct PropertyValue { } /// Describes a temporal position of a visual widget inside a video. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct InvideoTiming { /// Defines the time at which the promotion will appear. Depending on the value of type the value of the offsetMs field will represent a time offset from the start or from the end of the video, expressed in milliseconds. @@ -180,6 +226,9 @@ pub struct InvideoTiming { } /// Basic details about a playlist, including title, description and thumbnails. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistSnippet { /// The playlist's description. @@ -203,6 +252,9 @@ pub struct PlaylistSnippet { } /// The auditDetails object encapsulates channel data that is relevant for YouTube Partners during the audit process. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelAuditDetails { /// Whether or not the channel has any copyright strikes. @@ -216,6 +268,13 @@ pub struct ChannelAuditDetails { } /// A live stream describes a live ingestion point. +/// +/// # Activities +/// +/// * youtube.liveStreams.update +/// * youtube.liveStreams.insert +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct LiveStream { /// The status object contains information about live stream's status. @@ -235,6 +294,12 @@ pub struct LiveStream { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.thumbnails.set +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ThumbnailSetResponse { /// Serialized EventId of the request which produced this response. @@ -250,6 +315,9 @@ pub struct ThumbnailSetResponse { } /// Information about the uploaded video. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetailsUpload { /// The ID that YouTube uses to uniquely identify the uploaded video. @@ -257,6 +325,9 @@ pub struct ActivityContentDetailsUpload { } /// Branding properties for the channel view. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelSettings { /// Specifies the channel description. @@ -288,6 +359,9 @@ pub struct ChannelSettings { } /// Statistics about the video, such as the number of times the video was viewed or liked. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoStatistics { /// The number of comments for the video. @@ -303,6 +377,9 @@ pub struct VideoStatistics { } /// Brief description of the live stream cdn settings. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct CdnSettings { /// The format of the video stream that you are sending to Youtube. @@ -314,6 +391,12 @@ pub struct CdnSettings { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.videos.getRating +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoGetRatingResponse { /// Serialized EventId of the request which produced this response. @@ -329,6 +412,9 @@ pub struct VideoGetRatingResponse { } /// Basic details about a video category, such as its localized title. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoCategorySnippet { /// no description provided @@ -340,6 +426,9 @@ pub struct VideoCategorySnippet { } /// Details about a resource which was added to a channel. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetailsChannelItem { /// The resourceId object contains information that identifies the resource that was added to the channel. @@ -347,6 +436,9 @@ pub struct ActivityContentDetailsChannelItem { } /// Basic details about an i18n language, such as language code and human-readable name. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct I18nLanguageSnippet { /// The human-readable name of the language in the language itself. @@ -356,6 +448,9 @@ pub struct I18nLanguageSnippet { } /// Basic details about a subscription, including title, description and thumbnails of the subscribed item. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct SubscriptionSnippet { /// A map of thumbnail images associated with the video. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. @@ -375,6 +470,9 @@ pub struct SubscriptionSnippet { } /// Details about a channelsection, including playlists and channels. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelSectionContentDetails { /// The channel ids for type multiple_channels. @@ -384,6 +482,12 @@ pub struct ChannelSectionContentDetails { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.i18nRegions.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct I18nRegionListResponse { /// Serialized EventId of the request which produced this response. @@ -399,6 +503,12 @@ pub struct I18nRegionListResponse { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.liveStreams.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct LiveStreamListResponse { /// Serialized EventId of the request which produced this response. @@ -422,6 +532,9 @@ pub struct LiveStreamListResponse { } /// Describes a single promoted item. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PromotedItem { /// The temporal position within the video where the promoted item will be displayed. If present, it overrides the default timing. @@ -435,6 +548,9 @@ pub struct PromotedItem { } /// Branding properties of a YouTube channel. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelBrandingSettings { /// Branding properties for branding images. @@ -448,6 +564,12 @@ pub struct ChannelBrandingSettings { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.playlists.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistListResponse { /// Serialized EventId of the request which produced this response. @@ -471,6 +593,12 @@ pub struct PlaylistListResponse { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.watermarks.set +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct InvideoBranding { /// no description provided @@ -486,6 +614,9 @@ pub struct InvideoBranding { } /// Information about the playlist item's privacy status. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistItemStatus { /// This resource's privacy status. @@ -493,6 +624,9 @@ pub struct PlaylistItemStatus { } /// Pings that the app shall fire (authenticated by biscotti cookie). Each ping has a context, in which the app must fire the ping, and a url identifying the ping. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelConversionPing { /// Defines the context of the ping. @@ -502,6 +636,9 @@ pub struct ChannelConversionPing { } /// Describes an invideo promotion campaign consisting of multiple promoted items. A campaign belongs to a single channel_id. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct InvideoPromotion { /// The default temporal position within the video where the promoted item will be displayed. Can be overriden by more specific timing in the item. @@ -524,6 +661,13 @@ pub struct InvideoPromotion { /// - watch later To be more specific, these lists are associated with a channel, which is a collection of a person, group, or company's videos, playlists, and other YouTube information. /// /// You can retrieve the playlist IDs for each of these lists from the channel resource for a given channel. You can then use the playlistItems.list method to retrieve any of those lists. You can also add or remove items from those lists by calling the playlistItems.insert and playlistItems.delete methods. For example, if a user gives a positive rating to a video, you would insert that video into the liked videos playlist for that user's channel. +/// +/// # Activities +/// +/// * youtube.playlistItems.insert +/// * youtube.playlistItems.update +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistItem { /// The status object contains information about the playlist item's privacy status. @@ -541,6 +685,12 @@ pub struct PlaylistItem { } /// There is no detailed description. +/// +/// # Activities +/// +/// * youtube.guideCategories.list +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct GuideCategoryListResponse { /// Serialized EventId of the request which produced this response. @@ -564,6 +714,9 @@ pub struct GuideCategoryListResponse { } /// Localized versions of certain video properties (e.g. title). +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoLocalization { /// Localized version of the video's description. @@ -573,6 +726,9 @@ pub struct VideoLocalization { } /// Basic details about a channel section, including title, style and position. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelSectionSnippet { /// The style of the channel section. @@ -592,6 +748,9 @@ pub struct ChannelSectionSnippet { } /// Details about the content of a channel. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelContentDetails { /// no description provided @@ -601,10 +760,16 @@ pub struct ChannelContentDetails { } /// Stub token pagination template to suppress results. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct TokenPagination; /// There is no detailed description. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct PlaylistItemContentDetails { /// A user-generated note for this item. @@ -618,6 +783,9 @@ pub struct PlaylistItemContentDetails { } /// Internal representation of thumbnails for a YouTube resource. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ThumbnailDetails { /// The default image for this resource. @@ -633,6 +801,9 @@ pub struct ThumbnailDetails { } /// Details about monetization of a YouTube Video. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoMonetizationDetails { /// The value of access indicates whether the video can be monetized or not. @@ -640,6 +811,9 @@ pub struct VideoMonetizationDetails { } /// Information that identifies the recommended resource. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetailsRecommendation { /// The resourceId object contains information that identifies the recommended resource. @@ -651,6 +825,9 @@ pub struct ActivityContentDetailsRecommendation { } /// Recording information associated with the video. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoRecordingDetails { /// The date and time when the video was recorded. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sssZ) format. @@ -662,6 +839,9 @@ pub struct VideoRecordingDetails { } /// Information about a channel that a user subscribed to. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetailsSubscription { /// The resourceId object contains information that identifies the resource that the user subscribed to. @@ -669,6 +849,9 @@ pub struct ActivityContentDetailsSubscription { } /// The conversionPings object encapsulates information about conversion pings that need to be respected by the channel. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelConversionPings { /// Pings that the app shall fire (authenticated by biscotti cookie). Each ping has a context, in which the app must fire the ping, and a url identifying the ping. @@ -676,6 +859,9 @@ pub struct ChannelConversionPings { } /// Details about the content of an activity: the video that was shared, the channel that was subscribed to, etc. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ActivityContentDetails { /// The comment object contains information about a resource that received a comment. This property is only present if the snippet.type is comment. @@ -703,6 +889,9 @@ pub struct ActivityContentDetails { } /// A i18nRegion resource identifies a region where YouTube is available. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct I18nRegion { /// The snippet object contains basic details about the i18n region, such as region code and human-readable name. @@ -716,6 +905,9 @@ pub struct I18nRegion { } /// The contentOwnerDetails object encapsulates channel data that is relevant for YouTube Partners linked with the channel. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct ChannelContentOwnerDetails { /// The ID of the content owner linked to the channel. @@ -725,6 +917,9 @@ pub struct ChannelContentOwnerDetails { } /// Describes processing status and progress and availability of some other Video resource parts. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoProcessingDetails { /// This value indicates whether file details are available for the uploaded video. You can retrieve a video's file details by requesting the fileDetails part in your videos.list() request. @@ -746,6 +941,9 @@ pub struct VideoProcessingDetails { } /// There is no detailed description. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct LiveBroadcastStatus { /// The broadcast's recording status. @@ -759,6 +957,9 @@ pub struct LiveBroadcastStatus { } /// Details about the content to witch a subscription refers. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct SubscriptionContentDetails { /// The number of new items in the subscription since its content was last read. @@ -770,6 +971,13 @@ pub struct SubscriptionContentDetails { } /// A video resource represents a YouTube video. +/// +/// # Activities +/// +/// * youtube.videos.insert +/// * youtube.videos.update +/// +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct Video { /// The status object contains information about the video's uploading, processing, and privacy statuses. @@ -815,6 +1023,9 @@ pub struct Video { } /// Geographical coordinates of a point, in WGS84. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct GeoPoint { /// Latitude in degrees. @@ -826,6 +1037,9 @@ pub struct GeoPoint { } /// There is no detailed description. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoAgeGating { /// Age-restricted trailers. For redband trailers and adult-rated video-games. Only users aged 18+ can view the content. The the field is true the content is restricted to viewers aged 18+. Otherwise The field won't be present. @@ -837,6 +1051,9 @@ pub struct VideoAgeGating { } /// Player to be used for a video playback. +/// +/// This schema type is not used in any activity, and only used as *part* of another schema. +/// #[derive(RustcEncodable, RustcDecodable, Default, Clone)] pub struct VideoPlayer { /// An