Skip to content

Commit

Permalink
Merge pull request #2 from vkolodrevskiy/master
Browse files Browse the repository at this point in the history
Update spring-social vk
  • Loading branch information
Klaxon77 committed Jan 11, 2016
2 parents 68c6268 + 37f04f2 commit 1e50bcc
Show file tree
Hide file tree
Showing 36 changed files with 1,369 additions and 101 deletions.
Expand Up @@ -10,7 +10,8 @@ public enum ApiVersion {
VERSION_5_7("5.7"),
VERSION_5_8("5.8"),
VERSION_5_21("5.21"),
VERSION_5_27("5.27");
VERSION_5_27("5.27"),
VERSION_5_33("5.33");

private String version;

Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.io.Serializable;

/**
* Model class representing audio.</br>
* Model class representing audio.<br>
* See definition of this object at http://vk.com/dev/audio_object
*
* @author vkolodrevskiy
Expand Down
@@ -0,0 +1,66 @@
package org.springframework.social.vkontakte.api;

import org.springframework.social.vkontakte.api.attachment.Attachment;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.List;

/**
* Model class representing a comment on a post on a user wall or community wall.
*
* @see <a href="https://vk.com/dev/comment_object">Comment object | Developers | VK</a>
*/
public class Comment {
private long id;
private long fromId;
private Date date;
private String text;
private long replyToUser;
private long replyToComment;
private Post.Likes likes;
private List<? extends Attachment> attachments;

public long getFromId() {
return fromId;
}

public Date getDate() {
return date;
}

public String getText() {
return text;
}

public long getId() {
return id;
}

public long getReplyToUser() {
return replyToUser;
}

public long getReplyToComment() {
return replyToComment;
}

public Post.Likes getLikes() {
return likes;
}

public List<? extends Attachment> getAttachments() {
return attachments;
}

@Override
public String toString() {
return "Comment{" +
"id='" + id + '\'' +
", date=" + date +
", text='" + text + '\'' +
", likes=" + likes +
", attachments=" + (attachments == null ? null : StringUtils.collectionToDelimitedString(attachments, ",\n")) +
'}';
}
}
@@ -0,0 +1,42 @@
package org.springframework.social.vkontakte.api;

import org.springframework.social.vkontakte.api.impl.wall.CommentsQuery;

import java.util.List;

/**
* Model class representing a response that contains a list of comments on a post on a user wall or community wall.
*
* @see IWallOperations#getComments(CommentsQuery)
*/
public class CommentsResponse {
private final long count;
private final List<Comment> comments;
private final List<VKontakteProfile> profiles;
private final List<Group> groups;
private final Long realOffset;

public CommentsResponse(List<Comment> comments, long count, Long realOffset, List<VKontakteProfile> profiles, List<Group> groups) {
this.comments = comments;
this.count = count;
this.realOffset = realOffset;
this.groups = groups;
this.profiles = profiles;
}

public long getCount() {
return count;
}

public long getRealOffset() {
return realOffset;
}

public List<Comment> getComments() {
return comments;
}

public List<VKontakteProfile> getProfiles() {
return profiles;
}
}
@@ -0,0 +1,100 @@
/*
* Copyright 2011-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.social.vkontakte.api;

/**
* Counters.
* https://vk.com/dev/fields
*
* @author dIsoVi
*/
public class Counters {
private int albums;
private int videos;
private int audios;
private int notes;
private int photos;
private int groups;
private int gifts;
private int friends;
private int onlineFriends;
private int mutualFriends;
private int userPhotos;
private int userVideos;
private int followers;
private int subscriptions;
private int pages;

public int getUserVideos() {
return userVideos;
}

public int getUserPhotos() {
return userPhotos;
}

public int getAlbums() {
return albums;
}

public int getVideos() {
return videos;
}

public int getAudios() {
return audios;
}

public int getNotes() {
return notes;
}

public int getPhotos() {
return photos;
}

public int getGroups() {
return groups;
}

public int getGifts() {
return gifts;
}

public int getFriends() {
return friends;
}

public int getOnlineFriends() {
return onlineFriends;
}

public int getMutualFriends() {
return mutualFriends;
}

public int getFollowers() {
return followers;
}

public int getSubscriptions() {
return subscriptions;
}

public int getPages() {
return pages;
}
}
Expand Up @@ -15,22 +15,26 @@
*/
package org.springframework.social.vkontakte.api;

import org.springframework.social.vkontakte.api.impl.json.VKArray;
import org.springframework.social.vkontakte.api.vkenums.FriendsOrder;
import org.springframework.social.vkontakte.api.vkenums.NameCase;

import java.util.List;

/**
* Defines operations for interacting with a user's friends.
* @author vkolodrevskiy
*/
public interface IFriendsOperations {
public final static String DEFAULT_FIELDS = "first_name,last_name,photo_50,photo_100,photo_200,contacts,bdate,sex,screen_name";
String DEFAULT_FIELDS = "first_name,last_name,photo_50,photo_100,photo_200,contacts,bdate,sex,screen_name";
/**
* Retrieves a list of user friends for the current authorized user.
* @return a list of user friends profiles.
* @throws org.springframework.social.ApiException if there is an error while communicating with VKontakte.
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<VKontakteProfile> get();
VKArray<VKontakteProfile> get();

/**
* Retrieves a list of user friends for the current authorized user.
Expand All @@ -40,7 +44,7 @@ public interface IFriendsOperations {
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<VKontakteProfile> get(String fields);
VKArray<VKontakteProfile> get(String fields);

/**
* Retrieves a list of user friends for specified user unique identifier.
Expand All @@ -50,7 +54,7 @@ public interface IFriendsOperations {
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<VKontakteProfile> get(Long userId);
VKArray<VKontakteProfile> get(Long userId);

/**
* Retrieves a list of user friends for specified user unique identifier.
Expand All @@ -61,20 +65,35 @@ public interface IFriendsOperations {
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<VKontakteProfile> get(Long userId, String fields);
VKArray<VKontakteProfile> get(Long userId, String fields);

/**
* Retrieves a list of user friends for specified user unique identifier.
* @param userId user unique identifier for which to get friends.
* @param fields VKontakte fields to retrieve, comma-delimited.
* @param count Number(positive number) of friends to return. If you want to return all friends pass negative number.
* @param offset Offset(positive number) needed to return a specific subset of friends.
* @return a list of user friends profiles.
* @throws org.springframework.social.ApiException if there is an error while communicating with VKontakte.
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
VKArray<VKontakteProfile> get(Long userId, String fields, int count, int offset);

/**
* Retrieves a list of user friends for specified user unique identifier.
* @param userId user unique identifier for which to get friends.
* @param fields VKontakte fields to retrieve, comma-delimited.
* @param order sort order.
* @param nameCase case for declension of user name and surname.
* @param count Number(positive number) of friends to return. If you want to return all friends pass negative number.
* @param offset Offset(positive number) needed to return a specific subset of friends.
* @return a list of user friends profiles.
* @throws org.springframework.social.ApiException if there is an error while communicating with VKontakte.
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<VKontakteProfile> get(Long userId, String fields, int count, int offset);
VKArray<VKontakteProfile> get(Long userId, String fields, FriendsOrder order, NameCase nameCase, int count, int offset);

/**
* Retrieves a list of user friends id's that are online for the current authorized user.
Expand All @@ -88,7 +107,7 @@ public interface IFriendsOperations {
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<List<String>> getOnline(boolean onlineMobile, int count, int offset);
List<List<String>> getOnline(boolean onlineMobile, int count, int offset);

/**
* Retrieves a list of user friends that are online for specified user unique identifier.
Expand All @@ -103,5 +122,5 @@ public interface IFriendsOperations {
* @throws org.springframework.social.MissingAuthorizationException if VKontakteTemplate was not created with an access token.
* @throws org.springframework.social.vkontakte.api.VKontakteErrorException if VKontakte returned error.
*/
public List<List<String>> getOnline(Long userId, boolean onlineMobile, int count, int offset);
List<List<String>> getOnline(Long userId, boolean onlineMobile, int count, int offset);
}

0 comments on commit 1e50bcc

Please sign in to comment.