Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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);
            }
        }