-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from yvasyliev/dev
Dev
- Loading branch information
Showing
6 changed files
with
149 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/api/longpoll/bots/converter/impl/ForwardConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package api.longpoll.bots.converter.impl; | ||
|
||
import api.longpoll.bots.config.VkBotsConfig; | ||
import api.longpoll.bots.converter.Converter; | ||
import api.longpoll.bots.model.objects.additional.Forward; | ||
import com.google.gson.Gson; | ||
|
||
/** | ||
* Converts {@link Forward} object to JSON string. | ||
*/ | ||
public class ForwardConverter implements Converter<Forward, String> { | ||
/** | ||
* {@link Gson} object. | ||
*/ | ||
private final Gson gson = VkBotsConfig.getInstance().getGson(); | ||
|
||
@Override | ||
public String convert(Forward forward) { | ||
return gson.toJson(forward); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/main/java/api/longpoll/bots/model/objects/additional/Forward.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package api.longpoll.bots.model.objects.additional; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Stores messages to forward. | ||
*/ | ||
public class Forward { | ||
/** | ||
* Messages owner. | ||
* Should be set when forwarding messages from community to dialog. | ||
*/ | ||
@SerializedName("owner_id") | ||
private Integer ownerId; | ||
|
||
/** | ||
* Messages origin. | ||
*/ | ||
@SerializedName("peer_id") | ||
private int peerId; | ||
|
||
/** | ||
* Conversation message IDs. | ||
*/ | ||
@SerializedName("conversation_message_ids") | ||
private List<Integer> conversationMessageIds; | ||
|
||
/** | ||
* Message IDs. | ||
*/ | ||
@SerializedName("message_ids") | ||
private List<Integer> messageIds; | ||
|
||
/** | ||
* To forward message to the same char. | ||
*/ | ||
@SerializedName("is_reply") | ||
private Boolean isReply; | ||
|
||
public Integer getOwnerId() { | ||
return ownerId; | ||
} | ||
|
||
public Forward setOwnerId(Integer ownerId) { | ||
this.ownerId = ownerId; | ||
return this; | ||
} | ||
|
||
public int getPeerId() { | ||
return peerId; | ||
} | ||
|
||
public Forward setPeerId(int peerId) { | ||
this.peerId = peerId; | ||
return this; | ||
} | ||
|
||
public List<Integer> getConversationMessageIds() { | ||
return conversationMessageIds; | ||
} | ||
|
||
public Forward setConversationMessageIds(List<Integer> conversationMessageIds) { | ||
this.conversationMessageIds = conversationMessageIds; | ||
return this; | ||
} | ||
|
||
public List<Integer> getMessageIds() { | ||
return messageIds; | ||
} | ||
|
||
public Forward setMessageIds(List<Integer> messageIds) { | ||
this.messageIds = messageIds; | ||
return this; | ||
} | ||
|
||
public Boolean getReply() { | ||
return isReply; | ||
} | ||
|
||
public Forward setReply(Boolean reply) { | ||
isReply = reply; | ||
return this; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return "Forward{" + | ||
"ownerId=" + ownerId + | ||
", peerId=" + peerId + | ||
", conversationMessageIds=" + conversationMessageIds + | ||
", messageIds=" + messageIds + | ||
", isReply=" + isReply + | ||
'}'; | ||
} | ||
} |