Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Java library for VK API interaction, includes OAuth 2.0 authorization and API methods. Full VK API features documentation can be found [here](http://vk.com/dev).

This library has been created using the VK API JSON Schema. It can be found [here](https://github.com/VKCOM/vk-api-schema). It uses VK API [version](https://vk.com/dev/versions) 5.73.
This library has been created using the VK API JSON Schema. It can be found [here](https://github.com/VKCOM/vk-api-schema). It uses VK API [version](https://vk.com/dev/versions) 5.126.

## 1. Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ subprojects {
apply plugin: 'java'

group 'com.vk.api'
version '1.0.6'
version '1.0.7'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void messageReply(Integer groupId, Message message) {
}

public void messageEdit(Integer groupId, Message message) {
LOG.info("messageReply: " + message.toString());
LOG.info("messageEdit: " + message.toString());
}

public void messageAllow(Integer groupId, MessageAllow message) {
Expand Down
1 change: 0 additions & 1 deletion examples/group-oauth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
compile group: 'com.google.guava', name: 'guava', version: guavaVersion
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: log4jVersion
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
compile group: 'org.eclipse.jetty', name: 'jetty-server', version: jettyVersion

testCompile group: 'org.testng', name: 'testng', version: testngVersion
Expand Down
96 changes: 81 additions & 15 deletions sdk/src/main/java/com/vk/api/sdk/actions/Ads.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.vk.api.sdk.client.AbstractAction;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.UserActor;
import com.vk.api.sdk.objects.ads.UserSpecification;
import com.vk.api.sdk.objects.ads.UserSpecificationCutted;
import com.vk.api.sdk.objects.enums.AdsIdsType;
import com.vk.api.sdk.objects.enums.AdsLinkType;
import com.vk.api.sdk.objects.enums.AdsPeriod;
Expand All @@ -27,6 +29,8 @@
import com.vk.api.sdk.queries.ads.AdsGetClientsQuery;
import com.vk.api.sdk.queries.ads.AdsGetDemographicsQuery;
import com.vk.api.sdk.queries.ads.AdsGetFloodStatsQuery;
import com.vk.api.sdk.queries.ads.AdsGetLookalikeRequestsQuery;
import com.vk.api.sdk.queries.ads.AdsGetMusiciansQuery;
import com.vk.api.sdk.queries.ads.AdsGetOfficeUsersQuery;
import com.vk.api.sdk.queries.ads.AdsGetPostsReachQuery;
import com.vk.api.sdk.queries.ads.AdsGetRejectionReasonQuery;
Expand All @@ -44,7 +48,9 @@
import com.vk.api.sdk.queries.ads.AdsUpdateAdsQuery;
import com.vk.api.sdk.queries.ads.AdsUpdateCampaignsQuery;
import com.vk.api.sdk.queries.ads.AdsUpdateClientsQuery;
import com.vk.api.sdk.queries.ads.AdsUpdateOfficeUsersQuery;
import com.vk.api.sdk.queries.ads.AdsUpdateTargetGroupQuery;
import java.util.List;

/**
* List of Ads methods
Expand All @@ -67,7 +73,21 @@ public Ads(VkApiClient client) {
* @param data Serialized JSON array of objects that describe added managers. Description of 'user_specification' objects see below.
* @return query
*/
public AdsAddOfficeUsersQuery addOfficeUsers(UserActor actor, int accountId, String data) {
public AdsAddOfficeUsersQuery addOfficeUsers(UserActor actor, int accountId,
UserSpecificationCutted... data) {
return new AdsAddOfficeUsersQuery(getClient(), actor, accountId, data);
}

/**
* Adds managers and/or supervisors to advertising account.
*
* @param actor vk actor
* @param accountId Advertising account ID.
* @param data Serialized JSON array of objects that describe added managers. Description of 'user_specification' objects see below.
* @return query
*/
public AdsAddOfficeUsersQuery addOfficeUsers(UserActor actor, int accountId,
List<UserSpecificationCutted> data) {
return new AdsAddOfficeUsersQuery(getClient(), actor, accountId, data);
}

Expand Down Expand Up @@ -127,11 +147,12 @@ public AdsCreateClientsQuery createClients(UserActor actor, int accountId, Strin
* @param actor vk actor
* @param accountId Advertising account ID.
* @param name Name of the target group — a string up to 64 characters long.
* @param lifetime 'For groups with auditory created with pixel code only.', , Number of days after that users will be automatically removed from the group.
* @return query
*/
public AdsCreateTargetGroupQuery createTargetGroup(UserActor actor, int accountId,
String name) {
return new AdsCreateTargetGroupQuery(getClient(), actor, accountId, name);
public AdsCreateTargetGroupQuery createTargetGroup(UserActor actor, int accountId, String name,
int lifetime) {
return new AdsCreateTargetGroupQuery(getClient(), actor, accountId, name, lifetime);
}

/**
Expand Down Expand Up @@ -297,6 +318,24 @@ public AdsGetFloodStatsQuery getFloodStats(UserActor actor, int accountId) {
return new AdsGetFloodStatsQuery(getClient(), actor, accountId);
}

/**
* @param actor vk actor
* @param accountId
* @return query
*/
public AdsGetLookalikeRequestsQuery getLookalikeRequests(UserActor actor, int accountId) {
return new AdsGetLookalikeRequestsQuery(getClient(), actor, accountId);
}

/**
* @param actor vk actor
* @param artistName
* @return query
*/
public AdsGetMusiciansQuery getMusicians(UserActor actor, String artistName) {
return new AdsGetMusiciansQuery(getClient(), actor, artistName);
}

/**
* Returns a list of managers and supervisors of advertising account.
*
Expand Down Expand Up @@ -356,12 +395,10 @@ public AdsGetStatisticsQuery getStatistics(UserActor actor, int accountId, AdsId
*
* @param actor vk actor
* @param section Section, suggestions are retrieved in. Available values: *countries — request of a list of countries. If q is not set or blank, a short list of countries is shown. Otherwise, a full list of countries is shown. *regions — requested list of regions. 'country' parameter is required. *cities — requested list of cities. 'country' parameter is required. *districts — requested list of districts. 'cities' parameter is required. *stations — requested list of subway stations. 'cities' parameter is required. *streets — requested list of streets. 'cities' parameter is required. *schools — requested list of educational organizations. 'cities' parameter is required. *interests — requested list of interests. *positions — requested list of positions (professions). *group_types — requested list of group types. *religions — requested list of religious commitments. *browsers — requested list of browsers and mobile devices.
* @param cities IDs of cities where objects are searched in, separated with a comma.
* @return query
*/
public AdsGetSuggestionsQueryWithCities getSuggestionsWithCities(UserActor actor,
AdsSection section, String cities) {
return new AdsGetSuggestionsQueryWithCities(getClient(), actor, section, cities);
public AdsGetSuggestionsQuery getSuggestions(UserActor actor, AdsSection section) {
return new AdsGetSuggestionsQuery(getClient(), actor, section);
}

/**
Expand All @@ -383,20 +420,22 @@ public AdsGetSuggestionsQueryWithRegions getSuggestionsRegions(UserActor actor,
* @param section Section, suggestions are retrieved in. Available values: *countries — request of a list of countries. If q is not set or blank, a short list of countries is shown. Otherwise, a full list of countries is shown. *regions — requested list of regions. 'country' parameter is required. *cities — requested list of cities. 'country' parameter is required. *districts — requested list of districts. 'cities' parameter is required. *stations — requested list of subway stations. 'cities' parameter is required. *streets — requested list of streets. 'cities' parameter is required. *schools — requested list of educational organizations. 'cities' parameter is required. *interests — requested list of interests. *positions — requested list of positions (professions). *group_types — requested list of group types. *religions — requested list of religious commitments. *browsers — requested list of browsers and mobile devices.
* @return query
*/
public AdsGetSuggestionsQuery getSuggestions(UserActor actor, AdsSection section) {
return new AdsGetSuggestionsQuery(getClient(), actor, section);
public AdsGetSuggestionsQueryWithSchools getSuggestionsSchools(UserActor actor,
AdsSection section) {
return new AdsGetSuggestionsQueryWithSchools(getClient(), actor, section);
}

/**
* Returns a set of auto-suggestions for various targeting parameters.
*
* @param actor vk actor
* @param section Section, suggestions are retrieved in. Available values: *countries — request of a list of countries. If q is not set or blank, a short list of countries is shown. Otherwise, a full list of countries is shown. *regions — requested list of regions. 'country' parameter is required. *cities — requested list of cities. 'country' parameter is required. *districts — requested list of districts. 'cities' parameter is required. *stations — requested list of subway stations. 'cities' parameter is required. *streets — requested list of streets. 'cities' parameter is required. *schools — requested list of educational organizations. 'cities' parameter is required. *interests — requested list of interests. *positions — requested list of positions (professions). *group_types — requested list of group types. *religions — requested list of religious commitments. *browsers — requested list of browsers and mobile devices.
* @param cities IDs of cities where objects are searched in, separated with a comma.
* @return query
*/
public AdsGetSuggestionsQueryWithSchools getSuggestionsSchools(UserActor actor,
AdsSection section) {
return new AdsGetSuggestionsQueryWithSchools(getClient(), actor, section);
public AdsGetSuggestionsQueryWithCities getSuggestionsWithCities(UserActor actor,
AdsSection section, String cities) {
return new AdsGetSuggestionsQueryWithCities(getClient(), actor, section, cities);
}

/**
Expand Down Expand Up @@ -506,17 +545,44 @@ public AdsUpdateClientsQuery updateClients(UserActor actor, int accountId, Strin
return new AdsUpdateClientsQuery(getClient(), actor, accountId, data);
}

/**
* Adds managers and/or supervisors to advertising account.
*
* @param actor vk actor
* @param accountId Advertising account ID.
* @param data Serialized JSON array of objects that describe added managers. Description of 'user_specification' objects see below.
* @return query
*/
public AdsUpdateOfficeUsersQuery updateOfficeUsers(UserActor actor, int accountId,
UserSpecification... data) {
return new AdsUpdateOfficeUsersQuery(getClient(), actor, accountId, data);
}

/**
* Adds managers and/or supervisors to advertising account.
*
* @param actor vk actor
* @param accountId Advertising account ID.
* @param data Serialized JSON array of objects that describe added managers. Description of 'user_specification' objects see below.
* @return query
*/
public AdsUpdateOfficeUsersQuery updateOfficeUsers(UserActor actor, int accountId,
List<UserSpecification> data) {
return new AdsUpdateOfficeUsersQuery(getClient(), actor, accountId, data);
}

/**
* Edits a retarget group.
*
* @param actor vk actor
* @param accountId Advertising account ID.
* @param targetGroupId Group ID.
* @param name New name of the target group — a string up to 64 characters long.
* @param lifetime 'Only for the groups that get audience from sites with user accounting code.', Time in days when users added to a retarget group will be automatically excluded from it. '0' - automatic exclusion is off.
* @return query
*/
public AdsUpdateTargetGroupQuery updateTargetGroup(UserActor actor, int accountId,
int targetGroupId, String name) {
return new AdsUpdateTargetGroupQuery(getClient(), actor, accountId, targetGroupId, name);
int targetGroupId, String name, int lifetime) {
return new AdsUpdateTargetGroupQuery(getClient(), actor, accountId, targetGroupId, name, lifetime);
}
}
84 changes: 84 additions & 0 deletions sdk/src/main/java/com/vk/api/sdk/actions/Adsweb.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.vk.api.sdk.actions;

import com.vk.api.sdk.client.AbstractAction;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.UserActor;
import com.vk.api.sdk.queries.adsweb.AdswebGetAdCategoriesQuery;
import com.vk.api.sdk.queries.adsweb.AdswebGetAdUnitCodeQuery;
import com.vk.api.sdk.queries.adsweb.AdswebGetAdUnitsQuery;
import com.vk.api.sdk.queries.adsweb.AdswebGetFraudHistoryQuery;
import com.vk.api.sdk.queries.adsweb.AdswebGetSitesQuery;
import com.vk.api.sdk.queries.adsweb.AdswebGetStatisticsQuery;

/**
* List of Adsweb methods
*/
public class Adsweb extends AbstractAction {
/**
* Constructor
*
* @param client vk api client
*/
public Adsweb(VkApiClient client) {
super(client);
}

/**
* @param actor vk actor
* @param officeId
* @return query
*/
public AdswebGetAdCategoriesQuery getAdCategories(UserActor actor, int officeId) {
return new AdswebGetAdCategoriesQuery(getClient(), actor, officeId);
}

/**
* @param actor vk actor
* @return query
*/
public AdswebGetAdUnitCodeQuery getAdUnitCode(UserActor actor) {
return new AdswebGetAdUnitCodeQuery(getClient(), actor);
}

/**
* @param actor vk actor
* @param officeId
* @return query
*/
public AdswebGetAdUnitsQuery getAdUnits(UserActor actor, int officeId) {
return new AdswebGetAdUnitsQuery(getClient(), actor, officeId);
}

/**
* @param actor vk actor
* @param officeId
* @return query
*/
public AdswebGetFraudHistoryQuery getFraudHistory(UserActor actor, int officeId) {
return new AdswebGetFraudHistoryQuery(getClient(), actor, officeId);
}

/**
* @param actor vk actor
* @param officeId
* @return query
*/
public AdswebGetSitesQuery getSites(UserActor actor, int officeId) {
return new AdswebGetSitesQuery(getClient(), actor, officeId);
}

/**
* @param actor vk actor
* @param officeId
* @param idsType
* @param ids
* @param period
* @param dateFrom
* @param dateTo
* @return query
*/
public AdswebGetStatisticsQuery getStatistics(UserActor actor, int officeId, String idsType,
String ids, String period, String dateFrom, String dateTo) {
return new AdswebGetStatisticsQuery(getClient(), actor, officeId, idsType, ids, period, dateFrom, dateTo);
}
}
Loading