public async Task GetApplicationsTestAsync()
        {
            GotifySharp gotifySharp = new GotifySharp(Settings.Config);

            var res = await gotifySharp.GetApplications();

            res.Success.Should().BeTrue();
        }
예제 #2
0
        public async Task <List <ApplicationModel> > GetApplications()
        {
            try
            {
                List <ApplicationModel> applications = new List <ApplicationModel>();
                var response = await gotifySharp.GetApplications();

                foreach (var appResponse in response.ApplicationResponse)
                {
                    applications.Add(appResponse);
                }
                return(applications);
            }
            catch (HttpRequestException httpExc)
            {
                _logger.Error(httpExc, "Unable to Get Applications");
                throw new SyncFailureException();
            }
        }
예제 #3
0
        public static async Task <bool> TestConnectionAsync(string Url, int port, string Username, string Password, string Path, string Protocol)
        {
            IConfig     config      = new AppConfig(Username, Password, Url, port, Protocol, Path);
            GotifySharp gotifySharp = new GotifySharp(config);

            try
            {
                var res = await gotifySharp.GetApplications();

                if (res.Success)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (HttpRequestException HttpExcep)
            {
                throw HttpExcep;
            }
        }