public static async Task Login(string email, string password) { DiscordApiConfiguration config = new DiscordApiConfiguration { BaseUrl = "https://discordapp.com/api" }; BasicRestFactory basicRestFactory = new BasicRestFactory(config); ILoginService loginService = basicRestFactory.GetLoginService(); LoginRequest.Email = email; LoginRequest.Password = password; Loginresult = await loginService.Login(LoginRequest); Token = Loginresult.Token; IAuthenticator authenticator = new DiscordAuthenticator(Token); AuthenticatedRestFactory = new AuthenticatedRestFactory(config, authenticator); IGatewayConfigService gatewayService = basicRestFactory.GetGatewayConfigService(); SharedModels.GatewayConfig gateconfig = await gatewayService.GetGatewayConfig(); Gateway = new Gateway.Gateway(gateconfig, authenticator); }
public static void CreateGuild(string name) { API.Guild.Models.CreateGuild guild = new API.Guild.Models.CreateGuild(); guild.Name = name; IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); guildservice.CreateGuild(guild); }
public static void ModifyGuildMemberNickname(string guildId, string userId, string nickname) { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); guildservice.ModifyGuildMemberNickname(guildId, userId, new ModifyGuildMember() { Nick = nickname }); }
public static async Task AcceptInvite(string code) { try { IInviteService inviteservice = AuthenticatedRestFactory.GetInviteService(); await inviteservice.AcceptInvite(code); } catch { } }
public static void BlockUser(string userId) { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.BlockUser(userId).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static void DeleteMessage(string chnid, string msgid) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); channelservice.DeleteMessage(chnid, msgid).Wait(); } catch (Exception exception) { //App.NavigateToBugReport(exception); } }
public static async void AckGuild(string guildId) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); await guildservice.AckGuild(guildId); } catch (Exception exception) { //App.NavigateToBugReport(exception); } }
public static void DeleteGuild(string guildid) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); guildservice.DeleteGuild(guildid).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static async Task DeleteInvite(string channelId) { try { IInviteService channelservice = AuthenticatedRestFactory.GetInviteService(); var ch = await channelservice.DeleteInvite(channelId); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static void ModifyGuildRole(string guildId, string roleId, ModifyGuildRole newRole) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); guildservice.ModifyGuildRole(guildId, roleId, newRole).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static void ModifyGuildChannel(string chnId, ModifyChannel newChn) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); channelservice.ModifyChannel(chnId, newChn).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static async Task TriggerTypingIndicator(string channelId) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); await channelservice.TriggerTypingIndicator(channelId); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static async Task <Message> GetMessage(string chnid, string msgid) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); return(await channelservice.GetChannelMessage(chnid, msgid)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new SharedModels.Message()); }
public static async Task <IEnumerable <SharedModels.Message> > GetChannelPinnedMessages(string id) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); return(await channelservice.GetPinnedMessages(id)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task <IEnumerable <DirectMessageChannel> > GetDMs() { try { IUserService userService = AuthenticatedRestFactory.GetUserService(); return(await userService.GetCurrentUserDirectMessageChannels()); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task <User> GetUser(string userid) { try { IUserService userService = AuthenticatedRestFactory.GetUserService(); return(await userService.GetUser(userid)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new User()); }
public static async Task <UserProfile> GetUserProfile(string id) { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); return(await userservice.GetUserProfile(id)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new SharedModels.UserProfile()); }
public static async Task <IEnumerable <SharedModels.GuildMember> > GetGuildMembers(string id) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); return(await guildservice.ListGuildMemebers(id)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task <SharedModels.Guild> GetGuild(string id) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); return(await guildservice.GetGuild(id)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new SharedModels.Guild()); }
public static async Task <IEnumerable <SharedFriend> > GetUserRelationShips(string id) { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); return(await userservice.GetUserReleations(id)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task <User> GetCurrentUser() { try { IUserService userService = AuthenticatedRestFactory.GetUserService(); return(await userService.GetCurrentUser()); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(Storage.Cache.CurrentUser.Raw); }
public static async Task <IEnumerable <SharedModels.UserGuild> > GetGuilds() { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); return(await userservice.GetCurrentUserGuilds()); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task <IEnumerable <SharedModels.Message> > GetRecentMentions(int limit, bool ShowRoles, bool ShowEveryone) { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); return(await userservice.GetRecentMentions(limit, ShowRoles, ShowEveryone)); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task CreateMessage(string id, string text) { try { MessageUpsert message = new MessageUpsert(); message.Content = text; IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); await channelservice.CreateMessage(id, message); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static void AddNote(string userid, string note) { try { IUserService channelservice = AuthenticatedRestFactory.GetUserService(); channelservice.AddNote(userid, new Note() { note = note }).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static GuildMember GetGuildMember(string guildid, string userid) { try { IGuildService guildservice = AuthenticatedRestFactory.GetGuildService(); Task <GuildMember> memberTask = guildservice.GetGuildMemeber(guildid, userid); memberTask.Wait(); return(memberTask.Result); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new SharedModels.GuildMember()); }
public static SharedModels.GuildChannel GetGuildChannel(string id) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); Task <SharedModels.GuildChannel> channelTask = channelservice.GetGuildChannel(id); channelTask.Wait(); return(channelTask.Result); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(new SharedModels.GuildChannel()); }
public static async Task <IEnumerable <Invite> > GetChannelInvites(string channelId) { try { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); var ch = await channelservice.GetChannelInvites(channelId); return(ch); } catch (Exception exception) { App.NavigateToBugReport(exception); } return(null); }
public static async Task DeleteReactionAsync(string channelid, string messageid, string emoji) { try { await Task.Run(() => { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); channelservice.DeleteReaction(channelid, messageid, emoji).Wait(); }); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static async Task AckMessage(string chnId, string msgId) { try { await Task.Run(async() => { IChannelService channelservice = AuthenticatedRestFactory.GetChannelService(); await channelservice.AckMessage(chnId, msgId); }); } catch (Exception exception) { App.NavigateToBugReport(exception); } }