Beispiel #1
0
        // Channels
        public static async Task <RestSelfChannel> GetCurrentChannelAsync(BaseTwitchClient client, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetMyChannelAsync(options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestSelfChannel.Create(client, model));
            }
            return(null);
        }
Beispiel #2
0
        public static async Task <RestSelfChannel> GetSelfChannelAsync(BaseRestClient client, ulong channelId)
        {
            if (!TokenHelper.TryGetToken(client, channelId, out RestTokenInfo info))
            {
                throw new MissingScopeException("channel_read");
            }
            if (!info.Authorization.Scopes.Contains("channel_read"))
            {
                throw new MissingScopeException("channel_read");
            }

            var model = await client.RestClient.GetSelfChannelInternalAsync(info.Token);

            return(RestSelfChannel.Create(client, model));
        }