Exemplo n.º 1
0
        internal new static RestSelfChannel Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestSelfChannel(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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));
        }