com.vk.api.sdk.queries.messages.MessagesMarkAsImportantConversationQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk Show documentation
Show all versions of sdk Show documentation
Java library for VK API interaction, includes OAuth 2.0 authorization and API methods.
package com.vk.api.sdk.queries.messages;
import com.vk.api.sdk.client.AbstractQueryBuilder;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.GroupActor;
import com.vk.api.sdk.client.actors.UserActor;
import com.vk.api.sdk.objects.base.responses.OkResponse;
import java.util.Arrays;
import java.util.List;
/**
* Query for Messages.markAsImportantConversation method
*/
public class MessagesMarkAsImportantConversationQuery extends AbstractQueryBuilder {
/**
* Creates a AbstractQueryBuilder instance that can be used to build api request with various parameters
*
* @param client VK API client
* @param actor actor with access token
* @param peerId value of "peer id" parameter.
*/
public MessagesMarkAsImportantConversationQuery(VkApiClient client, UserActor actor,
int peerId) {
super(client, "messages.markAsImportantConversation", OkResponse.class);
accessToken(actor.getAccessToken());
peerId(peerId);
}
/**
* Creates a AbstractQueryBuilder instance that can be used to build api request with various parameters
*
* @param client VK API client
* @param actor actor with access token
* @param peerId value of "peer id" parameter.
*/
public MessagesMarkAsImportantConversationQuery(VkApiClient client, GroupActor actor,
int peerId) {
super(client, "messages.markAsImportantConversation", OkResponse.class);
accessToken(actor.getAccessToken());
groupId(actor.getGroupId());
peerId(peerId);
}
/**
* ID of conversation to mark as important.
*
* @param value value of "peer id" parameter.
* @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
*/
protected MessagesMarkAsImportantConversationQuery peerId(int value) {
return unsafeParam("peer_id", value);
}
/**
* '1' — to add a star (mark as important), '0' — to remove the star
*
* @param value value of "important" parameter. By default 1.
* @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
*/
public MessagesMarkAsImportantConversationQuery important(Boolean value) {
return unsafeParam("important", value);
}
/**
* Group ID (for group messages with group access token)
*
* @param value value of "group id" parameter. Minimum is 0.
* @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern.
*/
public MessagesMarkAsImportantConversationQuery groupId(Integer value) {
return unsafeParam("group_id", value);
}
@Override
protected MessagesMarkAsImportantConversationQuery getThis() {
return this;
}
@Override
protected List essentialKeys() {
return Arrays.asList("peer_id", "access_token");
}
}