Bolisov / google-api-typings-generator

⚠️ This repo is no longer maintained and outdated, use active fork ⚠️
https://github.com/Maxim-Mazurok/google-api-typings-generator
8 stars 5 forks source link

DefinitelyTyped gapi.client.youtube has wrong structure #3

Open st3h3n opened 6 years ago

st3h3n commented 6 years ago

DefinitelyTyped gapi.client.youtube describes to access the Youtube API like e. g. gapi.client.channels.list... but that's not the actual structure. The correct way would be gapi.client.youtube.channels.list.... When gapi.client loads the Youtube API the resources get added to gapi.client.youtube not gapi.client.

ehahn9 commented 5 years ago

+1 this is true for all of the clients, including calendars, people, etc. - they're all one level "too high" in the hierarchy. Any update?

alexturpin commented 4 years ago

The issue is also documented here https://github.com/Bolisov/google-api-typings-generator/issues/2. Unfortunately, the resulting PR was closed before it could be merged https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21303#issuecomment-355133151.

Here is the workaround I'm using:

// gapi-youtube.d.ts file in my own project
declare namespace gapi.client.youtube {
    const activities: youtube.ActivitiesResource;
    const captions: youtube.CaptionsResource;
    const channelBanners: youtube.ChannelBannersResource;
    const channelSections: youtube.ChannelSectionsResource;
    const channels: youtube.ChannelsResource;
    const commentThreads: youtube.CommentThreadsResource;
    const comments: youtube.CommentsResource;
    const fanFundingEvents: youtube.FanFundingEventsResource;
    const guideCategories: youtube.GuideCategoriesResource;
    const i18nLanguages: youtube.I18nLanguagesResource;
    const i18nRegions: youtube.I18nRegionsResource;
    const liveBroadcasts: youtube.LiveBroadcastsResource;
    const liveChatBans: youtube.LiveChatBansResource;
    const liveChatMessages: youtube.LiveChatMessagesResource;
    const liveChatModerators: youtube.LiveChatModeratorsResource;
    const liveStreams: youtube.LiveStreamsResource;
    const playlistItems: youtube.PlaylistItemsResource;
    const playlists: youtube.PlaylistsResource;
    const search: youtube.SearchResource;
    const sponsors: youtube.SponsorsResource;
    const subscriptions: youtube.SubscriptionsResource;
    const superChatEvents: youtube.SuperChatEventsResource;
    const thumbnails: youtube.ThumbnailsResource;
    const videoAbuseReportReasons: youtube.VideoAbuseReportReasonsResource;
    const videoCategories: youtube.VideoCategoriesResource;
    const videos: youtube.VideosResource;
    const watermarks: youtube.WatermarksResource;
}
Maxim-Mazurok commented 4 years ago

This repo is abandoned, see #19 and use active fork instead: Maxim-Mazurok/google-api-typings-generator

Please, close this issue if you will, thanks for your cooperation!