本文整理汇总了Java中com.restfb.types.send.Message类的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于com.restfb.types.send包,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final GenericTemplatePayload payload = new GenericTemplatePayload();
final BubbleSendPayload bubbleSendPayload = sendMessage.getPayloadWithType(BubbleSendPayload.class);
for (final Bubble bubble : bubbleSendPayload.getBubbles()) {
payload.addBubble(createBubble(bubble));
}
final TemplateAttachment templateAttachment = new TemplateAttachment(payload);
final Message message = new Message(templateAttachment);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例2: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final QuickRepliesSendPayload quickReplies = sendMessage.getPayloadWithType(QuickRepliesSendPayload.class);
final String text = quickReplies.getText();
final Message message = new Message(text);
for (final QuickReply quickReply : quickReplies.getQuickReplies()) {
message.addQuickReply(createQuickReply(quickReply));
}
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例3: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final ImageSendPayload imageSendPayload = sendMessage.getPayloadWithType(ImageSendPayload.class);
final MediaAttachment.Type type = MediaAttachment.Type.IMAGE;
final String imageUrl = imageSendPayload.getImageUrl();
final MediaAttachment mediaAttachment = new MediaAttachment(type, imageUrl);
final Message message = new Message(mediaAttachment);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例4: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final ListSendPayload listSendPayload = sendMessage.getPayloadWithType(ListSendPayload.class);
final List<ListViewElement> listViewElements = new ArrayList<ListViewElement>();
for (final ListSendElement listSendElement : listSendPayload.getListElements()) {
final ListViewElement listViewElement = new ListViewElement(listSendElement.getTitle());
listViewElement.setSubtitle(listSendElement.getSubTitle());
listViewElement.setImageUrl(listSendElement.getImageUrl());
addButton(listSendElement, listViewElement);
addAction(listSendElement, listViewElement);
listViewElements.add(listViewElement);
}
final ListTemplatePayload payload = new ListTemplatePayload(listViewElements);
setStyle(listSendPayload, payload);
addButton(listSendPayload, payload);
final TemplateAttachment templateAttachment = new TemplateAttachment(payload);
final Message message = new Message(templateAttachment);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例5: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final VideoSendPayload videoSendPayload = sendMessage.getPayloadWithType(VideoSendPayload.class);
final MediaAttachment.Type type = MediaAttachment.Type.VIDEO;
final String videoUrl = videoSendPayload.getVideoUrl();
final MediaAttachment mediaAttachment = new MediaAttachment(type, videoUrl);
final Message message = new Message(mediaAttachment);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例6: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final TextSendPayload textPayload = sendMessage.getPayloadWithType(TextSendPayload.class);
final String text = textPayload.getText();
final Message message = new Message(text);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例7: apply
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public void apply(final SendMessage sendMessage) {
final ButtonsSendPayload buttonsSendPayload = sendMessage.getPayloadWithType(ButtonsSendPayload.class);
final ButtonTemplatePayload payload = new ButtonTemplatePayload(buttonsSendPayload.getTitle());
for (final AbstractSendButton button : buttonsSendPayload.getButtons()) {
payload.addButton(facebookSendButtonFactory.createAbstractButton(button));
}
final TemplateAttachment templateAttachment = new TemplateAttachment(payload);
final Message message = new Message(templateAttachment);
final IdMessageRecipient recipient = createIdMessageRecipient(sendMessage.getRecipient());
publish(sendMessage, message, recipient);
}
示例8: publish
import com.restfb.types.send.Message; //导入依赖的package包/类
protected void publish(final SendMessage sendMessage, final Message message, final IdMessageRecipient recipient) {
LOG.info("sending message to {}", recipient);
if (recipient == null) {
LOG.warn("recipient is {}", recipient);
} else {
final Parameter recipientParam = Parameter.with("recipient", recipient);
final Parameter messageParam = Parameter.with("message", message);
final FacebookClient facebookClient = provideFacebookClient(sendMessage);
facebookClient.publish("me/messages", SendResponse.class, recipientParam, messageParam);
}
}
示例9: textMessage
import com.restfb.types.send.Message; //导入依赖的package包/类
@Override
public SendResponse textMessage(MessagingType type, MessageRecipient recipient, String text, NotificationTypeEnum notificationType,
MessageTag tag)
throws FacebookException {
requireNonNull(recipient, "'recipient' must not be null");
requireNonNull(text, "'text' must not be null");
Message message = new Message(text);
return message(type, recipient, message, notificationType, tag);
}
示例10: testMessageWithNotificationType
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testMessageWithNotificationType() {
Message message = new Message("Hello!");
sendOperations.message(RESPONSE, messageRecipient, message, NotificationTypeEnum.NO_PUSH);
verifySend(RESPONSE, messageRecipient,
Parameter.with(NOTIFICATION_TYPE_PARAM_NAME, NotificationTypeEnum.NO_PUSH),
Parameter.with(MESSAGE_PARAM_NAME, message));
}
示例11: testMessageWithNotificationTypeAndMessageTag
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testMessageWithNotificationTypeAndMessageTag() {
Message message = new Message("Hello!");
sendOperations.message(RESPONSE, messageRecipient, message, NotificationTypeEnum.NO_PUSH, MessageTag.ISSUE_RESOLUTION);
verifySend(RESPONSE, messageRecipient,
Parameter.with(NOTIFICATION_TYPE_PARAM_NAME, NotificationTypeEnum.NO_PUSH),
Parameter.with(TAG_PARAM_NAME, MessageTag.ISSUE_RESOLUTION.getTag()),
Parameter.with(MESSAGE_PARAM_NAME, message));
}
示例12: testMessageWithMessageTag
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testMessageWithMessageTag() {
Message message = new Message("Hello!");
sendOperations.message(RESPONSE, messageRecipient, message, MessageTag.ISSUE_RESOLUTION);
verifySend(RESPONSE, messageRecipient,
Parameter.with(TAG_PARAM_NAME, MessageTag.ISSUE_RESOLUTION.getTag()),
Parameter.with(MESSAGE_PARAM_NAME, message));
}
示例13: testMessageWithCustomMessageTag
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testMessageWithCustomMessageTag() {
Message message = new Message("Hello!");
sendOperations.message(RESPONSE, messageRecipient, message, new MessageTag("CUSTOM"));
verifySend(RESPONSE, messageRecipient,
Parameter.with(TAG_PARAM_NAME, "CUSTOM"),
Parameter.with(MESSAGE_PARAM_NAME, message));
}
示例14: testTextMessage
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testTextMessage() {
String text = "Hello!";
sendOperations.textMessage(RESPONSE, messageRecipient, text);
Message message = new Message(text);
verifySend(RESPONSE, messageRecipient, Parameter.with(MESSAGE_PARAM_NAME, message));
}
示例15: testTextMessageWithNotificationType
import com.restfb.types.send.Message; //导入依赖的package包/类
@Test
public void testTextMessageWithNotificationType() {
String text = "Hello!";
sendOperations.textMessage(RESPONSE, messageRecipient, text, NotificationTypeEnum.NO_PUSH);
Message message = new Message(text);
verifySend(RESPONSE, messageRecipient,
Parameter.with(NOTIFICATION_TYPE_PARAM_NAME, NotificationTypeEnum.NO_PUSH),
Parameter.with(MESSAGE_PARAM_NAME, message));
}