public static void BlockUser(string userId) { try { IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.BlockUser(userId).Wait(); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
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 <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 <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 <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 <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 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 async void ChangeCurrentGame(string game) { try { await Task.Run(() => { IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.UpdateGame("{\"name\":\"" + game + "\"}").Wait(); }); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static void ModifyCurrentUser(string newUsername) { try { ModifyUser modifyuser = new ModifyUser(); modifyuser.Username = newUsername; IUserService userService = AuthenticatedRestFactory.GetUserService(); Task <SharedModels.User> userTask = userService.ModifyCurrentUser(modifyuser); userTask.Wait(); Storage.Cache.CurrentUser = new CacheModels.User(userTask.Result); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
public static async void ChangeUserSettings(string settings) { try { await Task.Run(() => { Gateway.UpdateStatus(settings, 0, null); IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.UpdateSettings("{\"status\":\"" + settings + "\"}").Wait(); }); } catch (Exception exception) { App.NavigateToBugReport(exception); } }
private Task <bool> Login() { Messenger.Default.Send(new ConnectionStatusMessage(ConnectionStatus.Connecting)); IAuthenticator authenticator = new DiscordAuthenticator(_accessToken); AuthenticatedRestFactory authenticatedRestFactory = new AuthenticatedRestFactory(new DiscordApiConfiguration() { BaseUrl = "https://discordapp.com/api" }, authenticator); ActivitesService = authenticatedRestFactory.GetActivitesService(); ChannelService = authenticatedRestFactory.GetChannelService(); ConnectionsService = authenticatedRestFactory.GetConnectionService(); GameService = authenticatedRestFactory.GetGameService(); GuildService = authenticatedRestFactory.GetGuildService(); InviteService = authenticatedRestFactory.GetInviteService(); MiscService = authenticatedRestFactory.GetMiscService(); UserService = authenticatedRestFactory.GetUserService(); VoiceService = authenticatedRestFactory.GetVoiceService(); return(_gatewayService.InitializeGateway(_accessToken)); }
public static void CreateDM(CreateDM createDM) { IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.CreateDirectMessageChannelForCurrentUser(createDM).Wait(); }
public static void LeaveServer(string guildId) { IUserService userservice = AuthenticatedRestFactory.GetUserService(); userservice.LeaveGuild(guildId).Wait(); }