com.github.fedorchuck.developers_notification.integrations.telegram
Class TelegramImpl

java.lang.Object
  extended by com.github.fedorchuck.developers_notification.integrations.telegram.TelegramImpl
All Implemented Interfaces:
Integration

public class TelegramImpl
extends java.lang.Object
implements Integration

Provides sending messages via Telegram messenger

Author: Volodymyr Fedorchuk

Since:
0.1.0

Constructor Summary
TelegramImpl()
           
 
Method Summary
 void analyseResponse(HttpResponse response)
          Analyse response after sent message
 Task generateMessage(java.lang.String projectName, java.lang.String description, java.lang.Throwable throwable)
          Generate message to send by specified params
 Task generateMessageFromLoggingEvent(java.lang.String projectName, org.apache.log4j.spi.LoggingEvent event)
          Generate Task to send by specified params
 DevelopersNotificationMessenger name()
          Contains name of integration
 void sendMessage(Task message)
          Provides sending messages to Telegram messenger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TelegramImpl

public TelegramImpl()
Method Detail

name

public DevelopersNotificationMessenger name()
Description copied from interface: Integration
Contains name of integration

Specified by:
name in interface Integration
Returns:
name of integration

sendMessage

public void sendMessage(Task message)
Provides sending messages to Telegram messenger

Specified by:
sendMessage in interface Integration
Parameters:
message - to send
Since:
0.1.0

generateMessage

public Task generateMessage(java.lang.String projectName,
                            java.lang.String description,
                            java.lang.Throwable throwable)
Generate message to send by specified params

Specified by:
generateMessage in interface Integration
Parameters:
projectName - where was method called. Can be null
description - about situation. Can be null
throwable - which happened. Can be null
Returns:
generated message as JSON
Since:
0.1.0

generateMessageFromLoggingEvent

public Task generateMessageFromLoggingEvent(java.lang.String projectName,
                                            org.apache.log4j.spi.LoggingEvent event)
Generate Task to send by specified params

Specified by:
generateMessageFromLoggingEvent in interface Integration
Parameters:
projectName - where was method called. Can be null
event - from logger
Returns:
generated message as Task JSON
Since:
0.3.0

analyseResponse

public void analyseResponse(HttpResponse response)
Analyse response after sent message

See Also:: https://core.telegram.org/method/messages.sendMessage#return-errors

Specified by:
analyseResponse in interface Integration
Parameters:
response - response from http client
Since:
0.2.1