public async Task Logout(UserModel user) { using (var client = await restClient.CreateAuthenticatedClient()) { var result = await client.PostAsync(Endpoints.Auth.LOGOUT, restClient.SerializeToJson(user)); user = await restClient.ReadJsonResponse <UserModel>(result); } }
public async Task <Stream> DownloadUserData() { using (var client = await restClient.CreateAuthenticatedClient()) { var result = await client.GetAsync($"{Endpoints.API}User/downloaduserdata"); result.EnsureSuccessStatusCode(); var content = await result.Content.ReadAsStreamAsync(); return(content); } }
public async Task <bool> GetEnableBackups() { var definition = new { EnableDailyBackups = false }; using (var client = await restClient.CreateAuthenticatedClient()) { var result = await client.GetAsync(Endpoints.Preference.URL); var json = await result.Content.ReadAsStringAsync(); var content = JsonConvert.DeserializeAnonymousType(json, definition); return(content.EnableDailyBackups); } }