public static async Task <ChatClient> CreateFromChannel(MixerClient client, ChannelModel channel) { Validator.ValidateVariable(client, "client"); Validator.ValidateVariable(channel, "channel"); UserModel user = await client.Users.GetCurrentUser(); ChannelChatModel chat = await client.Chats.GetChat(channel); return(new ChatClient(channel, user, chat)); }
public static async Task <MixerClient> ConnectViaShortCode(string clientID, IEnumerable <ClientScopeEnum> scopes, Action <string> codeCallback) { Validator.ValidateString(clientID, "clientID"); Validator.ValidateList(scopes, "scopes"); Validator.ValidateVariable(codeCallback, "codeCallback"); ShortCode shortCode = await AuthorizationToken.GenerateShortCode(clientID, scopes); codeCallback(shortCode.code); string authorizationCode = await AuthorizationToken.ValidateShortCode(shortCode); if (authorizationCode != null) { return(await MixerClient.ConnectViaAuthorizationCode(clientID, authorizationCode)); } return(null); }