Beispiel #1
0
        public async Task GetMessagesForAppTestAsync()
        {
            GotifySharp gotifySharp = new GotifySharp(Settings.Config);

            var app = await gotifySharp.CreateApplicationAsync("Name", "Description");

            var res = await gotifySharp.GetMessageForApplicationAsync(app.Response.id);

            res.Success.Should().BeTrue();
        }
Beispiel #2
0
        public async Task <List <MessageModel> > GetMessagesForApplication(int id)
        {
            try
            {
                List <MessageModel> messages = new List <MessageModel>();
                var messageGetResponse       = await gotifySharp.GetMessageForApplicationAsync(id);

                foreach (MessageModel response in messageGetResponse.MessageGetModel.messages)
                {
                    messages.Add(response);
                }
                return(messages);
            }
            catch (HttpRequestException httpExc)
            {
                _logger.Error(httpExc, "Unable to Get Messages");
                throw new SyncFailureException();
            }
            catch (NullReferenceException nullExcp)
            {
                _logger.Error(nullExcp, "Unable to Get Messages");
                throw new SyncFailureException();
            }
        }