├── src ├── examples │ └── resources │ │ └── setup.properties.example ├── test │ ├── resources │ │ ├── payloads │ │ │ ├── post │ │ │ │ ├── flickr.favorites.add.xml │ │ │ │ ├── flickr.photos.setTags.xml │ │ │ │ ├── flickr.favorites.remove.xml │ │ │ │ ├── flickr.groups.pools.add.xml │ │ │ │ ├── flickr.groups.pools.remove.xml │ │ │ │ ├── flickr.photos.removeTag.xml │ │ │ │ ├── flickr.photosets.addPhoto.xml │ │ │ │ ├── flickr.photosets.delete.xml │ │ │ │ ├── flickr.photosets.orderSets.xml │ │ │ │ ├── flickr.photos.geo.setLocation.xml │ │ │ │ ├── flickr.photos.setContentType.xml │ │ │ │ ├── flickr.photos.setSafetyLevel.xml │ │ │ │ ├── flickr.photosets.editPhotos.xml │ │ │ │ ├── flickr.photosets.removePhoto.xml │ │ │ │ ├── flickr.photos.comments.deleteComment.xml │ │ │ │ ├── flickr.photos.comments.editComment.xml │ │ │ │ ├── flickr.photos.geo.removeLocation.xml │ │ │ │ ├── flickr.groups.join.xml │ │ │ │ ├── upload.xml │ │ │ │ ├── flickr.photos.setMeta.xml │ │ │ │ ├── flickr.test.login.xml │ │ │ │ ├── flickr.groups.leave.xml │ │ │ │ ├── flickr.photos.delete.xml │ │ │ │ ├── flickr.photosets.create.xml │ │ │ │ ├── flickr.blogs.getList.xml │ │ │ │ ├── flickr.photos.addTags.xml │ │ │ │ ├── flickr.favorites.getContext.xml │ │ │ │ ├── flickr.test.echo.xml │ │ │ │ ├── flickr.galleries.getList.xml │ │ │ │ ├── flickr.photos.comments.addComment.xml │ │ │ │ └── flickr.galleries.getInfo.xml │ │ │ └── get │ │ │ │ ├── flickr.photos.people.add.xml │ │ │ │ ├── flickr.photos.people.delete.xml │ │ │ │ ├── flickr.prefs.getHidden.xml │ │ │ │ ├── flickr.prefs.getContentType.xml │ │ │ │ ├── flickr.prefs.getSafetyLevel.xml │ │ │ │ ├── flickr.groups.pools.getPhotos.xml │ │ │ │ ├── flickr.photos.people.getList.xml │ │ │ │ ├── flickr.prefs.getGeoPerms.xml │ │ │ │ ├── flickr.panda.getPhotos.xml │ │ │ │ ├── flickr.places.getTopPlacesList.xml │ │ │ │ ├── flickr.urls.getGroup.xml │ │ │ │ ├── flickr.urls.lookupUser.xml │ │ │ │ ├── flickr.urls.getUserPhotos.xml │ │ │ │ ├── flickr.photos.geo.getPerms.xml │ │ │ │ ├── flickr.urls.getUserProfile.xml │ │ │ │ ├── flickr.urls.lookupGroup.xml │ │ │ │ ├── flickr.groups.pools.getContext.xml │ │ │ │ ├── flickr.people.findByEmail.xml │ │ │ │ ├── flickr.people.findByUsername.xml │ │ │ │ ├── flickr.photos.getCounts.xml │ │ │ │ ├── flickr.photos.getPerms.xml │ │ │ │ ├── flickr.panda.getList.xml │ │ │ │ ├── flickr.contacts.getPublicList.xml │ │ │ │ ├── flickr.photos.geo.getLocation.xml │ │ │ │ ├── flickr.blogs.getServices.xml │ │ │ │ ├── flickr.contacts.getList.xml │ │ │ │ ├── flickr.people.getPublicPhotos.xml │ │ │ │ ├── flickr.places.placesForTags.xml │ │ │ │ ├── flickr.places.getPlaceTypes.xml │ │ │ │ ├── flickr.people.getPhotosOf.xml │ │ │ │ ├── flickr.places.findByLatLon.xml │ │ │ │ ├── flickr.photos.comments.getList.xml │ │ │ │ ├── flickr.tags.getListUserPopular.xml │ │ │ │ ├── flickr.favorites.getPublicList.xml │ │ │ │ ├── flickr.collections.getTree.xml │ │ │ │ ├── flickr.places.placesForBoundingBox.xml │ │ │ │ ├── flickr.photosets.getInfo.xml │ │ │ │ ├── flickr.tags.getListPhoto.xml │ │ │ │ ├── flickr.places.placesForUser.xml │ │ │ │ ├── flickr.photos.getContext.xml │ │ │ │ ├── flickr.photosets.getContext.xml │ │ │ │ ├── flickr.people.getUploadStatus.xml │ │ │ │ ├── flickr.activity.userComments.xml │ │ │ │ ├── flickr.people.getPublicGroups.xml │ │ │ │ ├── flickr.people.getGroups.xml │ │ │ │ ├── flickr.groups.pools.getGroups.xml │ │ │ │ ├── flickr.machinetags.getPredicates.xml │ │ │ │ ├── flickr.tags.getRelated.xml │ │ │ │ ├── flickr.urls.lookupGallery.xml │ │ │ │ ├── flickr.photos.getContactsPhotos.xml │ │ │ │ ├── flickr.places.resolvePlaceId.xml │ │ │ │ ├── flickr.places.resolvePlaceURL.xml │ │ │ │ ├── flickr.tags.getClusters.xml │ │ │ │ ├── flickr.machinetags.getNamespaces.xml │ │ │ │ ├── flickr.people.getInfo.xml │ │ │ │ ├── flickr.photos.licenses.getInfo.xml │ │ │ │ ├── flickr.photos.getContactsPublicPhotos.xml │ │ │ │ ├── flickr.machinetags.getPairs.xml │ │ │ │ ├── flickr.activity.userPhotos.xml │ │ │ │ ├── flickr.places.find.xml │ │ │ │ ├── flickr.photos.getInfo.xml │ │ │ │ ├── flickr.cameras.getBrands.xml │ │ │ │ ├── flickr.photosets.getPhotos.xml │ │ │ │ ├── flickr.photosets.getList.xml │ │ │ │ ├── flickr.people.getPhotos.xml │ │ │ │ ├── flickr.machinetags.getValues.xml │ │ │ │ └── flickr.tags.getListUser.xml │ │ ├── setup.properties.example │ │ └── completenesstest.properties │ └── java │ │ └── com │ │ └── flickr4java │ │ └── flickr │ │ └── test │ │ ├── AuthUtilitiesTest.java │ │ ├── util │ │ ├── TestProperties.java │ │ └── TestPropertiesFactory.java │ │ ├── ObjectTest.java │ │ ├── LicensesInterfaceTest.java │ │ ├── TestInterfaceTest.java │ │ ├── NotesInterfaceTest.java │ │ ├── ActivityInterfaceTest.java │ │ ├── PandaInterfaceTest.java │ │ ├── CommonsInterfaceTest.java │ │ ├── MembersInterfaceTest.java │ │ ├── BlogsInterfaceTest.java │ │ ├── GalleriesInterfaceTest.java │ │ ├── CamerasInterfaceTest.java │ │ ├── PrefsInterfaceTest.java │ │ ├── ContactsInterfaceTest.java │ │ ├── Flickr4JavaTest.java │ │ └── PoolsInterfaceTest.java └── main │ └── java │ └── com │ └── flickr4java │ └── flickr │ ├── stats │ ├── DomainList.java │ ├── StatsSort.java │ ├── ReferrerList.java │ ├── Csv.java │ ├── Domain.java │ ├── Referrer.java │ └── Stats.java │ ├── groups │ ├── GroupList.java │ ├── discuss │ │ ├── ReplyList.java │ │ ├── ReplyObject.java │ │ ├── TopicList.java │ │ └── Reply.java │ ├── members │ │ ├── MembersList.java │ │ └── Member.java │ ├── Subcategory.java │ ├── Blast.java │ ├── Throttle.java │ └── Category.java │ ├── photos │ ├── PoolList.java │ ├── Media.java │ ├── PhotoSetList.java │ ├── PhotoList.java │ ├── PhotoAllContext.java │ ├── PhotoUrl.java │ ├── PhotoContext.java │ ├── suggestions │ │ ├── SuggestionList.java │ │ └── Suggestion.java │ ├── licenses │ │ └── License.java │ ├── Usage.java │ ├── SizeList.java │ ├── Editability.java │ ├── Pool.java │ ├── Exif.java │ ├── Photocount.java │ ├── transform │ │ └── TransformInterface.java │ ├── PhotoSet.java │ └── upload │ │ └── Ticket.java │ ├── activity │ ├── ItemList.java │ └── Event.java │ ├── contacts │ └── ContactList.java │ ├── galleries │ └── GalleryList.java │ ├── people │ ├── UserList.java │ ├── PhotoLimits.java │ ├── VideoLimits.java │ ├── PersonTagList.java │ └── TimeZone.java │ ├── machinetags │ ├── NamespacesList.java │ ├── Pair.java │ ├── Predicate.java │ ├── Namespace.java │ └── Value.java │ ├── cameras │ ├── Brand.java │ ├── Details.java │ └── Camera.java │ ├── tags │ ├── RelatedTagsList.java │ ├── ClusterList.java │ ├── Cluster.java │ ├── HotlistTag.java │ └── TagRaw.java │ ├── Response.java │ ├── panda │ └── Panda.java │ ├── util │ ├── BuddyIconable.java │ ├── ByteUtilities.java │ ├── AuthStore.java │ ├── IOUtilities.java │ ├── DebugOutputStream.java │ ├── DebugInputStream.java │ ├── ImageUtilities.java │ └── StringUtilities.java │ ├── blogs │ ├── Service.java │ └── Blog.java │ ├── uploader │ ├── IUploader.java │ └── Payload.java │ ├── FlickrRuntimeException.java │ ├── ProxyAuthenticator.java │ ├── places │ ├── PlacesList.java │ ├── ShapeDataList.java │ ├── PlaceType.java │ └── ShapeData.java │ ├── Parameter.java │ ├── reflection │ ├── Argument.java │ └── Error.java │ ├── push │ └── PushInterface.java │ ├── FlickrException.java │ ├── photosets │ └── Photosets.java │ ├── auth │ └── Auth.java │ ├── RESTResponse.java │ ├── SearchResultList.java │ └── commons │ └── Institution.java ├── doc ├── video-sizes ├── photo-sizes ├── flickr-video-sizes.xml └── flickr-photo-sizes.xml ├── config └── dependencyCheckSuppression.xml ├── .gitignore ├── ISSUE_TEMPLATE.md ├── CONTRIB.md ├── CHANGELOG.txt └── LICENSE.txt /src/examples/resources/setup.properties.example: -------------------------------------------------------------------------------- 1 | apiKey = your API key 2 | secret = your secret 3 | token = your token -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.favorites.add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.setTags.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.people.add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.people.delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.favorites.remove.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.groups.pools.add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.groups.pools.remove.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.removeTag.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.addPhoto.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.orderSets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.geo.setLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.setContentType.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.setSafetyLevel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.editPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.removePhoto.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.comments.deleteComment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.comments.editComment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.geo.removeLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/video-sizes: -------------------------------------------------------------------------------- 1 | Square 2 | Large Square 3 | Thumbnail 4 | Small 5 | Medium 6 | Original 7 | Video Player 8 | Site MP4 9 | Video Original 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.prefs.getHidden.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/photo-sizes: -------------------------------------------------------------------------------- 1 | Square 2 | Large Square 3 | Thumbnail 4 | Small 5 | Small 320 6 | Medium 7 | Medium 640 8 | Medium 800 9 | Large 10 | Large 1600 11 | Large 2048 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.prefs.getContentType.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.prefs.getSafetyLevel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.groups.join.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.groups.pools.getPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.people.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.prefs.getGeoPerms.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/upload.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 43123716831 4 | -------------------------------------------------------------------------------- /config/dependencyCheckSuppression.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.panda.getPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.getTopPlacesList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.getGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.lookupUser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.getUserPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.geo.getPerms.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.getUserProfile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.lookupGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FlickrCentral 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.setMeta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Robot 5 | Description 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.test.login.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.groups.pools.getContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.findByEmail.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.findByUsername.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getCounts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.groups.leave.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getPerms.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photosets.create.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.panda.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ling ling 5 | hsing hsing 6 | wang wang 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | .gradle 4 | build/ 5 | out/ 6 | src/examples/resources/setup.properties 7 | src/test/resources/setup.properties 8 | Flickr4Java.iml 9 | Flickr4Java.ipr 10 | Flickr4Java.iws 11 | .classpath 12 | .project 13 | .settings/ 14 | bin/ 15 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.blogs.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.addTags.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/DomainList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * 7 | * @author Darren Greaves 8 | */ 9 | public class DomainList extends SearchResultList { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/AuthUtilitiesTest.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test; 2 | 3 | import org.junit.Ignore; 4 | 5 | /** 6 | * Test the AuthUtilities. 7 | * 8 | * @author Anthony Eden 9 | */ 10 | @Ignore 11 | public class AuthUtilitiesTest { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/GroupList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | public class GroupList extends SearchResultList { 6 | private static final long serialVersionUID = 3344960036515265775L; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PoolList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PoolList extends ArrayList { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = -6749839441338939904L; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.contacts.getPublicList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Media.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.flickr4java.flickr.photos; 5 | 6 | /** 7 | * For the media attribute returned for different photo sizes. 8 | * 9 | * @author Darren Greaves 10 | * @see Size 11 | * 12 | */ 13 | public enum Media { 14 | 15 | photo, video; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/discuss/ReplyList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.discuss; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class ReplyList extends ArrayList { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 2830506892011990291L; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoSetList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PhotoSetList extends ArrayList { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = -6749839441338939904L; 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/StatsSort.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | /** 4 | * Sort orders for {@link StatsInterface#getPopularPhotos} 5 | * 6 | * @author Darren Greaves 7 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 8 | */ 9 | public enum StatsSort { 10 | 11 | views, comments, favorites; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/activity/ItemList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.activity; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | public class ItemList extends SearchResultList { 6 | 7 | private static final long serialVersionUID = 7330819045487912618L; 8 | 9 | public ItemList() { 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/contacts/ContactList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.contacts; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | 6 | public class ContactList extends SearchResultList { 7 | 8 | // (avoid compiler warning) 9 | private static final long serialVersionUID = -4735611134085303463L; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/galleries/GalleryList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.galleries; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * @author acaplan 7 | * 8 | */ 9 | public class GalleryList extends SearchResultList { 10 | 11 | private static final long serialVersionUID = 8615256591460951313L; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/people/UserList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.people; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * A list of users 7 | * 8 | * @author acaplan 9 | */ 10 | public class UserList extends SearchResultList { 11 | 12 | private static final long serialVersionUID = -4735611134085303463L; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.geo.getLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Daḩl Hīt 6 | 7 | Ar Riyāḑ 8 | Saudi Arabia 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.blogs.getServices.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Blogger 5 | LiveJournal 6 | Wordpress 7 | BloggerAPI 8 | Twitter 9 | 10 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.contacts.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getPublicPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.placesForTags.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | California, US, United States 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/machinetags/NamespacesList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.machinetags; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * 7 | * @author mago 8 | * @version $Id: NamespacesList.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 9 | */ 10 | public class NamespacesList extends SearchResultList { 11 | private static final long serialVersionUID = 12L; 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.getPlaceTypes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | neighbourhood 5 | locality 6 | county 7 | region 8 | country 9 | continent 10 | 11 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Subject of the issue 2 | Describe your issue here. 3 | 4 | ### Your environment 5 | * version of Flickr4Java 6 | * version of JDK 7 | 8 | ### Steps to reproduce 9 | Tell us how to reproduce this issue. 10 | Please provide working code. 11 | 12 | ### Expected behaviour 13 | Tell us what should happen 14 | 15 | ### Actual behaviour 16 | Tell us what happens instead 17 | 18 | ### Log 19 | ``` 20 | Please copy paste the log here if available 21 | 22 | ``` 23 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/members/MembersList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.members; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * List of Group-members. 7 | * 8 | * @author mago 9 | * @version $Id: MembersList.java,v 1.1 2009/06/21 19:55:15 x-mago Exp $ 10 | */ 11 | public class MembersList extends SearchResultList { 12 | private static final long serialVersionUID = 617037681128L; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoList.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.photos; 4 | 5 | import com.flickr4java.flickr.SearchResultList; 6 | 7 | /** 8 | * A list of photos with additional meta data. 9 | * 10 | * @author Anthony Eden 11 | */ 12 | public class PhotoList extends SearchResultList { 13 | 14 | // (avoid compiler warning) 15 | private static final long serialVersionUID = -4735611134085303463L; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getPhotosOf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/ReferrerList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * 7 | * @author Darren Greaves 8 | */ 9 | public class ReferrerList extends SearchResultList { 10 | 11 | private String name; 12 | 13 | public String getName() { 14 | return name; 15 | } 16 | 17 | public void setName(String name) { 18 | this.name = name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CONTRIB.md: -------------------------------------------------------------------------------- 1 | ## Contributors 2 | 3 | ### flickrj 4 | 5 | Anthony Eden (me at anthonyeden.com) 6 | Martin Goebel (x-mago at gmx.de) 7 | Matthew Ray (matthewhray at gmail.com) 8 | Matthew MacKenzie (matthew.mackenzie at gmail.com) 9 | Till Krech (till at dasburo.com) 10 | 11 | ### Flickr4Java 12 | #### Main contributors/owners 13 | Allan (https://github.com/callmeal) 14 | Darren Greaves (https://github.com/boncey) 15 | 16 | #### Full list 17 | https://github.com/callmeal/Flickr4Java/graphs/contributors 18 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.findByLatLon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.comments.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This looks familiar 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/cameras/Brand.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.cameras; 2 | 3 | public class Brand { 4 | 5 | private String id; 6 | 7 | private String name; 8 | 9 | public String getName() { 10 | return name; 11 | } 12 | 13 | public void setName(String name) { 14 | this.name = name; 15 | } 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.tags.getListUserPopular.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 30 6 | film 7 | for 8 | found 9 | green 10 | is 11 | london 12 | speed 13 | that 14 | this 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.favorites.getPublicList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.collections.getTree.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/tags/RelatedTagsList.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.tags; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * @author Anthony Eden 9 | */ 10 | public class RelatedTagsList extends ArrayList { 11 | private static final long serialVersionUID = 12L; 12 | 13 | private String source; 14 | 15 | public String getSource() { 16 | return source; 17 | } 18 | 19 | public void setSource(String source) { 20 | this.source = source; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.placesForBoundingBox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | China Basin Heliport, United States 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/Response.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr; 4 | 5 | import org.w3c.dom.Document; 6 | import org.w3c.dom.Element; 7 | 8 | import java.util.Collection; 9 | 10 | /** 11 | * @author Anthony Eden 12 | */ 13 | public interface Response { 14 | 15 | void parse(Document document); 16 | 17 | boolean isError(); 18 | 19 | String getErrorCode(); 20 | 21 | String getErrorMessage(); 22 | 23 | Element getPayload(); 24 | 25 | Collection getPayloadCollection(); 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photosets.getInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PhotosetsInterfaceTest 5 | JUnit test, should be deleted 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.tags.getListPhoto.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | green 6 | grn 7 | grngrn 8 | 9 | 10 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Release 1. (): 2 | - Initial release. 3 | 4 | Release 2. (April 5, 2012): 5 | - Completeness Release 6 | - Implemented API Methods for the following: 7 | + URL API 8 | + Stats API 9 | + Photosets API 10 | + PhotosetsComments API 11 | + People API 12 | + Collections API 13 | + Galleries API 14 | - Suggestion and Push API's remain unimplemented, as the functionality is yet to be released from Flickr 15 | - Cleaned up use of Exceptions. Flickr4Java will throw a FlickrException, cleaned up API to reflect this 16 | - Implemented some JUnit tests 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/panda/Panda.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.panda; 2 | 3 | /** 4 | * Holds the name of a panda. 5 | * 6 | * @author mago 7 | * @version $Id: Panda.java,v 1.3 2009/07/12 22:43:07 x-mago Exp $ 8 | * @see com.flickr4java.flickr.panda.PandaInterface#getPhotos(Panda, java.util.Set, int, int) 9 | */ 10 | public class Panda { 11 | 12 | String name; 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | public void setName(String name) { 19 | this.name = name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/tags/ClusterList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.tags; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * List (tag-)clusters. 7 | * 8 | * @author mago 9 | * @since 1.2 10 | * @version $Id: ClusterList.java,v 1.1 2008/07/19 14:42:54 x-mago Exp $ 11 | */ 12 | public class ClusterList { 13 | 14 | private ArrayList clusters = new ArrayList(); 15 | 16 | public void addCluster(Cluster cluster) { 17 | clusters.add(cluster); 18 | } 19 | 20 | public ArrayList getClusters() { 21 | return clusters; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/BuddyIconable.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.util; 2 | 3 | /** 4 | * Defines an interface for methods needed to get a BuddyIconUrl. 5 | * 6 | * @author mago 7 | * @version $Id: BuddyIconable.java,v 1.1 2008/01/11 21:02:55 x-mago Exp $ 8 | */ 9 | public interface BuddyIconable { 10 | String getBuddyIconUrl(); 11 | 12 | int getIconFarm(); 13 | 14 | int getIconServer(); 15 | 16 | void setIconFarm(int iconFarm); 17 | 18 | void setIconFarm(String iconFarm); 19 | 20 | void setIconServer(int iconServer); 21 | 22 | void setIconServer(String iconServer); 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.placesForUser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | England, GB, United Kingdom 5 | Riyadh, SA, Saudi Arabia 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/blogs/Service.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.blogs; 2 | 3 | /** 4 | * 5 | * @author mago 6 | * @version $Id: Service.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 7 | */ 8 | public class Service { 9 | 10 | private String id; 11 | 12 | private String name; 13 | 14 | public String getId() { 15 | return id; 16 | } 17 | 18 | public void setId(String id) { 19 | this.id = id; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/tags/Cluster.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.tags; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * Cluster (list) of tags. 7 | * 8 | * @author mago 9 | * @since 1.2 10 | * @version $Id: Cluster.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 11 | */ 12 | public class Cluster { 13 | 14 | private ArrayList tags = new ArrayList(); 15 | 16 | public void addTag(Tag tag) { 17 | tags.add(tag); 18 | } 19 | 20 | public ArrayList getTags() { 21 | return tags; 22 | } 23 | 24 | public void setTags(ArrayList tags) { 25 | this.tags = tags; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photosets.getContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getUploadStatus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoAllContext.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | public class PhotoAllContext { 4 | 5 | private PhotoSetList photoSetList = new PhotoSetList(); 6 | private PoolList poolList = new PoolList(); 7 | 8 | public PhotoSetList getPhotoSetList() { 9 | return photoSetList; 10 | } 11 | public void setPhotoSetList(PhotoSetList photoSetList) { 12 | this.photoSetList = photoSetList; 13 | } 14 | public PoolList getPoolList() { 15 | return poolList; 16 | } 17 | public void setPoolList(PoolList poolList) { 18 | this.poolList = poolList; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.activity.userComments.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cheddar 6 | 7 | Test comment. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.favorites.getContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoUrl.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.photos; 4 | 5 | /** 6 | * @author Anthony Eden 7 | */ 8 | public class PhotoUrl { 9 | 10 | private String url; 11 | 12 | private String type; 13 | 14 | public String getUrl() { 15 | return url; 16 | } 17 | 18 | public void setUrl(String url) { 19 | this.url = url; 20 | } 21 | 22 | /** 23 | * Possible known type is photopage. 24 | * 25 | * @return Type of URL 26 | */ 27 | public String getType() { 28 | return type; 29 | } 30 | 31 | public void setType(String type) { 32 | this.type = type; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/discuss/ReplyObject.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.discuss; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class ReplyObject { 6 | 7 | private ArrayList topicList = new ArrayList(); 8 | private ArrayList replyList = new ArrayList(); 9 | 10 | public ArrayList getTopicList() { 11 | return topicList; 12 | } 13 | public void setTopicList(ArrayList topicList) { 14 | this.topicList = topicList; 15 | } 16 | public ArrayList getReplyList() { 17 | return replyList; 18 | } 19 | public void setReplyList(ArrayList replyList) { 20 | this.replyList = replyList; 21 | } 22 | 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getPublicGroups.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoContext.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.photos; 3 | 4 | /** 5 | * @author Anthony Eden 6 | */ 7 | public class PhotoContext { 8 | 9 | private Photo previousPhoto; 10 | 11 | private Photo nextPhoto; 12 | 13 | public PhotoContext() { 14 | 15 | } 16 | 17 | public Photo getPreviousPhoto() { 18 | return previousPhoto; 19 | } 20 | 21 | public void setPreviousPhoto(Photo previousPhoto) { 22 | this.previousPhoto = previousPhoto; 23 | } 24 | 25 | public Photo getNextPhoto() { 26 | return nextPhoto; 27 | } 28 | 29 | public void setNextPhoto(Photo nextPhoto) { 30 | this.nextPhoto = nextPhoto; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.test.echo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | flickr.test.echo 4 | test 5 | 20f26bfcb5a2b46a2c11fd1210d3b420 6 | 372917862 7 | Dd8y7BG5UKBXZamjZx6/U3IH82k= 8 | 72157628704501859-025864ab0471c9bc 9 | 20f26bfcb5a2b46a2c11fd1210d3b420 10 | 1714311301 11 | HMAC-SHA1 12 | 1.0 13 | 1 14 | Dd8y7BG5UKBXZamjZx6/U3IH82k= 15 | 72157628704501859-025864ab0471c9bc 16 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.galleries.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test 6 | test gallery for Flickr4Java 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/uploader/IUploader.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.uploader; 2 | 3 | import com.flickr4java.flickr.FlickrException; 4 | 5 | import java.io.File; 6 | import java.io.InputStream; 7 | 8 | public interface IUploader { 9 | String upload(byte[] data, UploadMetaData metaData) throws FlickrException; 10 | 11 | String upload(File file, UploadMetaData metaData) throws FlickrException; 12 | 13 | String upload(InputStream in, UploadMetaData metaData) throws FlickrException; 14 | 15 | String replace(InputStream in, String flickrId, boolean async) throws FlickrException; 16 | 17 | String replace(byte[] data, String flickrId, boolean async) throws FlickrException; 18 | 19 | String replace(File file, String flickrId, boolean async) throws FlickrException; 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getGroups.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/FlickrRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr; 2 | 3 | /** 4 | * {@link RuntimeException} wrapper for the various XML or IO Exceptions thrown. 5 | * 6 | * @author Darren Greaves 7 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 8 | */ 9 | public class FlickrRuntimeException extends RuntimeException { 10 | 11 | private static final long serialVersionUID = 1303207981175254196L; 12 | 13 | public FlickrRuntimeException() { 14 | } 15 | 16 | public FlickrRuntimeException(String message) { 17 | super(message); 18 | } 19 | 20 | public FlickrRuntimeException(Throwable rootCause) { 21 | super(rootCause); 22 | } 23 | 24 | public FlickrRuntimeException(String message, Throwable rootCause) { 25 | super(message, rootCause); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.groups.pools.getGroups.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/people/PhotoLimits.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.people; 2 | 3 | public class PhotoLimits { 4 | 5 | 6 | private String maxDisplay; 7 | private String maxUpload; 8 | 9 | /** 10 | * Maximum photo display pixels 11 | * 12 | * @return String max pixels 13 | */ 14 | 15 | public String getMaxDisplay(){ 16 | return maxDisplay; 17 | } 18 | 19 | public void setMaxDisplay(String maxDisplay){ 20 | this.maxDisplay = maxDisplay; 21 | } 22 | 23 | /** 24 | * Maximum photo upload 25 | * 26 | * @return String upload capacity 27 | */ 28 | 29 | 30 | public String getMaxUpload(){ 31 | return maxUpload; 32 | } 33 | 34 | public void setMaxUpload(String maxUpload){ 35 | this.maxUpload = maxUpload; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/people/VideoLimits.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.people; 2 | 3 | public class VideoLimits { 4 | 5 | private String maxDuration; 6 | private String maxUpload; 7 | 8 | /** 9 | * Maximum photo display pixels 10 | * 11 | * @return String max pixels 12 | */ 13 | 14 | public String getMaxDuration(){ 15 | return maxDuration; 16 | } 17 | 18 | public void setMaxDuration(String maxDuration){ 19 | this.maxDuration = maxDuration; 20 | } 21 | 22 | /** 23 | * Maximum photo upload 24 | * 25 | * @return String upload capacity 26 | */ 27 | 28 | 29 | public String getMaxUpload(){ 30 | return maxUpload; 31 | } 32 | 33 | public void setMaxUpload(String maxUpload){ 34 | this.maxUpload = maxUpload; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/people/PersonTagList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.people; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PersonTagList extends ArrayList { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = -1841985011941978229L; 11 | 12 | private int total; 13 | private int height; 14 | private int width; 15 | 16 | public int getTotal() { 17 | return total; 18 | } 19 | public void setTotal(int total) { 20 | this.total = total; 21 | } 22 | public int getHeight() { 23 | return height; 24 | } 25 | public void setHeight(int height) { 26 | this.height = height; 27 | } 28 | public int getWidth() { 29 | return width; 30 | } 31 | public void setWidth(int width) { 32 | this.width = width; 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/suggestions/SuggestionList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos.suggestions; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class SuggestionList extends ArrayList{ 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = -791184866429373856L; 11 | private int total; 12 | private int perPage; 13 | private int page; 14 | 15 | public int getTotal() { 16 | return total; 17 | } 18 | public void setTotal(int total) { 19 | this.total = total; 20 | } 21 | public int getPerPage() { 22 | return perPage; 23 | } 24 | public void setPerPage(int perPage) { 25 | this.perPage = perPage; 26 | } 27 | public int getPage() { 28 | return page; 29 | } 30 | public void setPage(int page) { 31 | this.page = page; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.machinetags.getPredicates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | age 5 | all 6 | flickrprivacy 7 | flickrsafesearch 8 | groups 9 | location 10 | privacy 11 | projects 12 | realestate 13 | safesearch 14 | 15 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/licenses/License.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.photos.licenses; 4 | 5 | /** 6 | * @author Anthony Eden 7 | */ 8 | public class License { 9 | private static final long serialVersionUID = 12L; 10 | 11 | private String id; 12 | 13 | private String name; 14 | 15 | private String url; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getUrl() { 34 | return url; 35 | } 36 | 37 | public void setUrl(String url) { 38 | this.url = url; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.tags.getRelated.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | macro 5 | nature 6 | yellow 7 | red 8 | green 9 | garden 10 | pink 11 | purple 12 | bokeh 13 | closeup 14 | rose 15 | flowers 16 | plant 17 | white 18 | bee 19 | dof 20 | nikon 21 | insect 22 | canon 23 | orange 24 | sunflower 25 | petals 26 | color 27 | blue 28 | naturesfinest 29 | daisy 30 | rosa 31 | summer 32 | tulip 33 | butterfly 34 | water 35 | pollen 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/ProxyAuthenticator.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr; 2 | 3 | import java.net.Authenticator; 4 | import java.net.PasswordAuthentication; 5 | 6 | /** 7 | * Used to set the credentials for proxy-authentication in {@link REST#setProxy(String, int, String, String)}. 8 | * 9 | * @author mago 10 | * @version $Id: ProxyAuthenticator.java,v 1.1 2007/11/25 00:26:51 x-mago Exp $ 11 | */ 12 | public class ProxyAuthenticator extends Authenticator { 13 | String userName = ""; 14 | 15 | String passWord = ""; 16 | 17 | public ProxyAuthenticator(String userName, String passWord) { 18 | this.userName = userName; 19 | this.passWord = passWord; 20 | } 21 | 22 | protected PasswordAuthentication getPasswordAuthentication() { 23 | return new PasswordAuthentication(userName, passWord.toCharArray()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/Subcategory.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.groups; 3 | 4 | /** 5 | * Class representing a subcategory. 6 | * 7 | * @author Anthony Eden 8 | */ 9 | public class Subcategory { 10 | 11 | private int id; 12 | 13 | private String name; 14 | 15 | private int count; 16 | 17 | public Subcategory() { 18 | 19 | } 20 | 21 | public int getId() { 22 | return id; 23 | } 24 | 25 | public void setId(int id) { 26 | this.id = id; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | public int getCount() { 38 | return count; 39 | } 40 | 41 | public void setCount(int count) { 42 | this.count = count; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/util/TestProperties.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test.util; 2 | 3 | import java.util.List; 4 | 5 | public interface TestProperties { 6 | String getHost(); 7 | 8 | String getApiKey(); 9 | 10 | String getSecret(); 11 | 12 | String getToken(); 13 | 14 | String getTokenSecret(); 15 | 16 | String getNsid(); 17 | 18 | String getEmail(); 19 | 20 | String getUsername(); 21 | 22 | String getGroupId(); 23 | 24 | String getTestGroupId(); 25 | 26 | String getPhotoId(); 27 | 28 | String getPhotosetId(); 29 | 30 | String getImageFile(); 31 | 32 | String getGeoWritePhotoId(); 33 | 34 | String getCollectionId(); 35 | 36 | String getCollectionUrlId(); 37 | 38 | String getGalleryId(); 39 | 40 | String getDisplayname(); 41 | 42 | List getPhotosetPhotos(); 43 | 44 | boolean isRealFlickr(); 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.urls.lookupGallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | test 5 | test gallery for Flickr4Java 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/tags/HotlistTag.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.tags; 2 | 3 | /** 4 | * 5 | * @author mago 6 | * @version $Id: HotlistTag.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 7 | */ 8 | public class HotlistTag { 9 | 10 | private String value; 11 | 12 | private int score = 0; 13 | 14 | public HotlistTag() { 15 | 16 | } 17 | 18 | @Deprecated 19 | // Note that the API no longer returns the score 20 | public int getScore() { 21 | return score; 22 | } 23 | 24 | public void setScore(int score) { 25 | this.score = score; 26 | } 27 | 28 | public void setScore(String score) { 29 | setScore(Integer.parseInt(score)); 30 | } 31 | 32 | public String getValue() { 33 | return value; 34 | } 35 | 36 | public void setValue(String value) { 37 | this.value = value; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.photos.comments.addComment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a test for the flickr java api 5 | 6 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/places/PlacesList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.places; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | /** 6 | * Simple Extension of SearchResultList. 7 | * 8 | * @author mago 9 | * @version $Id: PlacesList.java,v 1.1 2008/01/19 22:53:56 x-mago Exp $ 10 | */ 11 | public class PlacesList extends SearchResultList { 12 | private static final long serialVersionUID = -6773614467896936754L; 13 | private String bBox; 14 | private String placeType; 15 | 16 | public PlacesList() { 17 | } 18 | 19 | public String getBBox() { 20 | return bBox; 21 | } 22 | 23 | public void setBBox(String bBox) { 24 | this.bBox = bBox; 25 | } 26 | 27 | public String getPlaceType() { 28 | return placeType; 29 | } 30 | 31 | public void setPlaceType(String placeType) { 32 | this.placeType = placeType; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Usage.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | public class Usage { 4 | 5 | private boolean canBlog; 6 | private boolean canPrint; 7 | private boolean canDownload; 8 | private boolean canShare; 9 | 10 | public boolean isCanBlog() { 11 | return canBlog; 12 | } 13 | public void setIsCanBlog(boolean canBlog) { 14 | this.canBlog = canBlog; 15 | } 16 | 17 | public boolean isCanPrint() { 18 | return canPrint; 19 | } 20 | public void setIsCanPrint(boolean canPrint) { 21 | this.canPrint = canPrint; 22 | } 23 | 24 | public boolean isCanDownload() { 25 | return canDownload; 26 | } 27 | public void setIsCanDownload(boolean canDownload) { 28 | this.canDownload = canDownload; 29 | } 30 | public boolean isCanShare() { 31 | return canShare; 32 | } 33 | public void setIsCanShare(boolean canShare) { 34 | this.canShare = canShare; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/Parameter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr; 3 | 4 | /** 5 | * Class encapsulating a name/value parameter. 6 | * 7 | * @author Anthony Eden 8 | */ 9 | public class Parameter { 10 | 11 | private String name; 12 | 13 | private Object value; 14 | 15 | /** 16 | * Construct the Parameter. 17 | * 18 | * @param name 19 | * The parameter name 20 | * @param value 21 | * The parameter value 22 | */ 23 | public Parameter(String name, Object value) { 24 | this.name = name; 25 | this.value = value; 26 | } 27 | 28 | public Parameter(String name, long value) { 29 | this.name = name; 30 | this.value = value; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public Object getValue() { 38 | return value; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/ByteUtilities.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.util; 4 | 5 | /** 6 | * Byte utilities. 7 | * 8 | * @author Anthony Eden 9 | */ 10 | public class ByteUtilities { 11 | 12 | static char[] hexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 13 | 14 | /** 15 | * Convert a byte array to a hex string. 16 | * 17 | * @param b 18 | * The byte array 19 | * @return The hex String 20 | */ 21 | public static String toHexString(byte[] b) { 22 | StringBuffer sb = new StringBuffer(b.length * 2); 23 | for (int i = 0; i < b.length; i++) { 24 | // look up high nibble char 25 | sb.append(hexChar[(b[i] & 0xf0) >>> 4]); 26 | 27 | // look up low nibble char 28 | sb.append(hexChar[b[i] & 0x0f]); 29 | } 30 | return sb.toString(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/SizeList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | import java.util.ArrayList; 4 | 5 | 6 | 7 | public class SizeList extends ArrayList { 8 | 9 | /** 10 | * @author Jonathan Willis 11 | */ 12 | private static final long serialVersionUID = -4735611134085303463L; 13 | 14 | private boolean canBlog; 15 | private boolean canPrint; 16 | private boolean canDownload; 17 | 18 | public boolean isCanBlog() { 19 | return canBlog; 20 | } 21 | public void setIsCanBlog(boolean canBlog) { 22 | this.canBlog = canBlog; 23 | } 24 | 25 | public boolean isCanPrint() { 26 | return canPrint; 27 | } 28 | public void setIsCanPrint(boolean canPrint) { 29 | this.canPrint = canPrint; 30 | } 31 | 32 | public boolean isCanDownload() { 33 | return canDownload; 34 | } 35 | public void setIsCanDownload(boolean canDownload) { 36 | this.canDownload = canDownload; 37 | } 38 | 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/ObjectTest.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test; 2 | 3 | import static org.junit.Assert.assertFalse; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import com.flickr4java.flickr.photos.Photo; 7 | 8 | import org.junit.Test; 9 | 10 | /** 11 | * 12 | * @author mago 13 | * @version $Id: ObjectTest.java,v 1.1 2009/07/23 20:41:03 x-mago Exp $ 14 | */ 15 | public class ObjectTest { 16 | /** 17 | * Testing the equals-implementation. 18 | * 19 | * Don't test every single member, as they are covered in equals() by reflection. Emphasis on the child-objects. 20 | */ 21 | @Test 22 | public void testPhoto() { 23 | Photo p1 = new Photo(); 24 | Photo p2 = new Photo(); 25 | assertTrue(p1.equals(p2)); 26 | 27 | p1.setSecret("secret"); 28 | assertFalse(p1.equals(p2)); 29 | p2.setSecret("secret"); 30 | assertTrue(p1.equals(p2)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/setup.properties.example: -------------------------------------------------------------------------------- 1 | host = www.flickr.com 2 | apiKey = f48f2e5ac98e94a7231aae79594e944c 3 | email = allancaplan 4 | username = I_am_Allan 5 | displayname = I_am_Allan 6 | nsid = 84454580@N00 7 | groupid = 34427469792@N01 # Flickr Central group, no need to change this 8 | testgroupid = (a group that you created) 9 | photoid = 1088148233 10 | photosetid = 122485 11 | collectionid = (taken from a call to http://www.flickr.com/services/api/flickr.collections.getTree.htm) 12 | collectionurlid = (taken from the id in the collection URL) 13 | imagefile = path/to/test/image 14 | secret = af995d0f2bc3ee51 15 | token = your token (with delete privileges) 16 | tokensecret = your token secret (as returned by OAuth) 17 | galleryid = 72157629277637049 18 | photosetphotos = (comma separated list of ids of at least 3 photos that you own) 19 | 20 | # id of a photo in your stream 21 | # which the tests can use to set, get and remove geo data 22 | # existing geo data will be destroyed! 23 | geo.write.photoid = 1088148233 -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/cameras/Details.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.cameras; 2 | 3 | public class Details { 4 | private String megapixels; 5 | 6 | private String zoom; 7 | 8 | private String lcdSize; 9 | 10 | private String storageType; 11 | 12 | public String getMegapixels() { 13 | return megapixels; 14 | } 15 | 16 | public void setMegapixels(String megapixels) { 17 | this.megapixels = megapixels; 18 | } 19 | 20 | public String getZoom() { 21 | return zoom; 22 | } 23 | 24 | public void setZoom(String zoom) { 25 | this.zoom = zoom; 26 | } 27 | 28 | public String getLcdSize() { 29 | return lcdSize; 30 | } 31 | 32 | public void setLcdSize(String lcdSize) { 33 | this.lcdSize = lcdSize; 34 | } 35 | 36 | public String getStorageType() { 37 | return storageType; 38 | } 39 | 40 | public void setStorageType(String storageType) { 41 | this.storageType = storageType; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getContactsPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/tags/TagRaw.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.tags; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 8 | * @see com.flickr4java.flickr.tags.TagsInterface#getListUserRaw 9 | * @author mago 10 | * @version $Id: TagRaw.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 11 | */ 12 | public class TagRaw { 13 | 14 | private String owner; 15 | 16 | private String clean; 17 | 18 | private List raw = new ArrayList(); 19 | 20 | public TagRaw() { 21 | } 22 | 23 | public String getClean() { 24 | return clean; 25 | } 26 | 27 | public void setClean(String clean) { 28 | this.clean = clean; 29 | } 30 | 31 | public String getOwner() { 32 | return owner; 33 | } 34 | 35 | public void setOwner(String owner) { 36 | this.owner = owner; 37 | } 38 | 39 | public List getRaw() { 40 | return raw; 41 | } 42 | 43 | public void addRaw(String rawStr) { 44 | raw.add(rawStr); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.resolvePlaceId.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | San Francisco, California, United States 5 | San Francisco County, California, United States 6 | California, United States 7 | United States 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.resolvePlaceURL.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | San Francisco, California, United States 5 | San Francisco County, California, United States 6 | California, United States 7 | United States 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/Csv.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * For the flickr.stats.getCSVFiles call. 10 | * 11 | * @author Darren Greaves 12 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 13 | */ 14 | public class Csv { 15 | 16 | /** 17 | * Logger. 18 | */ 19 | @SuppressWarnings("unused") 20 | private static Logger _log = LoggerFactory.getLogger(Csv.class); 21 | 22 | private String href; 23 | 24 | private String type; 25 | 26 | private Date date; 27 | 28 | public String getHref() { 29 | return href; 30 | } 31 | 32 | public void setHref(String href) { 33 | this.href = href; 34 | } 35 | 36 | public String getType() { 37 | return type; 38 | } 39 | 40 | public void setType(String type) { 41 | this.type = type; 42 | } 43 | 44 | public Date getDate() { 45 | return date; 46 | } 47 | 48 | public void setDate(Date date) { 49 | this.date = date; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/reflection/Argument.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.reflection; 4 | 5 | /** 6 | * Describes an argument of a Flickr-method. 7 | * 8 | * @author Anthony Eden 9 | * @see Method#getArguments() 10 | * @see Method#setArguments(java.util.Collection) 11 | * @version $Id: Argument.java,v 1.3 2007/11/18 22:48:09 x-mago Exp $ 12 | */ 13 | public class Argument { 14 | 15 | private String name; 16 | 17 | private boolean optional; 18 | 19 | private String description; 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | 29 | public boolean isOptional() { 30 | return optional; 31 | } 32 | 33 | public void setOptional(boolean optional) { 34 | this.optional = optional; 35 | } 36 | 37 | public String getDescription() { 38 | return description; 39 | } 40 | 41 | public void setDescription(String description) { 42 | this.description = description; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/push/PushInterface.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author acaplan 3 | */ 4 | package com.flickr4java.flickr.push; 5 | 6 | import com.flickr4java.flickr.Transport; 7 | 8 | /** 9 | * @author acaplan 10 | * 11 | */ 12 | public class PushInterface { 13 | 14 | public static final String METHOD_GET_SUBSCRIPTIONS = "flickr.push.getSubscriptions"; 15 | 16 | public static final String METHOD_GET_TOPICS = "flickr.push.getTopics"; 17 | 18 | public static final String METHOD_SUBSCRIBE = "flickr.push.subscribe"; 19 | 20 | public static final String METHOD_UNSUBSCRIBE = "flickr.push.unsubscribe"; 21 | 22 | private String apiKey; 23 | 24 | private String sharedSecret; 25 | 26 | private Transport transportAPI; 27 | 28 | /** 29 | * 30 | * @param apiKey 31 | * @param sharedSecret 32 | * @param transportAPI 33 | */ 34 | public PushInterface(String apiKey, String sharedSecret, Transport transportAPI) { 35 | this.apiKey = apiKey; 36 | this.sharedSecret = sharedSecret; 37 | this.transportAPI = transportAPI; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/resources/payloads/post/flickr.galleries.getInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Motorcycle Pics 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.tags.getClusters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fiori 6 | macro 7 | insetti 8 | flowers 9 | natura 10 | nature 11 | insects 12 | nikon 13 | animali 14 | primavera 15 | spring 16 | closeup 17 | canon 18 | estate 19 | 20 | 21 | verde 22 | green 23 | 24 | 25 | bee 26 | ape 27 | bees 28 | flower 29 | fiore 30 | insect 31 | italy 32 | yellow 33 | giallo 34 | miele 35 | honey 36 | italia 37 | insetto 38 | girasole 39 | sunflower 40 | 41 | 42 | flickr 43 | screenshot 44 | flickrapi 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/LicensesInterfaceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Your Corporation. All Rights Reserved. 3 | */ 4 | 5 | package com.flickr4java.flickr.test; 6 | 7 | import static org.junit.Assert.assertNotNull; 8 | import static org.junit.Assert.assertTrue; 9 | 10 | import java.util.Collection; 11 | 12 | import org.junit.Test; 13 | 14 | import com.flickr4java.flickr.FlickrException; 15 | import com.flickr4java.flickr.photos.licenses.License; 16 | import com.flickr4java.flickr.photos.licenses.LicensesInterface; 17 | 18 | /** 19 | * @author Anthony Eden 20 | */ 21 | public class LicensesInterfaceTest extends Flickr4JavaTest { 22 | 23 | @Test 24 | public void testGetInfo() throws FlickrException { 25 | LicensesInterface iface = flickr.getLicensesInterface(); 26 | Collection licenses = iface.getInfo(); 27 | assertNotNull(licenses); 28 | assertTrue(licenses.size() > 0); 29 | for (License license : licenses) { 30 | assertNotNull(license.getId()); 31 | assertNotNull(license.getName()); 32 | assertNotNull(license.getUrl()); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.machinetags.getNamespaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | cameratoss 5 | camertoss 6 | commons 7 | content 8 | diptych 9 | experimentcameratoss 10 | fc 11 | getty 12 | gravitygroup 13 | image 14 | jds 15 | jp2br 16 | labels 17 | pfo 18 | thegardens 19 | wrh 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/Blast.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups; 2 | 3 | public class Blast { 4 | 5 | private String dateBlastAdded; 6 | 7 | private String userId; 8 | 9 | private String blast; 10 | 11 | /** 12 | * Unix timestamp formatted date 13 | * 14 | * @return date blast was added 15 | */ 16 | public String getDateBlastAdded() { 17 | return dateBlastAdded; 18 | } 19 | 20 | public void setDateBlastAdded(String dateBlastAdded) { 21 | this.dateBlastAdded = dateBlastAdded; 22 | } 23 | 24 | /** 25 | * Blaster's user_id 26 | * 27 | * @return user_id 28 | */ 29 | public String getUserId() { 30 | return userId; 31 | } 32 | 33 | public void setUserId(String userId) { 34 | this.userId = userId; 35 | } 36 | 37 | /** 38 | * Text of the blast 39 | * 40 | * @return blast text 41 | */ 42 | public String getBlast() { 43 | return blast; 44 | } 45 | 46 | public void setBlast(String blast) { 47 | this.blast = blast; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/FlickrException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr; 3 | 4 | /** 5 | * Exception which wraps a Flickr error. 6 | * 7 | * @author Anthony Eden 8 | */ 9 | public class FlickrException extends Exception { 10 | 11 | private static final long serialVersionUID = 7958091410349084831L; 12 | 13 | private String errorCode; 14 | 15 | private String errorMessage; 16 | 17 | public FlickrException(String errorMessage) { 18 | 19 | super(errorMessage); 20 | } 21 | 22 | public FlickrException(String errorMessage, Throwable rootCause) { 23 | 24 | super(errorMessage, rootCause); 25 | } 26 | 27 | public FlickrException(Throwable rootCause) { 28 | 29 | super(rootCause); 30 | } 31 | 32 | public FlickrException(String errorCode, String errorMessage) { 33 | super(errorCode + ": " + errorMessage); 34 | this.errorCode = errorCode; 35 | this.errorMessage = errorMessage; 36 | } 37 | 38 | public String getErrorCode() { 39 | return errorCode; 40 | } 41 | 42 | public String getErrorMessage() { 43 | return errorMessage; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/cameras/Camera.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.cameras; 2 | 3 | public class Camera { 4 | 5 | private String id; 6 | 7 | private Details details; 8 | 9 | private String smallImage; 10 | 11 | private String largeImage; 12 | 13 | private String name; 14 | 15 | public String getSmallImage() { 16 | return smallImage; 17 | } 18 | 19 | public void setSmallImage(String smallImage) { 20 | this.smallImage = smallImage; 21 | } 22 | 23 | public String getLargeImage() { 24 | return largeImage; 25 | } 26 | 27 | public void setLargeImage(String largeImage) { 28 | this.largeImage = largeImage; 29 | } 30 | 31 | public String getId() { 32 | return id; 33 | } 34 | 35 | public void setId(String id) { 36 | this.id = id; 37 | } 38 | 39 | public Details getDetails() { 40 | return details; 41 | } 42 | 43 | public void setDetails(Details details) { 44 | this.details = details; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/reflection/Error.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.reflection; 4 | 5 | /** 6 | * Describes one possible error-code of a Flickr-method. 7 | * 8 | * @author Anthony Eden 9 | * @see Method#getErrors() 10 | * @see Method#setErrors(java.util.Collection) 11 | * @version $Id: Error.java,v 1.3 2007/11/18 22:48:09 x-mago Exp $ 12 | */ 13 | public class Error { 14 | 15 | private int code; 16 | 17 | private String message; 18 | 19 | private String explaination; 20 | 21 | public int getCode() { 22 | return code; 23 | } 24 | 25 | public void setCode(int code) { 26 | this.code = code; 27 | } 28 | 29 | public void setCode(String code) { 30 | setCode(Integer.parseInt(code)); 31 | } 32 | 33 | public String getMessage() { 34 | return message; 35 | } 36 | 37 | public void setMessage(String message) { 38 | this.message = message; 39 | } 40 | 41 | public String getExplaination() { 42 | return explaination; 43 | } 44 | 45 | public void setExplaination(String explaination) { 46 | this.explaination = explaination; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/machinetags/Pair.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.machinetags; 2 | 3 | /** 4 | * 5 | * @author mago 6 | * @version $Id: Pair.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 7 | */ 8 | public class Pair { 9 | 10 | String namespace; 11 | 12 | String predicate; 13 | 14 | int usage; 15 | 16 | public String getNamespace() { 17 | return namespace; 18 | } 19 | 20 | public void setNamespace(String namespace) { 21 | this.namespace = namespace; 22 | } 23 | 24 | public String getPredicate() { 25 | return predicate; 26 | } 27 | 28 | public void setPredicate(String predicate) { 29 | this.predicate = predicate; 30 | } 31 | 32 | public int getUsage() { 33 | return usage; 34 | } 35 | 36 | public void setUsage(String predicates) { 37 | try { 38 | setUsage(Integer.parseInt(predicates)); 39 | } catch (NumberFormatException e) { 40 | } 41 | } 42 | 43 | public void setUsage(int usage) { 44 | this.usage = usage; 45 | } 46 | 47 | public String getValue() { 48 | return namespace + ":" + predicate; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/TestInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertNotNull; 6 | 7 | import com.flickr4java.flickr.FlickrException; 8 | import com.flickr4java.flickr.people.User; 9 | 10 | import org.junit.Test; 11 | import org.w3c.dom.Element; 12 | 13 | import java.util.Collection; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | /** 18 | * @author Anthony Eden 19 | * @version $Id: TestInterfaceTest.java,v 1.6 2008/01/28 23:01:45 x-mago Exp $ 20 | */ 21 | public class TestInterfaceTest extends Flickr4JavaTest { 22 | 23 | @Test 24 | public void testEcho() throws FlickrException { 25 | TestInterface iface = flickr.getTestInterface(); 26 | Map params = new HashMap(); 27 | params.put("test", "test"); 28 | Collection results = iface.echo(params); 29 | assertNotNull(results); 30 | } 31 | 32 | @Test 33 | public void testLogin() throws FlickrException { 34 | TestInterface iface = flickr.getTestInterface(); 35 | User user = iface.login(); 36 | assertNotNull(user); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/places/ShapeDataList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.places; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class ShapeDataList extends ArrayList{ 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 3405746186476466870L; 11 | 12 | private int total; 13 | private String woeId; 14 | private String placeId; 15 | private String placeType; 16 | private int placeTypeId; 17 | 18 | 19 | public int getPlaceTypeId() { 20 | return placeTypeId; 21 | } 22 | 23 | public void setPlaceTypeId(int placeTypeId) { 24 | this.placeTypeId = placeTypeId; 25 | } 26 | public int getTotal() { 27 | return total; 28 | } 29 | public void setTotal(int total) { 30 | this.total = total; 31 | } 32 | public String getWoeId() { 33 | return woeId; 34 | } 35 | public void setWoeId(String woeId) { 36 | this.woeId = woeId; 37 | } 38 | public String getPlaceId() { 39 | return placeId; 40 | } 41 | public void setPlaceId(String placeId) { 42 | this.placeId = placeId; 43 | } 44 | 45 | public String getPlaceType() { 46 | return placeType; 47 | } 48 | 49 | public void setPlaceType(String placeType) { 50 | this.placeType = placeType; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | boncey_test 5 | Darren Greaves 6 | a35471fa063d334a497c1ad805a0bbf4d1f77641 7 | London, England 8 | 9 | I am <a href="https://flickr.com/photos/boncey">boncey</a>'s test account. 10 | https://www.flickr.com/photos/boncey_test/ 11 | https://www.flickr.com/people/boncey_test/ 12 | https://www.flickr.com/photos/boncey_test/ 13 | 14 | 2009-12-07 14:28:39 15 | 1260224919 16 | 35 17 | 108 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/NotesInterfaceTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author acaplan 3 | */ 4 | package com.flickr4java.flickr.test; 5 | 6 | import static org.junit.Assert.fail; 7 | 8 | import org.junit.Ignore; 9 | import org.junit.Test; 10 | 11 | /** 12 | * @author acaplan 13 | * 14 | */ 15 | public class NotesInterfaceTest extends Flickr4JavaTest { 16 | 17 | /** 18 | * Test method for {@link com.flickr4java.flickr.photos.notes.NotesInterface#add(java.lang.String, com.flickr4java.flickr.photos.Note)}. 19 | */ 20 | @Ignore("Haven't coded this yet") 21 | @Test 22 | public void testAdd() { 23 | fail("Not yet implemented"); 24 | } 25 | 26 | /** 27 | * Test method for {@link com.flickr4java.flickr.photos.notes.NotesInterface#delete(java.lang.String)}. 28 | */ 29 | @Ignore("Haven't coded this yet") 30 | @Test 31 | public void testDelete() { 32 | fail("Not yet implemented"); 33 | } 34 | 35 | /** 36 | * Test method for {@link com.flickr4java.flickr.photos.notes.NotesInterface#edit(com.flickr4java.flickr.photos.Note)}. 37 | */ 38 | @Ignore("Haven't coded this yet") 39 | @Test 40 | public void testEdit() { 41 | fail("Not yet implemented"); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/AuthStore.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.flickr4java.flickr.util; 5 | 6 | import com.flickr4java.flickr.auth.Auth; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * Defines an interface for possibly persistent storage of token information. 12 | * 13 | * @author Matthew MacKenzie 14 | * @version $Id: AuthStore.java,v 1.2 2007/09/09 17:15:57 x-mago Exp $ 15 | */ 16 | public interface AuthStore { 17 | /** 18 | * Store an Auth. 19 | * 20 | * @param token 21 | * Auth object to be stored. 22 | * @throws IOException 23 | */ 24 | void store(Auth token) throws IOException; 25 | 26 | /** 27 | * Retrieve Auth for a given NSID. 28 | * 29 | * @param nsid 30 | * NSID 31 | * @return Auth 32 | */ 33 | Auth retrieve(String nsid); 34 | 35 | /** 36 | * Retrieve all Auth objects being stored. 37 | * 38 | * @return Auth objects 39 | */ 40 | Auth[] retrieveAll(); 41 | 42 | /** 43 | * Clear out the store. 44 | * 45 | */ 46 | void clearAll(); 47 | 48 | /** 49 | * Clear for a given NSID. 50 | * 51 | * @param nsid 52 | */ 53 | void clear(String nsid); 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/places/PlaceType.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.places; 2 | 3 | /** 4 | * PlaceType as requested by {@link PlacesInterface#getPlaceTypes()} 5 | * 6 | * @see Place#TYPE_COUNTRY 7 | * @see Place#TYPE_COUNTY 8 | * @see Place#TYPE_LOCALITY 9 | * @see Place#TYPE_REGION 10 | * @see Place#TYPE_NEIGHBOURHOOD 11 | * @see Place#TYPE_CONTINENT 12 | * @author mago 13 | * @version $Id: PlaceType.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 14 | */ 15 | public class PlaceType { 16 | private static final long serialVersionUID = 12L; 17 | 18 | int placeTypeId; 19 | 20 | String placeTypeName; 21 | 22 | public int getPlaceTypeId() { 23 | return placeTypeId; 24 | } 25 | 26 | public void setPlaceTypeId(String placeTypeId) { 27 | try { 28 | setPlaceTypeId(Integer.parseInt(placeTypeId)); 29 | } catch (NumberFormatException e) { 30 | } 31 | } 32 | 33 | public void setPlaceTypeId(int placeTypeId) { 34 | this.placeTypeId = placeTypeId; 35 | } 36 | 37 | public String getPlaceTypeName() { 38 | return placeTypeName; 39 | } 40 | 41 | public void setPlaceTypeName(String placeTypeName) { 42 | this.placeTypeName = placeTypeName; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/people/TimeZone.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.people; 2 | 3 | public class TimeZone { 4 | 5 | private String label; 6 | 7 | private String offset; 8 | 9 | private String timeZoneId; 10 | 11 | /** 12 | * Time Zone text 13 | * 14 | * @return the label 15 | */ 16 | public String getLabel() { 17 | return label; 18 | } 19 | 20 | public void setLabel(String label) { 21 | this.label = label; 22 | } 23 | 24 | /** 25 | * Time Zone offset 26 | * 27 | * @return timezone offset value 28 | */ 29 | public String getOffset() { 30 | return offset; 31 | } 32 | 33 | /** 34 | * @deprecated typo in method name, use {@link #getOffset()}. 35 | */ 36 | @Deprecated 37 | public String geOffset() { 38 | return offset; 39 | } 40 | 41 | public void setOffset(String offset) { 42 | this.offset = offset; 43 | } 44 | 45 | /** 46 | * Time Zone id 47 | * 48 | * @return timezone_id offset value 49 | */ 50 | public String getTimeZoneId() { 51 | return timeZoneId; 52 | } 53 | 54 | public void setTimeZoneId(String id) { 55 | this.timeZoneId = id; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Editability.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.photos; 3 | 4 | /** 5 | * @author Anthony Eden 6 | */ 7 | public class Editability { 8 | 9 | private boolean comment; 10 | 11 | private boolean addmeta; 12 | 13 | public Editability() { 14 | 15 | } 16 | 17 | public boolean isComment() { 18 | return comment; 19 | } 20 | 21 | public void setComment(boolean comment) { 22 | this.comment = comment; 23 | } 24 | 25 | public boolean isAddmeta() { 26 | return addmeta; 27 | } 28 | 29 | public void setAddmeta(boolean addmeta) { 30 | this.addmeta = addmeta; 31 | } 32 | 33 | @Override 34 | public boolean equals(Object obj) { 35 | if ((obj == null) || (obj.getClass() != this.getClass())) { 36 | return false; 37 | } 38 | if (obj == this) { 39 | return true; 40 | } 41 | Editability test = (Editability) obj; 42 | return comment == test.comment && addmeta == test.addmeta; 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | int hash = 1; 48 | hash += Boolean.hashCode(comment); 49 | hash += Boolean.hashCode(addmeta); 50 | return hash; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.licenses.getInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/machinetags/Predicate.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.machinetags; 2 | 3 | /** 4 | * 5 | * @author mago 6 | * @version $Id: Predicate.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 7 | */ 8 | public class Predicate { 9 | 10 | int usage; 11 | 12 | int namespaces; 13 | 14 | String value; 15 | 16 | public String getValue() { 17 | return value; 18 | } 19 | 20 | public void setValue(String value) { 21 | this.value = value; 22 | } 23 | 24 | public int getUsage() { 25 | return usage; 26 | } 27 | 28 | public void setUsage(String predicates) { 29 | try { 30 | setUsage(Integer.parseInt(predicates)); 31 | } catch (NumberFormatException e) { 32 | } 33 | } 34 | 35 | public void setUsage(int usage) { 36 | this.usage = usage; 37 | } 38 | 39 | public int getNamespaces() { 40 | return namespaces; 41 | } 42 | 43 | public void setNamespaces(String namespaces) { 44 | try { 45 | setNamespaces(Integer.parseInt(namespaces)); 46 | } catch (NumberFormatException e) { 47 | } 48 | } 49 | 50 | public void setNamespaces(int namespaces) { 51 | this.namespaces = namespaces; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/blogs/Blog.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.blogs; 3 | 4 | import java.math.BigDecimal; 5 | 6 | /** 7 | * Class representing a Flickr blog configuration. 8 | * 9 | * @author Anthony Eden 10 | */ 11 | public class Blog { 12 | 13 | private BigDecimal id; 14 | 15 | private String name; 16 | 17 | private boolean needPassword; 18 | 19 | private String url; 20 | 21 | public Blog() { 22 | 23 | } 24 | 25 | public BigDecimal getId() { 26 | return id; 27 | } 28 | 29 | public void setId(BigDecimal id) { 30 | this.id = id; 31 | } 32 | 33 | public void setId(String id) { 34 | if (id != null) { 35 | setId(new BigDecimal(id)); 36 | } 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public boolean isNeedPassword() { 48 | return needPassword; 49 | } 50 | 51 | public void setNeedPassword(boolean needPassword) { 52 | this.needPassword = needPassword; 53 | } 54 | 55 | public String getUrl() { 56 | return url; 57 | } 58 | 59 | public void setUrl(String url) { 60 | this.url = url; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/IOUtilities.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.util; 3 | 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | import java.io.Reader; 8 | import java.io.Writer; 9 | 10 | /** 11 | * Common IO utilities. 12 | * 13 | * @author Anthony Eden 14 | */ 15 | public class IOUtilities { 16 | 17 | private IOUtilities() { 18 | 19 | } 20 | 21 | public static void close(InputStream s) { 22 | if (s != null) { 23 | try { 24 | s.close(); 25 | } catch (IOException e) { 26 | 27 | } 28 | } 29 | } 30 | 31 | public static void close(OutputStream s) { 32 | if (s != null) { 33 | try { 34 | s.close(); 35 | } catch (IOException e) { 36 | 37 | } 38 | } 39 | } 40 | 41 | public static void close(Reader s) { 42 | if (s != null) { 43 | try { 44 | s.close(); 45 | } catch (IOException e) { 46 | 47 | } 48 | } 49 | } 50 | 51 | public static void close(Writer s) { 52 | if (s != null) { 53 | try { 54 | s.close(); 55 | } catch (IOException e) { 56 | 57 | } 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/ActivityInterfaceTest.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | import com.flickr4java.flickr.FlickrException; 8 | import com.flickr4java.flickr.activity.ActivityInterface; 9 | import com.flickr4java.flickr.activity.Item; 10 | import com.flickr4java.flickr.activity.ItemList; 11 | 12 | /** 13 | * 14 | * @author mago 15 | * @version $Id: ActivityInterfaceTest.java,v 1.3 2009/06/30 18:48:59 x-mago Exp $ 16 | */ 17 | public class ActivityInterfaceTest extends Flickr4JavaTest { 18 | 19 | @Test 20 | public void testUserComments() throws FlickrException { 21 | ActivityInterface actInterface = flickr.getActivityInterface(); 22 | ItemList list = actInterface.userComments(10, 1); 23 | assertTrue(list.size() > 0); 24 | } 25 | 26 | @Test 27 | public void testUserPhotos() throws FlickrException { 28 | ActivityInterface actInterface = flickr.getActivityInterface(); 29 | ItemList list = actInterface.userPhotos(10, 1, "6000d"); 30 | assertTrue(list.size() > 0); 31 | } 32 | 33 | @Test 34 | public void testCheckTimeframeArg() { 35 | ActivityInterface actInterface = flickr.getActivityInterface(); 36 | assertTrue(actInterface.checkTimeframeArg("300d")); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getContactsPublicPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Pool.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | public class Pool { 4 | 5 | private String title; 6 | private String id; 7 | private String url; 8 | private String iconServer; 9 | private String iconFarm; 10 | private int memberCount; 11 | private int poolCount; 12 | 13 | public String getTitle() { 14 | return title; 15 | } 16 | public void setTitle(String title) { 17 | this.title = title; 18 | } 19 | public String getId() { 20 | return id; 21 | } 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | public String getUrl() { 26 | return url; 27 | } 28 | public void setUrl(String url) { 29 | this.url = url; 30 | } 31 | public String getIconServer() { 32 | return iconServer; 33 | } 34 | public void setIconServer(String iconServer) { 35 | this.iconServer = iconServer; 36 | } 37 | public String getIconFarm() { 38 | return iconFarm; 39 | } 40 | public void setIconFarm(String iconFarm) { 41 | this.iconFarm = iconFarm; 42 | } 43 | public int getMemberCount() { 44 | return memberCount; 45 | } 46 | public void setMemberCount(int memberCount) { 47 | this.memberCount = memberCount; 48 | } 49 | public int getPoolCount() { 50 | return poolCount; 51 | } 52 | public void setPoolCount(int poolCount) { 53 | this.poolCount = poolCount; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.machinetags.getPairs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ceramics:artist 5 | ceramics:date 6 | ceramics:dateadded 7 | ceramics:depth 8 | ceramics:glazing 9 | ceramics:height 10 | ceramics:length 11 | ceramics:material 12 | ceramics:object_type 13 | ceramics:series_title 14 | ceramics:technique 15 | ceramics:temperature 16 | ceramics:title 17 | ceramics:width 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/Throttle.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups; 2 | 3 | /** 4 | * Throttle - Limit the abilitiy to add Photos to a group on a per user per post basis. "No more than X in Y days". 5 | * 6 | * @author Anthony Eden 7 | * @version $Id: Throttle.java,v 1.3 2009/07/12 22:43:07 x-mago Exp $ 8 | */ 9 | public class Throttle { 10 | 11 | private int count; 12 | 13 | private String mode; 14 | 15 | private int remaining; 16 | 17 | /** 18 | * Posts are limited to this number of Photos. 19 | * 20 | * @return mx number of posts allowed 21 | */ 22 | public int getCount() { 23 | return count; 24 | } 25 | 26 | public void setCount(int count) { 27 | this.count = count; 28 | } 29 | 30 | /** 31 | * Throttle mode - day, month or none. 32 | * 33 | * @return mode 34 | */ 35 | public String getMode() { 36 | return mode; 37 | } 38 | 39 | public void setMode(String mode) { 40 | this.mode = mode; 41 | } 42 | 43 | /** 44 | * Number of remaining Photos to add.
45 | * (lokks, like not longer available) 46 | * 47 | * @return units 48 | */ 49 | public int getRemaining() { 50 | return remaining; 51 | } 52 | 53 | public void setRemaining(int remaining) { 54 | this.remaining = remaining; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/DebugOutputStream.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.util; 4 | 5 | import java.io.FilterOutputStream; 6 | import java.io.IOException; 7 | import java.io.OutputStream; 8 | 9 | /** 10 | * A FilterInputStream which will print all read data to the specified PrintWriter. 11 | * 12 | * @author Anthony Eden 13 | */ 14 | public class DebugOutputStream extends FilterOutputStream { 15 | 16 | private OutputStream debugOut; 17 | 18 | /** 19 | * Creates a FilterInputStream by assigning the argument in to the field this.in so as to remember it for later use. 20 | * 21 | * @param out 22 | * the underlying output stream, or null if this instance is to be created without an underlying stream. 23 | */ 24 | public DebugOutputStream(OutputStream out, OutputStream debugOut) { 25 | super(out); 26 | this.debugOut = debugOut; 27 | } 28 | 29 | public void write(int b) throws IOException { 30 | super.write(b); 31 | debugOut.write((char) b); 32 | } 33 | 34 | public void write(byte[] b) throws IOException { 35 | super.write(b); 36 | debugOut.write(b); 37 | } 38 | 39 | public void write(byte[] b, int offset, int length) throws IOException { 40 | super.write(b, offset, length); 41 | debugOut.write(b, offset, length); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2004, Anthony Eden (@aeden), Darren Greaves (@boncey), Allan (@callmeal) and contributors. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/Domain.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * Domain information as returned by the stats interface. 8 | * 9 | * @author Darren Greaves 10 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 11 | */ 12 | public class Domain { 13 | 14 | /** 15 | * Logger. 16 | */ 17 | @SuppressWarnings("unused") 18 | private static Logger _log = LoggerFactory.getLogger(Domain.class); 19 | 20 | public Domain() { 21 | } 22 | 23 | public Domain(String name, Long views) { 24 | super(); 25 | this.name = name; 26 | this.views = views; 27 | } 28 | 29 | private String name; 30 | 31 | private Long views; 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public Long getViews() { 42 | return views; 43 | } 44 | 45 | public void setViews(Long views) { 46 | this.views = views; 47 | } 48 | 49 | public void setViews(String views) { 50 | 51 | try { 52 | setViews(Long.valueOf(views)); 53 | } catch (NumberFormatException e) { 54 | // ignore and set value as null 55 | } 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | 61 | return String.format("%s (%d)", name, views); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/Referrer.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * Referrer information as returned by the stats interface. 8 | * 9 | * @author Darren Greaves 10 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 11 | */ 12 | public class Referrer { 13 | 14 | /** 15 | * Logger. 16 | */ 17 | @SuppressWarnings("unused") 18 | private static Logger _log = LoggerFactory.getLogger(Referrer.class); 19 | 20 | public Referrer() { 21 | } 22 | 23 | public Referrer(String url, Long views) { 24 | super(); 25 | this.url = url; 26 | this.views = views; 27 | } 28 | 29 | private String url; 30 | 31 | private Long views; 32 | 33 | public String getUrl() { 34 | return url; 35 | } 36 | 37 | public void setUrl(String url) { 38 | this.url = url; 39 | } 40 | 41 | public Long getViews() { 42 | return views; 43 | } 44 | 45 | public void setViews(Long views) { 46 | this.views = views; 47 | } 48 | 49 | public void setViews(String views) { 50 | 51 | try { 52 | setViews(Long.valueOf(views)); 53 | } catch (NumberFormatException e) { 54 | // ignore and set value as null 55 | } 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | 61 | return String.format("%s (%d)", url, views); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Exif.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.photos; 4 | 5 | /** 6 | * @author Anthony Eden 7 | */ 8 | public class Exif { 9 | 10 | private String tagspace; 11 | 12 | private String tagspaceId; 13 | 14 | private String tag; 15 | 16 | private String label; 17 | 18 | private String raw; 19 | 20 | private String clean; 21 | 22 | public String getTagspace() { 23 | return tagspace; 24 | } 25 | 26 | public void setTagspace(String tagspace) { 27 | this.tagspace = tagspace; 28 | } 29 | 30 | public String getTagspaceId() { 31 | return tagspaceId; 32 | } 33 | 34 | public void setTagspaceId(String tagspaceId) { 35 | this.tagspaceId = tagspaceId; 36 | } 37 | 38 | public String getTag() { 39 | return tag; 40 | } 41 | 42 | public void setTag(String tag) { 43 | this.tag = tag; 44 | } 45 | 46 | public String getLabel() { 47 | return label; 48 | } 49 | 50 | public void setLabel(String label) { 51 | this.label = label; 52 | } 53 | 54 | public String getRaw() { 55 | return raw; 56 | } 57 | 58 | public void setRaw(String raw) { 59 | this.raw = raw; 60 | } 61 | 62 | public String getClean() { 63 | return clean; 64 | } 65 | 66 | public void setClean(String clean) { 67 | this.clean = clean; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.activity.userPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2014-05-04 13.56.00 6 | 7 | london 8 | 9 | 10 | 11 | Robot 12 | 13 | This looks familiar 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/machinetags/Namespace.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.machinetags; 2 | 3 | /** 4 | * 5 | * @author mago 6 | * @version $Id: Namespace.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 7 | */ 8 | public class Namespace { 9 | 10 | private int usage; 11 | 12 | private int predicates; 13 | 14 | private String value; 15 | 16 | public Namespace() { 17 | } 18 | 19 | public int getUsage() { 20 | return usage; 21 | } 22 | 23 | public void setUsage(String usage) { 24 | try { 25 | setUsage(Integer.parseInt(usage)); 26 | } catch (NumberFormatException e) { 27 | } 28 | } 29 | 30 | public void setUsage(int usage) { 31 | this.usage = usage; 32 | } 33 | 34 | /** 35 | * Count of distinct predicates a namespace has. 36 | * 37 | * @return Number of predicates 38 | */ 39 | public int getPredicates() { 40 | return predicates; 41 | } 42 | 43 | public void setPredicates(String predicates) { 44 | try { 45 | setPredicates(Integer.parseInt(predicates)); 46 | } catch (NumberFormatException e) { 47 | } 48 | } 49 | 50 | public void setPredicates(int predicates) { 51 | this.predicates = predicates; 52 | } 53 | 54 | public String getValue() { 55 | return value; 56 | } 57 | 58 | public void setValue(String value) { 59 | this.value = value; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/Category.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.groups; 3 | 4 | import java.util.Collection; 5 | 6 | /** 7 | * Class representing a group Category. 8 | * 9 | * @author Anthony Eden 10 | */ 11 | public class Category { 12 | 13 | private String name; 14 | 15 | private String path; 16 | 17 | private String pathIds; 18 | 19 | private Collection subcategories; 20 | 21 | private Collection groups; 22 | 23 | public Category() { 24 | 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public String getPath() { 36 | return path; 37 | } 38 | 39 | public void setPath(String path) { 40 | this.path = path; 41 | } 42 | 43 | public String getPathIds() { 44 | return pathIds; 45 | } 46 | 47 | public void setPathIds(String pathIds) { 48 | this.pathIds = pathIds; 49 | } 50 | 51 | public Collection getSubcategories() { 52 | return subcategories; 53 | } 54 | 55 | public void setSubcategories(Collection subcategories) { 56 | this.subcategories = subcategories; 57 | } 58 | 59 | public Collection getGroups() { 60 | return groups; 61 | } 62 | 63 | public void setGroups(Collection groups) { 64 | this.groups = groups; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/PandaInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNotNull; 7 | 8 | import com.flickr4java.flickr.FlickrException; 9 | import com.flickr4java.flickr.panda.Panda; 10 | import com.flickr4java.flickr.panda.PandaInterface; 11 | import com.flickr4java.flickr.photos.Photo; 12 | import com.flickr4java.flickr.photos.PhotoList; 13 | 14 | import org.junit.Test; 15 | 16 | import java.util.ArrayList; 17 | 18 | /** 19 | * @author mago 20 | * @version $Id: PandaInterfaceTest.java,v 1.1 2009/06/18 21:56:43 x-mago Exp $ 21 | */ 22 | public class PandaInterfaceTest extends Flickr4JavaTest { 23 | 24 | @Test 25 | public void testGetList() throws FlickrException { 26 | PandaInterface iface = flickr.getPandaInterface(); 27 | ArrayList list = iface.getList(); 28 | assertNotNull(list); 29 | Panda p = list.get(0); 30 | assertEquals("ling ling", p.getName()); 31 | p = list.get(1); 32 | assertEquals("hsing hsing", p.getName()); 33 | p = list.get(2); 34 | assertEquals("wang wang", p.getName()); 35 | } 36 | 37 | @Test 38 | public void testGetPhotos() throws FlickrException { 39 | PandaInterface iface = flickr.getPandaInterface(); 40 | Panda p = new Panda(); 41 | p.setName("ling ling"); 42 | PhotoList list = iface.getPhotos(p, null, 1, 50); 43 | assertNotNull(list); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/Photocount.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.photos; 3 | 4 | import java.util.Date; 5 | 6 | /** 7 | * @author Anthony Eden 8 | */ 9 | public class Photocount { 10 | 11 | private int count; 12 | 13 | private Date fromDate; 14 | 15 | private Date toDate; 16 | 17 | public Photocount() { 18 | 19 | } 20 | 21 | public int getCount() { 22 | return count; 23 | } 24 | 25 | public void setCount(int count) { 26 | this.count = count; 27 | } 28 | 29 | public void setCount(String count) { 30 | if (count != null) 31 | setCount(Integer.parseInt(count)); 32 | } 33 | 34 | public Date getFromDate() { 35 | return fromDate; 36 | } 37 | 38 | public void setFromDate(Date fromDate) { 39 | this.fromDate = fromDate; 40 | } 41 | 42 | public void setFromDate(long fromDate) { 43 | setFromDate(new Date(fromDate)); 44 | } 45 | 46 | public void setFromDate(String fromDate) { 47 | if (fromDate != null) 48 | setFromDate(Long.parseLong(fromDate)); 49 | } 50 | 51 | public Date getToDate() { 52 | return toDate; 53 | } 54 | 55 | public void setToDate(Date toDate) { 56 | this.toDate = toDate; 57 | } 58 | 59 | public void setToDate(long toDate) { 60 | setToDate(new Date(toDate)); 61 | } 62 | 63 | public void setToDate(String toDate) { 64 | if (toDate != null) 65 | setToDate(Long.parseLong(toDate)); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/CommonsInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNotNull; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | import com.flickr4java.flickr.FlickrException; 10 | import com.flickr4java.flickr.commons.CommonsInterface; 11 | import com.flickr4java.flickr.commons.Institution; 12 | 13 | import org.junit.Test; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * @author mago 19 | * @version $Id: CommonsInterfaceTest.java,v 1.1 2009/06/30 18:48:59 x-mago Exp $ 20 | */ 21 | public class CommonsInterfaceTest extends Flickr4JavaTest { 22 | 23 | @Test 24 | public void testGetInstitutions() throws FlickrException { 25 | CommonsInterface iface = flickr.getCommonsInterface(); 26 | List list = iface.getInstitutions(); 27 | assertNotNull(list); 28 | boolean museumFound = false; 29 | for (Institution inst : list) { 30 | if (inst.getName().equals("The British Library")) { 31 | assertEquals(1386975388000L, inst.getDateLaunch().getTime()); 32 | assertEquals("www.bl.uk", inst.getSiteUrl()); 33 | assertEquals("https://www.bl.uk/about-us/terms-and-conditions/content-on-flickr-and-wikimedia-commons", inst.getLicenseUrl()); 34 | assertEquals("http://flickr.com/photos/britishlibrary/", inst.getFlickrUrl()); 35 | museumFound = true; 36 | } 37 | } 38 | assertTrue(museumFound); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/resources/completenesstest.properties: -------------------------------------------------------------------------------- 1 | # used for the basic completeness test of the api 2 | # 3 | # key is the method as denoted by flickr 4 | # value is either "skip" to skip the method or the fully qualified class name 5 | # appended with a '.' and the implemented method name 6 | 7 | # just an example for skip 8 | flickr.nonexisting.method = skip 9 | 10 | # Deprecated in API so not implemented 11 | flickr.auth.getFrob = skip 12 | flickr.auth.getFullToken = skip 13 | flickr.auth.getToken = skip 14 | flickr.push.getSubscriptions = skip 15 | flickr.push.getTopics = skip 16 | flickr.push.subscribe = skip 17 | flickr.push.unsubscribe = skip 18 | flickr.contacts.getTaggingSuggestions = skip 19 | flickr.people.getLimits = skip 20 | flickr.tags.getMostFrequentlyUsed = skip 21 | 22 | # a method cannot have the name null. We call it null_ 23 | flickr.test.null = com.flickr4java.flickr.test.TestInterface.null_ 24 | 25 | # all methods of flickr.photosets.comments are in PhotosetsComments 26 | flickr.photosets.comments.* = com.flickr4java.flickr.photosets.comments.PhotosetsCommentsInterface.* 27 | flickr.auth.oauth.* = com.flickr4java.flickr.auth.AuthInterface.* 28 | flickr.groups.discuss.topics.getList = com.flickr4java.flickr.groups.discuss.GroupDiscussInterface.getTopicsList 29 | flickr.groups.discuss.topics.getInfo = com.flickr4java.flickr.groups.discuss.GroupDiscussInterface.getTopicInfo 30 | flickr.groups.discuss.replies.getList = com.flickr4java.flickr.groups.discuss.GroupDiscussInterface.getReplyList 31 | flickr.groups.discuss.replies.getInfo = com.flickr4java.flickr.groups.discuss.GroupDiscussInterface.getReplyInfo 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photosets/Photosets.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.photosets; 3 | 4 | import java.util.Collection; 5 | 6 | /** 7 | * Photoset collection. This class is required instead of a basic Collection object because of the cancreate flag. 8 | * 9 | * @author Anthony Eden 10 | */ 11 | public class Photosets { 12 | 13 | private int total; 14 | private int perPage; 15 | private int page; 16 | private int pages; 17 | private boolean canCreate; 18 | 19 | private Collection photosets; 20 | 21 | public Photosets() { 22 | 23 | } 24 | 25 | public boolean isCanCreate() { 26 | return canCreate; 27 | } 28 | 29 | public void setCanCreate(boolean canCreate) { 30 | this.canCreate = canCreate; 31 | } 32 | 33 | public Collection getPhotosets() { 34 | return photosets; 35 | } 36 | 37 | public void setPhotosets(Collection photosets) { 38 | this.photosets = photosets; 39 | } 40 | 41 | public int getTotal() { 42 | return total; 43 | } 44 | 45 | public void setTotal(int total) { 46 | this.total = total; 47 | } 48 | 49 | public int getPerPage() { 50 | return perPage; 51 | } 52 | 53 | public void setPerPage(int perPage) { 54 | this.perPage = perPage; 55 | } 56 | 57 | public int getPages() { 58 | return pages; 59 | } 60 | 61 | public void setPages(int pages) { 62 | this.pages = pages; 63 | } 64 | 65 | public int getPage() { 66 | return page; 67 | } 68 | 69 | public void setPage(int page) { 70 | this.page = page; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/MembersInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNotNull; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | import com.flickr4java.flickr.FlickrException; 10 | import com.flickr4java.flickr.groups.members.Member; 11 | import com.flickr4java.flickr.groups.members.MembersInterface; 12 | import com.flickr4java.flickr.groups.members.MembersList; 13 | 14 | import org.junit.Test; 15 | 16 | import java.util.HashSet; 17 | import java.util.Set; 18 | 19 | /** 20 | * @author mago 21 | * @version $Id: MembersInterfaceTest.java,v 1.3 2009/07/11 20:30:27 x-mago Exp $ 22 | */ 23 | public class MembersInterfaceTest extends Flickr4JavaTest { 24 | 25 | @Test 26 | public void testGetList() throws FlickrException { 27 | MembersInterface iface = flickr.getMembersInterface(); 28 | // Group: Urban fragments 29 | String id = testProperties.getGroupId(); 30 | Set memberTypes = new HashSet(); 31 | memberTypes.add(Member.TYPE_MEMBER); 32 | memberTypes.add(Member.TYPE_ADMIN); 33 | memberTypes.add(Member.TYPE_MODERATOR); 34 | MembersList list = iface.getList(id, memberTypes, 50, 1); 35 | assertNotNull(list); 36 | assertEquals(50, list.size()); 37 | Member m = list.get(10); 38 | assertTrue(m.getId().indexOf("@") > 0); 39 | assertTrue(m.getUserName().length() > 0); 40 | assertTrue(m.getIconFarm() > -1); 41 | assertTrue(m.getIconServer() > -1); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/suggestions/Suggestion.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos.suggestions; 2 | 3 | import com.flickr4java.flickr.places.Location; 4 | 5 | public class Suggestion { 6 | 7 | private String suggestionId; 8 | private String photoId; 9 | private String dateSuggested; 10 | private String suggestorId; 11 | private String suggestorUsername; 12 | private String note; 13 | private Location location; 14 | 15 | public String getSuggestionId() { 16 | return suggestionId; 17 | } 18 | public void setSuggestionId(String suggestionId) { 19 | this.suggestionId = suggestionId; 20 | } 21 | public String getPhotoId() { 22 | return photoId; 23 | } 24 | public void setPhotoId(String photoId) { 25 | this.photoId = photoId; 26 | } 27 | public String getDateSuggested() { 28 | return dateSuggested; 29 | } 30 | public void setDateSuggested(String dateSuggested) { 31 | this.dateSuggested = dateSuggested; 32 | } 33 | public String getSuggestorId() { 34 | return suggestorId; 35 | } 36 | public void setSuggestorId(String suggestorId) { 37 | this.suggestorId = suggestorId; 38 | } 39 | public String getSuggestorUsername() { 40 | return suggestorUsername; 41 | } 42 | public void setSuggestorUsername(String suggestorUsername) { 43 | this.suggestorUsername = suggestorUsername; 44 | } 45 | public String getNote() { 46 | return note; 47 | } 48 | public void setNote(String note) { 49 | this.note = note; 50 | } 51 | public Location getLocation() { 52 | return location; 53 | } 54 | public void setLocation(Location location) { 55 | this.location = location; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.places.find.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Alabama, United States 5 | Alabama, United States 6 | Alabama, North-West, South Africa 7 | Alabama, Lehigh Acres, FL, United States 8 | Ilsfeld, Baden-Wurttemberg, Germany 9 | Rimini, Emilia Romagna, Italy 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/auth/Auth.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.auth; 4 | 5 | import com.flickr4java.flickr.people.User; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author Anthony Eden 11 | */ 12 | public class Auth implements Serializable { 13 | 14 | private static final long serialVersionUID = -2254618470673679663L; 15 | 16 | private String token; 17 | 18 | private String tokenSecret; 19 | 20 | private Permission permission; 21 | 22 | private User user; 23 | 24 | public Auth() { 25 | 26 | } 27 | 28 | public Auth(Permission permission, User user) { 29 | 30 | super(); 31 | this.permission = permission; 32 | this.user = user; 33 | } 34 | 35 | /** 36 | * @return the tokenSecret 37 | */ 38 | public String getTokenSecret() { 39 | return tokenSecret; 40 | } 41 | 42 | /** 43 | * @param tokenSecret 44 | * the tokenSecret to set 45 | */ 46 | public void setTokenSecret(String tokenSecret) { 47 | this.tokenSecret = tokenSecret; 48 | } 49 | 50 | public String getToken() { 51 | return token; 52 | } 53 | 54 | public void setToken(String token) { 55 | this.token = token; 56 | } 57 | 58 | public Permission getPermission() { 59 | return permission; 60 | } 61 | 62 | public void setPermission(Permission permission) { 63 | this.permission = permission; 64 | } 65 | 66 | public User getUser() { 67 | return user; 68 | } 69 | 70 | public void setUser(User user) { 71 | this.user = user; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/BlogsInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertNotNull; 6 | import static org.junit.Assert.assertTrue; 7 | 8 | import com.flickr4java.flickr.FlickrException; 9 | import com.flickr4java.flickr.blogs.Blog; 10 | import com.flickr4java.flickr.blogs.BlogsInterface; 11 | import com.flickr4java.flickr.blogs.Service; 12 | 13 | import org.junit.Ignore; 14 | import org.junit.Test; 15 | 16 | import java.util.Collection; 17 | import java.util.Iterator; 18 | 19 | /** 20 | * @author Anthony Eden 21 | */ 22 | public class BlogsInterfaceTest extends Flickr4JavaTest { 23 | 24 | @Test 25 | public void testGetList() throws FlickrException { 26 | BlogsInterface blogsInterface = flickr.getBlogsInterface(); 27 | Collection blogs = blogsInterface.getList(); 28 | assertNotNull(blogs); 29 | } 30 | 31 | @Test 32 | public void testGetServices() throws FlickrException { 33 | BlogsInterface blogsInterface = flickr.getBlogsInterface(); 34 | Collection services = blogsInterface.getServices(); 35 | Iterator it = services.iterator(); 36 | boolean bloggerFound = false; 37 | while (it.hasNext()) { 38 | Service ser = it.next(); 39 | if (ser.getId().equals("beta.blogger.com") && ser.getName().equals("Blogger")) { 40 | bloggerFound = true; 41 | } 42 | // System.out.println(ser.getId() + " " + ser.getName()); 43 | } 44 | assertTrue(bloggerFound); 45 | } 46 | 47 | @Ignore 48 | @Test 49 | public void testPostImage() { 50 | // TODO: implement this test 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/DebugInputStream.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.util; 4 | 5 | import java.io.FilterInputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | 10 | /** 11 | * A FilterInputStream which will print all read data to the specified PrintWriter. 12 | * 13 | * @author Anthony Eden 14 | */ 15 | public class DebugInputStream extends FilterInputStream { 16 | 17 | private OutputStream debugOut; 18 | 19 | /** 20 | * Creates a FilterInputStream by assigning the argument in to the field this.in so as to remember it for later use. 21 | * 22 | * @param in 23 | * the underlying input stream, or null if this instance is to be created without an underlying stream. 24 | */ 25 | public DebugInputStream(InputStream in, OutputStream debugOut) { 26 | super(in); 27 | this.debugOut = debugOut; 28 | } 29 | 30 | public int read() throws IOException { 31 | int c = super.read(); 32 | debugOut.write((char) c); 33 | return c; 34 | } 35 | 36 | public int read(byte[] b) throws IOException { 37 | int readCount = super.read(b); 38 | for (int i = 0; i < readCount; i++) { 39 | debugOut.write((char) b[i]); 40 | } 41 | return readCount; 42 | } 43 | 44 | public int read(byte[] b, int offset, int length) throws IOException { 45 | int readCount = super.read(b, offset, length); 46 | int readTo = offset + readCount; 47 | for (int i = offset; i < readTo; i++) { 48 | debugOut.write((char) b[i]); 49 | } 50 | return readCount; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/discuss/TopicList.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.discuss; 2 | 3 | import com.flickr4java.flickr.SearchResultList; 4 | 5 | public class TopicList extends SearchResultList { 6 | private static final long serialVersionUID = 617037681128L; 7 | private String groupId; 8 | private int iconServer; 9 | private int iconFarm; 10 | private String name; 11 | private int members; 12 | private int privacy; 13 | private String language; 14 | private boolean isPoolModerated; 15 | 16 | public int getIconServer() { 17 | return iconServer; 18 | } 19 | public void setIconServer(int iconServer) { 20 | this.iconServer = iconServer; 21 | } 22 | public String getGroupId() { 23 | return groupId; 24 | } 25 | public void setGroupId(String groupId) { 26 | this.groupId = groupId; 27 | } 28 | public int getIconFarm() { 29 | return iconFarm; 30 | } 31 | public void setIconFarm(int iconFarm) { 32 | this.iconFarm = iconFarm; 33 | } 34 | public String getName() { 35 | return name; 36 | } 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | public int getMembers() { 41 | return members; 42 | } 43 | public void setMembers(int members) { 44 | this.members = members; 45 | } 46 | public int getPrivacy() { 47 | return privacy; 48 | } 49 | public void setPrivacy(int privacy) { 50 | this.privacy = privacy; 51 | } 52 | public String getLanguage() { 53 | return language; 54 | } 55 | public void setLanguage(String language) { 56 | this.language = language; 57 | } 58 | public boolean isPoolModerated() { 59 | return isPoolModerated; 60 | } 61 | public void setIsPoolModerated(boolean isPoolModerated) { 62 | this.isPoolModerated = isPoolModerated; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/uploader/Payload.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.uploader; 2 | 3 | import com.flickr4java.flickr.FlickrRuntimeException; 4 | 5 | import java.io.ByteArrayOutputStream; 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.nio.file.Files; 10 | 11 | public class Payload { 12 | 13 | private byte[] payload; 14 | 15 | private String photoId; 16 | 17 | public Payload(byte[] payload) { 18 | this.payload = payload; 19 | } 20 | 21 | public Payload(File file) { 22 | try { 23 | payload = Files.readAllBytes(file.toPath()); 24 | } catch (IOException e) { 25 | throw new FlickrRuntimeException(e); 26 | } 27 | } 28 | 29 | public Payload(InputStream inputStream) { 30 | try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) { 31 | int nRead; 32 | byte[] data = new byte[16384]; 33 | 34 | while ((nRead = inputStream.read(data, 0, data.length)) != -1) { 35 | buffer.write(data, 0, nRead); 36 | } 37 | 38 | payload = buffer.toByteArray(); 39 | } catch (IOException e) { 40 | throw new FlickrRuntimeException(e); 41 | } 42 | } 43 | 44 | public Payload(InputStream inputStream, String photoId) { 45 | this(inputStream); 46 | this.photoId = photoId; 47 | } 48 | 49 | public Payload(byte[] payload, String photoId) { 50 | this(payload); 51 | this.photoId = photoId; 52 | } 53 | 54 | public Payload(File file, String photoId) { 55 | this(file); 56 | this.photoId = photoId; 57 | } 58 | 59 | public byte[] getPayload() { 60 | return payload; 61 | } 62 | 63 | public String getPhotoId() { 64 | return photoId; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/places/ShapeData.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.places; 2 | 3 | public class ShapeData { 4 | 5 | private String created; 6 | 7 | private double alpha; 8 | 9 | private int countPoints; 10 | 11 | private int countEdges; 12 | 13 | private boolean hasDonuthole; 14 | 15 | private boolean isDonutHole; 16 | 17 | private String polyline; 18 | 19 | private String shapefile; 20 | 21 | public String getCreated() { 22 | return created; 23 | } 24 | 25 | public void setCreated(String created) { 26 | this.created = created; 27 | } 28 | 29 | public double getAlpha() { 30 | return alpha; 31 | } 32 | 33 | public void setAlpha(double alpha) { 34 | this.alpha = alpha; 35 | } 36 | 37 | public int getCountPoints() { 38 | return countPoints; 39 | } 40 | 41 | public void setCountPoints(int countPoints) { 42 | this.countPoints = countPoints; 43 | } 44 | 45 | public int getCountEdges() { 46 | return countEdges; 47 | } 48 | 49 | public void setCountEdges(int countEdges) { 50 | this.countEdges = countEdges; 51 | } 52 | 53 | public boolean isHasDonuthole() { 54 | return hasDonuthole; 55 | } 56 | 57 | public void setHasDonuthole(boolean hasDonuthole) { 58 | this.hasDonuthole = hasDonuthole; 59 | } 60 | 61 | public boolean isDonutHole() { 62 | return isDonutHole; 63 | } 64 | 65 | public void setIsDonutHole(boolean isDonutHole) { 66 | this.isDonutHole = isDonutHole; 67 | } 68 | 69 | public String getPolyline() { 70 | return polyline; 71 | } 72 | 73 | public void setPolyline(String polyline) { 74 | this.polyline = polyline; 75 | } 76 | 77 | public String getShapefile() { 78 | return shapefile; 79 | } 80 | 81 | public void setShapefile(String shapefile) { 82 | this.shapefile = shapefile; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photos.getInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Robot 6 | Description 7 | 8 | 9 | 10 | 11 | 12 | 13 | 1 14 | 15 | 16 | 17 | green 18 | grn 19 | grngrn 20 | 21 | 22 | Daḩl Hīt 23 | 24 | Ar Riyāḑ 25 | Saudi Arabia 26 | 27 | 28 | 29 | https://www.flickr.com/photos/boncey_test/5628095432/ 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/transform/TransformInterface.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.photos.transform; 4 | 5 | import com.flickr4java.flickr.FlickrException; 6 | import com.flickr4java.flickr.Response; 7 | import com.flickr4java.flickr.Transport; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * @author Anthony Eden 14 | * @version $Id: TransformInterface.java,v 1.6 2008/01/28 23:01:44 x-mago Exp $ 15 | */ 16 | public class TransformInterface { 17 | 18 | public static final String METHOD_ROTATE = "flickr.photos.transform.rotate"; 19 | 20 | private String apiKey; 21 | 22 | private String sharedSecret; 23 | 24 | private Transport transportAPI; 25 | 26 | public TransformInterface(String apiKey, String sharedSecret, Transport transportAPI) { 27 | this.apiKey = apiKey; 28 | this.sharedSecret = sharedSecret; 29 | this.transportAPI = transportAPI; 30 | } 31 | 32 | /** 33 | * Rotate the specified photo. The only allowed values for degrees are 90, 180 and 270. 34 | * 35 | * @param photoId 36 | * The photo ID 37 | * @param degrees 38 | * The degrees to rotate (90, 170 or 270) 39 | */ 40 | public void rotate(String photoId, int degrees) throws FlickrException { 41 | Map parameters = new HashMap(); 42 | parameters.put("method", METHOD_ROTATE); 43 | 44 | parameters.put("photo_id", photoId); 45 | parameters.put("degrees", String.valueOf(degrees)); 46 | 47 | Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); 48 | if (response.isError()) { 49 | throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/members/Member.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.members; 2 | 3 | /** 4 | * Group-member. 5 | * 6 | * @author mago 7 | * @version $Id: Member.java,v 1.3 2009/07/12 22:43:07 x-mago Exp $ 8 | */ 9 | 10 | public class Member { 11 | 12 | private String id; 13 | 14 | private String userName; 15 | 16 | private int iconFarm = -1; 17 | 18 | private int iconServer = -1; 19 | 20 | private String memberType; 21 | 22 | public static final String TYPE_MEMBER = "2"; 23 | 24 | public static final String TYPE_MODERATOR = "3"; 25 | 26 | public static final String TYPE_ADMIN = "4"; 27 | 28 | public String getId() { 29 | return id; 30 | } 31 | 32 | public void setId(String id) { 33 | this.id = id; 34 | } 35 | 36 | public String getUserName() { 37 | return userName; 38 | } 39 | 40 | public void setUserName(String userName) { 41 | this.userName = userName; 42 | } 43 | 44 | public int getIconFarm() { 45 | return iconFarm; 46 | } 47 | 48 | public void setIconFarm(String iconFarm) { 49 | if (iconFarm != null) 50 | setIconFarm(Integer.parseInt(iconFarm)); 51 | } 52 | 53 | public void setIconFarm(int iconFarm) { 54 | this.iconFarm = iconFarm; 55 | } 56 | 57 | public int getIconServer() { 58 | return iconServer; 59 | } 60 | 61 | public void setIconServer(String iconServer) { 62 | if (iconServer != null) 63 | setIconServer(Integer.parseInt(iconServer)); 64 | } 65 | 66 | public void setIconServer(int iconServer) { 67 | this.iconServer = iconServer; 68 | } 69 | 70 | public String getMemberType() { 71 | return memberType; 72 | } 73 | 74 | public void setMemberType(String memberType) { 75 | this.memberType = memberType; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/PhotoSet.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos; 2 | 3 | public class PhotoSet { 4 | 5 | private String title; 6 | private String id; 7 | private String primary; 8 | private String secret; 9 | private String server; 10 | private String farm; 11 | private int viewCount; 12 | private int commentCount; 13 | private int countPhoto; 14 | private int countVideo; 15 | 16 | public String getTitle() { 17 | return title; 18 | } 19 | public void setTitle(String title) { 20 | this.title = title; 21 | } 22 | public String getId() { 23 | return id; 24 | } 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | public String getPrimary() { 29 | return primary; 30 | } 31 | public void setPrimary(String primary) { 32 | this.primary = primary; 33 | } 34 | public String getSecret() { 35 | return secret; 36 | } 37 | public void setSecret(String secret) { 38 | this.secret = secret; 39 | } 40 | public String getServer() { 41 | return server; 42 | } 43 | public void setServer(String server) { 44 | this.server = server; 45 | } 46 | public String getFarm() { 47 | return farm; 48 | } 49 | public void setFarm(String farm) { 50 | this.farm = farm; 51 | } 52 | public int getViewCount() { 53 | return viewCount; 54 | } 55 | public void setViewCount(int viewCount) { 56 | this.viewCount = viewCount; 57 | } 58 | public int getCountPhoto() { 59 | return countPhoto; 60 | } 61 | public void setCountPhoto(int countPhoto) { 62 | this.countPhoto = countPhoto; 63 | } 64 | public int getCommentCount() { 65 | return commentCount; 66 | } 67 | public void setCommentCount(int commentCount) { 68 | this.commentCount = commentCount; 69 | } 70 | public int getCountVideo() { 71 | return countVideo; 72 | } 73 | public void setCountVideo(int countVideo) { 74 | this.countVideo = countVideo; 75 | } 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/GalleriesInterfaceTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author acaplan 3 | */ 4 | package com.flickr4java.flickr.test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | import static org.junit.Assert.assertFalse; 8 | import static org.junit.Assert.assertNotNull; 9 | 10 | import com.flickr4java.flickr.FlickrException; 11 | import com.flickr4java.flickr.galleries.GalleriesInterface; 12 | import com.flickr4java.flickr.galleries.Gallery; 13 | 14 | import org.junit.After; 15 | import org.junit.Ignore; 16 | import org.junit.Test; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * @author acaplan 22 | * 23 | */ 24 | public class GalleriesInterfaceTest extends Flickr4JavaTest { 25 | 26 | @After 27 | public void tearDown() { 28 | flickr = null; 29 | } 30 | 31 | @Test 32 | public void testGetList() throws FlickrException { 33 | GalleriesInterface iface = flickr.getGalleriesInterface(); 34 | List galleries = iface.getList(testProperties.getNsid(), 10, 1); 35 | assertNotNull(galleries); 36 | assertFalse(galleries.isEmpty()); 37 | } 38 | 39 | @Ignore 40 | @Test 41 | public void testCreate() throws FlickrException { 42 | GalleriesInterface iface = flickr.getGalleriesInterface(); 43 | Gallery gallery = iface.create("test_gallery", "test gallery", "2732893596"); 44 | assertNotNull(gallery); 45 | assertNotNull(gallery.getId()); 46 | assertEquals("test_gallery", gallery.getTitle()); 47 | assertEquals("test gallery", gallery.getDesc()); 48 | } 49 | 50 | @Test 51 | public void testGetInfo() throws FlickrException { 52 | GalleriesInterface iface = flickr.getGalleriesInterface(); 53 | Gallery gallery = iface.getInfo("1979953-72157629277637049"); 54 | assertNotNull(gallery); 55 | assertEquals("Motorcycle Pics", gallery.getTitle()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /doc/flickr-video-sizes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/RESTResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr; 3 | 4 | import com.flickr4java.flickr.util.XMLUtilities; 5 | 6 | import org.w3c.dom.Document; 7 | import org.w3c.dom.Element; 8 | 9 | import java.util.Collection; 10 | import java.util.List; 11 | 12 | /** 13 | * Flickr Response object. 14 | * 15 | * @author Anthony Eden 16 | */ 17 | public class RESTResponse implements Response { 18 | 19 | private String stat; 20 | 21 | private List payload; 22 | 23 | private String errorCode; 24 | 25 | private String errorMessage; 26 | 27 | public void parse(Document document) { 28 | Element rspElement = document.getDocumentElement(); 29 | rspElement.normalize(); 30 | stat = rspElement.getAttribute("stat"); 31 | if ("ok".equals(stat)) { 32 | // TODO: Verify that the payload is always a single XML node 33 | payload = (List) XMLUtilities.getChildElements(rspElement); 34 | } else if ("fail".equals(stat)) { 35 | Element errElement = (Element) rspElement.getElementsByTagName("err").item(0); 36 | errorCode = errElement.getAttribute("code"); 37 | errorMessage = errElement.getAttribute("msg"); 38 | } 39 | } 40 | 41 | public String getStat() { 42 | return stat; 43 | } 44 | 45 | public Element getPayload() { 46 | if (payload.isEmpty()) { 47 | throw new RuntimeException("REST response payload has no elements"); 48 | } 49 | return payload.get(0); 50 | } 51 | 52 | public Collection getPayloadCollection() { 53 | return payload; 54 | } 55 | 56 | public boolean isError() { 57 | return errorCode != null; 58 | } 59 | 60 | public String getErrorCode() { 61 | return errorCode; 62 | } 63 | 64 | public String getErrorMessage() { 65 | return errorMessage; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/CamerasInterfaceTest.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test; 2 | 3 | import static org.junit.Assert.assertNotNull; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import com.flickr4java.flickr.Flickr; 7 | import com.flickr4java.flickr.FlickrException; 8 | import com.flickr4java.flickr.cameras.Brand; 9 | import com.flickr4java.flickr.cameras.Camera; 10 | import com.flickr4java.flickr.cameras.CamerasInterface; 11 | 12 | import org.junit.Test; 13 | 14 | import java.util.Collection; 15 | 16 | public class CamerasInterfaceTest extends Flickr4JavaTest { 17 | 18 | @Test 19 | public void testGetBrands() throws FlickrException { 20 | 21 | // not implementing much for tests here - flickr doesn't give us much to go on. 22 | CamerasInterface camInterface = flickr.getCamerasInterface(); 23 | Collection brands = camInterface.getBrands(); 24 | assertNotNull(brands); 25 | assertTrue(brands.size() > 0); 26 | } 27 | 28 | @Test 29 | public void testGetBrandModels() throws FlickrException { 30 | 31 | // not implementing much for tests here - flickr doesn't give us much to go on. 32 | // the interface may not be final - the documented xml nodes don't correspond to what is in the xml 33 | CamerasInterface camInterface = flickr.getCamerasInterface(); 34 | Flickr.debugStream = true; 35 | Collection cams = camInterface.getBrandModels("Canon"); 36 | assertNotNull(cams); 37 | assertTrue(cams.size() > 0); 38 | for (Camera cam : cams) { 39 | assertNotNull(cam.getId()); 40 | assertNotNull(cam.getName()); 41 | /* 42 | * assertNotNull(cam.getSmallImage()); assertNotNull(cam.getLargeImage()); assertNotNull(cam.getDetails().getMegapixels()); 43 | * assertNotNull(cam.getDetails().getZoom()); assertNotNull(cam.getDetails().getLcdSize()); assertNotNull(cam.getDetails().getStorageType()); 44 | */} 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/activity/Event.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.activity; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Activity-Event. It's type is either 'note' or 'comment', or 'fave'. id is set only, if the type of the Event is 'note' or 'comment'. 7 | * 8 | * @see com.flickr4java.flickr.activity.Item 9 | * @author mago 10 | * @version $Id: Event.java,v 1.2 2007/07/22 16:18:20 x-mago Exp $ 11 | */ 12 | public class Event { 13 | private String id; 14 | 15 | private String type; 16 | 17 | private String user; 18 | 19 | private String username; 20 | 21 | private String value; 22 | 23 | private Date dateadded; 24 | 25 | public Event() { 26 | } 27 | 28 | public Date getDateadded() { 29 | return dateadded; 30 | } 31 | 32 | public void setDateadded(Date dateadded) { 33 | this.dateadded = dateadded; 34 | } 35 | 36 | public void setDateadded(String dateAdded) { 37 | if (dateAdded == null || "".equals(dateAdded)) 38 | return; 39 | setDateadded(new Date(Long.parseLong(dateAdded) * (long) 1000)); 40 | } 41 | 42 | public String getId() { 43 | return id; 44 | } 45 | 46 | public void setId(String id) { 47 | this.id = id; 48 | } 49 | 50 | public String getType() { 51 | return type; 52 | } 53 | 54 | public void setType(String type) { 55 | this.type = type; 56 | } 57 | 58 | public String getUser() { 59 | return user; 60 | } 61 | 62 | public void setUser(String user) { 63 | this.user = user; 64 | } 65 | 66 | public String getUsername() { 67 | return username; 68 | } 69 | 70 | public void setUsername(String username) { 71 | this.username = username; 72 | } 73 | 74 | public String getValue() { 75 | return value; 76 | } 77 | 78 | public void setValue(String value) { 79 | this.value = value; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/SearchResultList.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * Search result list with additional meta data. 9 | * 10 | * @author Anthony Eden 11 | * @version $Id: SearchResultList.java,v 1.3 2007/07/20 19:06:27 x-mago Exp $ 12 | */ 13 | public class SearchResultList extends ArrayList { 14 | 15 | private static final long serialVersionUID = -7962319033867024935L; 16 | 17 | private int page; 18 | 19 | private int pages; 20 | 21 | private int perPage; 22 | 23 | private int total; 24 | 25 | public int getPage() { 26 | return page; 27 | } 28 | 29 | public void setPage(int page) { 30 | this.page = page; 31 | } 32 | 33 | public void setPage(String page) { 34 | if (page != null && page.length() != 0) { 35 | setPage(Integer.parseInt(page)); 36 | } 37 | } 38 | 39 | public int getPages() { 40 | return pages; 41 | } 42 | 43 | public void setPages(int pages) { 44 | this.pages = pages; 45 | } 46 | 47 | public void setPages(String pages) { 48 | if (pages != null && pages.length() != 0) { 49 | setPages(Integer.parseInt(pages)); 50 | } 51 | } 52 | 53 | public int getPerPage() { 54 | return perPage; 55 | } 56 | 57 | public void setPerPage(int perPage) { 58 | this.perPage = perPage; 59 | } 60 | 61 | public void setPerPage(String perPage) { 62 | if (perPage != null && perPage.length() != 0) { 63 | setPerPage(Integer.parseInt(perPage)); 64 | } 65 | } 66 | 67 | public int getTotal() { 68 | return total; 69 | } 70 | 71 | public void setTotal(int total) { 72 | this.total = total; 73 | } 74 | 75 | public void setTotal(String total) { 76 | if (total != null && total.length() != 0) { 77 | setTotal(Integer.parseInt(total)); 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.cameras.getBrands.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/commons/Institution.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.commons; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * A commons institution. 7 | * 8 | * @author mago 9 | * @version $Id: Institution.java,v 1.2 2009/07/12 22:43:07 x-mago Exp $ 10 | */ 11 | public class Institution { 12 | 13 | private String id; 14 | 15 | private String name; 16 | 17 | private Date dateLaunch; 18 | 19 | private String siteUrl; 20 | 21 | private String licenseUrl; 22 | 23 | private String flickrUrl; 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | 33 | public String getName() { 34 | return name; 35 | } 36 | 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | public Date getDateLaunch() { 42 | return dateLaunch; 43 | } 44 | 45 | public void setDateLaunch(Date dateLaunch) { 46 | this.dateLaunch = dateLaunch; 47 | } 48 | 49 | public void setDateLaunch(long date) { 50 | setDateLaunch(new Date(date)); 51 | } 52 | 53 | public void setDateLaunch(String date) { 54 | if (date == null || "".equals(date)) 55 | return; 56 | setDateLaunch(Long.parseLong(date) * 1000); 57 | } 58 | 59 | public String getSiteUrl() { 60 | return siteUrl; 61 | } 62 | 63 | public void setSiteUrl(String siteUrl) { 64 | this.siteUrl = siteUrl; 65 | } 66 | 67 | public String getLicenseUrl() { 68 | return licenseUrl; 69 | } 70 | 71 | public void setLicenseUrl(String licenseUrl) { 72 | this.licenseUrl = licenseUrl; 73 | } 74 | 75 | public String getFlickrUrl() { 76 | return flickrUrl; 77 | } 78 | 79 | public void setFlickrUrl(String flickrUrl) { 80 | this.flickrUrl = flickrUrl; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return String.format("Institution [name=%s]", name); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/util/TestPropertiesFactory.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import java.io.File; 7 | import java.net.URL; 8 | import java.nio.file.Paths; 9 | import java.util.Optional; 10 | 11 | public class TestPropertiesFactory { 12 | 13 | /** 14 | * Logger. 15 | */ 16 | private static Logger _log = LoggerFactory.getLogger(TestPropertiesFactory.class); 17 | 18 | 19 | public static TestProperties getTestProperties() { 20 | 21 | TestPropertiesFactory factory = new TestPropertiesFactory(); 22 | Optional fileOptional = factory.findPropertyFile(); 23 | 24 | TestProperties testProperties; 25 | if (fileOptional.isPresent()) { 26 | testProperties = new FileTestProperties(fileOptional.get()); 27 | } else { 28 | testProperties = new StubTestProperties(); 29 | } 30 | 31 | return testProperties; 32 | } 33 | 34 | private Optional findPropertyFile() { 35 | Optional fileOptional = Optional.empty(); 36 | String setupPropertiesPath = System.getenv("SETUP_PROPERTIES_PATH"); 37 | 38 | try { 39 | if (setupPropertiesPath != null && setupPropertiesPath.length() > 0) { 40 | _log.info("Using properties file at '{}'", setupPropertiesPath); 41 | File properties = new File(setupPropertiesPath); 42 | fileOptional = properties.exists() ? Optional.of(properties) : Optional.empty(); 43 | } else { 44 | URL resource = this.getClass().getResource("/setup.properties"); 45 | if (resource != null) { 46 | fileOptional = Optional.of(Paths.get(resource.toURI()).toFile()); 47 | _log.info("Using properties file /setup.properties from classpath"); 48 | } 49 | } 50 | } catch (Exception e) { 51 | _log.warn("Unable to load properties file", e); 52 | fileOptional = Optional.empty(); 53 | } 54 | 55 | return fileOptional; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/PrefsInterfaceTest.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.test; 2 | 3 | import static org.junit.Assert.assertNotNull; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.Test; 7 | 8 | import com.flickr4java.flickr.Flickr; 9 | import com.flickr4java.flickr.FlickrException; 10 | import com.flickr4java.flickr.prefs.PrefsInterface; 11 | 12 | /** 13 | * @author Martin Goebel 14 | * @version $Id: PrefsInterfaceTest.java,v 1.3 2008/06/28 22:30:04 x-mago Exp $ 15 | */ 16 | public class PrefsInterfaceTest extends Flickr4JavaTest { 17 | 18 | @Test 19 | public void testGetContentType() throws FlickrException { 20 | PrefsInterface iface = flickr.getPrefsInterface(); 21 | String type = iface.getContentType(); 22 | assertTrue(type.equals(Flickr.CONTENTTYPE_OTHER) || type.equals(Flickr.CONTENTTYPE_PHOTO) || type.equals(Flickr.CONTENTTYPE_SCREENSHOT)); 23 | } 24 | 25 | @Test 26 | public void testGetSafetyLevel() throws FlickrException { 27 | PrefsInterface iface = flickr.getPrefsInterface(); 28 | String level = iface.getSafetyLevel(); 29 | assertTrue(level.equals(Flickr.SAFETYLEVEL_SAFE) || level.equals(Flickr.SAFETYLEVEL_MODERATE) || level.equals(Flickr.SAFETYLEVEL_RESTRICTED)); 30 | } 31 | 32 | @Test 33 | public void testGetHidden() throws FlickrException { 34 | PrefsInterface iface = flickr.getPrefsInterface(); 35 | Boolean hidden = iface.getHidden(); 36 | assertNotNull(hidden); 37 | } 38 | 39 | @Test 40 | public void testGetGeoPerms() throws FlickrException { 41 | PrefsInterface iface = flickr.getPrefsInterface(); 42 | int geoPerm = iface.getGeoPerms(); 43 | // check for known levels. 44 | if (geoPerm != Flickr.PRIVACY_LEVEL_NO_FILTER && geoPerm != Flickr.PRIVACY_LEVEL_FRIENDS && geoPerm != Flickr.PRIVACY_LEVEL_PUBLIC 45 | && geoPerm != Flickr.PRIVACY_LEVEL_PRIVATE && geoPerm != Flickr.PRIVACY_LEVEL_FRIENDS_FAMILY && geoPerm != Flickr.PRIVACY_LEVEL_FAMILY) { 46 | assertTrue(false); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photosets.getPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/photos/upload/Ticket.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.photos.upload; 2 | 3 | /** 4 | * Photo upload ticket. 5 | *

6 | * The ticketId attribute contains the ticket id.
7 | * If the ticket wasn't found, the invalid attribute is set.
8 | * The status of the ticket is passed in the status attribute; 9 | *

10 | * 0 means not completed,
11 | * 1 means completed and
12 | * 2 means the ticket failed (indicating there was a problem converting the file). 13 | *

14 | * When the status is 1, the photo id is passed in the photoid attribute. The photo id can then be used as with the synchronous upload API. 15 | * 16 | * @author till (Till Krech) extranoise:flickr 17 | * @version $Id: Ticket.java,v 1.2 2007/11/02 21:46:52 x-mago Exp $ 18 | */ 19 | public class Ticket { 20 | public static final int UNCOMPLETED = 0; 21 | 22 | public static final int COMPLETED = 1; 23 | 24 | public static final int FAILED = 2; 25 | 26 | private String ticketId; 27 | 28 | private boolean invalid; 29 | 30 | private String photoId; 31 | 32 | private int status; 33 | 34 | public boolean isInvalid() { 35 | return invalid; 36 | } 37 | 38 | public void setInvalid(boolean invalid) { 39 | this.invalid = invalid; 40 | } 41 | 42 | public String getPhotoId() { 43 | return photoId; 44 | } 45 | 46 | public void setPhotoId(String photoId) { 47 | this.photoId = photoId; 48 | } 49 | 50 | public String getTicketId() { 51 | return ticketId; 52 | } 53 | 54 | public void setTicketId(String ticketId) { 55 | this.ticketId = ticketId; 56 | } 57 | 58 | public int getStatus() { 59 | return status; 60 | } 61 | 62 | public void setStatus(int complete) { 63 | this.status = complete; 64 | } 65 | 66 | public boolean hasCompleted() { 67 | return status == COMPLETED; 68 | } 69 | 70 | public boolean hasFailed() { 71 | return status == FAILED; 72 | } 73 | 74 | public boolean isBusy() { 75 | return status == UNCOMPLETED; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.photosets.getList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PhotosetsInterfaceTest 6 | JUnit test, should be deleted 7 | 8 | 9 | 10 | test 11 | 12 | 13 | 14 | 15 | test 16 | A test photoset 17 | 18 | 19 | 20 | Places 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/stats/Stats.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.stats; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * Stats information as returned by the stats interface. 8 | * 9 | * @author Darren Greaves 10 | * @version $Id$ Copyright (c) 2012 Darren Greaves. 11 | */ 12 | public class Stats { 13 | 14 | /** 15 | * Logger. 16 | */ 17 | @SuppressWarnings("unused") 18 | private static Logger _log = LoggerFactory.getLogger(Stats.class); 19 | 20 | private int views; 21 | 22 | private int comments; 23 | 24 | private int favorites; 25 | 26 | public Stats() { 27 | } 28 | 29 | public int getViews() { 30 | return views; 31 | } 32 | 33 | public void setViews(int views) { 34 | this.views = views; 35 | } 36 | 37 | public void setViews(String views) { 38 | try { 39 | setViews(Integer.parseInt(views)); 40 | } catch (NumberFormatException e) { 41 | // ignore and set value as 0 42 | setViews(0); 43 | } 44 | } 45 | 46 | public int getComments() { 47 | return comments; 48 | } 49 | 50 | public void setComments(int comments) { 51 | this.comments = comments; 52 | } 53 | 54 | public void setComments(String comments) { 55 | try { 56 | setComments(Integer.parseInt(comments)); 57 | } catch (NumberFormatException e) { 58 | // ignore and set value as 0 59 | setComments(0); 60 | } 61 | } 62 | 63 | public int getFavorites() { 64 | return favorites; 65 | } 66 | 67 | public void setFavorites(int favorites) { 68 | this.favorites = favorites; 69 | } 70 | 71 | public void setFavorites(String favorites) { 72 | try { 73 | setFavorites(Integer.parseInt(favorites)); 74 | } catch (NumberFormatException e) { 75 | // ignore and set value as null 76 | setFavorites(0); 77 | } 78 | } 79 | 80 | @SuppressWarnings("boxing") 81 | @Override 82 | public String toString() { 83 | 84 | return String.format("views (%d), favorites (%d), comments (%d)", views, favorites, comments); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/ImageUtilities.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.util; 4 | 5 | import java.awt.Graphics2D; 6 | import java.awt.Image; 7 | import java.awt.image.BufferedImage; 8 | import java.awt.image.ImageObserver; 9 | 10 | /** 11 | * @author Anthony Eden 12 | */ 13 | public class ImageUtilities { 14 | 15 | private static final int DEFAULT_IMAGE_TYPE = BufferedImage.TYPE_INT_RGB; 16 | 17 | public BufferedImage bufferImage(Image image) { 18 | return bufferImage(image, DEFAULT_IMAGE_TYPE); 19 | } 20 | 21 | public BufferedImage bufferImage(Image image, int type) { 22 | BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), type); 23 | Graphics2D g = bufferedImage.createGraphics(); 24 | g.drawImage(image, null, null); 25 | waitForImage(bufferedImage); 26 | return bufferedImage; 27 | } 28 | 29 | private void waitForImage(BufferedImage bufferedImage) { 30 | final ImageLoadStatus imageLoadStatus = new ImageLoadStatus(); 31 | bufferedImage.getHeight(new ImageObserver() { 32 | public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 33 | if (infoflags == ALLBITS) { 34 | imageLoadStatus.heightDone = true; 35 | return true; 36 | } 37 | return false; 38 | } 39 | }); 40 | bufferedImage.getWidth(new ImageObserver() { 41 | public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 42 | if (infoflags == ALLBITS) { 43 | imageLoadStatus.widthDone = true; 44 | return true; 45 | } 46 | return false; 47 | } 48 | }); 49 | while (!imageLoadStatus.widthDone && !imageLoadStatus.heightDone) { 50 | try { 51 | Thread.sleep(300); 52 | } catch (InterruptedException e) { 53 | 54 | } 55 | } 56 | } 57 | 58 | class ImageLoadStatus { 59 | 60 | public boolean widthDone = false; 61 | 62 | public boolean heightDone = false; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/ContactsInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertNotNull; 6 | import static org.junit.Assert.assertTrue; 7 | 8 | import java.util.Collection; 9 | import java.util.Iterator; 10 | 11 | import org.junit.Test; 12 | 13 | import com.flickr4java.flickr.FlickrException; 14 | import com.flickr4java.flickr.contacts.Contact; 15 | import com.flickr4java.flickr.contacts.ContactsInterface; 16 | 17 | /** 18 | * @author Anthony Eden 19 | * @version $Id: ContactsInterfaceTest.java,v 1.9 2009/01/01 20:25:57 x-mago Exp $ 20 | */ 21 | public class ContactsInterfaceTest extends Flickr4JavaTest { 22 | 23 | @Test 24 | public void testGetList() throws FlickrException { 25 | ContactsInterface iface = flickr.getContactsInterface(); 26 | Collection contacts = iface.getList(); 27 | assertNotNull(contacts); 28 | assertTrue("No Contacts. (You need to have contacts for this test to succceed)", contacts.size() > 0); 29 | Iterator it = contacts.iterator(); 30 | for (int i = 0; it.hasNext() && i < 10; i++) { 31 | Contact contact = (Contact) it.next(); 32 | assertNotNull(contact.getUsername()); 33 | assertNotNull(contact.getRealName()); 34 | assertNotNull(contact.getId()); 35 | assertTrue(contact.getIconFarm() > 0); 36 | assertTrue(contact.getIconServer() > 0); 37 | } 38 | } 39 | 40 | @Test 41 | public void testGetPublicList() throws FlickrException { 42 | ContactsInterface iface = flickr.getContactsInterface(); 43 | Collection contacts = iface.getPublicList(testProperties.getNsid()); 44 | assertNotNull(contacts); 45 | assertTrue("No Contacts. (You need to have contacts for this test to succceed)", contacts.size() > 0); 46 | Iterator it = contacts.iterator(); 47 | for (int i = 0; it.hasNext() && i < 10; i++) { 48 | Contact contact = (Contact) it.next(); 49 | assertNotNull(contact.getUsername()); 50 | assertNotNull(contact.getId()); 51 | assertTrue(contact.getIconFarm() > 0); 52 | assertTrue(contact.getIconServer() > 0); 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.people.getPhotos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.machinetags.getValues.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | _wood 5 | bag 6 | black_clay 7 | booy 8 | boy 9 | boys 10 | bus 11 | camera 12 | cast_iron 13 | charcoal 14 | chocolate 15 | clay_and_brick 16 | clover 17 | counter 18 | cyrus 19 | dfgdfg 20 | dfggdf 21 | digital_image 22 | dog 23 | earthenware 24 | flower 25 | fruit 26 | fur 27 | glass 28 | glaze 29 | grass 30 | grass_hill 31 | hiking 32 | hill 33 | human_flesh 34 | kiln_cast_glass 35 | kiln-cast_glass 36 | leather_pillow 37 | limoges_porcelain 38 | marley 39 | mixed_media 40 | mn 41 | nature 42 | none, 43 | nylon_flocking 44 | other 45 | paint 46 | porcelain 47 | porcelain_slip 48 | puppy 49 | resin 50 | royal_copenhagen_porcelain 51 | silver_leaf 52 | slipware 53 | small_child 54 | stoneware 55 | t_material 56 | table 57 | terra_cotta 58 | trails 59 | wood 60 | 61 | -------------------------------------------------------------------------------- /doc/flickr-photo-sizes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/Flickr4JavaTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author acaplan 3 | */ 4 | package com.flickr4java.flickr.test; 5 | 6 | import com.flickr4java.flickr.Flickr; 7 | import com.flickr4java.flickr.FlickrException; 8 | import com.flickr4java.flickr.IFlickr; 9 | import com.flickr4java.flickr.REST; 10 | import com.flickr4java.flickr.RequestContext; 11 | import com.flickr4java.flickr.auth.Auth; 12 | import com.flickr4java.flickr.auth.Permission; 13 | import com.flickr4java.flickr.test.util.FlickrStub; 14 | import com.flickr4java.flickr.test.util.TestProperties; 15 | import com.flickr4java.flickr.test.util.TestPropertiesFactory; 16 | import org.junit.Before; 17 | 18 | /** 19 | * @author acaplan 20 | * 21 | */ 22 | public class Flickr4JavaTest { 23 | 24 | protected IFlickr flickr; 25 | 26 | protected TestProperties testProperties; 27 | 28 | /** 29 | * @throws FlickrException if there was a problem connecting to Flickr 30 | */ 31 | @Before 32 | public void setUp() throws FlickrException { 33 | testProperties = TestPropertiesFactory.getTestProperties(); 34 | 35 | if (testProperties.isRealFlickr()) { 36 | REST rest = new REST(); 37 | rest.setHost(testProperties.getHost()); 38 | 39 | flickr = new Flickr(testProperties.getApiKey(), testProperties.getSecret(), rest); 40 | 41 | setAuth(Permission.READ); 42 | } else { 43 | flickr = new FlickrStub(); 44 | } 45 | } 46 | 47 | /** 48 | * Set auth parameters for API calls that need it. 49 | * 50 | * @param perms 51 | */ 52 | protected void setAuth(Permission perms) { 53 | Auth auth = new Auth(); 54 | auth.setPermission(perms); 55 | auth.setToken(testProperties.getToken()); 56 | auth.setTokenSecret(testProperties.getTokenSecret()); 57 | 58 | RequestContext requestContext = RequestContext.getRequestContext(); 59 | requestContext.setAuth(auth); 60 | flickr.setAuth(auth); 61 | } 62 | 63 | /** 64 | * Certain tests don't require authorization and calling with auth set may mask other errors. 65 | */ 66 | protected void clearAuth() { 67 | RequestContext requestContext = RequestContext.getRequestContext(); 68 | requestContext.setAuth(null); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/groups/discuss/Reply.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.groups.discuss; 2 | 3 | public class Reply { 4 | 5 | private String replyId; 6 | private String authorId; 7 | private String authorname; 8 | private String role; 9 | private int iconserver; 10 | private int iconfarm; 11 | private boolean canEdit; 12 | private boolean canDelete; 13 | private String datecreate; 14 | private String message; 15 | private String lastEdit; 16 | private boolean isPro; 17 | 18 | public String getReplyId() { 19 | return replyId; 20 | } 21 | public void setReplyId(String replyId) { 22 | this.replyId = replyId; 23 | } 24 | public String getAuthorId() { 25 | return authorId; 26 | } 27 | public void setAuthorId(String authorId) { 28 | this.authorId = authorId; 29 | } 30 | public String getAuthorname() { 31 | return authorname; 32 | } 33 | public void setAuthorname(String authorname) { 34 | this.authorname = authorname; 35 | } 36 | public int getIconserver() { 37 | return iconserver; 38 | } 39 | public void setIconserver(int iconserver) { 40 | this.iconserver = iconserver; 41 | } 42 | public String getRole() { 43 | return role; 44 | } 45 | public void setRole(String role) { 46 | this.role = role; 47 | } 48 | public int getIconfarm() { 49 | return iconfarm; 50 | } 51 | public void setIconfarm(int iconfarm) { 52 | this.iconfarm = iconfarm; 53 | } 54 | public boolean isCanEdit() { 55 | return canEdit; 56 | } 57 | public void setIsCanEdit(boolean canEdit) { 58 | this.canEdit = canEdit; 59 | } 60 | public boolean isCanDelete() { 61 | return canDelete; 62 | } 63 | public void setIsCanDelete(boolean canDelete) { 64 | this.canDelete = canDelete; 65 | } 66 | public String getDatecreate() { 67 | return datecreate; 68 | } 69 | public void setDatecreate(String datecreate) { 70 | this.datecreate = datecreate; 71 | } 72 | public String getMessage() { 73 | return message; 74 | } 75 | public void setMessage(String message) { 76 | this.message = message; 77 | } 78 | public String getLastEdit() { 79 | return lastEdit; 80 | } 81 | public void setLastEdit(String lastEdit) { 82 | this.lastEdit = lastEdit; 83 | } 84 | public boolean isPro() { 85 | return isPro; 86 | } 87 | public void setIsPro(boolean isPro) { 88 | this.isPro = isPro; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/test/java/com/flickr4java/flickr/test/PoolsInterfaceTest.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package com.flickr4java.flickr.test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNotNull; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | import com.flickr4java.flickr.FlickrException; 10 | import com.flickr4java.flickr.groups.Group; 11 | import com.flickr4java.flickr.groups.pools.PoolsInterface; 12 | import com.flickr4java.flickr.photos.Photo; 13 | import com.flickr4java.flickr.photos.PhotoContext; 14 | 15 | import org.junit.Test; 16 | 17 | import java.util.Collection; 18 | 19 | /** 20 | * @author Anthony Eden 21 | */ 22 | public class PoolsInterfaceTest extends Flickr4JavaTest { 23 | 24 | @Test 25 | public void testAddAndRemove() throws FlickrException { 26 | PoolsInterface iface = flickr.getPoolsInterface(); 27 | String photoId = testProperties.getPhotoId(); 28 | String groupId = testProperties.getTestGroupId(); 29 | 30 | try { 31 | iface.add(photoId, groupId); 32 | } finally { 33 | iface.remove(photoId, groupId); 34 | } 35 | } 36 | 37 | @Test 38 | public void testGetGroups() throws FlickrException { 39 | PoolsInterface iface = flickr.getPoolsInterface(); 40 | Collection groups = iface.getGroups(); 41 | assertNotNull(groups); 42 | assertTrue(groups.size() >= 1); 43 | } 44 | 45 | @Test 46 | public void testGetPhotos() throws FlickrException { 47 | String groupId = testProperties.getTestGroupId(); 48 | PoolsInterface iface = flickr.getPoolsInterface(); 49 | Collection photos = iface.getPhotos(groupId, null, 0, 0); 50 | assertNotNull(photos); 51 | assertEquals(0, photos.size()); 52 | } 53 | 54 | @Test 55 | public void testGetContext() throws FlickrException { 56 | String groupId = testProperties.getTestGroupId(); 57 | String photoId = testProperties.getPhotoId(); 58 | PoolsInterface iface = flickr.getPoolsInterface(); 59 | 60 | try { 61 | iface.add(photoId, groupId); 62 | PhotoContext photoContext = iface.getContext(photoId, groupId); 63 | assertNotNull(photoContext); 64 | } finally { 65 | iface.remove(photoId, groupId); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/machinetags/Value.java: -------------------------------------------------------------------------------- 1 | package com.flickr4java.flickr.machinetags; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * 7 | * @author mago 8 | * @version $Id: Value.java,v 1.3 2009/07/12 22:43:07 x-mago Exp $ 9 | */ 10 | public class Value { 11 | 12 | String value; 13 | 14 | int usage; 15 | 16 | String namespace; 17 | 18 | String predicate; 19 | 20 | Date firstAdded; 21 | 22 | Date lastAdded; 23 | 24 | public String getValue() { 25 | return value; 26 | } 27 | 28 | public void setValue(String value) { 29 | this.value = value; 30 | } 31 | 32 | public int getUsage() { 33 | return usage; 34 | } 35 | 36 | public String getNamespace() { 37 | return namespace; 38 | } 39 | 40 | public void setNamespace(String namespace) { 41 | this.namespace = namespace; 42 | } 43 | 44 | public String getPredicate() { 45 | return predicate; 46 | } 47 | 48 | public void setPredicate(String predicate) { 49 | this.predicate = predicate; 50 | } 51 | 52 | public void setFirstAdded(Date date) { 53 | firstAdded = date; 54 | } 55 | 56 | public void setFirstAdded(long datePosted) { 57 | setFirstAdded(new Date(datePosted)); 58 | } 59 | 60 | public void setFirstAdded(String timestamp) { 61 | if (timestamp == null || "".equals(timestamp)) 62 | return; 63 | setFirstAdded(Long.parseLong(timestamp) * 1000); 64 | } 65 | 66 | public void setLastAdded(Date date) { 67 | lastAdded = date; 68 | } 69 | 70 | public void setLastAdded(long date) { 71 | setLastAdded(new Date(date)); 72 | } 73 | 74 | public void setLastAdded(String timestamp) { 75 | if (timestamp == null || "".equals(timestamp)) 76 | return; 77 | setLastAdded(Long.parseLong(timestamp) * 1000); 78 | } 79 | 80 | public void setUsage(String predicates) { 81 | try { 82 | setUsage(Integer.parseInt(predicates)); 83 | } catch (NumberFormatException e) { 84 | } 85 | } 86 | 87 | public void setUsage(int usage) { 88 | this.usage = usage; 89 | } 90 | 91 | @Override 92 | public String toString() { 93 | 94 | return String.format("%s:%s=%s", namespace, predicate, value); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/flickr4java/flickr/util/StringUtilities.java: -------------------------------------------------------------------------------- 1 | 2 | package com.flickr4java.flickr.util; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collection; 6 | import java.util.Iterator; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * String utility methods. 11 | * 12 | * @author Anthony Eden 13 | * @version $Id: StringUtilities.java,v 1.5 2009/07/23 20:41:03 x-mago Exp $ 14 | */ 15 | public class StringUtilities { 16 | public static final Pattern getterPattern = Pattern.compile("^is|^get"); 17 | 18 | private StringUtilities() { 19 | 20 | } 21 | 22 | /** 23 | * Join the array of Strings using the specified delimiter. 24 | * 25 | * @param s 26 | * The String array 27 | * @param delimiter 28 | * The delimiter String 29 | * @return The joined String 30 | */ 31 | public static String join(String[] s, String delimiter) { 32 | return join(s, delimiter, false); 33 | } 34 | 35 | public static String join(String[] s, String delimiter, boolean doQuote) { 36 | return join(Arrays.asList(s), delimiter, doQuote); 37 | } 38 | 39 | /** 40 | * Join the Collection of Strings using the specified delimter and optionally quoting each 41 | * 42 | * @param s 43 | * The String collection 44 | * @param delimiter 45 | * the delimiter String 46 | * @param doQuote 47 | * whether or not to quote the Strings 48 | * @return The joined String 49 | */ 50 | public static String join(Collection s, String delimiter, boolean doQuote) { 51 | StringBuffer buffer = new StringBuffer(); 52 | Iterator iter = s.iterator(); 53 | while (iter.hasNext()) { 54 | if (doQuote) { 55 | buffer.append("\"" + iter.next() + "\""); 56 | } else { 57 | buffer.append(iter.next()); 58 | } 59 | if (iter.hasNext()) { 60 | buffer.append(delimiter); 61 | } 62 | } 63 | return buffer.toString(); 64 | } 65 | 66 | /** 67 | * Join the Collection of Strings using the specified delimiter. 68 | * 69 | * @param s 70 | * The String collection 71 | * @param delimiter 72 | * The delimiter String 73 | * @return The joined String 74 | */ 75 | public static String join(Collection s, String delimiter) { 76 | return join(s, delimiter, false); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/test/resources/payloads/get/flickr.tags.getListUser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 6 | 11 7 | 2000 8 | 30 9 | 400 10 | a 11 | an 12 | april 13 | banana 14 | be 15 | blog 16 | commercial 17 | d76 18 | database 19 | dbms 20 | ddx 21 | developed 22 | developer:brand=foma 23 | developer:brand=ilford 24 | developer:name=fomafomauniversaldeveloper 25 | developer:name=ilfordilfotecddx 26 | developing 27 | documents 28 | enhancements 29 | entry 30 | every 31 | expired 32 | features 33 | film 34 | film:brand=ilford 35 | film:brand=kodak 36 | film:iso=25 37 | film:iso=800 38 | film:name=ilfordhp5400 39 | film:name=kodakprofessionalortho655625 40 | filmdev:recipe=2307 41 | filmdev:recipe=2347 42 | filmdev:recipe=2355 43 | filmdev:recipe=5519 44 | filmdev:recipe=6417 45 | filmdev:recipe=9083 46 | flickr 47 | fomafomauniversaldeveloper 48 | for 49 | found 50 | green 51 | grn 52 | grngrn 53 | has 54 | hp5 55 | ilford 56 | ilfordhp5400 57 | ilfordilfotecddx 58 | ilfotec 59 | infact 60 | installation 61 | inversions 62 | is 63 | kodak 64 | kodakprofessionalortho6556 65 | linking 66 | linux 67 | london 68 | minutes 69 | nextgeneration 70 | objectrelational 71 | pan 72 | photos 73 | postgresql 74 | process 75 | rated 76 | recipes 77 | seconds 78 | shot 79 | site 80 | speed 81 | stock 82 | stuff 83 | system 84 | systems 85 | that 86 | this 87 | tmax 88 | traditional 89 | trix 90 | ubuntu 91 | uniquetesttag 92 | with 93 | xml 94 | 95 | 96 | --------------------------------------------------------------------------------