├── .gitmodules ├── spring-social-foursquare └── src │ ├── test │ └── java │ │ └── org │ │ └── springframework │ │ └── social │ │ └── foursquare │ │ └── api │ │ ├── impl │ │ ├── testdata │ │ │ ├── ok-response.json │ │ │ ├── booleansetting.json │ │ │ ├── setsetting.json │ │ │ ├── stringsetting.json │ │ │ ├── photo.json │ │ │ ├── tips.json │ │ │ ├── venue.json │ │ │ ├── categories.json │ │ │ ├── searchtips.json │ │ │ ├── venue-history.json │ │ │ ├── recentcheckins.json │ │ │ ├── checkincomment.json │ │ │ ├── allsettings.json │ │ │ ├── special.json │ │ │ ├── requests.json │ │ │ ├── user-search.json │ │ │ ├── venuelinks.json │ │ │ ├── marktodo.json │ │ │ └── friends.json │ │ ├── AbstractFoursquareApiTest.java │ │ ├── SpecialTemplateTest.java │ │ ├── FoursquareTemplateTest.java │ │ └── SettingTemplateTest.java │ │ └── VenueBeenHereTest.java │ └── main │ └── java │ └── org │ └── springframework │ └── social │ └── foursquare │ ├── api │ ├── Provider.java │ ├── ParamErrorException.java │ ├── BadgeSets.java │ ├── impl │ │ ├── json │ │ │ ├── CheckinSourceMixin.java │ │ │ ├── ProviderMixin.java │ │ │ ├── StringValueContainer.java │ │ │ ├── BooleanValueContainer.java │ │ │ ├── TipContainer.java │ │ │ ├── TodoContainer.java │ │ │ ├── PhotoSourceMixin.java │ │ │ ├── TipsContainer.java │ │ │ ├── PhotoContainer.java │ │ │ ├── VenueContainer.java │ │ │ ├── ReasonMixin.java │ │ │ ├── TodosContainer.java │ │ │ ├── VenueStatsMixin.java │ │ │ ├── CheckinCommentInfoMixin.java │ │ │ ├── FriendsContainer.java │ │ │ ├── KeywordMixin.java │ │ │ ├── PhotoSizeMixin.java │ │ │ ├── SpecialContainer.java │ │ │ ├── CheckinContainer.java │ │ │ ├── ScoresMixin.java │ │ │ ├── TipTodoGroupMixin.java │ │ │ ├── VenueLinksContainer.java │ │ │ ├── SpecialsContainer.java │ │ │ ├── TipsListContainer.java │ │ │ ├── VenuePhotosContainer.java │ │ │ ├── BadgeSetsMixin.java │ │ │ ├── CheckinCommentMixin.java │ │ │ ├── TipsMixin.java │ │ │ ├── VenueMayorMixin.java │ │ │ ├── AllSettingsContainer.java │ │ │ ├── HereNowContainer.java │ │ │ ├── TodosMixin.java │ │ │ ├── VenueHistoryItemMixin.java │ │ │ ├── BadgeUnlocksMixin.java │ │ │ ├── CheckinCommentContainer.java │ │ │ ├── FoursquareUserContainer.java │ │ │ ├── SpecialsMixin.java │ │ │ ├── CheckinInfoMixin.java │ │ │ ├── PhotosMixin.java │ │ │ ├── VenuePhotosMixin.java │ │ │ ├── PhotoSizesMixin.java │ │ │ ├── VenueLinksMixin.java │ │ │ ├── VenueTipsMixin.java │ │ │ ├── CheckinInfoContainer.java │ │ │ ├── FriendsMixin.java │ │ │ ├── CheckinListContainer.java │ │ │ ├── MayorshipInfoMixin.java │ │ │ ├── ReasonsMixin.java │ │ │ ├── VenueHistoryContainer.java │ │ │ ├── VenueLinkMixin.java │ │ │ ├── BadgeImageMixin.java │ │ │ ├── ContactInfoMixin.java │ │ │ ├── HereNowMixin.java │ │ │ ├── KeywordsMixin.java │ │ │ ├── CategoriesContainer.java │ │ │ ├── FriendInfoMixin.java │ │ │ ├── LeaderboardContainer.java │ │ │ ├── VenueHistoryMixin.java │ │ │ ├── VenueSearchContainer.java │ │ │ ├── LeaderboardMixin.java │ │ │ ├── BadgesResponseContainer.java │ │ │ ├── ExploreResponseContainer.java │ │ │ ├── VenueGroupMixin.java │ │ │ ├── RequestsContainer.java │ │ │ ├── UserSearchResponseContainer.java │ │ │ ├── TipGroupMixin.java │ │ │ ├── PhotoGroupMixin.java │ │ │ ├── FoursquareDateDeserializer.java │ │ │ ├── TipUserGroupMixin.java │ │ │ ├── BadgesResponseMixin.java │ │ │ ├── BooleanValueContainerDeserializer.java │ │ │ ├── StringValueContainerDeserializer.java │ │ │ ├── TodoContainerDeserializer.java │ │ │ ├── FoursquareUserGroupMixin.java │ │ │ ├── LeaderboardItemMixin.java │ │ │ ├── TipsContainerDeserializer.java │ │ │ ├── UserSearchResponseMixin.java │ │ │ ├── TipContainerDeserializer.java │ │ │ ├── PhotoContainerDeserializer.java │ │ │ ├── TodoMixin.java │ │ │ ├── TodosContainerDeserializer.java │ │ │ ├── VenueContainerDeserializer.java │ │ │ ├── FriendMixin.java │ │ │ ├── FriendsContainerDeserializer.java │ │ │ ├── HereNowContainerDeserializer.java │ │ │ ├── SpecialContainerDeserializer.java │ │ │ ├── SpecialsContainerDeserializer.java │ │ │ ├── VenuePhotosContainerDeserializer.java │ │ │ ├── CheckinInfoContainerDeserializer.java │ │ │ ├── VenueGroupItemMixin.java │ │ │ ├── VenueLinksContainerDeserializer.java │ │ │ ├── AllSettingsContainerDeserializer.java │ │ │ ├── VenueHistoryContainerDeserializer.java │ │ │ ├── CheckinContainerDeserializer.java │ │ │ ├── CheckinCommentContainerDeserializer.java │ │ │ ├── BadgesResponseContainerDeserializer.java │ │ │ ├── ExploreResponseContainerDeserializer.java │ │ │ ├── ExploreResponseMixin.java │ │ │ ├── FoursquareUserContainerDeserializer.java │ │ │ ├── LeaderboardContainerDeserializer.java │ │ │ ├── BadgeMixin.java │ │ │ ├── LocationMixin.java │ │ │ ├── UserSearchResponseContainerDeserializer.java │ │ │ ├── CategoryMixin.java │ │ │ ├── BadgeGroupMixin.java │ │ │ ├── TipsListContainerDeserializer.java │ │ │ ├── CheckinListContainerDeserializer.java │ │ │ ├── CategoriesContainerDeserializer.java │ │ │ ├── VenueSearchContainerDeserializer.java │ │ │ ├── RequestsContainerDeserializer.java │ │ │ ├── AllSettingsMixin.java │ │ │ ├── TipMixin.java │ │ │ ├── PhotoMixin.java │ │ │ ├── SpecialMixin.java │ │ │ ├── CheckinMixin.java │ │ │ ├── FoursquareUserMixin.java │ │ │ ├── VenueMixin.java │ │ │ └── AbstractFoursquareDeserializer.java │ │ ├── BadgeCount.java │ │ ├── SettingTemplate.java │ │ ├── SpecialTemplate.java │ │ ├── AbstractFoursquareOperations.java │ │ ├── TipTemplate.java │ │ ├── CheckinTemplate.java │ │ └── PhotoTemplate.java │ ├── BadgeUnlocks.java │ ├── CheckinComment.java │ ├── CheckinSource.java │ ├── PhotoSource.java │ ├── Tips.java │ ├── VenueMayor.java │ ├── Photos.java │ ├── Foursquare.java │ ├── VenueHistoryItem.java │ ├── Reason.java │ ├── Todos.java │ ├── Specials.java │ ├── VenueLinks.java │ ├── MayorshipInfo.java │ ├── PhotoSizes.java │ ├── VenueTips.java │ ├── Friends.java │ ├── CheckinInfo.java │ ├── PhotoGroups.java │ ├── TipTodoGroup.java │ ├── Reasons.java │ ├── VenueHistory.java │ ├── Keywords.java │ ├── FriendInfo.java │ ├── HereNow.java │ ├── CheckinCommentInfo.java │ ├── Keyword.java │ ├── VenueBeenHere.java │ ├── PhotoSize.java │ ├── Leaderboard.java │ ├── Todo.java │ ├── Scores.java │ ├── VenueLink.java │ ├── FoursquareApiException.java │ ├── LeaderboardItem.java │ ├── BadgeImage.java │ ├── VenueGroup.java │ ├── VenueGroupItem.java │ ├── UserSearchResponse.java │ ├── VenueStats.java │ ├── TipGroup.java │ ├── PhotoGroup.java │ ├── TipUserGroup.java │ ├── SettingOperations.java │ ├── FoursquareUserGroup.java │ ├── ExploreResponse.java │ ├── SpecialOperations.java │ ├── BadgeGroup.java │ ├── Badge.java │ ├── Photo.java │ ├── Tip.java │ ├── Category.java │ ├── ContactInfo.java │ ├── BadgesResponse.java │ ├── TipOperations.java │ ├── Checkin.java │ ├── CheckinOperations.java │ ├── FoursquareUser.java │ ├── AllSettings.java │ ├── Special.java │ ├── Location.java │ └── PhotoOperations.java │ └── connect │ ├── FoursquareConnectionFactory.java │ ├── FoursquareServiceProvider.java │ ├── FoursquareAdapter.java │ └── FoursquareOAuth2Template.java ├── .gitignore ├── settings.gradle ├── README.md ├── gradle.properties └── gradlew.bat /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "buildSrc"] 2 | path = buildSrc 3 | url = git://github.com/SpringSource/spring-build-gradle.git 4 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/ok-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | **/build 4 | **/src/test/java/exploration 5 | .gradle 6 | spring-social-core/src/test/java/exploration 7 | **/.classpath 8 | **/.project 9 | **/.settings 10 | **/bin 11 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/booleansetting.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "value":true 7 | } 8 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/setsetting.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "message":"done" 7 | } 8 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/stringsetting.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "value":"stringsetting" 7 | } 8 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/photo.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/photo.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/tips.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/tips.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/venue.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/venue.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/categories.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/categories.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/searchtips.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/searchtips.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/venue-history.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/venue-history.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/recentcheckins.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattupstate/spring-social-foursquare/HEAD/spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/recentcheckins.json -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/checkincomment.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "comment":{ 7 | "id":"commentid", 8 | "text":"comment text" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Provider.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class Provider { 4 | private String id; 5 | 6 | public Provider(String id) { 7 | this.id = id; 8 | } 9 | 10 | public String getId() { 11 | return id; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/ParamErrorException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class ParamErrorException extends FoursquareApiException { 4 | 5 | public ParamErrorException(int code, String errorType, String message) { 6 | super(code, errorType, message); 7 | } 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/BadgeSets.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class BadgeSets { 6 | 7 | private List groups; 8 | 9 | public BadgeSets(List groups) { 10 | this.groups = groups; 11 | } 12 | 13 | public List getGroups() { 14 | return groups; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinSourceMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | 6 | abstract class CheckinSourceMixin { 7 | @JsonCreator 8 | CheckinSourceMixin( 9 | @JsonProperty("name") String name, 10 | @JsonProperty("url") String url) {} 11 | } 12 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/BadgeUnlocks.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class BadgeUnlocks { 6 | 7 | private List checkins; 8 | 9 | public BadgeUnlocks(List checkins) { 10 | this.checkins = checkins; 11 | } 12 | 13 | public List getCheckins() { 14 | return checkins; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/CheckinComment.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class CheckinComment { 4 | private String id; 5 | private String text; 6 | 7 | public CheckinComment(String id, String text) { 8 | this.id = id; 9 | this.text = text; 10 | } 11 | 12 | public String getId() { 13 | return id; 14 | } 15 | public String getText() { 16 | return text; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/CheckinSource.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class CheckinSource { 4 | 5 | private String name; 6 | private String url; 7 | 8 | public CheckinSource(String name, String url) { 9 | this.name = name; 10 | this.url = url; 11 | } 12 | 13 | public String getName() { 14 | return name; 15 | } 16 | 17 | public String getUrl() { 18 | return url; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoSource.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class PhotoSource { 4 | private String name; 5 | private String url; 6 | 7 | public PhotoSource(String name, String url) { 8 | this.name = name; 9 | this.url = url; 10 | } 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | public String getUrl() { 17 | return url; 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Tips.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Tips { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Tips(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueMayor.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class VenueMayor { 4 | 5 | private int count; 6 | private FoursquareUser user; 7 | 8 | public VenueMayor(int count, FoursquareUser user) { 9 | this.count = count; 10 | this.user = user; 11 | } 12 | 13 | public int getCount() { 14 | return count; 15 | } 16 | 17 | public FoursquareUser getUser() { 18 | return user; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ProviderMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class ProviderMixin { 9 | @JsonCreator 10 | ProviderMixin( 11 | @JsonProperty("id") String id){} 12 | } 13 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Photos.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Photos { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Photos(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Foursquare.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public interface Foursquare { 4 | 5 | UserOperations userOperations(); 6 | 7 | VenueOperations venueOperations(); 8 | 9 | CheckinOperations checkinOperations(); 10 | 11 | TipOperations tipOperations(); 12 | 13 | PhotoOperations photoOperations(); 14 | 15 | SettingOperations settingOperations(); 16 | 17 | SpecialOperations specialOperations(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueHistoryItem.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class VenueHistoryItem { 4 | 5 | private int beenHere; 6 | private Venue venue; 7 | 8 | public VenueHistoryItem(int beenHere, Venue venue) { 9 | this.beenHere = beenHere; 10 | this.venue = venue; 11 | } 12 | 13 | public int getBeenHere() { 14 | return beenHere; 15 | } 16 | 17 | public Venue getVenue() { 18 | return venue; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Reason.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class Reason { 4 | private String type; 5 | private String message; 6 | 7 | public Reason(String type, String message) { 8 | this.type = type; 9 | this.message = message; 10 | } 11 | 12 | public String getType() { 13 | return type; 14 | } 15 | 16 | public String getMessage() { 17 | return message; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Todos.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Todos { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Todos(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Specials.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Specials { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Specials(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/StringValueContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | 5 | @JsonDeserialize(using=StringValueContainerDeserializer.class) 6 | public class StringValueContainer { 7 | private String value; 8 | 9 | public StringValueContainer(String value) { 10 | this.value = value; 11 | } 12 | 13 | public String getValue() { 14 | return value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueLinks.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class VenueLinks { 6 | private int count; 7 | private List items; 8 | 9 | public VenueLinks(int count, List items) { 10 | this.count = count; 11 | this.items = items; 12 | } 13 | 14 | public int getCount() { 15 | return count; 16 | } 17 | 18 | public List getItems() { 19 | return items; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BooleanValueContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | 5 | @JsonDeserialize(using=BooleanValueContainerDeserializer.class) 6 | public class BooleanValueContainer { 7 | private Boolean value; 8 | 9 | public BooleanValueContainer(Boolean value) { 10 | this.value = value; 11 | } 12 | 13 | public Boolean getValue() { 14 | return value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Tip; 5 | 6 | @JsonDeserialize(using=TipContainerDeserializer.class) 7 | public class TipContainer { 8 | private Tip tip; 9 | 10 | public TipContainer(Tip tip) { 11 | this.tip = tip; 12 | } 13 | 14 | public Tip getTip() { 15 | return tip; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/MayorshipInfo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class MayorshipInfo { 6 | 7 | private int total; 8 | private List venues; 9 | 10 | public MayorshipInfo(int total, List venues) { 11 | this.total = total; 12 | this.venues = venues; 13 | } 14 | 15 | public int getTotal() { 16 | return total; 17 | } 18 | 19 | public List getVenues() { 20 | return venues; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoSizes.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class PhotoSizes { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public PhotoSizes(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueTips.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class VenueTips { 6 | 7 | private int count; 8 | private List groups; 9 | 10 | public VenueTips(int count, List groups) { 11 | this.count = count; 12 | this.groups = groups; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getGroups() { 20 | return groups; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/BadgeCount.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | 6 | @JsonIgnoreProperties(ignoreUnknown=true) 7 | public class BadgeCount { 8 | 9 | private int count; 10 | 11 | public BadgeCount(@JsonProperty("count") int count) { 12 | this.count = count; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodoContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Todo; 5 | 6 | @JsonDeserialize(using=TodoContainerDeserializer.class) 7 | public class TodoContainer { 8 | private Todo todo; 9 | 10 | public TodoContainer(Todo todo) { 11 | this.todo = todo; 12 | } 13 | 14 | public Todo getTodo() { 15 | return todo; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Friends.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Friends { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Friends(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoSourceMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class PhotoSourceMixin { 9 | @JsonCreator 10 | PhotoSourceMixin( 11 | @JsonProperty("name") String name, 12 | @JsonProperty("url") String url){} 13 | } 14 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/CheckinInfo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class CheckinInfo { 6 | 7 | private int total; 8 | private List checkins; 9 | 10 | public CheckinInfo(int total, List checkins) { 11 | this.total = total; 12 | this.checkins = checkins; 13 | } 14 | 15 | public int getTotal() { 16 | return total; 17 | } 18 | 19 | public List getCheckins() { 20 | return checkins; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoGroups.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class PhotoGroups { 6 | 7 | private int count; 8 | private List groups; 9 | 10 | public PhotoGroups(int count, List groups) { 11 | this.count = count; 12 | this.groups = groups; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getGroups() { 20 | return groups; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/TipTodoGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class TipTodoGroup { 6 | 7 | private int count; 8 | private List groups; 9 | 10 | public TipTodoGroup(int count, List groups) { 11 | this.count = count; 12 | this.groups = groups; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getGroups() { 20 | return groups; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipsContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Tips; 5 | 6 | @JsonDeserialize(using=TipsContainerDeserializer.class) 7 | public class TipsContainer { 8 | 9 | private Tips tips; 10 | 11 | public TipsContainer(Tips tips) { 12 | this.tips = tips; 13 | } 14 | 15 | public Tips getTips() { 16 | return tips; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Reasons.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Reasons { 6 | private int count; 7 | private List items; 8 | 9 | public Reasons(int count, List items) { 10 | this.count = count; 11 | this.items = items; 12 | } 13 | 14 | public int getCount() { 15 | return count; 16 | } 17 | 18 | public List getItems() { 19 | return items; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueHistory.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class VenueHistory { 6 | private int count; 7 | private List items; 8 | 9 | public VenueHistory(int count, List items) { 10 | this.count = count; 11 | this.items = items; 12 | } 13 | 14 | public int getCount() { 15 | return count; 16 | } 17 | 18 | public List getItems() { 19 | return items; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Photo; 5 | 6 | @JsonDeserialize(using=PhotoContainerDeserializer.class) 7 | public class PhotoContainer { 8 | private Photo photo; 9 | 10 | public PhotoContainer(Photo photo) { 11 | this.photo = photo; 12 | } 13 | 14 | public Photo getPhoto() { 15 | return photo; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Venue; 5 | 6 | @JsonDeserialize(using=VenueContainerDeserializer.class) 7 | public class VenueContainer { 8 | private Venue venue; 9 | 10 | public VenueContainer(Venue venue) { 11 | this.venue = venue; 12 | } 13 | 14 | public Venue getVenue() { 15 | return venue; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Keywords.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Keywords { 6 | private int count; 7 | private List items; 8 | 9 | public Keywords(int count, List items) { 10 | this.count = count; 11 | this.items = items; 12 | } 13 | 14 | public int getCount() { 15 | return count; 16 | } 17 | 18 | public List getItems() { 19 | return items; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/FriendInfo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class FriendInfo { 6 | 7 | private int total; 8 | private List groups; 9 | 10 | public FriendInfo(int total, List groups) { 11 | this.total = total; 12 | this.groups = groups; 13 | } 14 | 15 | public int getTotal() { 16 | return total; 17 | } 18 | 19 | public List getGroups() { 20 | return groups; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/HereNow.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class HereNow { 6 | 7 | private int count; 8 | private List groups; 9 | 10 | public HereNow(int count, List groups) { 11 | this.count = count; 12 | this.groups = groups; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getGroups() { 20 | return groups; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ReasonMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class ReasonMixin { 9 | @JsonCreator 10 | ReasonMixin( 11 | @JsonProperty("count") String type, 12 | @JsonProperty("items") String message){} 13 | } 14 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/CheckinCommentInfo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class CheckinCommentInfo { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public CheckinCommentInfo(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Keyword.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class Keyword { 4 | private String displayName; 5 | private String keyword; 6 | 7 | public Keyword(String displayName, String keyword) { 8 | this.displayName = displayName; 9 | this.keyword = keyword; 10 | } 11 | 12 | public String getDisplayName() { 13 | return displayName; 14 | } 15 | 16 | public String getKeyword() { 17 | return keyword; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodosContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Todos; 5 | 6 | @JsonDeserialize(using=TodosContainerDeserializer.class) 7 | public class TodosContainer { 8 | 9 | private Todos todos; 10 | 11 | public TodosContainer(Todos todos) { 12 | this.todos = todos; 13 | } 14 | 15 | public Todos getTodos() { 16 | return todos; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueStatsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class VenueStatsMixin { 9 | @JsonCreator 10 | VenueStatsMixin( 11 | @JsonProperty("checkinsCount") int checkinsCount, 12 | @JsonProperty("usersCount") int usersCount){} 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/allsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "settings":{ 7 | "receivePings":true, 8 | "receiveCommentPings":true, 9 | "sendToTwitter":false, 10 | "sendMayorshipsToTwitter":false, 11 | "sendBadgesToTwitter":false, 12 | "sendToFacebook":false, 13 | "sendMayorshipsToFacebook":false, 14 | "sendBadgesToFacebook":false, 15 | "foreignConsent":"undetermined" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinCommentInfoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | import org.springframework.social.foursquare.api.CheckinComment; 8 | 9 | abstract class CheckinCommentInfoMixin { 10 | @JsonCreator 11 | CheckinCommentInfoMixin( 12 | @JsonProperty("count") int count, 13 | @JsonProperty("items") List comments) {} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FriendsContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Friends; 5 | 6 | @JsonDeserialize(using=FriendsContainerDeserializer.class) 7 | public class FriendsContainer { 8 | private Friends friends; 9 | 10 | public FriendsContainer(Friends friends) { 11 | this.friends = friends; 12 | } 13 | 14 | public Friends getFriends() { 15 | return friends; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/KeywordMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class KeywordMixin { 9 | @JsonCreator 10 | KeywordMixin( 11 | @JsonProperty("displayName") String displayName, 12 | @JsonProperty("keyword") String keyword){} 13 | } 14 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoSizeMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | public class PhotoSizeMixin { 9 | @JsonCreator 10 | PhotoSizeMixin( 11 | @JsonProperty("url") String url, 12 | @JsonProperty("width") int width, 13 | @JsonProperty("height") int height){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Special; 5 | 6 | @JsonDeserialize(using=SpecialContainerDeserializer.class) 7 | public class SpecialContainer { 8 | private Special special; 9 | 10 | public SpecialContainer(Special special) { 11 | this.special = special; 12 | } 13 | 14 | public Special getSpecial() { 15 | return special; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/special.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "special":{ 7 | "id":"4cfc5c5ffabc2d437522ddd2", 8 | "type":"frequency", 9 | "message":"Free small cappuccino", 10 | "description":"every 3 check-ins", 11 | "unlocked":false, 12 | "icon":"frequency", 13 | "title":"Loyalty Special", 14 | "state":"locked", 15 | "provider":"foursquare", 16 | "redemption":"standard" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueBeenHere.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class VenueBeenHere { 4 | private int count; 5 | private boolean marked; 6 | 7 | public int getCount() { 8 | return count; 9 | } 10 | 11 | public void setCount(int count) { 12 | this.count = count; 13 | } 14 | 15 | public boolean isMarked() { 16 | return marked; 17 | } 18 | 19 | public void setMarked(boolean marked) { 20 | this.marked = marked; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Checkin; 5 | 6 | @JsonDeserialize(using=CheckinContainerDeserializer.class) 7 | public class CheckinContainer { 8 | 9 | private Checkin checkin; 10 | 11 | public CheckinContainer(Checkin checkin) { 12 | this.checkin = checkin; 13 | } 14 | 15 | public Checkin getCheckin() { 16 | return checkin; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ScoresMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class ScoresMixin { 9 | @JsonCreator 10 | ScoresMixin( 11 | @JsonProperty("recent") int recent, 12 | @JsonProperty("max") int max, 13 | @JsonProperty("checkinsCount") int checkinsCount) {} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipTodoGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 6 | import org.codehaus.jackson.annotate.JsonProperty; 7 | import org.springframework.social.foursquare.api.TipUserGroup; 8 | 9 | @JsonIgnoreProperties(ignoreUnknown=true) 10 | abstract class TipTodoGroupMixin { 11 | TipTodoGroupMixin( 12 | @JsonProperty("count") int count, 13 | @JsonProperty("groups") List groups){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueLinksContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.VenueLinks; 5 | 6 | @JsonDeserialize(using=VenueLinksContainerDeserializer.class) 7 | public class VenueLinksContainer { 8 | private VenueLinks links; 9 | 10 | public VenueLinksContainer(VenueLinks links) { 11 | this.links = links; 12 | } 13 | 14 | public VenueLinks getLinks() { 15 | return links; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoSize.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class PhotoSize { 4 | 5 | private String url; 6 | private int width; 7 | private int height; 8 | 9 | public PhotoSize(String url, int width, int height) { 10 | this.url = url; 11 | this.width = width; 12 | this.height = height; 13 | } 14 | 15 | public String getUrl() { 16 | return url; 17 | } 18 | 19 | public int getWidth() { 20 | return width; 21 | } 22 | 23 | public int getHeight() { 24 | return height; 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialsContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Specials; 5 | 6 | @JsonDeserialize(using=SpecialsContainerDeserializer.class) 7 | public class SpecialsContainer { 8 | private Specials specials; 9 | 10 | public SpecialsContainer(Specials specials) { 11 | this.specials = specials; 12 | } 13 | 14 | public Specials getSpecials() { 15 | return specials; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipsListContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 6 | import org.springframework.social.foursquare.api.Tip; 7 | 8 | @JsonDeserialize(using=TipsListContainerDeserializer.class) 9 | public class TipsListContainer { 10 | private List tips; 11 | 12 | public TipsListContainer(List tips) { 13 | this.tips = tips; 14 | } 15 | 16 | public List getTips() { 17 | return tips; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenuePhotosContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Photos; 5 | 6 | @JsonDeserialize(using=VenuePhotosContainerDeserializer.class) 7 | public class VenuePhotosContainer { 8 | 9 | private Photos photos; 10 | 11 | public VenuePhotosContainer(Photos photos) { 12 | this.photos = photos; 13 | } 14 | 15 | public Photos getPhotos() { 16 | return photos; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgeSetsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.BadgeGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class BadgeSetsMixin { 12 | @JsonCreator 13 | BadgeSetsMixin(@JsonProperty("groups") List groups){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Leaderboard.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Leaderboard { 6 | 7 | private int count; 8 | private List items; 9 | 10 | public Leaderboard(int count, List items) { 11 | this.count = count; 12 | this.items = items; 13 | } 14 | 15 | public int getCount() { 16 | return count; 17 | } 18 | 19 | public List getItems() { 20 | return items; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Todo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.Date; 4 | 5 | public class Todo { 6 | 7 | private String id; 8 | private Date createdAt; 9 | private Tip tip; 10 | 11 | public Todo(String id, Date createdAt, Tip tip) { 12 | this.id = id; 13 | this.createdAt = createdAt; 14 | this.tip = tip; 15 | } 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public Date getCreatedAt() { 22 | return createdAt; 23 | } 24 | 25 | public Tip getTip() { 26 | return tip; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinCommentMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class CheckinCommentMixin { 9 | // TODO: Determine real checkin comment JSON structure 10 | @JsonCreator 11 | CheckinCommentMixin( 12 | @JsonProperty("id") String id, 13 | @JsonProperty("text") String text){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/connect/FoursquareConnectionFactory.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.connect; 2 | 3 | import org.springframework.social.connect.support.OAuth2ConnectionFactory; 4 | import org.springframework.social.foursquare.api.Foursquare; 5 | 6 | public class FoursquareConnectionFactory extends OAuth2ConnectionFactory { 7 | 8 | public FoursquareConnectionFactory(String clientId, String clientSecret) { 9 | super("foursquare", new FoursquareServiceProvider(clientId, clientSecret), new FoursquareAdapter()); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Scores.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class Scores { 4 | 5 | private int recent; 6 | private int max; 7 | private int checkinsCount; 8 | 9 | public Scores(int recent, int max, int checkinsCount) { 10 | this.recent = recent; 11 | this.max = max; 12 | this.checkinsCount = checkinsCount; 13 | } 14 | 15 | public int getRecent() { 16 | return recent; 17 | } 18 | 19 | public int getMax() { 20 | return max; 21 | } 22 | 23 | public int getCheckinsCount() { 24 | return checkinsCount; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Tip; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class TipsMixin { 12 | @JsonCreator 13 | TipsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueMayorMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.springframework.social.foursquare.api.FoursquareUser; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown=true) 9 | abstract class VenueMayorMixin { 10 | @JsonCreator 11 | VenueMayorMixin( 12 | @JsonProperty("count") int count, 13 | @JsonProperty("user") FoursquareUser user){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/AllSettingsContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.AllSettings; 5 | 6 | @JsonDeserialize(using=AllSettingsContainerDeserializer.class) 7 | public class AllSettingsContainer { 8 | 9 | private AllSettings settings; 10 | 11 | public AllSettingsContainer(AllSettings settings) { 12 | this.settings = settings; 13 | } 14 | 15 | public AllSettings getSettings() { 16 | return settings; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/HereNowContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.CheckinInfo; 5 | 6 | @JsonDeserialize(using=HereNowContainerDeserializer.class) 7 | public class HereNowContainer { 8 | 9 | private CheckinInfo checkinInfo; 10 | 11 | public HereNowContainer(CheckinInfo checkinInfo) { 12 | this.checkinInfo = checkinInfo; 13 | } 14 | 15 | public CheckinInfo getCheckinInfo() { 16 | return checkinInfo; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodosMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Todo; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class TodosMixin { 12 | @JsonCreator 13 | TodosMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueHistoryItemMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.springframework.social.foursquare.api.Venue; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown=true) 9 | abstract class VenueHistoryItemMixin { 10 | @JsonCreator 11 | VenueHistoryItemMixin( 12 | @JsonProperty("beenHere") int beenHere, 13 | @JsonProperty("venue") Venue venue){} 14 | } 15 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueLink.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class VenueLink { 4 | 5 | private Provider provider; 6 | private String linkedId; 7 | private String url; 8 | 9 | public VenueLink(Provider provider, String linkedId, String url) { 10 | this.provider = provider; 11 | this.linkedId = linkedId; 12 | this.url = url; 13 | } 14 | 15 | public Provider getProvider() { 16 | return provider; 17 | } 18 | 19 | public String getLinkedId() { 20 | return linkedId; 21 | } 22 | 23 | public String getUrl() { 24 | return url; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgeUnlocksMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Checkin; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class BadgeUnlocksMixin { 12 | @JsonCreator 13 | BadgeUnlocksMixin( 14 | @JsonProperty("checkins") List checkins){} 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinCommentContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.CheckinComment; 5 | 6 | @JsonDeserialize(using=CheckinCommentContainerDeserializer.class) 7 | public class CheckinCommentContainer { 8 | private CheckinComment comment; 9 | 10 | public CheckinCommentContainer(CheckinComment comment) { 11 | this.comment = comment; 12 | } 13 | 14 | public CheckinComment getComment() { 15 | return comment; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FoursquareUserContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.FoursquareUser; 5 | 6 | @JsonDeserialize(using=FoursquareUserContainerDeserializer.class) 7 | public class FoursquareUserContainer { 8 | 9 | private final FoursquareUser user; 10 | 11 | public FoursquareUserContainer(FoursquareUser user) { 12 | this.user = user; 13 | } 14 | 15 | public FoursquareUser getUser() { 16 | return user; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Special; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class SpecialsMixin { 12 | @JsonCreator 13 | SpecialsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinInfoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Venue; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class CheckinInfoMixin { 12 | @JsonCreator 13 | CheckinInfoMixin( 14 | @JsonProperty("count") int total, 15 | @JsonProperty("items") List venues){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotosMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.PhotoGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class PhotosMixin { 12 | @JsonCreator 13 | PhotosMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("groups") List groups) {} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenuePhotosMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Photo; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class VenuePhotosMixin { 12 | @JsonCreator 13 | VenuePhotosMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoSizesMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.PhotoSize; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class PhotoSizesMixin { 12 | @JsonCreator 13 | PhotoSizesMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueLinksMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.VenueLink; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class VenueLinksMixin { 12 | @JsonCreator 13 | VenueLinksMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueTipsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.TipGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class VenueTipsMixin { 12 | @JsonCreator 13 | VenueTipsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("groups") List groups) {} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinInfoContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | 4 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 5 | import org.springframework.social.foursquare.api.CheckinInfo; 6 | 7 | @JsonDeserialize(using=CheckinInfoContainerDeserializer.class) 8 | public class CheckinInfoContainer { 9 | 10 | private final CheckinInfo checkinInfo; 11 | 12 | public CheckinInfoContainer(CheckinInfo checkinInfo) { 13 | this.checkinInfo = checkinInfo; 14 | } 15 | 16 | public CheckinInfo getCheckinInfo() { 17 | return checkinInfo; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FriendsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class FriendsMixin { 12 | @JsonCreator 13 | FriendsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinListContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 6 | import org.springframework.social.foursquare.api.Checkin; 7 | 8 | @JsonDeserialize(using=CheckinListContainerDeserializer.class) 9 | public class CheckinListContainer { 10 | 11 | private List checkins; 12 | 13 | public CheckinListContainer(List checkins) { 14 | this.checkins = checkins; 15 | } 16 | 17 | public List getCheckins() { 18 | return checkins; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/MayorshipInfoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Venue; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class MayorshipInfoMixin { 12 | @JsonCreator 13 | MayorshipInfoMixin( 14 | @JsonProperty("count") int total, 15 | @JsonProperty("items") List venues){} 16 | 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ReasonsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Reasons; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class ReasonsMixin { 12 | @JsonCreator 13 | ReasonsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueHistoryContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.VenueHistory; 5 | 6 | @JsonDeserialize(using=VenueHistoryContainerDeserializer.class) 7 | public class VenueHistoryContainer { 8 | 9 | private VenueHistory venueHistory; 10 | 11 | public VenueHistoryContainer(VenueHistory venueHistory) { 12 | this.venueHistory = venueHistory; 13 | } 14 | 15 | public VenueHistory getVenueHistory() { 16 | return venueHistory; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueLinkMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.springframework.social.foursquare.api.Provider; 7 | 8 | @JsonIgnoreProperties(ignoreUnknown=true) 9 | abstract class VenueLinkMixin { 10 | @JsonCreator 11 | VenueLinkMixin( 12 | @JsonProperty("provider") Provider provider, 13 | @JsonProperty("linkedId") String linkedId, 14 | @JsonProperty("url") String url){} 15 | } 16 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgeImageMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | 9 | @JsonIgnoreProperties(ignoreUnknown=true) 10 | abstract class BadgeImageMixin { 11 | @JsonCreator 12 | BadgeImageMixin( 13 | @JsonProperty("prefix") String prefix, 14 | @JsonProperty("name") String name, 15 | @JsonProperty("sizes") List sizes){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ContactInfoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class ContactInfoMixin { 9 | @JsonCreator 10 | ContactInfoMixin( 11 | @JsonProperty("email") String email, 12 | @JsonProperty("twitter") String twitter, 13 | @JsonProperty("phone") String phone, 14 | @JsonProperty("formattedPhone") String formattedPhone) {} 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/HereNowMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUserGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class HereNowMixin { 12 | @JsonCreator 13 | HereNowMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("groups") List groups){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/KeywordsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Keyword; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class KeywordsMixin { 12 | @JsonCreator 13 | KeywordsMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CategoriesContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 6 | import org.springframework.social.foursquare.api.Category; 7 | 8 | @JsonDeserialize(using=CategoriesContainerDeserializer.class) 9 | public class CategoriesContainer { 10 | 11 | private List categories; 12 | 13 | public CategoriesContainer(List categories) { 14 | this.categories = categories; 15 | } 16 | 17 | public List getCategories() { 18 | return categories; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FriendInfoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUserGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class FriendInfoMixin { 12 | @JsonCreator 13 | FriendInfoMixin( 14 | @JsonProperty("count") int total, 15 | @JsonProperty("groups") List groups){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/LeaderboardContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.Leaderboard; 5 | 6 | @JsonDeserialize(using=LeaderboardContainerDeserializer.class) 7 | public class LeaderboardContainer { 8 | 9 | private Leaderboard leaderboard; 10 | 11 | public LeaderboardContainer(Leaderboard leaderboard) { 12 | this.leaderboard = leaderboard; 13 | } 14 | 15 | public Leaderboard getLeaderboard() { 16 | return leaderboard; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueHistoryMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.VenueHistoryItem; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class VenueHistoryMixin { 12 | @JsonCreator 13 | VenueHistoryMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/FoursquareApiException.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import org.springframework.social.SocialException; 4 | 5 | @SuppressWarnings("serial") 6 | public class FoursquareApiException extends SocialException { 7 | 8 | private int code; 9 | private String errorType; 10 | 11 | public FoursquareApiException(int code, String errorType, String message) { 12 | super(message); 13 | this.code = code; 14 | this.errorType = errorType; 15 | } 16 | 17 | public int getCode() { 18 | return code; 19 | } 20 | 21 | public String getErrorType() { 22 | return errorType; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueSearchContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 6 | import org.springframework.social.foursquare.api.Venue; 7 | 8 | @JsonDeserialize(using=VenueSearchContainerDeserializer.class) 9 | public class VenueSearchContainer { 10 | 11 | List venues; 12 | 13 | public VenueSearchContainer(List venues) { 14 | this.venues = venues; 15 | } 16 | 17 | public List getVenues() { 18 | return venues; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/LeaderboardMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.LeaderboardItem; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | public class LeaderboardMixin { 12 | @JsonCreator 13 | LeaderboardMixin( 14 | @JsonProperty("count") int count, 15 | @JsonProperty("items") List items){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgesResponseContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.BadgesResponse; 5 | 6 | @JsonDeserialize(using=BadgesResponseContainerDeserializer.class) 7 | public class BadgesResponseContainer { 8 | 9 | private BadgesResponse response; 10 | 11 | public BadgesResponseContainer(BadgesResponse response) { 12 | this.response = response; 13 | } 14 | 15 | public BadgesResponse getResponse() { 16 | return response; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ExploreResponseContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.ExploreResponse; 5 | 6 | @JsonDeserialize(using=ExploreResponseContainerDeserializer.class) 7 | public class ExploreResponseContainer { 8 | 9 | private ExploreResponse response; 10 | 11 | public ExploreResponseContainer(ExploreResponse response) { 12 | this.response = response; 13 | } 14 | 15 | public ExploreResponse getResponse() { 16 | return response; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.VenueGroupItem; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class VenueGroupMixin { 12 | @JsonCreator 13 | VenueGroupMixin( 14 | @JsonProperty("type") String type, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("items") List items){} 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/LeaderboardItem.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class LeaderboardItem { 4 | 5 | private int rank; 6 | private Scores scores; 7 | private FoursquareUser user; 8 | 9 | public LeaderboardItem(FoursquareUser user, int rank, Scores scores) { 10 | this.user = user; 11 | this.rank = rank; 12 | this.scores = scores; 13 | } 14 | 15 | public int getRank() { 16 | return rank; 17 | } 18 | 19 | public Scores getScores() { 20 | return scores; 21 | } 22 | 23 | public FoursquareUser getUser() { 24 | return user; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/RequestsContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 6 | import org.springframework.social.foursquare.api.FoursquareUser; 7 | 8 | @JsonDeserialize(using=RequestsContainerDeserializer.class) 9 | public class RequestsContainer { 10 | 11 | private List requests; 12 | 13 | public RequestsContainer(List requests) { 14 | this.requests = requests; 15 | } 16 | 17 | public List getRequests() { 18 | return requests; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/UserSearchResponseContainer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 4 | import org.springframework.social.foursquare.api.UserSearchResponse; 5 | 6 | @JsonDeserialize(using=UserSearchResponseContainerDeserializer.class) 7 | public class UserSearchResponseContainer { 8 | 9 | private UserSearchResponse results; 10 | 11 | public UserSearchResponseContainer(UserSearchResponse results) { 12 | this.results = results; 13 | } 14 | 15 | public UserSearchResponse getResults() { 16 | return results; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Tip; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class TipGroupMixin { 12 | @JsonCreator 13 | TipGroupMixin( 14 | @JsonProperty("type") String type, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("count") int count, 17 | @JsonProperty("items") List items){} 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/BadgeImage.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class BadgeImage { 6 | 7 | private String prefix; 8 | private String name; 9 | private List sizes; 10 | 11 | public BadgeImage(String prefix, String name, List sizes) { 12 | this.prefix = prefix; 13 | this.name = name; 14 | this.sizes = sizes; 15 | } 16 | 17 | public String getPrefix() { 18 | return prefix; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public List getSizes() { 26 | return sizes; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class VenueGroup { 6 | private String type; 7 | private String name; 8 | private List items; 9 | 10 | public VenueGroup(String type, String name, List items) { 11 | this.type = type; 12 | this.name = name; 13 | this.items = items; 14 | } 15 | 16 | public String getType() { 17 | return type; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public List getItems() { 25 | return items; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueGroupItem.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class VenueGroupItem { 6 | private Reasons reasons; 7 | private Venue venue; 8 | private List tips; 9 | 10 | public VenueGroupItem(Reasons reasons, Venue venue, List tips) { 11 | this.reasons = reasons; 12 | this.venue = venue; 13 | this.tips = tips; 14 | } 15 | 16 | public Reasons getReasons() { 17 | return reasons; 18 | } 19 | 20 | public Venue getVenue() { 21 | return venue; 22 | } 23 | 24 | public List getTips() { 25 | return tips; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.PhotoGroup; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class PhotoGroupMixin { 12 | @JsonCreator 13 | PhotoGroupMixin( 14 | @JsonProperty("type") String type, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("count") int count, 17 | @JsonProperty("items") List items){} 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/UserSearchResponse.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class UserSearchResponse { 7 | 8 | private final List results; 9 | private Map unmatched; 10 | 11 | public UserSearchResponse(List results, Map unmatched) { 12 | this.results = results; 13 | this.unmatched = unmatched; 14 | } 15 | 16 | public List getResults() { 17 | return results; 18 | } 19 | 20 | public Map getUnmatched() { 21 | return unmatched; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FoursquareDateDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.Date; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.map.JsonDeserializer; 10 | 11 | public class FoursquareDateDeserializer extends JsonDeserializer { 12 | 13 | @Override 14 | public Date deserialize(JsonParser jp, DeserializationContext ctxt) 15 | throws IOException, JsonProcessingException { 16 | return new Date(Long.valueOf(jp.getText()) * 1000); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipUserGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class TipUserGroupMixin { 12 | @JsonCreator 13 | TipUserGroupMixin( 14 | @JsonProperty("type") String type, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("count") int count, 17 | @JsonProperty("items") List items){} 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueStats.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class VenueStats { 4 | 5 | private int checkinsCount; 6 | private int usersCount; 7 | 8 | public VenueStats(int checkinsCount, int usersCount) { 9 | this.checkinsCount = checkinsCount; 10 | this.usersCount = usersCount; 11 | } 12 | 13 | public int getCheckinsCount() { 14 | return checkinsCount; 15 | } 16 | 17 | public void setCheckinsCount(int checkinsCount) { 18 | this.checkinsCount = checkinsCount; 19 | } 20 | 21 | public int getUsersCount() { 22 | return usersCount; 23 | } 24 | 25 | public void setUsersCount(int usersCount) { 26 | this.usersCount = usersCount; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgesResponseMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.Map; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Badge; 9 | import org.springframework.social.foursquare.api.BadgeSets; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown=true) 12 | abstract class BadgesResponseMixin { 13 | @JsonCreator 14 | BadgesResponseMixin( 15 | @JsonProperty("sets") BadgeSets sets, 16 | @JsonProperty("badges") Map badges){} 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BooleanValueContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | 9 | public class BooleanValueContainerDeserializer extends AbstractFoursquareDeserializer { 10 | @Override 11 | public BooleanValueContainer deserialize(JsonParser jp, DeserializationContext ctxt) 12 | throws IOException, JsonProcessingException { 13 | return new BooleanValueContainer(deserializeNestedResponseObject(jp, "value", Boolean.class)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/TipGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class TipGroup { 6 | 7 | private String type; 8 | private String name; 9 | private int count; 10 | private List items; 11 | 12 | public TipGroup(String type, String name, int count, List items) { 13 | this.type = type; 14 | this.name = name; 15 | this.count = count; 16 | this.items = items; 17 | } 18 | 19 | public String getType() { 20 | return type; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public int getCount() { 28 | return count; 29 | } 30 | 31 | public List getItems() { 32 | return items; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/StringValueContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | 9 | 10 | public class StringValueContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public StringValueContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new StringValueContainer(deserializeNestedResponseObject(jp, "message", String.class)); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodoContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Todo; 9 | 10 | public class TodoContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public TodoContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new TodoContainer(deserializeNestedResponseObject(jp, "todo", Todo.class)); 15 | } 16 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FoursquareUserGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | public class FoursquareUserGroupMixin { 12 | @JsonCreator 13 | FoursquareUserGroupMixin( 14 | @JsonProperty("type") String type, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("count") int count, 17 | @JsonProperty("items") List items) {} 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/LeaderboardItemMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.springframework.social.foursquare.api.FoursquareUser; 7 | import org.springframework.social.foursquare.api.Scores; 8 | 9 | @JsonIgnoreProperties(ignoreUnknown=true) 10 | abstract class LeaderboardItemMixin { 11 | @JsonCreator 12 | LeaderboardItemMixin( 13 | @JsonProperty("user") FoursquareUser user, 14 | @JsonProperty("rank") int rank, 15 | @JsonProperty("scores") Scores scores){} 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipsContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Tips; 9 | 10 | public class TipsContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public TipsContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new TipsContainer(deserializeNestedResponseObject(jp, "tips", Tips.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/UserSearchResponseMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.codehaus.jackson.annotate.JsonCreator; 7 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 8 | import org.codehaus.jackson.annotate.JsonProperty; 9 | import org.springframework.social.foursquare.api.FoursquareUser; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown=true) 12 | abstract class UserSearchResponseMixin { 13 | @JsonCreator 14 | UserSearchResponseMixin( 15 | @JsonProperty("results") List results, 16 | @JsonProperty("unmatched") Map unmatched){} 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Tip; 9 | 10 | public class TipContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public TipContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new TipContainer(deserializeNestedResponseObject(jp, "tip", Tip.class)); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | rootProject.name = 'spring-social-foursquare' 18 | 19 | include 'docs' 20 | include 'spring-social-foursquare' 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Photo; 9 | 10 | public class PhotoContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public PhotoContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new PhotoContainer(deserializeNestedResponseObject(jp, "photo", Photo.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.Date; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 9 | import org.springframework.social.foursquare.api.Tip; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown=true) 12 | abstract class TodoMixin { 13 | @JsonCreator 14 | TodoMixin( 15 | @JsonProperty("id") String id, 16 | @JsonProperty("createdAt") @JsonDeserialize(using=FoursquareDateDeserializer.class) Date createdAt, 17 | @JsonProperty("tip") Tip tip){} 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TodosContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Todos; 9 | 10 | public class TodosContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public TodosContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new TodosContainer(deserializeNestedResponseObject(jp, "todos", Todos.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Venue; 9 | 10 | public class VenueContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public VenueContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new VenueContainer(deserializeNestedResponseObject(jp, "venue", Venue.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class PhotoGroup { 6 | 7 | private String type; 8 | private String name; 9 | private int count; 10 | private List items; 11 | 12 | public PhotoGroup(String type, String name, int count, List items) { 13 | this.type = type; 14 | this.name = name; 15 | this.count = count; 16 | this.items = items; 17 | } 18 | 19 | public String getType() { 20 | return type; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public int getCount() { 28 | return count; 29 | } 30 | 31 | public List getItems() { 32 | return items; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FriendMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | public class FriendMixin { 9 | @JsonCreator 10 | FriendMixin( 11 | @JsonProperty("id") long id, 12 | @JsonProperty("firstName") String firstName, 13 | @JsonProperty("lastName") String lastName, 14 | @JsonProperty("photoUrl") String photoUrl, 15 | @JsonProperty("gender") String gender, 16 | @JsonProperty("homeCity") String homeCity, 17 | @JsonProperty("relationship") String relationship) {} 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FriendsContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Friends; 9 | 10 | public class FriendsContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public FriendsContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new FriendsContainer(deserializeNestedResponseObject(jp, "friends", Friends.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/TipUserGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class TipUserGroup { 6 | 7 | private String type; 8 | private String name; 9 | private int count; 10 | private List items; 11 | 12 | public TipUserGroup(String type, String name, int count, List items) { 13 | this.type = type; 14 | this.name = name; 15 | this.count = count; 16 | this.items = items; 17 | } 18 | 19 | public String getType() { 20 | return type; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public int getCount() { 28 | return count; 29 | } 30 | 31 | public List getItems() { 32 | return items; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/HereNowContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.CheckinInfo; 9 | 10 | public class HereNowContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public HereNowContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new HereNowContainer(deserializeNestedResponseObject(jp, "hereNow", CheckinInfo.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Special; 9 | 10 | public class SpecialContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public SpecialContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new SpecialContainer(deserializeNestedResponseObject(jp, "special", Special.class)); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialsContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Specials; 9 | 10 | public class SpecialsContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public SpecialsContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new SpecialsContainer(deserializeNestedResponseObject(jp, "specials", Specials.class)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenuePhotosContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Photos; 9 | 10 | public class VenuePhotosContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public VenuePhotosContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new VenuePhotosContainer(deserializeNestedResponseObject(jp, "photos", Photos.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinInfoContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.CheckinInfo; 9 | 10 | public class CheckinInfoContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public CheckinInfoContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new CheckinInfoContainer(deserializeNestedResponseObject(jp, "checkins", CheckinInfo.class)); 15 | } 16 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueGroupItemMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Reasons; 9 | import org.springframework.social.foursquare.api.Tip; 10 | import org.springframework.social.foursquare.api.Venue; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown=true) 13 | abstract class VenueGroupItemMixin { 14 | @JsonCreator 15 | VenueGroupItemMixin( 16 | @JsonProperty("reasons") Reasons reasons, 17 | @JsonProperty("venue") Venue venue, 18 | @JsonProperty("tips") List tips){} 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueLinksContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.VenueLinks; 9 | 10 | 11 | public class VenueLinksContainerDeserializer extends AbstractFoursquareDeserializer { 12 | @Override 13 | public VenueLinksContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new VenueLinksContainer(deserializeNestedResponseObject(jp, "links", VenueLinks.class)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/SettingOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public interface SettingOperations { 4 | 5 | /** 6 | * Retrieve the values of all the authenticated user's settings 7 | * @return All settings 8 | */ 9 | AllSettings getAll(); 10 | 11 | /** 12 | * Retrieve a boolean setting value 13 | * @param settingId The setting ID/name 14 | * @return The setting value 15 | */ 16 | Boolean getSetting(String settingId); 17 | 18 | 19 | /** 20 | * Change a setting value 21 | * @param settingId Setting name 22 | * @param value true or false 23 | * @return A confirmation message 24 | */ 25 | String setSetting(String settingId, Boolean value); 26 | 27 | public static final String SETTINGS_ENDPOINT = "settings/"; 28 | } 29 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/AllSettingsContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.AllSettings; 9 | 10 | public class AllSettingsContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public AllSettingsContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new AllSettingsContainer(deserializeNestedResponseObject(jp, "settings", AllSettings.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/FoursquareUserGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class FoursquareUserGroup { 6 | 7 | private String type; 8 | private String name; 9 | private int count; 10 | private List items; 11 | 12 | public FoursquareUserGroup(String type, String name, int count, List items) { 13 | this.type = type; 14 | this.name = name; 15 | this.count = count; 16 | this.items = items; 17 | } 18 | 19 | public String getType() { 20 | return type; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public int getCount() { 28 | return count; 29 | } 30 | 31 | public List getItems() { 32 | return items; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueHistoryContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.VenueHistory; 9 | 10 | public class VenueHistoryContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public VenueHistoryContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new VenueHistoryContainer(deserializeNestedResponseObject(jp, "venues", VenueHistory.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Checkin; 9 | 10 | public class CheckinContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public CheckinContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | CheckinContainer result = new CheckinContainer(deserializeNestedResponseObject(jp, "checkin", Checkin.class)); 15 | return result; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinCommentContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.CheckinComment; 9 | 10 | public class CheckinCommentContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public CheckinCommentContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return new CheckinCommentContainer(deserializeNestedResponseObject(jp, "comment", CheckinComment.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgesResponseContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.BadgesResponse; 9 | 10 | public class BadgesResponseContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public BadgesResponseContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return deserializeResponseObject(jp, BadgesResponseContainer.class, BadgesResponse.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ExploreResponseContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.ExploreResponse; 9 | 10 | public class ExploreResponseContainerDeserializer extends AbstractFoursquareDeserializer { 11 | @Override 12 | public ExploreResponseContainer deserialize(JsonParser jp, DeserializationContext ctxt) 13 | throws IOException, JsonProcessingException { 14 | return deserializeResponseObject(jp, ExploreResponseContainer.class, ExploreResponse.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/ExploreResponseMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.codehaus.jackson.annotate.JsonCreator; 7 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 8 | import org.codehaus.jackson.annotate.JsonProperty; 9 | import org.springframework.social.foursquare.api.Keywords; 10 | import org.springframework.social.foursquare.api.VenueGroup; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown=true) 13 | abstract class ExploreResponseMixin { 14 | @JsonCreator 15 | ExploreResponseMixin( 16 | @JsonProperty("keywords") Keywords keywords, 17 | @JsonProperty("groups") List groups, 18 | @JsonProperty("warning") Map warning){} 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/ExploreResponse.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public class ExploreResponse { 7 | 8 | private Keywords keywords; 9 | private List groups; 10 | private Map warning; 11 | 12 | public ExploreResponse(Keywords keywords, List groups, Map warning) { 13 | this.keywords = keywords; 14 | this.groups = groups; 15 | this.warning = warning; 16 | } 17 | 18 | public Keywords getKeywords() { 19 | return keywords; 20 | } 21 | 22 | public List getGroups() { 23 | return groups; 24 | } 25 | 26 | public Map getWarning() { 27 | return warning; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FoursquareUserContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | 10 | public class FoursquareUserContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public FoursquareUserContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new FoursquareUserContainer(deserializeNestedResponseObject(jp, "user", FoursquareUser.class)); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/LeaderboardContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.Leaderboard; 9 | 10 | public class LeaderboardContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public LeaderboardContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | return new LeaderboardContainer(deserializeNestedResponseObject(jp, "leaderboard", Leaderboard.class)); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgeMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.BadgeImage; 9 | import org.springframework.social.foursquare.api.BadgeUnlocks; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown=true) 12 | abstract class BadgeMixin { 13 | @JsonCreator 14 | BadgeMixin( 15 | @JsonProperty("id") String id, 16 | @JsonProperty("name") String name, 17 | @JsonProperty("description") String description, 18 | @JsonProperty("image") BadgeImage image, 19 | @JsonProperty("unlocks") List unlocks){} 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/LocationMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class LocationMixin { 9 | @JsonCreator 10 | LocationMixin( 11 | @JsonProperty("address") String address, 12 | @JsonProperty("crossStreet") String crossStreet, 13 | @JsonProperty("city") String city, 14 | @JsonProperty("state") String state, 15 | @JsonProperty("postalCode") String postalCode, 16 | @JsonProperty("country") String country, 17 | @JsonProperty("lat") double latitude, 18 | @JsonProperty("lng") double longitude){} 19 | 20 | @JsonProperty("distance") 21 | int distance; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/UserSearchResponseContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | 5 | import org.codehaus.jackson.JsonParser; 6 | import org.codehaus.jackson.JsonProcessingException; 7 | import org.codehaus.jackson.map.DeserializationContext; 8 | import org.springframework.social.foursquare.api.UserSearchResponse; 9 | 10 | public class UserSearchResponseContainerDeserializer extends AbstractFoursquareDeserializer { 11 | 12 | @Override 13 | public UserSearchResponseContainer deserialize(JsonParser jp, DeserializationContext ctxt) 14 | throws IOException, JsonProcessingException { 15 | 16 | return deserializeResponseObject(jp, UserSearchResponseContainer.class, UserSearchResponse.class); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CategoryMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.Category; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class CategoryMixin { 12 | @JsonCreator 13 | CategoryMixin( 14 | @JsonProperty("id") String id, 15 | @JsonProperty("name") String name, 16 | @JsonProperty("pluralName") String pluralName, 17 | @JsonProperty("iconUrl") String iconUrl, 18 | @JsonProperty("primary") boolean primary) {} 19 | 20 | @JsonProperty("parents") 21 | List parents; 22 | 23 | @JsonProperty("categories") 24 | List children; 25 | } 26 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/BadgeGroupMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.BadgeGroup; 9 | import org.springframework.social.foursquare.api.BadgeImage; 10 | 11 | @JsonIgnoreProperties(ignoreUnknown=true) 12 | abstract class BadgeGroupMixin { 13 | @JsonCreator 14 | BadgeGroupMixin( 15 | @JsonProperty("type") String type, 16 | @JsonProperty("name") String name, 17 | @JsonProperty("items") List items, 18 | @JsonProperty("groups") List groups){} 19 | 20 | @JsonProperty("image") 21 | BadgeImage image; 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipsListContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.type.TypeReference; 10 | import org.springframework.social.foursquare.api.Tip; 11 | 12 | public class TipsListContainerDeserializer extends AbstractFoursquareDeserializer { 13 | 14 | @SuppressWarnings("unchecked") 15 | @Override 16 | public TipsListContainer deserialize(JsonParser jp, 17 | DeserializationContext ctxt) throws IOException, 18 | JsonProcessingException { 19 | return new TipsListContainer((List) deserializeNestedList(jp, "tips", new TypeReference>() { })); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinListContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.type.TypeReference; 10 | import org.springframework.social.foursquare.api.Checkin; 11 | 12 | public class CheckinListContainerDeserializer extends AbstractFoursquareDeserializer { 13 | @SuppressWarnings("unchecked") 14 | @Override 15 | public CheckinListContainer deserialize(JsonParser jp, DeserializationContext ctxt) 16 | throws IOException, JsonProcessingException { 17 | return new CheckinListContainer((List) deserializeNestedList(jp, "recent", new TypeReference>() {})); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CategoriesContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.type.TypeReference; 10 | import org.springframework.social.foursquare.api.Category; 11 | 12 | public class CategoriesContainerDeserializer extends AbstractFoursquareDeserializer { 13 | @SuppressWarnings("unchecked") 14 | @Override 15 | public CategoriesContainer deserialize(JsonParser jp, DeserializationContext ctxt) 16 | throws IOException, JsonProcessingException { 17 | return new CategoriesContainer((List) deserializeNestedList(jp, "categories", new TypeReference>(){})); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/connect/FoursquareServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.connect; 2 | 3 | import org.springframework.social.foursquare.api.Foursquare; 4 | import org.springframework.social.foursquare.api.impl.FoursquareTemplate; 5 | import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider; 6 | 7 | public class FoursquareServiceProvider extends AbstractOAuth2ServiceProvider { 8 | 9 | private final String clientId; 10 | private final String clientSecret; 11 | 12 | public FoursquareServiceProvider(String clientId, String clientSecret) { 13 | super(new FoursquareOAuth2Template(clientId, clientSecret)); 14 | this.clientId = clientId; 15 | this.clientSecret = clientSecret; 16 | } 17 | 18 | public Foursquare getApi(String accessToken) { 19 | return new FoursquareTemplate(clientId, clientSecret, accessToken); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/SpecialOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | 4 | public interface SpecialOperations { 5 | 6 | /** 7 | * Retrieve details of a special 8 | * @param specialId Special ID 9 | * @param venueId Venue ID 10 | * @return Special 11 | */ 12 | Special get(String specialId, String venueId); 13 | 14 | /** 15 | * Search for specials near the specified location 16 | * @param latitude Latitude 17 | * @param longitude Longitude 18 | * @param locationAccuracy Location accuracy in meters 19 | * @param altitude Altitude in meters 20 | * @param altitudeAccuracy Altitude accuracy in meters 21 | * @param limit Result set limit 22 | * @return A list of specials 23 | */ 24 | Specials search(Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy, Integer limit); 25 | 26 | public static final String SPECIALS_ENDPOINT = "specials/"; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueSearchContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.type.TypeReference; 10 | import org.springframework.social.foursquare.api.Venue; 11 | 12 | public class VenueSearchContainerDeserializer extends AbstractFoursquareDeserializer { 13 | 14 | @SuppressWarnings("unchecked") 15 | @Override 16 | public VenueSearchContainer deserialize(JsonParser jp, DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException { 18 | Listresult = (List) deserializeNestedList(jp, "venues", new TypeReference>(){}); 19 | return new VenueSearchContainer(result); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/RequestsContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.codehaus.jackson.JsonParser; 7 | import org.codehaus.jackson.JsonProcessingException; 8 | import org.codehaus.jackson.map.DeserializationContext; 9 | import org.codehaus.jackson.type.TypeReference; 10 | import org.springframework.social.foursquare.api.FoursquareUser; 11 | 12 | public class RequestsContainerDeserializer extends AbstractFoursquareDeserializer { 13 | 14 | @SuppressWarnings("unchecked") 15 | @Override 16 | public RequestsContainer deserialize(JsonParser jp, DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException { 18 | return new RequestsContainer((List) deserializeNestedList(jp, "requests", new TypeReference>(){})); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/BadgeGroup.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class BadgeGroup { 6 | 7 | private String type; 8 | private String name; 9 | private List items; 10 | private List groups; 11 | private BadgeImage image; 12 | 13 | public BadgeGroup(String type, String name, List items, List groups) { 14 | this.type = type; 15 | this.name = name; 16 | this.items = items; 17 | this.groups = groups; 18 | } 19 | 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public List getItems() { 29 | return items; 30 | } 31 | 32 | public List getGroups() { 33 | return groups; 34 | } 35 | 36 | public BadgeImage getImage() { 37 | return image; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Badge.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Badge { 6 | private String id; 7 | private String name; 8 | private String description; 9 | private BadgeImage image; 10 | private List unlocks; 11 | 12 | public Badge(String id, String name, String description, BadgeImage image, List unlocks) { 13 | this.id = id; 14 | this.name = name; 15 | this.description = description; 16 | this.image = image; 17 | this.unlocks = unlocks; 18 | } 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public String getDescription() { 29 | return description; 30 | } 31 | 32 | public BadgeImage getImage() { 33 | return image; 34 | } 35 | 36 | public List getUnlocks() { 37 | return unlocks; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/AllSettingsMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | @JsonIgnoreProperties(ignoreUnknown=true) 8 | abstract class AllSettingsMixin { 9 | @JsonCreator 10 | AllSettingsMixin( 11 | @JsonProperty("receivePings") boolean receivePings, 12 | @JsonProperty("receiveCommentPings") boolean receiveCommentPings, 13 | @JsonProperty("sendToTwitter") boolean sendToTwitter, 14 | @JsonProperty("sendMayorshipsToTwitter") boolean sendMayorshipsToTwitter, 15 | @JsonProperty("sendBadgesToTwitter") boolean sendBadgesToTwitter, 16 | @JsonProperty("sendToFacebook") boolean sendToFacebook, 17 | @JsonProperty("sendMayorshipsToFacebook") boolean sendMayorshipsToFacebook, 18 | @JsonProperty("sendBadgesToFacebook") boolean sendBadgesToFacebook, 19 | @JsonProperty("foreignConsent") String foreignConsent){} 20 | } 21 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Photo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.Date; 4 | 5 | public class Photo { 6 | 7 | private String id; 8 | private Date createdAt; 9 | private String url; 10 | private PhotoSizes sizes; 11 | private PhotoSource source; 12 | private FoursquareUser user; 13 | private Venue venue; 14 | 15 | public Photo(String id, Date createdAt, String url, PhotoSizes sizes, FoursquareUser user) { 16 | this.id = id; 17 | this.createdAt = createdAt; 18 | this.url = url; 19 | this.sizes = sizes; 20 | this.user = user; 21 | } 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public Date getCreatedAt() { 28 | return createdAt; 29 | } 30 | 31 | public String getUrl() { 32 | return url; 33 | } 34 | 35 | public PhotoSizes getSizes() { 36 | return sizes; 37 | } 38 | 39 | public PhotoSource getSource() { 40 | return source; 41 | } 42 | 43 | public FoursquareUser getUser() { 44 | return user; 45 | } 46 | 47 | public Venue getVenue() { 48 | return venue; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Tip.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.Date; 4 | 5 | public class Tip { 6 | 7 | private String id; 8 | private Date createdAt; 9 | private String text; 10 | private String status; 11 | private Venue venue; 12 | private FoursquareUser user; 13 | private TipTodoGroup todo; 14 | private TipTodoGroup done; 15 | 16 | public Tip(String id, Date createdAt, String text) { 17 | this.id = id; 18 | this.createdAt = createdAt; 19 | this.text = text; 20 | } 21 | 22 | public String getId() { 23 | return id; 24 | } 25 | 26 | public Date getCreatedAt() { 27 | return createdAt; 28 | } 29 | 30 | public String getText() { 31 | return text; 32 | } 33 | 34 | public String getStatus() { 35 | return status; 36 | } 37 | 38 | public Venue getVenue() { 39 | return venue; 40 | } 41 | 42 | public FoursquareUser getUser() { 43 | return user; 44 | } 45 | 46 | public TipTodoGroup getTodo() { 47 | return todo; 48 | } 49 | 50 | public TipTodoGroup getDone() { 51 | return done; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Category.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Category { 6 | 7 | private String id; 8 | private String name; 9 | private String pluralName; 10 | private String iconUrl; 11 | private List parents; 12 | private List children; 13 | private boolean primary; 14 | 15 | public Category(String id, String name, String pluralName, String iconUrl, boolean primary) { 16 | this.id = id; 17 | this.name = name; 18 | this.pluralName = pluralName; 19 | this.iconUrl = iconUrl; 20 | this.primary = primary; 21 | } 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public String getPluralName() { 32 | return pluralName; 33 | } 34 | 35 | public String getIconUrl() { 36 | return iconUrl; 37 | } 38 | 39 | public List getParents() { 40 | return parents; 41 | } 42 | 43 | public List getChildren() { 44 | return children; 45 | } 46 | 47 | public boolean isPrimary() { 48 | return primary; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/ContactInfo.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class ContactInfo { 4 | 5 | private String email; 6 | private String twitter; 7 | private String phone; 8 | private String formattedPhone; 9 | 10 | public ContactInfo(String email, String twitter, String phone, String formattedPhone) { 11 | this.email = email; 12 | this.twitter = twitter; 13 | this.phone = phone; 14 | this.formattedPhone = formattedPhone; 15 | } 16 | 17 | public String getEmail() { 18 | return email; 19 | } 20 | 21 | public void setEmail(String email) { 22 | this.email = email; 23 | } 24 | 25 | public String getTwitter() { 26 | return twitter; 27 | } 28 | 29 | public void setTwitter(String twitter) { 30 | this.twitter = twitter; 31 | } 32 | 33 | public String getPhone() { 34 | return phone; 35 | } 36 | 37 | public void setPhone(String phone) { 38 | this.phone = phone; 39 | } 40 | 41 | public String getFormattedPhone() { 42 | return formattedPhone; 43 | } 44 | 45 | public void setFormattedPhone(String formattedPhone) { 46 | this.formattedPhone = formattedPhone; 47 | } 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/TipMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.Date; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 9 | import org.springframework.social.foursquare.api.FoursquareUser; 10 | import org.springframework.social.foursquare.api.TipTodoGroup; 11 | import org.springframework.social.foursquare.api.Venue; 12 | 13 | @JsonIgnoreProperties(ignoreUnknown=true) 14 | abstract class TipMixin { 15 | @JsonCreator 16 | TipMixin( 17 | @JsonProperty("id") String id, 18 | @JsonProperty("createdAt") @JsonDeserialize(using=FoursquareDateDeserializer.class) Date createdAt, 19 | @JsonProperty("text") String text){} 20 | 21 | @JsonProperty("venue") 22 | Venue venue; 23 | 24 | @JsonProperty("user") 25 | FoursquareUser user; 26 | 27 | @JsonProperty("status") 28 | String status; 29 | 30 | @JsonProperty("todo") 31 | TipTodoGroup todo; 32 | 33 | @JsonProperty("done") 34 | TipTodoGroup done; 35 | } 36 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/BadgesResponse.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.Map; 4 | 5 | public class BadgesResponse { 6 | 7 | private BadgeSets sets; 8 | private Map badges; 9 | 10 | public BadgesResponse(BadgeSets sets, Map badges) { 11 | this.sets = sets; 12 | this.badges = badges; 13 | } 14 | 15 | /** 16 | * Hierarchical groups of badge IDs or, for unlocked badges, badge unlock IDs, as they are 17 | * intended for display. Badges may be repeated across groups, e.g. a unlocked partner badge 18 | * may shop up under "all badges," "partner badges," and "Bravo badges." 19 | * @return BadgeSets 20 | */ 21 | public BadgeSets getSets() { 22 | return sets; 23 | } 24 | 25 | /** 26 | * A map of badge ID or badge unlock ID to a badge. Unlocked badges will contain the checkin 27 | * that led to it being unlocked (may eventually only be returned if the client asks for it) 28 | * and the underlying badge ID. 29 | * @return 30 | */ 31 | public Map getBadges() { 32 | return badges; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/requests.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "requests":[ 7 | { 8 | "id":"2275522", 9 | "firstName":"Albert", 10 | "lastName":"Rosa", 11 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/WX0PYSIEZ2CCZGOO.png", 12 | "gender":"male", 13 | "homeCity":"Bronx, New York", 14 | "relationship":"pendingMe" 15 | }, 16 | { 17 | "id":"9851792", 18 | "firstName":"Ben", 19 | "lastName":"van den Heever", 20 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/REHTQ5HCQWDOOWZY.jpg", 21 | "gender":"male", 22 | "homeCity":"NY", 23 | "relationship":"pendingMe" 24 | }, 25 | { 26 | "id":"25718", 27 | "firstName":"Elad", 28 | "lastName":"Elrom", 29 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/550YBSH5ENUEL0LE.jpg", 30 | "gender":"male", 31 | "homeCity":"New York, NY", 32 | "relationship":"pendingMe" 33 | } 34 | ] 35 | } 36 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/PhotoMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.Date; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 9 | import org.springframework.social.foursquare.api.FoursquareUser; 10 | import org.springframework.social.foursquare.api.PhotoSizes; 11 | import org.springframework.social.foursquare.api.PhotoSource; 12 | import org.springframework.social.foursquare.api.Tip; 13 | import org.springframework.social.foursquare.api.Venue; 14 | 15 | @JsonIgnoreProperties(ignoreUnknown=true) 16 | abstract class PhotoMixin { 17 | @JsonCreator 18 | PhotoMixin( 19 | @JsonProperty("id") String id, 20 | @JsonProperty("createdAt") @JsonDeserialize(using=FoursquareDateDeserializer.class) Date createdAt, 21 | @JsonProperty("url") String url, 22 | @JsonProperty("sizes") PhotoSizes sizes, 23 | @JsonProperty("user") FoursquareUser user){} 24 | 25 | 26 | @JsonProperty("source") 27 | PhotoSource source; 28 | 29 | @JsonProperty("venue") 30 | Venue venue; 31 | 32 | @JsonProperty("tip") 33 | Tip tip; 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring Social Foursquare 2 | 3 | To check out the project and build from source, do the following: 4 | 5 | git clone --recursive git://github.com/mattupstate/spring-social-foursquare.git 6 | cd spring-social-foursquare 7 | ./gradlew build 8 | 9 | Note: the --recursive switch above is important, as spring-social uses git submodules, which must themselves be cloned and initialized. If --recursive is omitted, doing so becomes a multi-step process of: 10 | 11 | git clone git://github.com/mattupstate/spring-social-foursquare.git 12 | git submodule init 13 | git submodule update 14 | 15 | ## Example Project 16 | 17 | An example project is located at https://github.com/mattupstate/spring-social-foursquare-example 18 | 19 | ## Using Eclipse 20 | 21 | To generate Eclipse metadata (.classpath and .project files), do the following: 22 | 23 | ./gradlew eclipse 24 | 25 | Once complete, you may then import the projects into Eclipse as usual: 26 | 27 | File -> Import -> Existing projects into workspace 28 | 29 | ## Using IntelliJ 30 | 31 | To generate IDEA metadata (.iml and .ipr files), do the following: 32 | 33 | ./gradlew idea 34 | 35 | ## Documentation 36 | 37 | To build the JavaDoc, do the following from within the root directory: 38 | 39 | ./gradlew :docs:api 40 | 41 | The result will be available in 'docs/build/api'. 42 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/SpecialMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | 10 | @JsonIgnoreProperties(ignoreUnknown=true) 11 | abstract class SpecialMixin { 12 | @JsonCreator 13 | public SpecialMixin( 14 | @JsonProperty("id") String id, 15 | @JsonProperty("type") String type, 16 | @JsonProperty("message") String message, 17 | @JsonProperty("description") String description, 18 | @JsonProperty("unlocked") boolean unlocked, 19 | @JsonProperty("icon") String icon, 20 | @JsonProperty("title") String title, 21 | @JsonProperty("state") String state) {} 22 | 23 | 24 | @JsonProperty("provider") 25 | String provider; 26 | 27 | @JsonProperty("redemption") 28 | String redemption; 29 | 30 | @JsonProperty("progress") 31 | int progress; 32 | 33 | @JsonProperty("progressDescription") 34 | String progressDescription; 35 | 36 | @JsonProperty("detail") 37 | int detail; 38 | 39 | @JsonProperty("target") 40 | int target; 41 | 42 | @JsonProperty("friendsHere") 43 | List friendsHere; 44 | } 45 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/user-search.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "results":[ 7 | { 8 | "id":"1726", 9 | "firstName":"adafruit", 10 | "lastName":"fried & torrone", 11 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/1726_1236972007.jpg", 12 | "gender":"none", 13 | "homeCity":"New York, NY" 14 | }, 15 | { 16 | "id":"2275522", 17 | "firstName":"Albert", 18 | "lastName":"Rosa", 19 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/WX0PYSIEZ2CCZGOO.png", 20 | "gender":"male", 21 | "homeCity":"Bronx, New York", 22 | "relationship":"pendingMe" 23 | }, 24 | { 25 | "id":"684789", 26 | "firstName":"Andy", 27 | "lastName":"P", 28 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/KIGWT34QW2S401XP.jpg", 29 | "gender":"male", 30 | "homeCity":"New York", 31 | "relationship":"friend" 32 | } 33 | ], 34 | "unmatched":{ 35 | "fbid":[ 36 | 10347651 37 | ], 38 | "twitterSource":[ 39 | 40061400, 40 | 45309257, 41 | 15056788 42 | ] 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/CheckinMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.Date; 4 | 5 | import org.codehaus.jackson.annotate.JsonCreator; 6 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 7 | import org.codehaus.jackson.annotate.JsonProperty; 8 | import org.codehaus.jackson.map.annotate.JsonDeserialize; 9 | import org.springframework.social.foursquare.api.CheckinCommentInfo; 10 | import org.springframework.social.foursquare.api.CheckinSource; 11 | import org.springframework.social.foursquare.api.FoursquareUser; 12 | import org.springframework.social.foursquare.api.Photos; 13 | import org.springframework.social.foursquare.api.Venue; 14 | 15 | @JsonIgnoreProperties(ignoreUnknown=true) 16 | abstract class CheckinMixin { 17 | @JsonCreator 18 | CheckinMixin( 19 | @JsonProperty("id") String id, 20 | @JsonProperty("user") FoursquareUser user, 21 | @JsonProperty("createdAt") @JsonDeserialize(using=FoursquareDateDeserializer.class) Date createdAt, 22 | @JsonProperty("type") String type, 23 | @JsonProperty("timeZone") String timeZone, 24 | @JsonProperty("venue") Venue venue, 25 | @JsonProperty("source") CheckinSource source, 26 | @JsonProperty("comments") CheckinCommentInfo comments) {} 27 | 28 | @JsonProperty("isMayor") 29 | boolean mayor; 30 | 31 | @JsonProperty("shout") 32 | String shout; 33 | 34 | @JsonProperty("") 35 | Photos photos; 36 | } 37 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/AbstractFoursquareApiTest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Before; 6 | import org.springframework.http.HttpHeaders; 7 | import org.springframework.http.MediaType; 8 | import org.springframework.social.foursquare.api.FoursquareUser; 9 | import org.springframework.social.test.client.MockRestServiceServer; 10 | 11 | public class AbstractFoursquareApiTest { 12 | 13 | public FoursquareTemplate foursquare; 14 | 15 | protected MockRestServiceServer mockServer; 16 | 17 | protected HttpHeaders responseHeaders; 18 | 19 | @Before 20 | public void setup() { 21 | foursquare = new FoursquareTemplate("CLIENT_ID", "CLIENT_SECRET", "ACCESS_TOKEN"); 22 | mockServer = MockRestServiceServer.createServer(foursquare.getRestTemplate()); 23 | responseHeaders = new HttpHeaders(); 24 | responseHeaders.setContentType(MediaType.APPLICATION_JSON); 25 | } 26 | 27 | public void assertProfile(FoursquareUser profile) { 28 | assertEquals("Matt", profile.getFirstName()); 29 | assertEquals("Wright", profile.getLastName()); 30 | assertEquals("male", profile.getGender()); 31 | assertEquals(3, profile.getMayorshipInfo().getTotal()); 32 | assertEquals(659, profile.getCheckinInfo().getTotal()); 33 | assertEquals("https://playfoursquare.s3.amazonaws.com/userpix_thumbs/OGGQATTYHOGWJL4E.jpg", profile.getPhotoUrl()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/FoursquareUserMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import org.codehaus.jackson.annotate.JsonCreator; 4 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.springframework.social.foursquare.api.CheckinInfo; 7 | import org.springframework.social.foursquare.api.ContactInfo; 8 | import org.springframework.social.foursquare.api.FriendInfo; 9 | import org.springframework.social.foursquare.api.MayorshipInfo; 10 | import org.springframework.social.foursquare.api.Scores; 11 | 12 | @JsonIgnoreProperties(ignoreUnknown=true) 13 | abstract class FoursquareUserMixin { 14 | 15 | @JsonCreator 16 | FoursquareUserMixin( 17 | @JsonProperty("id") String id, 18 | @JsonProperty("firstName") String firstName, 19 | @JsonProperty("lastName") String lastName, 20 | @JsonProperty("photo") String photoUrl, 21 | @JsonProperty("gender") String gender, 22 | @JsonProperty("homeCity") String homeCity, 23 | @JsonProperty("relationship") String relationship){} 24 | 25 | @JsonProperty("type") 26 | String type; 27 | 28 | @JsonProperty("pings") 29 | boolean pings; 30 | 31 | @JsonProperty("contact") 32 | ContactInfo contactInfo; 33 | 34 | @JsonProperty("mayorships") 35 | MayorshipInfo mayorshipInfo; 36 | 37 | @JsonProperty("checkins") 38 | CheckinInfo checkinInfo; 39 | 40 | @JsonProperty("friends") 41 | FriendInfo friendInfo; 42 | 43 | @JsonProperty("scores") 44 | Scores scores; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/venuelinks.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "links":{ 7 | "count":5, 8 | "items":[ 9 | { 10 | "provider":{ 11 | "id":"nyt" 12 | }, 13 | "linkedId":"1002207971611", 14 | "url":"http://www.nytimes.com/restaurants/1002207971611/db-bistro-moderne/details.html" 15 | }, 16 | { 17 | "provider":{ 18 | "id":"menupages" 19 | }, 20 | "linkedId":"4545", 21 | "url":"http://www.menupages.com/restaurants/db-bistro-moderne/" 22 | }, 23 | { 24 | "provider":{ 25 | "id":"nymag" 26 | }, 27 | "linkedId":"444", 28 | "url":"http://nymag.com/listings/restaurant/db-bistro-moderne/index.html" 29 | }, 30 | { 31 | "provider":{ 32 | "id":"metromix" 33 | }, 34 | "linkedId":"57068", 35 | "url":"http://newyork.metromix.com/restaurants/venue/db-bistro-moderne-midtown-west/57068/content" 36 | }, 37 | { 38 | "provider":{ 39 | "id":"voiceplaces" 40 | }, 41 | "linkedId":"4247874", 42 | "url":"http://www.voiceplaces.com/db-bistro-moderne-voice-places-4247874-l/" 43 | } 44 | ] 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/SettingTemplate.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import org.springframework.social.foursquare.api.AllSettings; 4 | import org.springframework.social.foursquare.api.SettingOperations; 5 | import org.springframework.social.foursquare.api.impl.json.AllSettingsContainer; 6 | import org.springframework.social.foursquare.api.impl.json.BooleanValueContainer; 7 | import org.springframework.social.foursquare.api.impl.json.StringValueContainer; 8 | import org.springframework.util.LinkedMultiValueMap; 9 | import org.springframework.util.MultiValueMap; 10 | 11 | public class SettingTemplate extends AbstractFoursquareOperations implements SettingOperations { 12 | 13 | public SettingTemplate(FoursquareTemplate foursquare, boolean isAuthorized) { 14 | super(foursquare, isAuthorized); 15 | } 16 | 17 | public AllSettings getAll() { 18 | requireUserAuthorization(); 19 | return get(buildUri(SETTINGS_ENDPOINT + "all"), AllSettingsContainer.class).getSettings(); 20 | } 21 | 22 | public Boolean getSetting(String settingId) { 23 | requireUserAuthorization(); 24 | return get(buildUri(SETTINGS_ENDPOINT + settingId), BooleanValueContainer.class).getValue(); 25 | } 26 | 27 | public String setSetting(String settingId, Boolean value) { 28 | requireUserAuthorization(); 29 | MultiValueMap params = new LinkedMultiValueMap(); 30 | params.add("value", (value) ? "1" : "0"); 31 | return post(buildUri(SETTINGS_ENDPOINT + settingId + "/set"), params, StringValueContainer.class).getValue(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/TipOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public interface TipOperations { 6 | 7 | /** 8 | * Retrieve a detailed tip 9 | * @param tipId Tip ID 10 | * @return Tip object 11 | */ 12 | Tip get(String tipId); 13 | 14 | /** 15 | * Add a tip to a venue 16 | * @param venueId Foursquare venue ID 17 | * @param text Tip text 18 | * @param url URL related to the tip 19 | * @return The new Tip 20 | */ 21 | Tip add(String venueId, String text, String url); 22 | 23 | /** 24 | * Retrieve a list of tips near the area specified. 25 | * @param latitude Latitude 26 | * @param longitude Longitude 27 | * @param query String query 28 | * @param offset Result set offset 29 | * @param friendsOnly Show only tips from friends 30 | * @return A list of tips 31 | */ 32 | List search(Double latitude, Double longitude, String query, Integer offset, boolean friendsOnly); 33 | 34 | /** 35 | * Mark a tip for the authenticated user as something they should do 36 | * @param tipId Tip ID 37 | * @return The marked todo 38 | */ 39 | Todo markTodo(String tipId); 40 | 41 | /** 42 | * Mark a tip as completed 43 | * @param tipId Tip ID 44 | * @return The marked todo 45 | */ 46 | Todo markDone(String tipId); 47 | 48 | /** 49 | * Remove a tip from the authenticated user's todo list or done list 50 | * @param tipId Tip ID 51 | * @return The tip acted on 52 | */ 53 | Tip unmarkTodo(String tipId); 54 | 55 | public static final String TIPS_ENDPOINT = "tips/"; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Checkin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.Date; 4 | 5 | public class Checkin { 6 | 7 | private String id; 8 | private FoursquareUser user; 9 | private Date createdAt; 10 | private String type; 11 | private String shout; 12 | private boolean mayor; 13 | private String timeZone; 14 | private Venue venue; 15 | private Photos photos; 16 | private CheckinSource source; 17 | private CheckinCommentInfo comments; 18 | 19 | public Checkin(String id, FoursquareUser user, Date createdAt, String type, String timeZone, 20 | Venue venue, CheckinSource source, CheckinCommentInfo comments) { 21 | this.id = id; 22 | this.user = user; 23 | this.createdAt = createdAt; 24 | this.type = type; 25 | this.timeZone = timeZone; 26 | this.venue = venue; 27 | this.source = source; 28 | this.comments = comments; 29 | } 30 | 31 | public String getId() { 32 | return id; 33 | } 34 | 35 | public FoursquareUser getUser() { 36 | return user; 37 | } 38 | 39 | public Date getCreatedAt() { 40 | return createdAt; 41 | } 42 | 43 | public String getType() { 44 | return type; 45 | } 46 | 47 | public boolean isMayor() { 48 | return mayor; 49 | } 50 | 51 | public String getTimeZone() { 52 | return timeZone; 53 | } 54 | 55 | public Venue getVenue() { 56 | return venue; 57 | } 58 | 59 | public String getShout() { 60 | return shout; 61 | } 62 | 63 | public Photos getPhotos() { 64 | return photos; 65 | } 66 | 67 | public CheckinSource getSource() { 68 | return source; 69 | } 70 | 71 | public CheckinCommentInfo getComments() { 72 | return comments; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/connect/FoursquareAdapter.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.connect; 2 | 3 | import org.springframework.social.ApiException; 4 | import org.springframework.social.connect.ApiAdapter; 5 | import org.springframework.social.connect.ConnectionValues; 6 | import org.springframework.social.connect.UserProfile; 7 | import org.springframework.social.connect.UserProfileBuilder; 8 | import org.springframework.social.foursquare.api.Foursquare; 9 | import org.springframework.social.foursquare.api.FoursquareUser; 10 | 11 | 12 | /** 13 | * Foursquare ApiAdapter implementation. 14 | */ 15 | public class FoursquareAdapter implements ApiAdapter { 16 | 17 | public boolean test(Foursquare foursquare) { 18 | try { 19 | foursquare.userOperations().getUser(); 20 | return true; 21 | } catch (ApiException e) { 22 | return false; 23 | } 24 | } 25 | 26 | public void setConnectionValues(Foursquare foursquare, ConnectionValues values) { 27 | FoursquareUser user = foursquare.userOperations().getUser(); 28 | values.setProviderUserId(user.getId()); 29 | values.setDisplayName(user.getFirstName() + " " + user.getLastName()); 30 | values.setImageUrl(user.getPhotoUrl()); 31 | } 32 | 33 | public UserProfile fetchUserProfile(Foursquare instagram) { 34 | FoursquareUser user = instagram.userOperations().getUser(); 35 | String name = user.getFirstName() + " " + user.getLastName(); 36 | String email = user.getContactInfo().getEmail(); 37 | return new UserProfileBuilder().setName(name).setUsername(email).setEmail(email).build(); 38 | } 39 | 40 | public void updateStatus(Foursquare foursquare, String message) { 41 | // Unimplemented 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/CheckinOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public interface CheckinOperations { 6 | 7 | /** 8 | * Retrieve a detailed checkin 9 | * @param checkinId Checkin ID 10 | * @return Checkin 11 | */ 12 | Checkin get(String checkinId); 13 | 14 | /** 15 | * Retrieve a detailed checkin 16 | * @param checkinId Checkin ID 17 | * @param signature Signature for third party services such as Twitter 18 | * @return Checkin 19 | */ 20 | Checkin get(String checkinId, String signature); 21 | 22 | /** 23 | * Checkin the authenticated user to a specified venue 24 | * @param params Checkin parameters 25 | * @return The newly created Checkin 26 | */ 27 | Checkin add(CheckinParams params); 28 | 29 | /** 30 | * Returns a list of recent checkins from friends of the authenticated user. 31 | * @param latitude Latitude 32 | * @param longitude Longitude 33 | * @param afterTimestamp Seconds after which to retrieve checkins 34 | * @param limit Result set limit 35 | * @return A list of checkins 36 | */ 37 | List getRecent(Double latitude, Double longitude, Long afterTimestamp, Integer limit); 38 | 39 | /** 40 | * Add a comment to the specified checkin 41 | * @param checkinId Checkin ID 42 | * @param text Comment text 43 | * @return The created comment 44 | */ 45 | CheckinComment addComment(String checkinId, String text); 46 | 47 | /** 48 | * Remove a comment on a checkin made by the authenticated user 49 | * @param checkinId Checkin ID 50 | * @param commentId Comment ID 51 | * @return The checkin object minus the specified comment 52 | */ 53 | Checkin deleteComment(String checkinId, String commentId); 54 | 55 | public static final String CHECKINS_ENDPOINT = "checkins/"; 56 | } 57 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/SpecialTemplateTest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.springframework.http.HttpMethod.GET; 5 | import static org.springframework.social.test.client.RequestMatchers.method; 6 | import static org.springframework.social.test.client.RequestMatchers.requestTo; 7 | import static org.springframework.social.test.client.ResponseCreators.withResponse; 8 | 9 | import org.junit.Test; 10 | import org.springframework.core.io.ClassPathResource; 11 | import org.springframework.social.foursquare.api.Special; 12 | import org.springframework.social.foursquare.api.Specials; 13 | 14 | public class SpecialTemplateTest extends AbstractFoursquareApiTest { 15 | 16 | @Test 17 | public void get() { 18 | mockServer.expect(requestTo("https://api.foursquare.com/v2/specials/SPECIAL_ID?oauth_token=ACCESS_TOKEN&v=20110609&venueId=VENUE_ID")) 19 | .andExpect(method(GET)) 20 | .andRespond(withResponse(new ClassPathResource("testdata/special.json", getClass()), responseHeaders)); 21 | 22 | Special special = foursquare.specialOperations().get("SPECIAL_ID", "VENUE_ID"); 23 | assertEquals("4cfc5c5ffabc2d437522ddd2", special.getId()); 24 | mockServer.verify(); 25 | } 26 | 27 | @Test 28 | public void search() { 29 | mockServer.expect(requestTo("https://api.foursquare.com/v2/specials/search?oauth_token=ACCESS_TOKEN&v=20110609&limit=10&ll=10.0%2C10.0&alt=10.0&altAcc=100&llAcc=100")) 30 | .andExpect(method(GET)) 31 | .andRespond(withResponse(new ClassPathResource("testdata/searchspecials.json", getClass()), responseHeaders)); 32 | 33 | Specials specials = foursquare.specialOperations().search(10d, 10d, 100l, 10d, 100l, 10); 34 | assertEquals(30, specials.getCount()); 35 | mockServer.verify(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/VenueBeenHereTest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertFalse; 5 | import static org.junit.Assert.assertTrue; 6 | 7 | import java.io.IOException; 8 | 9 | import org.codehaus.jackson.JsonParseException; 10 | import org.codehaus.jackson.map.JsonMappingException; 11 | import org.codehaus.jackson.map.ObjectMapper; 12 | import org.junit.Test; 13 | 14 | public class VenueBeenHereTest { 15 | 16 | @Test 17 | public void shouldParseCount() throws JsonParseException, JsonMappingException, IOException { 18 | String beenHereJson = "{\"count\":3}"; 19 | ObjectMapper mapper = new ObjectMapper(); 20 | VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class); 21 | assertEquals(3, beenHere.getCount()); 22 | assertFalse(beenHere.isMarked()); 23 | } 24 | 25 | @Test 26 | public void shouldParseCountAndMarkedFalse() throws JsonParseException, JsonMappingException, IOException { 27 | String beenHereJson = "{\"count\":3, \"marked\":false}"; 28 | ObjectMapper mapper = new ObjectMapper(); 29 | VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class); 30 | assertEquals(3, beenHere.getCount()); 31 | assertFalse(beenHere.isMarked()); 32 | } 33 | 34 | @Test 35 | public void shouldParseCountAndMarkedTrue() throws JsonParseException, JsonMappingException, IOException { 36 | String beenHereJson = "{\"count\":3, \"marked\":true}"; 37 | ObjectMapper mapper = new ObjectMapper(); 38 | VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class); 39 | assertEquals(3, beenHere.getCount()); 40 | assertTrue(beenHere.isMarked()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/SpecialTemplate.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.social.foursquare.api.Special; 7 | import org.springframework.social.foursquare.api.SpecialOperations; 8 | import org.springframework.social.foursquare.api.Specials; 9 | import org.springframework.social.foursquare.api.impl.json.SpecialContainer; 10 | import org.springframework.social.foursquare.api.impl.json.SpecialsContainer; 11 | 12 | public class SpecialTemplate extends AbstractFoursquareOperations implements SpecialOperations { 13 | 14 | public SpecialTemplate(FoursquareTemplate foursquare, boolean isAuthorized) { 15 | super(foursquare, isAuthorized); 16 | } 17 | 18 | public Special get(String specialId, String venueId) { 19 | Map params = new HashMap(); 20 | params.put("venueId", venueId); 21 | return get(buildUri(SPECIALS_ENDPOINT + specialId, params), SpecialContainer.class).getSpecial(); 22 | } 23 | 24 | public Specials search(Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy, Integer limit) { 25 | Map params = new HashMap(); 26 | if(latitude != null && longitude != null) { 27 | params.put("ll", latitude.toString() + "," + longitude.toString()); 28 | } 29 | if(locationAccuracy != null) { 30 | params.put("llAcc", locationAccuracy.toString()); 31 | } 32 | if(altitude != null) { 33 | params.put("alt", altitude.toString()); 34 | } 35 | if(altitudeAccuracy != null) { 36 | params.put("altAcc", altitudeAccuracy.toString()); 37 | } 38 | if(limit != null) { 39 | params.put("limit", limit.toString()); 40 | } 41 | return get(buildUri(SPECIALS_ENDPOINT + "search", params), SpecialsContainer.class).getSpecials(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/FoursquareUser.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class FoursquareUser { 4 | 5 | private final String id; 6 | private final String firstName; 7 | private final String lastName; 8 | private final String photoUrl; 9 | private final String gender; 10 | private final String homeCity; 11 | private final String relationship; 12 | private boolean pings; 13 | private ContactInfo contactInfo; 14 | private MayorshipInfo mayorshipInfo; 15 | private CheckinInfo checkinInfo; 16 | private FriendInfo friendInfo; 17 | private Scores scores; 18 | 19 | public FoursquareUser(String id, String firstName, String lastName, String photoUrl, 20 | String gender, String homeCity, String relationship) { 21 | this.id = id; 22 | this.firstName = firstName; 23 | this.lastName = lastName; 24 | this.photoUrl = photoUrl; 25 | this.gender = gender; 26 | this.homeCity = homeCity; 27 | this.relationship = relationship; 28 | } 29 | 30 | public String getId() { 31 | return id; 32 | } 33 | 34 | public String getFirstName() { 35 | return firstName; 36 | } 37 | 38 | public String getLastName() { 39 | return lastName; 40 | } 41 | 42 | public String getPhotoUrl() { 43 | return photoUrl; 44 | } 45 | 46 | public String getGender() { 47 | return gender; 48 | } 49 | 50 | public String getHomeCity() { 51 | return homeCity; 52 | } 53 | 54 | public String getRelationship() { 55 | return relationship; 56 | } 57 | 58 | public boolean hasPings() { 59 | return pings; 60 | } 61 | 62 | public ContactInfo getContactInfo() { 63 | return contactInfo; 64 | } 65 | 66 | public MayorshipInfo getMayorshipInfo() { 67 | return mayorshipInfo; 68 | } 69 | 70 | public CheckinInfo getCheckinInfo() { 71 | return checkinInfo; 72 | } 73 | 74 | public FriendInfo getFriendInfo() { 75 | return friendInfo; 76 | } 77 | 78 | public Scores getScores() { 79 | return scores; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/VenueMixin.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.codehaus.jackson.annotate.JsonCreator; 7 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; 8 | import org.codehaus.jackson.annotate.JsonProperty; 9 | import org.springframework.social.foursquare.api.Category; 10 | import org.springframework.social.foursquare.api.ContactInfo; 11 | import org.springframework.social.foursquare.api.HereNow; 12 | import org.springframework.social.foursquare.api.Location; 13 | import org.springframework.social.foursquare.api.PhotoGroups; 14 | import org.springframework.social.foursquare.api.Special; 15 | import org.springframework.social.foursquare.api.VenueStats; 16 | import org.springframework.social.foursquare.api.VenueTips; 17 | 18 | @JsonIgnoreProperties(ignoreUnknown=true) 19 | abstract class VenueMixin { 20 | @JsonCreator 21 | VenueMixin( 22 | @JsonProperty("id") String id, 23 | @JsonProperty("name") String name, 24 | @JsonProperty("contact") ContactInfo contactInfo, 25 | @JsonProperty("location") Location location, 26 | @JsonProperty("categories") List categories, 27 | @JsonProperty("verified") boolean verified, 28 | @JsonProperty("stats") VenueStats stats){} 29 | 30 | @JsonProperty("url") 31 | String url; 32 | 33 | @JsonProperty("hereNow") 34 | HereNow hereNow; 35 | 36 | @JsonProperty("tips") 37 | VenueTips tips; 38 | 39 | @JsonProperty("tags") 40 | List tags; 41 | 42 | @JsonProperty("specials") 43 | List specials; 44 | 45 | @JsonProperty("specialsNearby") 46 | List specialsNearby; 47 | 48 | @JsonProperty("shortUrl") 49 | String shortUrl; 50 | 51 | @JsonProperty("timezone") 52 | String timezone; 53 | 54 | @JsonProperty("beenHere") 55 | Map beenHere; 56 | 57 | @JsonProperty("photos") 58 | PhotoGroups photos; 59 | 60 | @JsonProperty("description") 61 | String description; 62 | } 63 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/AllSettings.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class AllSettings { 4 | 5 | private boolean receivePings; 6 | private boolean receiveCommentPings; 7 | private boolean sendToTwitter; 8 | private boolean sendMayorshipsToTwitter; 9 | private boolean sendBadgesToTwitter; 10 | private boolean sendToFacebook; 11 | private boolean sendMayorshipsToFacebook; 12 | private boolean sendBadgesToFacebook; 13 | private String foreignConsent; 14 | 15 | public AllSettings(boolean receivePings, boolean receiveCommentPings, boolean sendToTwitter, 16 | boolean sendMayorshipsToTwitter, boolean sendBadgesToTwitter, boolean sendToFacebook, 17 | boolean sendMayorshipsToFacebook, boolean sendBadgesToFacebook, String foreignConsent) { 18 | this.receivePings = receivePings; 19 | this.receiveCommentPings = receiveCommentPings; 20 | this.sendToTwitter = sendToTwitter; 21 | this.sendMayorshipsToTwitter = sendMayorshipsToTwitter; 22 | this.sendBadgesToTwitter = sendBadgesToTwitter; 23 | this.sendToFacebook = sendToFacebook; 24 | this.sendMayorshipsToFacebook = sendMayorshipsToFacebook; 25 | this.sendBadgesToFacebook = sendBadgesToFacebook; 26 | this.foreignConsent = foreignConsent; 27 | } 28 | 29 | public boolean receivePings() { 30 | return receivePings; 31 | } 32 | 33 | public boolean receiveCommentPings() { 34 | return receiveCommentPings; 35 | } 36 | 37 | public boolean sendToTwitter() { 38 | return sendToTwitter; 39 | } 40 | 41 | public boolean sendMayorshipsToTwitter() { 42 | return sendMayorshipsToTwitter; 43 | } 44 | 45 | public boolean sendBadgesToTwitter() { 46 | return sendBadgesToTwitter; 47 | } 48 | 49 | public boolean sendToFacebook() { 50 | return sendToFacebook; 51 | } 52 | 53 | public boolean sendMayorshipsToFacebook() { 54 | return sendMayorshipsToFacebook; 55 | } 56 | 57 | public boolean sendBadgesToFacebook() { 58 | return sendBadgesToFacebook; 59 | } 60 | 61 | public String foreignConsent() { 62 | return foreignConsent; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Special.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import java.util.List; 4 | 5 | public class Special { 6 | 7 | private String id; 8 | private String type; 9 | private String message; 10 | private String description; 11 | private boolean unlocked; 12 | private String icon; 13 | private String title; 14 | private String state; 15 | private int progress; 16 | private String progressDescription; 17 | private int detail; 18 | private int target; 19 | private List friendsHere; 20 | private String provider; 21 | private String redemption; 22 | 23 | public Special(String id, String type, String message, String description, boolean unlocked, 24 | String icon, String title, String state) { 25 | this.id = id; 26 | this.type = type; 27 | this.message = message; 28 | this.description = description; 29 | this.unlocked = unlocked; 30 | this.icon = icon; 31 | this.title = title; 32 | this.state = state; 33 | } 34 | 35 | public String getId() { 36 | return id; 37 | } 38 | 39 | public String getType() { 40 | return type; 41 | } 42 | 43 | public String getMessage() { 44 | return message; 45 | } 46 | 47 | public String getDescription() { 48 | return description; 49 | } 50 | 51 | public boolean isUnlocked() { 52 | return unlocked; 53 | } 54 | 55 | public String getIcon() { 56 | return icon; 57 | } 58 | 59 | public String getTitle() { 60 | return title; 61 | } 62 | 63 | public String getState() { 64 | return state; 65 | } 66 | 67 | public String getProvider() { 68 | return provider; 69 | } 70 | 71 | public String getRedemption() { 72 | return redemption; 73 | } 74 | 75 | public int getProgress() { 76 | return progress; 77 | } 78 | 79 | public String getProgressDescription() { 80 | return progressDescription; 81 | } 82 | 83 | public int getDetail() { 84 | return detail; 85 | } 86 | 87 | public int getTarget() { 88 | return target; 89 | } 90 | 91 | public List getFriendsHere() { 92 | return friendsHere; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/FoursquareTemplateTest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.springframework.http.HttpMethod.GET; 5 | import static org.springframework.social.test.client.RequestMatchers.method; 6 | import static org.springframework.social.test.client.RequestMatchers.requestTo; 7 | import static org.springframework.social.test.client.ResponseCreators.withResponse; 8 | 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | import org.springframework.core.io.ClassPathResource; 12 | import org.springframework.http.HttpHeaders; 13 | import org.springframework.http.MediaType; 14 | import org.springframework.social.MissingAuthorizationException; 15 | import org.springframework.social.foursquare.api.Venue; 16 | import org.springframework.social.test.client.MockRestServiceServer; 17 | 18 | public class FoursquareTemplateTest { 19 | 20 | private FoursquareTemplate noAuthFoursquare; 21 | 22 | protected MockRestServiceServer mockServer; 23 | 24 | protected HttpHeaders responseHeaders; 25 | 26 | @Before 27 | public void setup() { 28 | noAuthFoursquare = new FoursquareTemplate("CLIENT_ID", "CLIENT_SECRET"); 29 | mockServer = MockRestServiceServer.createServer(noAuthFoursquare.getRestTemplate()); 30 | responseHeaders = new HttpHeaders(); 31 | responseHeaders.setContentType(MediaType.APPLICATION_JSON); 32 | } 33 | 34 | @Test 35 | public void noAuthGetVenue() { 36 | mockServer.expect(requestTo("https://api.foursquare.com/v2/venues/VENUE_ID?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20110609")) 37 | .andExpect(method(GET)) 38 | .andRespond(withResponse(new ClassPathResource("testdata/venue.json", getClass()), responseHeaders)); 39 | 40 | Venue venue = noAuthFoursquare.venueOperations().getVenue("VENUE_ID"); 41 | assertEquals("3fd66200f964a520dbe91ee3", venue.getId()); 42 | mockServer.verify(); 43 | } 44 | 45 | @Test(expected=MissingAuthorizationException.class) 46 | public void noAuthCall() { 47 | noAuthFoursquare.userOperations().getUser(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/AbstractFoursquareOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import java.net.URI; 4 | import java.util.Collections; 5 | import java.util.Map; 6 | 7 | import org.springframework.social.MissingAuthorizationException; 8 | import org.springframework.social.support.URIBuilder; 9 | import org.springframework.util.LinkedMultiValueMap; 10 | import org.springframework.util.MultiValueMap; 11 | 12 | public abstract class AbstractFoursquareOperations { 13 | 14 | private final boolean isAuthorized; 15 | 16 | protected final FoursquareTemplate foursquare; 17 | 18 | public AbstractFoursquareOperations(FoursquareTemplate foursquare, boolean isAuthorized) { 19 | this.foursquare = foursquare; 20 | this.isAuthorized = isAuthorized; 21 | } 22 | 23 | protected T get(URI uri, Class responseType) { 24 | return foursquare.getRestTemplate().getForObject(uri, responseType); 25 | } 26 | 27 | protected C post(URI uri, MultiValueMap data, Class responseType) { 28 | MultiValueMap requestData = new LinkedMultiValueMap(data); 29 | return foursquare.getRestTemplate().postForObject(uri, requestData, responseType); 30 | } 31 | 32 | protected void delete(URI uri) { 33 | foursquare.getRestTemplate().delete(uri); 34 | } 35 | 36 | protected void requireUserAuthorization() { 37 | if(!isAuthorized) { 38 | throw new MissingAuthorizationException(); 39 | } 40 | } 41 | 42 | protected URI buildUri(String path) { 43 | return buildUri(path, Collections.emptyMap()); 44 | } 45 | 46 | protected URI buildUri(String path, Map params) { 47 | URIBuilder uriBuilder = foursquare.withAccessToken(API_URL_BASE + path); 48 | uriBuilder.queryParam("v", API_VERSION); 49 | for (String paramName : params.keySet()) { 50 | uriBuilder.queryParam(paramName, String.valueOf(params.get(paramName))); 51 | } 52 | URI uri = uriBuilder.build(); 53 | return uri; 54 | } 55 | 56 | private static final String API_URL_BASE = "https://api.foursquare.com/v2/"; 57 | 58 | private static final String API_VERSION = "20110609"; 59 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/Location.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | public class Location { 4 | 5 | private String address; 6 | private String crossStreet; 7 | private String city; 8 | private String state; 9 | private String postalCode; 10 | private String country; 11 | private double latitude; 12 | private double longitude; 13 | private int distance; 14 | 15 | public Location(String address, String crossStreet, String city, String state, 16 | String postalCode, String country, double latitude, double longitude) { 17 | this.address = address; 18 | this.crossStreet = crossStreet; 19 | this.city = city; 20 | this.state = state; 21 | this.postalCode = postalCode; 22 | this.country = country; 23 | this.latitude = latitude; 24 | this.longitude = longitude; 25 | } 26 | 27 | public String getAddress() { 28 | return address; 29 | } 30 | 31 | public void setAddress(String address) { 32 | this.address = address; 33 | } 34 | 35 | public String getCrossStreet() { 36 | return crossStreet; 37 | } 38 | 39 | public void setCrossStreet(String crossStreet) { 40 | this.crossStreet = crossStreet; 41 | } 42 | 43 | public String getCity() { 44 | return city; 45 | } 46 | 47 | public void setCity(String city) { 48 | this.city = city; 49 | } 50 | 51 | public String getState() { 52 | return state; 53 | } 54 | 55 | public void setState(String state) { 56 | this.state = state; 57 | } 58 | 59 | public String getPostalCode() { 60 | return postalCode; 61 | } 62 | 63 | public void setPostalCode(String postalCode) { 64 | this.postalCode = postalCode; 65 | } 66 | 67 | public String getCountry() { 68 | return country; 69 | } 70 | 71 | public void setCountry(String country) { 72 | this.country = country; 73 | } 74 | 75 | public double getLatitude() { 76 | return latitude; 77 | } 78 | 79 | public void setLatitude(double latitude) { 80 | this.latitude = latitude; 81 | } 82 | 83 | public double getLongitude() { 84 | return longitude; 85 | } 86 | 87 | public void setLongitude(double longitude) { 88 | this.longitude = longitude; 89 | } 90 | 91 | public int getDistance() { 92 | return distance; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Copyright 2002-2010 the original author or authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | # ------------------------------------------------------------------------------ 17 | # version to be applied to all projects in this multi-project build. this is 18 | # the one and only location version changes need to be made. 19 | # ------------------------------------------------------------------------------ 20 | springSocialFoursquareVersion=1.0.8.RELEASE 21 | 22 | # ------------------------------------------------------------------------------ 23 | # build system user roles 24 | # role may be either 'developer' or 'buildmaster' 25 | # ------------------------------------------------------------------------------ 26 | role=developer 27 | 28 | # ------------------------------------------------------------------------------ 29 | # for buildmasters: create a $HOME/.gradle/gradle.properties with the following 30 | # properties. They'll be necessary uploading artifacts to s3, maven repos, and 31 | # static.springframework.org. By placing them in your home directory, there's 32 | # no need to change/check in this file. Remember that properties can also be 33 | # specified at the gradle command line with -P, e.g.: -Prole=buildmaster 34 | # ------------------------------------------------------------------------------ 35 | # role = buildmaster # overrides default 'role = developer' above 36 | # s3AccessKey= 37 | # s3SecretAccessKey= 38 | # docsHost=static.springsource.org 39 | # sshHost=static.springsource.org 40 | # sshUsername= 41 | # sshPrivateKey= 43 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/SettingTemplateTest.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | import static org.springframework.http.HttpMethod.GET; 6 | import static org.springframework.http.HttpMethod.POST; 7 | import static org.springframework.social.test.client.RequestMatchers.body; 8 | import static org.springframework.social.test.client.RequestMatchers.method; 9 | import static org.springframework.social.test.client.RequestMatchers.requestTo; 10 | import static org.springframework.social.test.client.ResponseCreators.withResponse; 11 | 12 | import org.junit.Test; 13 | import org.springframework.core.io.ClassPathResource; 14 | import org.springframework.social.foursquare.api.AllSettings; 15 | 16 | public class SettingTemplateTest extends AbstractFoursquareApiTest { 17 | 18 | @Test 19 | public void getAll() { 20 | mockServer.expect(requestTo("https://api.foursquare.com/v2/settings/all?oauth_token=ACCESS_TOKEN&v=20110609")) 21 | .andExpect(method(GET)) 22 | .andRespond(withResponse(new ClassPathResource("testdata/allsettings.json", getClass()), responseHeaders)); 23 | 24 | AllSettings settings = foursquare.settingOperations().getAll(); 25 | assertTrue(settings.receivePings()); 26 | mockServer.verify(); 27 | } 28 | 29 | @Test 30 | public void getSetting() { 31 | mockServer.expect(requestTo("https://api.foursquare.com/v2/settings/SETTING_ID?oauth_token=ACCESS_TOKEN&v=20110609")) 32 | .andExpect(method(GET)) 33 | .andRespond(withResponse(new ClassPathResource("testdata/booleansetting.json", getClass()), responseHeaders)); 34 | 35 | Boolean setting = foursquare.settingOperations().getSetting("SETTING_ID"); 36 | assertTrue(setting); 37 | mockServer.verify(); 38 | } 39 | 40 | @Test 41 | public void setSetting() { 42 | mockServer.expect(requestTo("https://api.foursquare.com/v2/settings/SETTING_ID/set?oauth_token=ACCESS_TOKEN&v=20110609")) 43 | .andExpect(method(POST)) 44 | .andExpect(body("value=1")) 45 | .andRespond(withResponse(new ClassPathResource("testdata/setsetting.json", getClass()), responseHeaders)); 46 | 47 | String msg = foursquare.settingOperations().setSetting("SETTING_ID", true); 48 | assertEquals("done", msg); 49 | mockServer.verify(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/connect/FoursquareOAuth2Template.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.connect; 2 | 3 | import java.util.Collections; 4 | import java.util.Map; 5 | import java.util.Map.Entry; 6 | 7 | import org.codehaus.jackson.map.ObjectMapper; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.http.converter.FormHttpMessageConverter; 10 | import org.springframework.http.converter.HttpMessageConverter; 11 | import org.springframework.social.oauth2.AccessGrant; 12 | import org.springframework.social.oauth2.OAuth2Template; 13 | import org.springframework.social.support.ClientHttpRequestFactorySelector; 14 | import org.springframework.util.MultiValueMap; 15 | import org.springframework.web.client.RestTemplate; 16 | 17 | public class FoursquareOAuth2Template extends OAuth2Template { 18 | 19 | public FoursquareOAuth2Template(String clientId, String clientSecret) { 20 | super(clientId, clientSecret, "https://foursquare.com/oauth2/authenticate", "https://foursquare.com/oauth2/access_token"); 21 | } 22 | 23 | @Override 24 | protected RestTemplate createRestTemplate() { 25 | RestTemplate restTemplate = new RestTemplate(ClientHttpRequestFactorySelector.getRequestFactory()); 26 | FormHttpMessageConverter messageConverter = new FormHttpMessageConverter() { 27 | public boolean canRead(Class clazz, MediaType mediaType) { 28 | return true; 29 | } 30 | }; 31 | restTemplate.setMessageConverters(Collections.>singletonList(messageConverter)); 32 | return restTemplate; 33 | } 34 | 35 | @Override 36 | @SuppressWarnings("unchecked") 37 | protected AccessGrant postForAccessGrant(String accessTokenUrl, MultiValueMap parameters) { 38 | Map response = getRestTemplate().postForObject(accessTokenUrl, parameters, Map.class); 39 | Entry entry = response.entrySet().iterator().next(); 40 | String jsonString = entry.getKey(); 41 | ObjectMapper mapper = new ObjectMapper(); 42 | Map response2 = null; 43 | try { 44 | response2 = mapper.readValue(jsonString, Map.class); 45 | } catch (Exception e) { 46 | 47 | } 48 | return new AccessGrant(response2.get("access_token"), null, null, null); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/PhotoOperations.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api; 2 | 3 | import org.springframework.core.io.Resource; 4 | 5 | public interface PhotoOperations { 6 | 7 | /** 8 | * Get details of a photo. 9 | * @param photoId Photo ID 10 | * @return a photo 11 | */ 12 | Photo get(String photoId); 13 | 14 | /** 15 | * Add a photo to the specified checkin 16 | * @param checkinId Checkin ID 17 | * @param photo Photo resource 18 | * @param broadcast Whether to broadcast this photo either 'twitter', 'facebook', or 'twitter,facebook' 19 | * @param latitude Latitude 20 | * @param longitude Longitude 21 | * @param locationAccuracy Location accuracy in meters 22 | * @param altitude Altitude in meters 23 | * @param altitudeAccuracy Altitude accuracy in meters 24 | * @return The created Photo 25 | */ 26 | Photo addToCheckin(String checkinId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy); 27 | 28 | /** 29 | * Add a photo to the specified tip 30 | * @param tipId Tip ID 31 | * @param photo Photo resource 32 | * @param broadcast Whether to broadcast this photo either 'twitter', 'facebook', or 'twitter,facebook' 33 | * @param latitude Latitude 34 | * @param longitude Longitude 35 | * @param locationAccuracy Location accuracy in meters 36 | * @param altitude Altitude in meters 37 | * @param altitudeAccuracy Altitude accuracy in meters 38 | * @return The created Photo 39 | */ 40 | Photo addToTip(String tipId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy); 41 | 42 | /** 43 | * Add a photo to the specified venue 44 | * @param venueId Venue ID 45 | * @param photo Photo resource 46 | * @param broadcast Whether to broadcast this photo either 'twitter', 'facebook', or 'twitter,facebook' 47 | * @param latitude Latitude 48 | * @param longitude Longitude 49 | * @param locationAccuracy Location accuracy in meters 50 | * @param altitude Altitude in meters 51 | * @param altitudeAccuracy Altitude accuracy in meters 52 | * @return The created Photo 53 | */ 54 | Photo addToVenue(String venueId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy); 55 | 56 | public static final String PHOTOS_ENDPOINT = "photos/"; 57 | } 58 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/marktodo.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response": { 6 | "todo": { 7 | "id":"4dfa596a8877b30c3987985f", 8 | "createdAt":1308252522, 9 | "tip":{ 10 | "id":"4dfa596a8877b30c3987985e", 11 | "createdAt":1308252522, 12 | "text":"Work on stuff", 13 | "status":"todo", 14 | "todo":{ 15 | "count":1 16 | }, 17 | "done":{ 18 | "count":0 19 | }, 20 | "venue":{ 21 | "id":"4a8030abf964a520bcf41fe3", 22 | "name":"Syrup", 23 | "contact":{ 24 | "phone":"2126801477" 25 | }, 26 | "location":{ 27 | "address":"12 Vestry St.", 28 | "crossStreet":"Hudson Street", 29 | "city":"New York", 30 | "state":"NY", 31 | "postalCode":"10013", 32 | "country":"USA", 33 | "lat":40.7228, 34 | "lng":-74.0073 35 | }, 36 | "categories":[ 37 | { 38 | "id":"4bf58dd8d48988d124941735", 39 | "name":"Office", 40 | "pluralName":"Offices", 41 | "icon":"https://foursquare.com/img/categories/building/default.png", 42 | "parents":[ 43 | "Homes, Work, Others" 44 | ], 45 | "primary":true 46 | } 47 | ], 48 | "verified":false, 49 | "stats":{ 50 | "checkinsCount":216, 51 | "usersCount":39 52 | }, 53 | "todos":{ 54 | "count":1 55 | } 56 | }, 57 | "user":{ 58 | "id":"700390", 59 | "firstName":"Matt", 60 | "lastName":"Wright", 61 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/OGGQATTYHOGWJL4E.jpg", 62 | "gender":"male", 63 | "homeCity":"New York", 64 | "relationship":"self" 65 | } 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /spring-social-foursquare/src/test/java/org/springframework/social/foursquare/api/impl/testdata/friends.json: -------------------------------------------------------------------------------- 1 | { 2 | "meta":{ 3 | "code":200 4 | }, 5 | "response":{ 6 | "friends":{ 7 | "count":6, 8 | "items":[ 9 | { 10 | "id":"527", 11 | "firstName":"Crystal", 12 | "lastName":"Ginn", 13 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/527_1236920910.jpg", 14 | "gender":"female", 15 | "homeCity":"New York, NY", 16 | "relationship":"friend" 17 | }, 18 | { 19 | "id":"702521", 20 | "firstName":"Matt", 21 | "lastName":"Burniston", 22 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/DGMGAGH3SLS30OGN.jpg", 23 | "gender":"male", 24 | "homeCity":"New York, NY", 25 | "relationship":"friend" 26 | }, 27 | { 28 | "id":"6061196", 29 | "firstName":"Matt", 30 | "lastName":"Lohmann", 31 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/BM2PSQOSZ4XFMT4G.jpg", 32 | "gender":"male", 33 | "homeCity":"Brooklyn, NY", 34 | "relationship":"friend" 35 | }, 36 | { 37 | "id":"2045181", 38 | "firstName":"Tung", 39 | "lastName":"Luong", 40 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/1I3RLTZEYCDKJVD3.jpg", 41 | "gender":"male", 42 | "homeCity":"Rochester, NY", 43 | "relationship":"friend" 44 | }, 45 | { 46 | "id":"90521", 47 | "firstName":"Brian", 48 | "lastName":"Carley", 49 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/90521_1257544228738.jpg", 50 | "gender":"male", 51 | "homeCity":"New York", 52 | "relationship":"friend" 53 | }, 54 | { 55 | "id":"674228", 56 | "firstName":"Quirine", 57 | "photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/1U2CECU3GWBKPVT4.jpg", 58 | "gender":"female", 59 | "homeCity":"New York, NY", 60 | "relationship":"friend" 61 | } 62 | ] 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem ## 4 | @rem Gradle startup script for Windows ## 5 | @rem ## 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. 12 | @rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m 13 | @rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m 14 | 15 | set DIRNAME=%~dp0 16 | if "%DIRNAME%" == "" set DIRNAME=.\ 17 | 18 | @rem Find java.exe 19 | set JAVA_EXE=java.exe 20 | if not defined JAVA_HOME goto init 21 | 22 | set JAVA_HOME=%JAVA_HOME:"=% 23 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 24 | 25 | if exist "%JAVA_EXE%" goto init 26 | 27 | echo. 28 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 29 | echo. 30 | echo Please set the JAVA_HOME variable in your environment to match the 31 | echo location of your Java installation. 32 | echo. 33 | goto end 34 | 35 | :init 36 | @rem Get command-line arguments, handling Windowz variants 37 | 38 | if not "%OS%" == "Windows_NT" goto win9xME_args 39 | if "%eval[2+2]" == "4" goto 4NT_args 40 | 41 | :win9xME_args 42 | @rem Slurp the command line arguments. 43 | set CMD_LINE_ARGS= 44 | set _SKIP=2 45 | 46 | :win9xME_args_slurp 47 | if "x%~1" == "x" goto execute 48 | 49 | set CMD_LINE_ARGS=%* 50 | goto execute 51 | 52 | :4NT_args 53 | @rem Get arguments from the 4NT Shell from JP Software 54 | set CMD_LINE_ARGS=%$ 55 | 56 | :execute 57 | @rem Setup the command line 58 | 59 | set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain 60 | set CLASSPATH=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.jar 61 | set WRAPPER_PROPERTIES=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.properties 62 | 63 | set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%" 64 | 65 | @rem Execute Gradle 66 | "%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS% 67 | 68 | :end 69 | @rem End local scope for the variables with windows NT shell 70 | if "%ERRORLEVEL%"=="0" goto mainEnd 71 | 72 | if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 73 | 74 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 75 | rem the _cmd.exe /c_ return code! 76 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%" 77 | exit /b "%ERRORLEVEL%" 78 | 79 | :mainEnd 80 | if "%OS%"=="Windows_NT" endlocal 81 | 82 | :omega -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/json/AbstractFoursquareDeserializer.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl.json; 2 | 3 | import java.io.FileDescriptor; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.PrintStream; 7 | import java.util.List; 8 | 9 | import org.codehaus.jackson.JsonParser; 10 | import org.codehaus.jackson.JsonProcessingException; 11 | import org.codehaus.jackson.JsonToken; 12 | import org.codehaus.jackson.map.JsonDeserializer; 13 | import org.codehaus.jackson.type.TypeReference; 14 | 15 | public abstract class AbstractFoursquareDeserializer extends JsonDeserializer { 16 | 17 | PrintStream actualStdout = new PrintStream(new FileOutputStream(FileDescriptor.out)); 18 | 19 | public List deserializeNestedList(JsonParser jp, String propertyName, TypeReference typeRef) 20 | throws IOException, JsonProcessingException { 21 | while (true) { 22 | String fieldname = jp.getCurrentName(); 23 | jp.nextToken(); 24 | if("response".equals(fieldname)) { 25 | while(jp.nextToken() != JsonToken.END_OBJECT) { 26 | String responseField = jp.getCurrentName(); 27 | jp.nextToken(); 28 | if(propertyName.equals(responseField)) { 29 | List result = (List) jp.readValueAs(typeRef); 30 | //actualStdout.println(result.toString()); 31 | return result; 32 | } 33 | } 34 | } 35 | } 36 | } 37 | 38 | public C deserializeNestedResponseObject(JsonParser jp, String responseProperty, Class responseType) 39 | throws IOException, JsonProcessingException { 40 | while (true) { 41 | String fieldname = jp.getCurrentName(); 42 | jp.nextToken(); 43 | if("response".equals(fieldname)) { 44 | while(jp.nextToken() != JsonToken.END_OBJECT) { 45 | String responseField = jp.getCurrentName(); 46 | jp.nextToken(); 47 | if(responseProperty.equals(responseField)) { 48 | return jp.readValueAs(responseType); 49 | } 50 | } 51 | } 52 | } 53 | } 54 | 55 | public C deserializeResponseObject(JsonParser jp, Class container, Class containee) 56 | throws IOException, JsonProcessingException { 57 | 58 | while (true) { 59 | String fieldname = jp.getCurrentName(); 60 | jp.nextToken(); 61 | if("response".equals(fieldname)) { 62 | try { 63 | return container.getConstructor(containee).newInstance(jp.readValueAs(containee)); 64 | } catch (Exception e) { 65 | 66 | return null; 67 | } 68 | } 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/TipTemplate.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.social.foursquare.api.Tip; 8 | import org.springframework.social.foursquare.api.TipOperations; 9 | import org.springframework.social.foursquare.api.Todo; 10 | import org.springframework.social.foursquare.api.impl.json.TipContainer; 11 | import org.springframework.social.foursquare.api.impl.json.TipsListContainer; 12 | import org.springframework.social.foursquare.api.impl.json.TodoContainer; 13 | import org.springframework.util.LinkedMultiValueMap; 14 | import org.springframework.util.MultiValueMap; 15 | 16 | public class TipTemplate extends AbstractFoursquareOperations implements TipOperations { 17 | 18 | public TipTemplate(FoursquareTemplate foursquare, boolean isAuthorized) { 19 | super(foursquare, isAuthorized); 20 | } 21 | 22 | public Tip get(String tipId) { 23 | return get(buildUri(TIPS_ENDPOINT + tipId), TipContainer.class).getTip(); 24 | } 25 | 26 | public Tip add(String venueId, String text, String url) { 27 | requireUserAuthorization(); 28 | MultiValueMap params = new LinkedMultiValueMap(); 29 | params.add("venueId", venueId); 30 | params.add("text", text); 31 | params.add("url", url); 32 | return post(buildUri(TIPS_ENDPOINT + "add"), params, TipContainer.class).getTip(); 33 | } 34 | 35 | public List search(Double latitude, Double longitude, String query, Integer offset, boolean friendsOnly) { 36 | Map params = new HashMap(); 37 | if(latitude != null && longitude != null) { 38 | params.put("ll", latitude.toString() + "," + longitude.toString()); 39 | } 40 | if(query != null) { 41 | params.put("query", query); 42 | } 43 | if(offset != null) { 44 | params.put("offset", offset.toString()); 45 | } 46 | if(friendsOnly) { 47 | params.put("filter", "friends"); 48 | } 49 | return get(buildUri(TIPS_ENDPOINT + "search", params), TipsListContainer.class).getTips(); 50 | } 51 | 52 | public Todo markTodo(String tipId) { 53 | requireUserAuthorization(); 54 | return post(buildUri(TIPS_ENDPOINT + tipId + "/marktodo"), new LinkedMultiValueMap(), TodoContainer.class).getTodo(); 55 | } 56 | 57 | public Todo markDone(String tipId) { 58 | requireUserAuthorization(); 59 | return post(buildUri(TIPS_ENDPOINT + tipId + "/markdone"), new LinkedMultiValueMap(), TodoContainer.class).getTodo(); 60 | } 61 | 62 | public Tip unmarkTodo(String tipId) { 63 | requireUserAuthorization(); 64 | return post(buildUri(TIPS_ENDPOINT + tipId + "/unmark"), new LinkedMultiValueMap(), TipContainer.class).getTip(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/CheckinTemplate.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.social.foursquare.api.Checkin; 8 | import org.springframework.social.foursquare.api.CheckinComment; 9 | import org.springframework.social.foursquare.api.CheckinOperations; 10 | import org.springframework.social.foursquare.api.CheckinParams; 11 | import org.springframework.social.foursquare.api.impl.json.CheckinCommentContainer; 12 | import org.springframework.social.foursquare.api.impl.json.CheckinContainer; 13 | import org.springframework.social.foursquare.api.impl.json.CheckinListContainer; 14 | import org.springframework.util.LinkedMultiValueMap; 15 | import org.springframework.util.MultiValueMap; 16 | 17 | public class CheckinTemplate extends AbstractFoursquareOperations implements CheckinOperations { 18 | 19 | public CheckinTemplate(FoursquareTemplate foursquare, boolean isAuthorized) { 20 | super(foursquare, isAuthorized); 21 | } 22 | 23 | public Checkin get(String checkinId) { 24 | return get(checkinId, null); 25 | } 26 | 27 | public Checkin get(String checkinId, String signature) { 28 | Map params = new HashMap(); 29 | if(signature != null) { 30 | params.put("signature", signature); 31 | } 32 | return get(buildUri(CHECKINS_ENDPOINT + checkinId, params), CheckinContainer.class).getCheckin(); 33 | } 34 | 35 | public Checkin add(CheckinParams params) { 36 | requireUserAuthorization(); 37 | return post(buildUri(CHECKINS_ENDPOINT + "add"), params.toParams(), CheckinContainer.class).getCheckin(); 38 | } 39 | 40 | public List getRecent(Double latitude, Double longitude, Long afterTimestamp, Integer limit) { 41 | requireUserAuthorization(); 42 | Map params = new HashMap(); 43 | if(latitude != null && longitude != null) { 44 | params.put("ll", latitude.toString() + "," + longitude.toString()); 45 | } 46 | if(afterTimestamp != null) { 47 | params.put("afterTimestamp", afterTimestamp.toString()); 48 | } 49 | if(limit != null) { 50 | params.put("limit", limit.toString()); 51 | } 52 | return get(buildUri(CHECKINS_ENDPOINT + "recent", params), CheckinListContainer.class).getCheckins(); 53 | } 54 | 55 | public CheckinComment addComment(String checkinId, String text) { 56 | requireUserAuthorization(); 57 | MultiValueMap params = new LinkedMultiValueMap(); 58 | params.add("text", text); 59 | return post(buildUri(CHECKINS_ENDPOINT + checkinId + "/addcomment"), params, CheckinCommentContainer.class).getComment(); 60 | } 61 | 62 | public Checkin deleteComment(String checkinId, String commentId) { 63 | requireUserAuthorization(); 64 | MultiValueMap params = new LinkedMultiValueMap(); 65 | params.add("commentId", commentId); 66 | return post(buildUri(CHECKINS_ENDPOINT + checkinId + "/deletecomment"), params, CheckinContainer.class).getCheckin(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /spring-social-foursquare/src/main/java/org/springframework/social/foursquare/api/impl/PhotoTemplate.java: -------------------------------------------------------------------------------- 1 | package org.springframework.social.foursquare.api.impl; 2 | 3 | import org.springframework.core.io.Resource; 4 | import org.springframework.social.foursquare.api.Photo; 5 | import org.springframework.social.foursquare.api.PhotoOperations; 6 | import org.springframework.social.foursquare.api.impl.json.PhotoContainer; 7 | import org.springframework.util.LinkedMultiValueMap; 8 | import org.springframework.util.MultiValueMap; 9 | 10 | public class PhotoTemplate extends AbstractFoursquareOperations implements PhotoOperations { 11 | 12 | public PhotoTemplate(FoursquareTemplate foursquare, boolean isAuthorized) { 13 | super(foursquare, isAuthorized); 14 | } 15 | 16 | public Photo get(String photoId) { 17 | requireUserAuthorization(); 18 | return get(buildUri(PHOTOS_ENDPOINT + photoId), PhotoContainer.class).getPhoto(); 19 | } 20 | 21 | public Photo addToCheckin(String checkinId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy) { 22 | requireUserAuthorization(); 23 | return post(buildUri(PHOTOS_ENDPOINT + "add"), createPhotoParams("checkinId", checkinId, photo, broadcast, latitude, longitude, locationAccuracy, altitude, altitudeAccuracy), PhotoContainer.class).getPhoto(); 24 | } 25 | 26 | public Photo addToTip(String tipId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy) { 27 | requireUserAuthorization(); 28 | return post(buildUri(PHOTOS_ENDPOINT + "add"), createPhotoParams("checkinId", tipId, photo, broadcast, latitude, longitude, locationAccuracy, altitude, altitudeAccuracy), PhotoContainer.class).getPhoto(); 29 | } 30 | 31 | public Photo addToVenue(String venueId, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy) { 32 | requireUserAuthorization(); 33 | return post(buildUri(PHOTOS_ENDPOINT + "add"), createPhotoParams("checkinId", venueId, photo, broadcast, latitude, longitude, locationAccuracy, altitude, altitudeAccuracy), PhotoContainer.class).getPhoto(); 34 | } 35 | 36 | private MultiValueMap createPhotoParams(String entityParameter, String entityValue, Resource photo, String broadcast, Double latitude, Double longitude, Long locationAccuracy, Double altitude, Long altitudeAccuracy) { 37 | MultiValueMap params = new LinkedMultiValueMap(); 38 | params.add(entityParameter, entityValue); 39 | params.add("photo", photo); 40 | if(latitude != null && longitude != null) { 41 | params.add("ll", latitude.toString() + "," + longitude.toString()); 42 | } 43 | if(locationAccuracy != null) { 44 | params.add("llAcc", locationAccuracy.toString()); 45 | } 46 | if(broadcast != null) { 47 | params.add("broadcast", broadcast); 48 | } 49 | if(altitude != null) { 50 | params.add("alt", locationAccuracy.toString()); 51 | } 52 | if(altitudeAccuracy != null) { 53 | params.add("altAcc", altitudeAccuracy.toString()); 54 | } 55 | return params; 56 | } 57 | } 58 | --------------------------------------------------------------------------------