id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
160,000
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/members/MembersInterface.java
MembersInterface.getList
public MembersList<Member> getList(String groupId, Set<String> memberTypes, int perPage, int page) throws FlickrException { MembersList<Member> members = new MembersList<Member>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); parameters.put("group_id", groupId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } if (memberTypes != null) { parameters.put("membertypes", StringUtilities.join(memberTypes, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element mElement = response.getPayload(); members.setPage(mElement.getAttribute("page")); members.setPages(mElement.getAttribute("pages")); members.setPerPage(mElement.getAttribute("perpage")); members.setTotal(mElement.getAttribute("total")); NodeList mNodes = mElement.getElementsByTagName("member"); for (int i = 0; i < mNodes.getLength(); i++) { Element element = (Element) mNodes.item(i); members.add(parseMember(element)); } return members; }
java
public MembersList<Member> getList(String groupId, Set<String> memberTypes, int perPage, int page) throws FlickrException { MembersList<Member> members = new MembersList<Member>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); parameters.put("group_id", groupId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } if (memberTypes != null) { parameters.put("membertypes", StringUtilities.join(memberTypes, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element mElement = response.getPayload(); members.setPage(mElement.getAttribute("page")); members.setPages(mElement.getAttribute("pages")); members.setPerPage(mElement.getAttribute("perpage")); members.setTotal(mElement.getAttribute("total")); NodeList mNodes = mElement.getElementsByTagName("member"); for (int i = 0; i < mNodes.getLength(); i++) { Element element = (Element) mNodes.item(i); members.add(parseMember(element)); } return members; }
[ "public", "MembersList", "<", "Member", ">", "getList", "(", "String", "groupId", ",", "Set", "<", "String", ">", "memberTypes", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "MembersList", "<", "Member", ">", "members", "=", "new", "MembersList", "<", "Member", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "if", "(", "memberTypes", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"membertypes\"", ",", "StringUtilities", ".", "join", "(", "memberTypes", ",", "\",\"", ")", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "mElement", "=", "response", ".", "getPayload", "(", ")", ";", "members", ".", "setPage", "(", "mElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "members", ".", "setPages", "(", "mElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "members", ".", "setPerPage", "(", "mElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "members", ".", "setTotal", "(", "mElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "mNodes", "=", "mElement", ".", "getElementsByTagName", "(", "\"member\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "element", "=", "(", "Element", ")", "mNodes", ".", "item", "(", "i", ")", ";", "members", ".", "add", "(", "parseMember", "(", "element", ")", ")", ";", "}", "return", "members", ";", "}" ]
Get a list of the members of a group. The call must be signed on behalf of a Flickr member, and the ability to see the group membership will be determined by the Flickr member's group privileges. @param groupId Return a list of members for this group. The group must be viewable by the Flickr member on whose behalf the API call is made. @param memberTypes A set of Membertypes as available as constants in {@link Member}. @param perPage Number of records per page. @param page Result-section. @return A members-list @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.members.getList.html">API Documentation</a>
[ "Get", "a", "list", "of", "the", "members", "of", "a", "group", ".", "The", "call", "must", "be", "signed", "on", "behalf", "of", "a", "Flickr", "member", "and", "the", "ability", "to", "see", "the", "group", "membership", "will", "be", "determined", "by", "the", "Flickr", "member", "s", "group", "privileges", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/members/MembersInterface.java#L52-L85
160,001
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/Size.java
Size.setLabel
public void setLabel(String label) { int ix = lstSizes.indexOf(label); if (ix != -1) { setLabel(ix); } }
java
public void setLabel(String label) { int ix = lstSizes.indexOf(label); if (ix != -1) { setLabel(ix); } }
[ "public", "void", "setLabel", "(", "String", "label", ")", "{", "int", "ix", "=", "lstSizes", ".", "indexOf", "(", "label", ")", ";", "if", "(", "ix", "!=", "-", "1", ")", "{", "setLabel", "(", "ix", ")", ";", "}", "}" ]
Set the String-representation of size. Like: Square, Thumbnail, Small, Medium, Large, Original. @param label
[ "Set", "the", "String", "-", "representation", "of", "size", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/Size.java#L225-L231
160,002
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.create
public Photoset create(String title, String description, String primaryPhotoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_CREATE); parameters.put("title", title); parameters.put("description", description); parameters.put("primary_photo_id", primaryPhotoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosetElement = response.getPayload(); Photoset photoset = new Photoset(); photoset.setId(photosetElement.getAttribute("id")); photoset.setUrl(photosetElement.getAttribute("url")); return photoset; }
java
public Photoset create(String title, String description, String primaryPhotoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_CREATE); parameters.put("title", title); parameters.put("description", description); parameters.put("primary_photo_id", primaryPhotoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosetElement = response.getPayload(); Photoset photoset = new Photoset(); photoset.setId(photosetElement.getAttribute("id")); photoset.setUrl(photosetElement.getAttribute("url")); return photoset; }
[ "public", "Photoset", "create", "(", "String", "title", ",", "String", "description", ",", "String", "primaryPhotoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_CREATE", ")", ";", "parameters", ".", "put", "(", "\"title\"", ",", "title", ")", ";", "parameters", ".", "put", "(", "\"description\"", ",", "description", ")", ";", "parameters", ".", "put", "(", "\"primary_photo_id\"", ",", "primaryPhotoId", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosetElement", "=", "response", ".", "getPayload", "(", ")", ";", "Photoset", "photoset", "=", "new", "Photoset", "(", ")", ";", "photoset", ".", "setId", "(", "photosetElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "photoset", ".", "setUrl", "(", "photosetElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "return", "photoset", ";", "}" ]
Create a new photoset. @param title The photoset title @param description The photoset description @param primaryPhotoId The primary photo id @return The new Photset @throws FlickrException
[ "Create", "a", "new", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L113-L130
160,003
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.editMeta
public void editMeta(String photosetId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("photoset_id", photosetId); parameters.put("title", title); if (description != null) { parameters.put("description", description); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void editMeta(String photosetId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("photoset_id", photosetId); parameters.put("title", title); if (description != null) { parameters.put("description", description); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "editMeta", "(", "String", "photosetId", ",", "String", "title", ",", "String", "description", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_EDIT_META", ")", ";", "parameters", ".", "put", "(", "\"photoset_id\"", ",", "photosetId", ")", ";", "parameters", ".", "put", "(", "\"title\"", ",", "title", ")", ";", "if", "(", "description", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"description\"", ",", "description", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Modify the meta-data for a photoset. @param photosetId The photoset ID @param title A new title @param description A new description (can be null) @throws FlickrException
[ "Modify", "the", "meta", "-", "data", "for", "a", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L162-L176
160,004
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.editPhotos
public void editPhotos(String photosetId, String primaryPhotoId, String[] photoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTOS); parameters.put("photoset_id", photosetId); parameters.put("primary_photo_id", primaryPhotoId); parameters.put("photo_ids", StringUtilities.join(photoIds, ",")); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void editPhotos(String photosetId, String primaryPhotoId, String[] photoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTOS); parameters.put("photoset_id", photosetId); parameters.put("primary_photo_id", primaryPhotoId); parameters.put("photo_ids", StringUtilities.join(photoIds, ",")); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "editPhotos", "(", "String", "photosetId", ",", "String", "primaryPhotoId", ",", "String", "[", "]", "photoIds", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_EDIT_PHOTOS", ")", ";", "parameters", ".", "put", "(", "\"photoset_id\"", ",", "photosetId", ")", ";", "parameters", ".", "put", "(", "\"primary_photo_id\"", ",", "primaryPhotoId", ")", ";", "parameters", ".", "put", "(", "\"photo_ids\"", ",", "StringUtilities", ".", "join", "(", "photoIds", ",", "\",\"", ")", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Edit which photos are in the photoset. @param photosetId The photoset ID @param primaryPhotoId The primary photo Id @param photoIds The photo IDs for the photos in the set @throws FlickrException
[ "Edit", "which", "photos", "are", "in", "the", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L189-L201
160,005
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.getInfo
public Photoset getInfo(String photosetId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photoset_id", photosetId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosetElement = response.getPayload(); Photoset photoset = new Photoset(); photoset.setId(photosetElement.getAttribute("id")); User owner = new User(); owner.setId(photosetElement.getAttribute("owner")); photoset.setOwner(owner); Photo primaryPhoto = new Photo(); primaryPhoto.setId(photosetElement.getAttribute("primary")); primaryPhoto.setSecret(photosetElement.getAttribute("secret")); // TODO verify that this is the secret for the photo primaryPhoto.setServer(photosetElement.getAttribute("server")); // TODO verify that this is the server for the photo primaryPhoto.setFarm(photosetElement.getAttribute("farm")); photoset.setPrimaryPhoto(primaryPhoto); // TODO remove secret/server/farm from photoset? // It's rather related to the primaryPhoto, then to the photoset itself. photoset.setSecret(photosetElement.getAttribute("secret")); photoset.setServer(photosetElement.getAttribute("server")); photoset.setFarm(photosetElement.getAttribute("farm")); photoset.setPhotoCount(photosetElement.getAttribute("count_photos")); photoset.setVideoCount(Integer.parseInt(photosetElement.getAttribute("count_videos"))); photoset.setViewCount(Integer.parseInt(photosetElement.getAttribute("count_views"))); photoset.setCommentCount(Integer.parseInt(photosetElement.getAttribute("count_comments"))); photoset.setDateCreate(photosetElement.getAttribute("date_create")); photoset.setDateUpdate(photosetElement.getAttribute("date_update")); photoset.setIsCanComment("1".equals(photosetElement.getAttribute("can_comment"))); photoset.setTitle(XMLUtilities.getChildValue(photosetElement, "title")); photoset.setDescription(XMLUtilities.getChildValue(photosetElement, "description")); photoset.setPrimaryPhoto(primaryPhoto); return photoset; }
java
public Photoset getInfo(String photosetId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photoset_id", photosetId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosetElement = response.getPayload(); Photoset photoset = new Photoset(); photoset.setId(photosetElement.getAttribute("id")); User owner = new User(); owner.setId(photosetElement.getAttribute("owner")); photoset.setOwner(owner); Photo primaryPhoto = new Photo(); primaryPhoto.setId(photosetElement.getAttribute("primary")); primaryPhoto.setSecret(photosetElement.getAttribute("secret")); // TODO verify that this is the secret for the photo primaryPhoto.setServer(photosetElement.getAttribute("server")); // TODO verify that this is the server for the photo primaryPhoto.setFarm(photosetElement.getAttribute("farm")); photoset.setPrimaryPhoto(primaryPhoto); // TODO remove secret/server/farm from photoset? // It's rather related to the primaryPhoto, then to the photoset itself. photoset.setSecret(photosetElement.getAttribute("secret")); photoset.setServer(photosetElement.getAttribute("server")); photoset.setFarm(photosetElement.getAttribute("farm")); photoset.setPhotoCount(photosetElement.getAttribute("count_photos")); photoset.setVideoCount(Integer.parseInt(photosetElement.getAttribute("count_videos"))); photoset.setViewCount(Integer.parseInt(photosetElement.getAttribute("count_views"))); photoset.setCommentCount(Integer.parseInt(photosetElement.getAttribute("count_comments"))); photoset.setDateCreate(photosetElement.getAttribute("date_create")); photoset.setDateUpdate(photosetElement.getAttribute("date_update")); photoset.setIsCanComment("1".equals(photosetElement.getAttribute("can_comment"))); photoset.setTitle(XMLUtilities.getChildValue(photosetElement, "title")); photoset.setDescription(XMLUtilities.getChildValue(photosetElement, "description")); photoset.setPrimaryPhoto(primaryPhoto); return photoset; }
[ "public", "Photoset", "getInfo", "(", "String", "photosetId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INFO", ")", ";", "parameters", ".", "put", "(", "\"photoset_id\"", ",", "photosetId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosetElement", "=", "response", ".", "getPayload", "(", ")", ";", "Photoset", "photoset", "=", "new", "Photoset", "(", ")", ";", "photoset", ".", "setId", "(", "photosetElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "User", "owner", "=", "new", "User", "(", ")", ";", "owner", ".", "setId", "(", "photosetElement", ".", "getAttribute", "(", "\"owner\"", ")", ")", ";", "photoset", ".", "setOwner", "(", "owner", ")", ";", "Photo", "primaryPhoto", "=", "new", "Photo", "(", ")", ";", "primaryPhoto", ".", "setId", "(", "photosetElement", ".", "getAttribute", "(", "\"primary\"", ")", ")", ";", "primaryPhoto", ".", "setSecret", "(", "photosetElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "// TODO verify that this is the secret for the photo\r", "primaryPhoto", ".", "setServer", "(", "photosetElement", ".", "getAttribute", "(", "\"server\"", ")", ")", ";", "// TODO verify that this is the server for the photo\r", "primaryPhoto", ".", "setFarm", "(", "photosetElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "photoset", ".", "setPrimaryPhoto", "(", "primaryPhoto", ")", ";", "// TODO remove secret/server/farm from photoset?\r", "// It's rather related to the primaryPhoto, then to the photoset itself.\r", "photoset", ".", "setSecret", "(", "photosetElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "photoset", ".", "setServer", "(", "photosetElement", ".", "getAttribute", "(", "\"server\"", ")", ")", ";", "photoset", ".", "setFarm", "(", "photosetElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "photoset", ".", "setPhotoCount", "(", "photosetElement", ".", "getAttribute", "(", "\"count_photos\"", ")", ")", ";", "photoset", ".", "setVideoCount", "(", "Integer", ".", "parseInt", "(", "photosetElement", ".", "getAttribute", "(", "\"count_videos\"", ")", ")", ")", ";", "photoset", ".", "setViewCount", "(", "Integer", ".", "parseInt", "(", "photosetElement", ".", "getAttribute", "(", "\"count_views\"", ")", ")", ")", ";", "photoset", ".", "setCommentCount", "(", "Integer", ".", "parseInt", "(", "photosetElement", ".", "getAttribute", "(", "\"count_comments\"", ")", ")", ")", ";", "photoset", ".", "setDateCreate", "(", "photosetElement", ".", "getAttribute", "(", "\"date_create\"", ")", ")", ";", "photoset", ".", "setDateUpdate", "(", "photosetElement", ".", "getAttribute", "(", "\"date_update\"", ")", ")", ";", "photoset", ".", "setIsCanComment", "(", "\"1\"", ".", "equals", "(", "photosetElement", ".", "getAttribute", "(", "\"can_comment\"", ")", ")", ")", ";", "photoset", ".", "setTitle", "(", "XMLUtilities", ".", "getChildValue", "(", "photosetElement", ",", "\"title\"", ")", ")", ";", "photoset", ".", "setDescription", "(", "XMLUtilities", ".", "getChildValue", "(", "photosetElement", ",", "\"description\"", ")", ")", ";", "photoset", ".", "setPrimaryPhoto", "(", "primaryPhoto", ")", ";", "return", "photoset", ";", "}" ]
Get the information for a specified photoset. This method does not require authentication. @param photosetId The photoset ID @return The Photoset @throws FlickrException
[ "Get", "the", "information", "for", "a", "specified", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L257-L301
160,006
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.getPhotos
public PhotoList<Photo> getPhotos(String photosetId, Set<String> extras, int privacy_filter, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PHOTOS); parameters.put("photoset_id", photosetId); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } if (privacy_filter > 0) { parameters.put("privacy_filter", "" + privacy_filter); } if (extras != null && !extras.isEmpty()) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoset = response.getPayload(); NodeList photoElements = photoset.getElementsByTagName("photo"); photos.setPage(photoset.getAttribute("page")); photos.setPages(photoset.getAttribute("pages")); photos.setPerPage(photoset.getAttribute("per_page")); photos.setTotal(photoset.getAttribute("total")); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement, photoset)); } return photos; }
java
public PhotoList<Photo> getPhotos(String photosetId, Set<String> extras, int privacy_filter, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PHOTOS); parameters.put("photoset_id", photosetId); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } if (privacy_filter > 0) { parameters.put("privacy_filter", "" + privacy_filter); } if (extras != null && !extras.isEmpty()) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoset = response.getPayload(); NodeList photoElements = photoset.getElementsByTagName("photo"); photos.setPage(photoset.getAttribute("page")); photos.setPages(photoset.getAttribute("pages")); photos.setPerPage(photoset.getAttribute("per_page")); photos.setTotal(photoset.getAttribute("total")); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement, photoset)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getPhotos", "(", "String", "photosetId", ",", "Set", "<", "String", ">", "extras", ",", "int", "privacy_filter", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PHOTOS", ")", ";", "parameters", ".", "put", "(", "\"photoset_id\"", ",", "photosetId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "String", ".", "valueOf", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "String", ".", "valueOf", "(", "page", ")", ")", ";", "}", "if", "(", "privacy_filter", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"privacy_filter\"", ",", "\"\"", "+", "privacy_filter", ")", ";", "}", "if", "(", "extras", "!=", "null", "&&", "!", "extras", ".", "isEmpty", "(", ")", ")", "{", "parameters", ".", "put", "(", "Extras", ".", "KEY_EXTRAS", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photoset", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "photoElements", "=", "photoset", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "photos", ".", "setPage", "(", "photoset", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photoset", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photoset", ".", "getAttribute", "(", "\"per_page\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photoset", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoElements", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ",", "photoset", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Get a collection of Photo objects for the specified Photoset. This method does not require authentication. @see com.flickr4java.flickr.photos.Extras @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS @param photosetId The photoset ID @param extras Set of extra-fields @param privacy_filter filter value for authenticated calls @param perPage The number of photos per page @param page The page offset @return PhotoList The Collection of Photo objects @throws FlickrException
[ "Get", "a", "collection", "of", "Photo", "objects", "for", "the", "specified", "Photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L486-L527
160,007
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.orderSets
public void orderSets(String[] photosetIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ORDER_SETS); ; parameters.put("photoset_ids", StringUtilities.join(photosetIds, ",")); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void orderSets(String[] photosetIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ORDER_SETS); ; parameters.put("photoset_ids", StringUtilities.join(photosetIds, ",")); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "orderSets", "(", "String", "[", "]", "photosetIds", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_ORDER_SETS", ")", ";", ";", "parameters", ".", "put", "(", "\"photoset_ids\"", ",", "StringUtilities", ".", "join", "(", "photosetIds", ",", "\",\"", ")", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the order in which sets are returned for the user. This method requires authentication with 'write' permission. @param photosetIds An array of Ids @throws FlickrException
[ "Set", "the", "order", "in", "which", "sets", "are", "returned", "for", "the", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L565-L576
160,008
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java
ContactsInterface.getList
public Collection<Contact> getList() throws FlickrException { ContactList<Contact> contacts = new ContactList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); contacts.setPage(contactsElement.getAttribute("page")); contacts.setPages(contactsElement.getAttribute("pages")); contacts.setPerPage(contactsElement.getAttribute("perpage")); contacts.setTotal(contactsElement.getAttribute("total")); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setRealName(contactElement.getAttribute("realname")); contact.setFriend("1".equals(contactElement.getAttribute("friend"))); contact.setFamily("1".equals(contactElement.getAttribute("family"))); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); String lPathAlias = contactElement.getAttribute("path_alias"); contact.setPathAlias(lPathAlias == null || "".equals(lPathAlias) ? null : lPathAlias); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
java
public Collection<Contact> getList() throws FlickrException { ContactList<Contact> contacts = new ContactList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); contacts.setPage(contactsElement.getAttribute("page")); contacts.setPages(contactsElement.getAttribute("pages")); contacts.setPerPage(contactsElement.getAttribute("perpage")); contacts.setTotal(contactsElement.getAttribute("total")); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setRealName(contactElement.getAttribute("realname")); contact.setFriend("1".equals(contactElement.getAttribute("friend"))); contact.setFamily("1".equals(contactElement.getAttribute("family"))); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); String lPathAlias = contactElement.getAttribute("path_alias"); contact.setPathAlias(lPathAlias == null || "".equals(lPathAlias) ? null : lPathAlias); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
[ "public", "Collection", "<", "Contact", ">", "getList", "(", ")", "throws", "FlickrException", "{", "ContactList", "<", "Contact", ">", "contacts", "=", "new", "ContactList", "<", "Contact", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "contactsElement", "=", "response", ".", "getPayload", "(", ")", ";", "contacts", ".", "setPage", "(", "contactsElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "contacts", ".", "setPages", "(", "contactsElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "contacts", ".", "setPerPage", "(", "contactsElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "contacts", ".", "setTotal", "(", "contactsElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "contactNodes", "=", "contactsElement", ".", "getElementsByTagName", "(", "\"contact\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contactNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "contactElement", "=", "(", "Element", ")", "contactNodes", ".", "item", "(", "i", ")", ";", "Contact", "contact", "=", "new", "Contact", "(", ")", ";", "contact", ".", "setId", "(", "contactElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "contact", ".", "setUsername", "(", "contactElement", ".", "getAttribute", "(", "\"username\"", ")", ")", ";", "contact", ".", "setRealName", "(", "contactElement", ".", "getAttribute", "(", "\"realname\"", ")", ")", ";", "contact", ".", "setFriend", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"friend\"", ")", ")", ")", ";", "contact", ".", "setFamily", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"family\"", ")", ")", ")", ";", "contact", ".", "setIgnored", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"ignored\"", ")", ")", ")", ";", "String", "lPathAlias", "=", "contactElement", ".", "getAttribute", "(", "\"path_alias\"", ")", ";", "contact", ".", "setPathAlias", "(", "lPathAlias", "==", "null", "||", "\"\"", ".", "equals", "(", "lPathAlias", ")", "?", "null", ":", "lPathAlias", ")", ";", "contact", ".", "setOnline", "(", "OnlineStatus", ".", "fromType", "(", "contactElement", ".", "getAttribute", "(", "\"online\"", ")", ")", ")", ";", "contact", ".", "setIconFarm", "(", "contactElement", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ";", "contact", ".", "setIconServer", "(", "contactElement", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ";", "if", "(", "contact", ".", "getOnline", "(", ")", "==", "OnlineStatus", ".", "AWAY", ")", "{", "contactElement", ".", "normalize", "(", ")", ";", "contact", ".", "setAwayMessage", "(", "XMLUtilities", ".", "getValue", "(", "contactElement", ")", ")", ";", "}", "contacts", ".", "add", "(", "contact", ")", ";", "}", "return", "contacts", ";", "}" ]
Get the collection of contacts for the calling user. @return The Collection of Contact objects
[ "Get", "the", "collection", "of", "contacts", "for", "the", "calling", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java#L50-L88
160,009
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java
ContactsInterface.getListRecentlyUploaded
public Collection<Contact> getListRecentlyUploaded(Date lastUpload, String filter) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_RECENTLY_UPLOADED); if (lastUpload != null) { parameters.put("date_lastupload", String.valueOf(lastUpload.getTime() / 1000L)); } if (filter != null) { parameters.put("filter", filter); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setRealName(contactElement.getAttribute("realname")); contact.setFriend("1".equals(contactElement.getAttribute("friend"))); contact.setFamily("1".equals(contactElement.getAttribute("family"))); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
java
public Collection<Contact> getListRecentlyUploaded(Date lastUpload, String filter) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST_RECENTLY_UPLOADED); if (lastUpload != null) { parameters.put("date_lastupload", String.valueOf(lastUpload.getTime() / 1000L)); } if (filter != null) { parameters.put("filter", filter); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setRealName(contactElement.getAttribute("realname")); contact.setFriend("1".equals(contactElement.getAttribute("friend"))); contact.setFamily("1".equals(contactElement.getAttribute("family"))); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
[ "public", "Collection", "<", "Contact", ">", "getListRecentlyUploaded", "(", "Date", "lastUpload", ",", "String", "filter", ")", "throws", "FlickrException", "{", "List", "<", "Contact", ">", "contacts", "=", "new", "ArrayList", "<", "Contact", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST_RECENTLY_UPLOADED", ")", ";", "if", "(", "lastUpload", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"date_lastupload\"", ",", "String", ".", "valueOf", "(", "lastUpload", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "filter", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"filter\"", ",", "filter", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "contactsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "contactNodes", "=", "contactsElement", ".", "getElementsByTagName", "(", "\"contact\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contactNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "contactElement", "=", "(", "Element", ")", "contactNodes", ".", "item", "(", "i", ")", ";", "Contact", "contact", "=", "new", "Contact", "(", ")", ";", "contact", ".", "setId", "(", "contactElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "contact", ".", "setUsername", "(", "contactElement", ".", "getAttribute", "(", "\"username\"", ")", ")", ";", "contact", ".", "setRealName", "(", "contactElement", ".", "getAttribute", "(", "\"realname\"", ")", ")", ";", "contact", ".", "setFriend", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"friend\"", ")", ")", ")", ";", "contact", ".", "setFamily", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"family\"", ")", ")", ")", ";", "contact", ".", "setIgnored", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"ignored\"", ")", ")", ")", ";", "contact", ".", "setOnline", "(", "OnlineStatus", ".", "fromType", "(", "contactElement", ".", "getAttribute", "(", "\"online\"", ")", ")", ")", ";", "contact", ".", "setIconFarm", "(", "contactElement", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ";", "contact", ".", "setIconServer", "(", "contactElement", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ";", "if", "(", "contact", ".", "getOnline", "(", ")", "==", "OnlineStatus", ".", "AWAY", ")", "{", "contactElement", ".", "normalize", "(", ")", ";", "contact", ".", "setAwayMessage", "(", "XMLUtilities", ".", "getValue", "(", "contactElement", ")", ")", ";", "}", "contacts", ".", "add", "(", "contact", ")", ";", "}", "return", "contacts", ";", "}" ]
Return a list of contacts for a user who have recently uploaded photos along with the total count of photos uploaded. @param lastUpload Limits the resultset to contacts that have uploaded photos since this date. The date should be in the form of a Unix timestamp. The default, and maximum, offset is (1) hour. (Optional, can be null) @param filter Limit the result set to all contacts or only those who are friends or family.<br/> Valid options are: <b>ff</b> -&gt; friends and family, <b>all</b> -&gt; all your contacts. (Optional, can be null) @return List of Contacts @throws FlickrException
[ "Return", "a", "list", "of", "contacts", "for", "a", "user", "who", "have", "recently", "uploaded", "photos", "along", "with", "the", "total", "count", "of", "photos", "uploaded", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java#L103-L142
160,010
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java
ContactsInterface.getPublicList
public Collection<Contact> getPublicList(String userId) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_LIST); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
java
public Collection<Contact> getPublicList(String userId) throws FlickrException { List<Contact> contacts = new ArrayList<Contact>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_LIST); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element contactsElement = response.getPayload(); NodeList contactNodes = contactsElement.getElementsByTagName("contact"); for (int i = 0; i < contactNodes.getLength(); i++) { Element contactElement = (Element) contactNodes.item(i); Contact contact = new Contact(); contact.setId(contactElement.getAttribute("nsid")); contact.setUsername(contactElement.getAttribute("username")); contact.setIgnored("1".equals(contactElement.getAttribute("ignored"))); contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute("online"))); contact.setIconFarm(contactElement.getAttribute("iconfarm")); contact.setIconServer(contactElement.getAttribute("iconserver")); if (contact.getOnline() == OnlineStatus.AWAY) { contactElement.normalize(); contact.setAwayMessage(XMLUtilities.getValue(contactElement)); } contacts.add(contact); } return contacts; }
[ "public", "Collection", "<", "Contact", ">", "getPublicList", "(", "String", "userId", ")", "throws", "FlickrException", "{", "List", "<", "Contact", ">", "contacts", "=", "new", "ArrayList", "<", "Contact", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PUBLIC_LIST", ")", ";", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "contactsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "contactNodes", "=", "contactsElement", ".", "getElementsByTagName", "(", "\"contact\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contactNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "contactElement", "=", "(", "Element", ")", "contactNodes", ".", "item", "(", "i", ")", ";", "Contact", "contact", "=", "new", "Contact", "(", ")", ";", "contact", ".", "setId", "(", "contactElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "contact", ".", "setUsername", "(", "contactElement", ".", "getAttribute", "(", "\"username\"", ")", ")", ";", "contact", ".", "setIgnored", "(", "\"1\"", ".", "equals", "(", "contactElement", ".", "getAttribute", "(", "\"ignored\"", ")", ")", ")", ";", "contact", ".", "setOnline", "(", "OnlineStatus", ".", "fromType", "(", "contactElement", ".", "getAttribute", "(", "\"online\"", ")", ")", ")", ";", "contact", ".", "setIconFarm", "(", "contactElement", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ";", "contact", ".", "setIconServer", "(", "contactElement", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ";", "if", "(", "contact", ".", "getOnline", "(", ")", "==", "OnlineStatus", ".", "AWAY", ")", "{", "contactElement", ".", "normalize", "(", ")", ";", "contact", ".", "setAwayMessage", "(", "XMLUtilities", ".", "getValue", "(", "contactElement", ")", ")", ";", "}", "contacts", ".", "add", "(", "contact", ")", ";", "}", "return", "contacts", ";", "}" ]
Get the collection of public contacts for the specified user ID. This method does not require authentication. @param userId The user ID @return The Collection of Contact objects @throws FlickrException
[ "Get", "the", "collection", "of", "public", "contacts", "for", "the", "specified", "user", "ID", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/contacts/ContactsInterface.java#L154-L184
160,011
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/reflection/ReflectionInterface.java
ReflectionInterface.getMethods
public Collection<String> getMethods() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_METHODS); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element methodsElement = response.getPayload(); List<String> methods = new ArrayList<String>(); NodeList methodElements = methodsElement.getElementsByTagName("method"); for (int i = 0; i < methodElements.getLength(); i++) { Element methodElement = (Element) methodElements.item(i); methods.add(XMLUtilities.getValue(methodElement)); } return methods; }
java
public Collection<String> getMethods() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_METHODS); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element methodsElement = response.getPayload(); List<String> methods = new ArrayList<String>(); NodeList methodElements = methodsElement.getElementsByTagName("method"); for (int i = 0; i < methodElements.getLength(); i++) { Element methodElement = (Element) methodElements.item(i); methods.add(XMLUtilities.getValue(methodElement)); } return methods; }
[ "public", "Collection", "<", "String", ">", "getMethods", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_METHODS", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "methodsElement", "=", "response", ".", "getPayload", "(", ")", ";", "List", "<", "String", ">", "methods", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "NodeList", "methodElements", "=", "methodsElement", ".", "getElementsByTagName", "(", "\"method\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methodElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "methodElement", "=", "(", "Element", ")", "methodElements", ".", "item", "(", "i", ")", ";", "methods", ".", "add", "(", "XMLUtilities", ".", "getValue", "(", "methodElement", ")", ")", ";", "}", "return", "methods", ";", "}" ]
Get a list of all methods. @return The method names @throws FlickrException
[ "Get", "a", "list", "of", "all", "methods", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/reflection/ReflectionInterface.java#L182-L200
160,012
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java
PoolsInterface.getContext
public PhotoContext getContext(String photoId, String groupId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); parameters.put("group_id", groupId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Collection<Element> payload = response.getPayloadCollection(); PhotoContext photoContext = new PhotoContext(); for (Element element : payload) { String elementName = element.getTagName(); if (elementName.equals("prevphoto")) { Photo photo = new Photo(); photo.setId(element.getAttribute("id")); photoContext.setPreviousPhoto(photo); } else if (elementName.equals("nextphoto")) { Photo photo = new Photo(); photo.setId(element.getAttribute("id")); photoContext.setNextPhoto(photo); } else if (!elementName.equals("count")) { _log.warn("unsupported element name: " + elementName); } } return photoContext; }
java
public PhotoContext getContext(String photoId, String groupId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); parameters.put("group_id", groupId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Collection<Element> payload = response.getPayloadCollection(); PhotoContext photoContext = new PhotoContext(); for (Element element : payload) { String elementName = element.getTagName(); if (elementName.equals("prevphoto")) { Photo photo = new Photo(); photo.setId(element.getAttribute("id")); photoContext.setPreviousPhoto(photo); } else if (elementName.equals("nextphoto")) { Photo photo = new Photo(); photo.setId(element.getAttribute("id")); photoContext.setNextPhoto(photo); } else if (!elementName.equals("count")) { _log.warn("unsupported element name: " + elementName); } } return photoContext; }
[ "public", "PhotoContext", "getContext", "(", "String", "photoId", ",", "String", "groupId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_CONTEXT", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Collection", "<", "Element", ">", "payload", "=", "response", ".", "getPayloadCollection", "(", ")", ";", "PhotoContext", "photoContext", "=", "new", "PhotoContext", "(", ")", ";", "for", "(", "Element", "element", ":", "payload", ")", "{", "String", "elementName", "=", "element", ".", "getTagName", "(", ")", ";", "if", "(", "elementName", ".", "equals", "(", "\"prevphoto\"", ")", ")", "{", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "element", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "photoContext", ".", "setPreviousPhoto", "(", "photo", ")", ";", "}", "else", "if", "(", "elementName", ".", "equals", "(", "\"nextphoto\"", ")", ")", "{", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "element", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "photoContext", ".", "setNextPhoto", "(", "photo", ")", ";", "}", "else", "if", "(", "!", "elementName", ".", "equals", "(", "\"count\"", ")", ")", "{", "_log", ".", "warn", "(", "\"unsupported element name: \"", "+", "elementName", ")", ";", "}", "}", "return", "photoContext", ";", "}" ]
Get the context for a photo in the group pool. This method does not require authentication. @param photoId The photo ID @param groupId The group ID @return The PhotoContext @throws FlickrException
[ "Get", "the", "context", "for", "a", "photo", "in", "the", "group", "pool", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java#L89-L117
160,013
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java
PoolsInterface.getGroups
public Collection<Group> getGroups() throws FlickrException { GroupList<Group> groups = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GROUPS); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); groups.setPage(groupsElement.getAttribute("page")); groups.setPages(groupsElement.getAttribute("pages")); groups.setPerPage(groupsElement.getAttribute("perpage")); groups.setTotal(groupsElement.getAttribute("total")); NodeList groupNodes = groupsElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("id")); group.setName(groupElement.getAttribute("name")); group.setAdmin("1".equals(groupElement.getAttribute("admin"))); group.setPrivacy(groupElement.getAttribute("privacy")); group.setIconServer(groupElement.getAttribute("iconserver")); group.setIconFarm(groupElement.getAttribute("iconfarm")); group.setPhotoCount(groupElement.getAttribute("photos")); groups.add(group); } return groups; }
java
public Collection<Group> getGroups() throws FlickrException { GroupList<Group> groups = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GROUPS); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); groups.setPage(groupsElement.getAttribute("page")); groups.setPages(groupsElement.getAttribute("pages")); groups.setPerPage(groupsElement.getAttribute("perpage")); groups.setTotal(groupsElement.getAttribute("total")); NodeList groupNodes = groupsElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("id")); group.setName(groupElement.getAttribute("name")); group.setAdmin("1".equals(groupElement.getAttribute("admin"))); group.setPrivacy(groupElement.getAttribute("privacy")); group.setIconServer(groupElement.getAttribute("iconserver")); group.setIconFarm(groupElement.getAttribute("iconfarm")); group.setPhotoCount(groupElement.getAttribute("photos")); groups.add(group); } return groups; }
[ "public", "Collection", "<", "Group", ">", "getGroups", "(", ")", "throws", "FlickrException", "{", "GroupList", "<", "Group", ">", "groups", "=", "new", "GroupList", "<", "Group", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_GROUPS", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "groupsElement", "=", "response", ".", "getPayload", "(", ")", ";", "groups", ".", "setPage", "(", "groupsElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "groups", ".", "setPages", "(", "groupsElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "groups", ".", "setPerPage", "(", "groupsElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "groups", ".", "setTotal", "(", "groupsElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "groupNodes", "=", "groupsElement", ".", "getElementsByTagName", "(", "\"group\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "groupElement", "=", "(", "Element", ")", "groupNodes", ".", "item", "(", "i", ")", ";", "Group", "group", "=", "new", "Group", "(", ")", ";", "group", ".", "setId", "(", "groupElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "group", ".", "setName", "(", "groupElement", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "group", ".", "setAdmin", "(", "\"1\"", ".", "equals", "(", "groupElement", ".", "getAttribute", "(", "\"admin\"", ")", ")", ")", ";", "group", ".", "setPrivacy", "(", "groupElement", ".", "getAttribute", "(", "\"privacy\"", ")", ")", ";", "group", ".", "setIconServer", "(", "groupElement", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ";", "group", ".", "setIconFarm", "(", "groupElement", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ";", "group", ".", "setPhotoCount", "(", "groupElement", ".", "getAttribute", "(", "\"photos\"", ")", ")", ";", "groups", ".", "add", "(", "group", ")", ";", "}", "return", "groups", ";", "}" ]
Get a collection of all of the user's groups. @return A Collection of Group objects @throws FlickrException
[ "Get", "a", "collection", "of", "all", "of", "the", "user", "s", "groups", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java#L125-L154
160,014
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java
PoolsInterface.getPhotos
public PhotoList<Photo> getPhotos(String groupId, String userId, String[] tags, Set<String> extras, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PHOTOS); parameters.put("group_id", groupId); if (userId != null) { parameters.put("user_id", userId); } if (tags != null) { parameters.put("tags", StringUtilities.join(tags, " ")); } if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } if (extras != null) { StringBuffer sb = new StringBuffer(); Iterator<String> it = extras.iterator(); for (int i = 0; it.hasNext(); i++) { if (i > 0) { sb.append(","); } sb.append(it.next()); } parameters.put(Extras.KEY_EXTRAS, sb.toString()); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> getPhotos(String groupId, String userId, String[] tags, Set<String> extras, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PHOTOS); parameters.put("group_id", groupId); if (userId != null) { parameters.put("user_id", userId); } if (tags != null) { parameters.put("tags", StringUtilities.join(tags, " ")); } if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } if (extras != null) { StringBuffer sb = new StringBuffer(); Iterator<String> it = extras.iterator(); for (int i = 0; it.hasNext(); i++) { if (i > 0) { sb.append(","); } sb.append(it.next()); } parameters.put(Extras.KEY_EXTRAS, sb.toString()); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getPhotos", "(", "String", "groupId", ",", "String", "userId", ",", "String", "[", "]", "tags", ",", "Set", "<", "String", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PHOTOS", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "userId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "}", "if", "(", "tags", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"tags\"", ",", "StringUtilities", ".", "join", "(", "tags", ",", "\" \"", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "String", ".", "valueOf", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "String", ".", "valueOf", "(", "page", ")", ")", ";", "}", "if", "(", "extras", "!=", "null", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "<", "String", ">", "it", "=", "extras", ".", "iterator", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "it", ".", "hasNext", "(", ")", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "sb", ".", "append", "(", "it", ".", "next", "(", ")", ")", ";", "}", "parameters", ".", "put", "(", "Extras", ".", "KEY_EXTRAS", ",", "sb", ".", "toString", "(", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Get the photos for the specified group pool, optionally filtering by taf. This method does not require authentication. @see com.flickr4java.flickr.photos.Extras @param groupId The group ID @param userId The user ID (may be null) @param tags The optional tags (may be null) @param extras Set of extra-attributes to include (may be null) @param perPage The number of photos per page (0 to ignore) @param page The page offset (0 to ignore) @return A Collection of Photo objects @throws FlickrException
[ "Get", "the", "photos", "for", "the", "specified", "group", "pool", "optionally", "filtering", "by", "taf", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/pools/PoolsInterface.java#L177-L226
160,015
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java
PrefsInterface.getGeoPerms
public int getGeoPerms() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GEO_PERMS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } int perm = -1; Element personElement = response.getPayload(); String geoPerms = personElement.getAttribute("geoperms"); try { perm = Integer.parseInt(geoPerms); } catch (NumberFormatException e) { throw new FlickrException("0", "Unable to parse geoPermission"); } return perm; }
java
public int getGeoPerms() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_GEO_PERMS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } int perm = -1; Element personElement = response.getPayload(); String geoPerms = personElement.getAttribute("geoperms"); try { perm = Integer.parseInt(geoPerms); } catch (NumberFormatException e) { throw new FlickrException("0", "Unable to parse geoPermission"); } return perm; }
[ "public", "int", "getGeoPerms", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_GEO_PERMS", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "int", "perm", "=", "-", "1", ";", "Element", "personElement", "=", "response", ".", "getPayload", "(", ")", ";", "String", "geoPerms", "=", "personElement", ".", "getAttribute", "(", "\"geoperms\"", ")", ";", "try", "{", "perm", "=", "Integer", ".", "parseInt", "(", "geoPerms", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "FlickrException", "(", "\"0\"", ",", "\"Unable to parse geoPermission\"", ")", ";", "}", "return", "perm", ";", "}" ]
Returns the default privacy level for geographic information attached to the user's photos. @return privacy-level @throws FlickrException @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PRIVATE
[ "Returns", "the", "default", "privacy", "level", "for", "geographic", "information", "attached", "to", "the", "user", "s", "photos", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java#L86-L104
160,016
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java
PrefsInterface.getHidden
public boolean getHidden() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_HIDDEN); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return personElement.getAttribute("hidden").equals("1") ? true : false; }
java
public boolean getHidden() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_HIDDEN); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return personElement.getAttribute("hidden").equals("1") ? true : false; }
[ "public", "boolean", "getHidden", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_HIDDEN", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "personElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "personElement", ".", "getAttribute", "(", "\"hidden\"", ")", ".", "equals", "(", "\"1\"", ")", "?", "true", ":", "false", ";", "}" ]
Returns the default hidden preference for the user. @return boolean hidden or not @throws FlickrException
[ "Returns", "the", "default", "hidden", "preference", "for", "the", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java#L112-L123
160,017
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java
PrefsInterface.getSafetyLevel
public String getSafetyLevel() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SAFETY_LEVEL); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return personElement.getAttribute("safety_level"); }
java
public String getSafetyLevel() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SAFETY_LEVEL); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return personElement.getAttribute("safety_level"); }
[ "public", "String", "getSafetyLevel", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_SAFETY_LEVEL", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "personElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "personElement", ".", "getAttribute", "(", "\"safety_level\"", ")", ";", "}" ]
Returns the default safety level preference for the user. @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_MODERATE @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_RESTRICTED @see com.flickr4java.flickr.Flickr#SAFETYLEVEL_SAFE @return The current users safety-level @throws FlickrException
[ "Returns", "the", "default", "safety", "level", "preference", "for", "the", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java#L134-L145
160,018
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java
PrefsInterface.getPrivacy
public int getPrivacy() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PRIVACY); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return Integer.parseInt(personElement.getAttribute("privacy")); }
java
public int getPrivacy() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PRIVACY); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element personElement = response.getPayload(); return Integer.parseInt(personElement.getAttribute("privacy")); }
[ "public", "int", "getPrivacy", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PRIVACY", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "personElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "Integer", ".", "parseInt", "(", "personElement", ".", "getAttribute", "(", "\"privacy\"", ")", ")", ";", "}" ]
Returns the default privacy level preference for the user. @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY @see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS @throws FlickrException @return privacyLevel
[ "Returns", "the", "default", "privacy", "level", "preference", "for", "the", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/prefs/PrefsInterface.java#L159-L170
160,019
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java
GroupsInterface.browse
@Deprecated public Category browse(String catId) throws FlickrException { List<Subcategory> subcategories = new ArrayList<Subcategory>(); List<Group> groups = new ArrayList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_BROWSE); if (catId != null) { parameters.put("cat_id", catId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element categoryElement = response.getPayload(); Category category = new Category(); category.setName(categoryElement.getAttribute("name")); category.setPath(categoryElement.getAttribute("path")); category.setPathIds(categoryElement.getAttribute("pathids")); NodeList subcatNodes = categoryElement.getElementsByTagName("subcat"); for (int i = 0; i < subcatNodes.getLength(); i++) { Element node = (Element) subcatNodes.item(i); Subcategory subcategory = new Subcategory(); subcategory.setId(Integer.parseInt(node.getAttribute("id"))); subcategory.setName(node.getAttribute("name")); subcategory.setCount(Integer.parseInt(node.getAttribute("count"))); subcategories.add(subcategory); } NodeList groupNodes = categoryElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element node = (Element) groupNodes.item(i); Group group = new Group(); group.setId(node.getAttribute("nsid")); group.setName(node.getAttribute("name")); group.setMembers(node.getAttribute("members")); groups.add(group); } category.setGroups(groups); category.setSubcategories(subcategories); return category; }
java
@Deprecated public Category browse(String catId) throws FlickrException { List<Subcategory> subcategories = new ArrayList<Subcategory>(); List<Group> groups = new ArrayList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_BROWSE); if (catId != null) { parameters.put("cat_id", catId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element categoryElement = response.getPayload(); Category category = new Category(); category.setName(categoryElement.getAttribute("name")); category.setPath(categoryElement.getAttribute("path")); category.setPathIds(categoryElement.getAttribute("pathids")); NodeList subcatNodes = categoryElement.getElementsByTagName("subcat"); for (int i = 0; i < subcatNodes.getLength(); i++) { Element node = (Element) subcatNodes.item(i); Subcategory subcategory = new Subcategory(); subcategory.setId(Integer.parseInt(node.getAttribute("id"))); subcategory.setName(node.getAttribute("name")); subcategory.setCount(Integer.parseInt(node.getAttribute("count"))); subcategories.add(subcategory); } NodeList groupNodes = categoryElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element node = (Element) groupNodes.item(i); Group group = new Group(); group.setId(node.getAttribute("nsid")); group.setName(node.getAttribute("name")); group.setMembers(node.getAttribute("members")); groups.add(group); } category.setGroups(groups); category.setSubcategories(subcategories); return category; }
[ "@", "Deprecated", "public", "Category", "browse", "(", "String", "catId", ")", "throws", "FlickrException", "{", "List", "<", "Subcategory", ">", "subcategories", "=", "new", "ArrayList", "<", "Subcategory", ">", "(", ")", ";", "List", "<", "Group", ">", "groups", "=", "new", "ArrayList", "<", "Group", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_BROWSE", ")", ";", "if", "(", "catId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"cat_id\"", ",", "catId", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "categoryElement", "=", "response", ".", "getPayload", "(", ")", ";", "Category", "category", "=", "new", "Category", "(", ")", ";", "category", ".", "setName", "(", "categoryElement", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "category", ".", "setPath", "(", "categoryElement", ".", "getAttribute", "(", "\"path\"", ")", ")", ";", "category", ".", "setPathIds", "(", "categoryElement", ".", "getAttribute", "(", "\"pathids\"", ")", ")", ";", "NodeList", "subcatNodes", "=", "categoryElement", ".", "getElementsByTagName", "(", "\"subcat\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subcatNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "node", "=", "(", "Element", ")", "subcatNodes", ".", "item", "(", "i", ")", ";", "Subcategory", "subcategory", "=", "new", "Subcategory", "(", ")", ";", "subcategory", ".", "setId", "(", "Integer", ".", "parseInt", "(", "node", ".", "getAttribute", "(", "\"id\"", ")", ")", ")", ";", "subcategory", ".", "setName", "(", "node", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "subcategory", ".", "setCount", "(", "Integer", ".", "parseInt", "(", "node", ".", "getAttribute", "(", "\"count\"", ")", ")", ")", ";", "subcategories", ".", "add", "(", "subcategory", ")", ";", "}", "NodeList", "groupNodes", "=", "categoryElement", ".", "getElementsByTagName", "(", "\"group\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "node", "=", "(", "Element", ")", "groupNodes", ".", "item", "(", "i", ")", ";", "Group", "group", "=", "new", "Group", "(", ")", ";", "group", ".", "setId", "(", "node", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "group", ".", "setName", "(", "node", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "group", ".", "setMembers", "(", "node", ".", "getAttribute", "(", "\"members\"", ")", ")", ";", "groups", ".", "add", "(", "group", ")", ";", "}", "category", ".", "setGroups", "(", "groups", ")", ";", "category", ".", "setSubcategories", "(", "subcategories", ")", ";", "return", "category", ";", "}" ]
Browse groups for the given category ID. If a null value is passed for the category then the root category is used. @param catId The optional category id. Null value will be ignored. @return The Collection of Photo objects @throws FlickrException @deprecated Flickr returns just empty results
[ "Browse", "groups", "for", "the", "given", "category", "ID", ".", "If", "a", "null", "value", "is", "passed", "for", "the", "category", "then", "the", "root", "category", "is", "used", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L64-L113
160,020
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java
GroupsInterface.search
public Collection<Group> search(String text, int perPage, int page) throws FlickrException { GroupList<Group> groupList = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SEARCH); parameters.put("text", text); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); NodeList groupNodes = groupsElement.getElementsByTagName("group"); groupList.setPage(XMLUtilities.getIntAttribute(groupsElement, "page")); groupList.setPages(XMLUtilities.getIntAttribute(groupsElement, "pages")); groupList.setPerPage(XMLUtilities.getIntAttribute(groupsElement, "perpage")); groupList.setTotal(XMLUtilities.getIntAttribute(groupsElement, "total")); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("nsid")); group.setName(groupElement.getAttribute("name")); groupList.add(group); } return groupList; }
java
public Collection<Group> search(String text, int perPage, int page) throws FlickrException { GroupList<Group> groupList = new GroupList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SEARCH); parameters.put("text", text); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); NodeList groupNodes = groupsElement.getElementsByTagName("group"); groupList.setPage(XMLUtilities.getIntAttribute(groupsElement, "page")); groupList.setPages(XMLUtilities.getIntAttribute(groupsElement, "pages")); groupList.setPerPage(XMLUtilities.getIntAttribute(groupsElement, "perpage")); groupList.setTotal(XMLUtilities.getIntAttribute(groupsElement, "total")); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("nsid")); group.setName(groupElement.getAttribute("name")); groupList.add(group); } return groupList; }
[ "public", "Collection", "<", "Group", ">", "search", "(", "String", "text", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "GroupList", "<", "Group", ">", "groupList", "=", "new", "GroupList", "<", "Group", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SEARCH", ")", ";", "parameters", ".", "put", "(", "\"text\"", ",", "text", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "String", ".", "valueOf", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "String", ".", "valueOf", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "groupsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "groupNodes", "=", "groupsElement", ".", "getElementsByTagName", "(", "\"group\"", ")", ";", "groupList", ".", "setPage", "(", "XMLUtilities", ".", "getIntAttribute", "(", "groupsElement", ",", "\"page\"", ")", ")", ";", "groupList", ".", "setPages", "(", "XMLUtilities", ".", "getIntAttribute", "(", "groupsElement", ",", "\"pages\"", ")", ")", ";", "groupList", ".", "setPerPage", "(", "XMLUtilities", ".", "getIntAttribute", "(", "groupsElement", ",", "\"perpage\"", ")", ")", ";", "groupList", ".", "setTotal", "(", "XMLUtilities", ".", "getIntAttribute", "(", "groupsElement", ",", "\"total\"", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "groupElement", "=", "(", "Element", ")", "groupNodes", ".", "item", "(", "i", ")", ";", "Group", "group", "=", "new", "Group", "(", ")", ";", "group", ".", "setId", "(", "groupElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "group", ".", "setName", "(", "groupElement", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "groupList", ".", "add", "(", "group", ")", ";", "}", "return", "groupList", ";", "}" ]
Search for groups. 18+ groups will only be returned for authenticated calls where the authenticated user is over 18. This method does not require authentication. @param text The text to search for. @param perPage Number of groups to return per page. If this argument is 0, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is 0, it defaults to 1. @return A GroupList Object. Only the fields <em>id</em>, <em>name</em> and <em>eighteenplus</em> in the Groups will be set. @throws FlickrException
[ "Search", "for", "groups", ".", "18", "+", "groups", "will", "only", "be", "returned", "for", "authenticated", "calls", "where", "the", "authenticated", "user", "is", "over", "18", ".", "This", "method", "does", "not", "require", "authentication", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L214-L246
160,021
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java
GroupsInterface.join
public void join(String groupId, Boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN); parameters.put("group_id", groupId); if (acceptRules != null) { parameters.put("accept_rules", acceptRules); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void join(String groupId, Boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN); parameters.put("group_id", groupId); if (acceptRules != null) { parameters.put("accept_rules", acceptRules); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "join", "(", "String", "groupId", ",", "Boolean", "acceptRules", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_JOIN", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "acceptRules", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"accept_rules\"", ",", "acceptRules", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Join a group as a public member. Note: if a group has rules - the client must display the rules to the user and the user must accept them prior to joining the group. The acceptRules parameter indicates that the user has accepted those rules. @param groupId - the id of the group to join @param acceptRules - if a group has rules, true indicates the user has accepted the rules @see <a href="http://www.flickr.com/services/api/flickr.groups.join.html">flickr.groups.join</a>
[ "Join", "a", "group", "as", "a", "public", "member", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L261-L274
160,022
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java
GroupsInterface.joinRequest
public void joinRequest(String groupId, String message, boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN_REQUEST); parameters.put("group_id", groupId); parameters.put("message", message); parameters.put("accept_rules", acceptRules); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void joinRequest(String groupId, String message, boolean acceptRules) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_JOIN_REQUEST); parameters.put("group_id", groupId); parameters.put("message", message); parameters.put("accept_rules", acceptRules); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "joinRequest", "(", "String", "groupId", ",", "String", "message", ",", "boolean", "acceptRules", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_JOIN_REQUEST", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "parameters", ".", "put", "(", "\"message\"", ",", "message", ")", ";", "parameters", ".", "put", "(", "\"accept_rules\"", ",", "acceptRules", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Request to join a group. Note: if a group has rules, the client must display the rules to the user and the user must accept them (which is indicated by passing a true value to acceptRules) prior to making the join request. @param groupId - groupId parameter @param message - (required) message to group administrator @param acceptRules - (required) parameter indicating user has accepted groups rules
[ "Request", "to", "join", "a", "group", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L289-L300
160,023
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java
GroupsInterface.leave
public void leave(String groupId, Boolean deletePhotos) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LEAVE); parameters.put("group_id", groupId); parameters.put("delete_photos", deletePhotos); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void leave(String groupId, Boolean deletePhotos) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_LEAVE); parameters.put("group_id", groupId); parameters.put("delete_photos", deletePhotos); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "leave", "(", "String", "groupId", ",", "Boolean", "deletePhotos", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_LEAVE", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "parameters", ".", "put", "(", "\"delete_photos\"", ",", "deletePhotos", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Leave a group. @see <a href="http://www.flickr.com/services/api/flickr.groups.leave.html">lickr.groups.leave</a> for a description of the various behaviors possible when a user leaves a group. @param groupId - the id of the group to leave @param deletePhotos - delete photos by this user from group
[ "Leave", "a", "group", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/GroupsInterface.java#L313-L323
160,024
boncey/Flickr4Java
src/examples/java/UploadPhoto.java
UploadPhoto.setNsid
private void setNsid() throws FlickrException { if (username != null && !username.equals("")) { Auth auth = null; if (authStore != null) { auth = authStore.retrieve(username); // assuming FileAuthStore is enhanced else need to // keep in user-level files. if (auth != null) { nsid = auth.getUser().getId(); } } if (auth != null) return; Auth[] allAuths = authStore.retrieveAll(); for (int i = 0; i < allAuths.length; i++) { if (username.equals(allAuths[i].getUser().getUsername())) { nsid = allAuths[i].getUser().getId(); return; } } // For this to work: REST.java or PeopleInterface needs to change to pass apiKey // as the parameter to the call which is not authenticated. // Get nsid using flickr.people.findByUsername PeopleInterface peopleInterf = flickr.getPeopleInterface(); User u = peopleInterf.findByUsername(username); if (u != null) { nsid = u.getId(); } } }
java
private void setNsid() throws FlickrException { if (username != null && !username.equals("")) { Auth auth = null; if (authStore != null) { auth = authStore.retrieve(username); // assuming FileAuthStore is enhanced else need to // keep in user-level files. if (auth != null) { nsid = auth.getUser().getId(); } } if (auth != null) return; Auth[] allAuths = authStore.retrieveAll(); for (int i = 0; i < allAuths.length; i++) { if (username.equals(allAuths[i].getUser().getUsername())) { nsid = allAuths[i].getUser().getId(); return; } } // For this to work: REST.java or PeopleInterface needs to change to pass apiKey // as the parameter to the call which is not authenticated. // Get nsid using flickr.people.findByUsername PeopleInterface peopleInterf = flickr.getPeopleInterface(); User u = peopleInterf.findByUsername(username); if (u != null) { nsid = u.getId(); } } }
[ "private", "void", "setNsid", "(", ")", "throws", "FlickrException", "{", "if", "(", "username", "!=", "null", "&&", "!", "username", ".", "equals", "(", "\"\"", ")", ")", "{", "Auth", "auth", "=", "null", ";", "if", "(", "authStore", "!=", "null", ")", "{", "auth", "=", "authStore", ".", "retrieve", "(", "username", ")", ";", "// assuming FileAuthStore is enhanced else need to", "// keep in user-level files.", "if", "(", "auth", "!=", "null", ")", "{", "nsid", "=", "auth", ".", "getUser", "(", ")", ".", "getId", "(", ")", ";", "}", "}", "if", "(", "auth", "!=", "null", ")", "return", ";", "Auth", "[", "]", "allAuths", "=", "authStore", ".", "retrieveAll", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allAuths", ".", "length", ";", "i", "++", ")", "{", "if", "(", "username", ".", "equals", "(", "allAuths", "[", "i", "]", ".", "getUser", "(", ")", ".", "getUsername", "(", ")", ")", ")", "{", "nsid", "=", "allAuths", "[", "i", "]", ".", "getUser", "(", ")", ".", "getId", "(", ")", ";", "return", ";", "}", "}", "// For this to work: REST.java or PeopleInterface needs to change to pass apiKey", "// as the parameter to the call which is not authenticated.", "// Get nsid using flickr.people.findByUsername", "PeopleInterface", "peopleInterf", "=", "flickr", ".", "getPeopleInterface", "(", ")", ";", "User", "u", "=", "peopleInterf", ".", "findByUsername", "(", "username", ")", ";", "if", "(", "u", "!=", "null", ")", "{", "nsid", "=", "u", ".", "getId", "(", ")", ";", "}", "}", "}" ]
Check local saved copy first ??. If Auth by username is available, then we will not need to make the API call. @throws FlickrException
[ "Check", "local", "saved", "copy", "first", "??", ".", "If", "Auth", "by", "username", "is", "available", "then", "we", "will", "not", "need", "to", "make", "the", "API", "call", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/examples/java/UploadPhoto.java#L130-L163
160,025
boncey/Flickr4Java
src/examples/java/UploadPhoto.java
UploadPhoto.constructAuth
private Auth constructAuth(String authToken, String tokenSecret, String username) throws IOException { Auth auth = new Auth(); auth.setToken(authToken); auth.setTokenSecret(tokenSecret); // Prompt to ask what permission is needed: read, update or delete. auth.setPermission(Permission.fromString("delete")); User user = new User(); // Later change the following 3. Either ask user to pass on command line or read // from saved file. user.setId(nsid); user.setUsername((username)); user.setRealName(""); auth.setUser(user); this.authStore.store(auth); return auth; }
java
private Auth constructAuth(String authToken, String tokenSecret, String username) throws IOException { Auth auth = new Auth(); auth.setToken(authToken); auth.setTokenSecret(tokenSecret); // Prompt to ask what permission is needed: read, update or delete. auth.setPermission(Permission.fromString("delete")); User user = new User(); // Later change the following 3. Either ask user to pass on command line or read // from saved file. user.setId(nsid); user.setUsername((username)); user.setRealName(""); auth.setUser(user); this.authStore.store(auth); return auth; }
[ "private", "Auth", "constructAuth", "(", "String", "authToken", ",", "String", "tokenSecret", ",", "String", "username", ")", "throws", "IOException", "{", "Auth", "auth", "=", "new", "Auth", "(", ")", ";", "auth", ".", "setToken", "(", "authToken", ")", ";", "auth", ".", "setTokenSecret", "(", "tokenSecret", ")", ";", "// Prompt to ask what permission is needed: read, update or delete.", "auth", ".", "setPermission", "(", "Permission", ".", "fromString", "(", "\"delete\"", ")", ")", ";", "User", "user", "=", "new", "User", "(", ")", ";", "// Later change the following 3. Either ask user to pass on command line or read", "// from saved file.", "user", ".", "setId", "(", "nsid", ")", ";", "user", ".", "setUsername", "(", "(", "username", ")", ")", ";", "user", ".", "setRealName", "(", "\"\"", ")", ";", "auth", ".", "setUser", "(", "user", ")", ";", "this", ".", "authStore", ".", "store", "(", "auth", ")", ";", "return", "auth", ";", "}" ]
If the Authtoken was already created in a separate program but not saved to file. @param authToken @param tokenSecret @param username @return @throws IOException
[ "If", "the", "Authtoken", "was", "already", "created", "in", "a", "separate", "program", "but", "not", "saved", "to", "file", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/examples/java/UploadPhoto.java#L199-L217
160,026
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.find
public PlacesList<Place> find(String query) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> placesList = new PlacesList<Place>(); parameters.put("method", METHOD_FIND); parameters.put("query", query); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element placesElement = response.getPayload(); NodeList placesNodes = placesElement.getElementsByTagName("place"); placesList.setPage("1"); placesList.setPages("1"); placesList.setPerPage("" + placesNodes.getLength()); placesList.setTotal("" + placesNodes.getLength()); for (int i = 0; i < placesNodes.getLength(); i++) { Element placeElement = (Element) placesNodes.item(i); placesList.add(parsePlace(placeElement)); } return placesList; }
java
public PlacesList<Place> find(String query) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> placesList = new PlacesList<Place>(); parameters.put("method", METHOD_FIND); parameters.put("query", query); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element placesElement = response.getPayload(); NodeList placesNodes = placesElement.getElementsByTagName("place"); placesList.setPage("1"); placesList.setPages("1"); placesList.setPerPage("" + placesNodes.getLength()); placesList.setTotal("" + placesNodes.getLength()); for (int i = 0; i < placesNodes.getLength(); i++) { Element placeElement = (Element) placesNodes.item(i); placesList.add(parsePlace(placeElement)); } return placesList; }
[ "public", "PlacesList", "<", "Place", ">", "find", "(", "String", "query", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "PlacesList", "<", "Place", ">", "placesList", "=", "new", "PlacesList", "<", "Place", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_FIND", ")", ";", "parameters", ".", "put", "(", "\"query\"", ",", "query", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "placesElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "placesNodes", "=", "placesElement", ".", "getElementsByTagName", "(", "\"place\"", ")", ";", "placesList", ".", "setPage", "(", "\"1\"", ")", ";", "placesList", ".", "setPages", "(", "\"1\"", ")", ";", "placesList", ".", "setPerPage", "(", "\"\"", "+", "placesNodes", ".", "getLength", "(", ")", ")", ";", "placesList", ".", "setTotal", "(", "\"\"", "+", "placesNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "placesNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "placeElement", "=", "(", "Element", ")", "placesNodes", ".", "item", "(", "i", ")", ";", "placesList", ".", "add", "(", "parsePlace", "(", "placeElement", ")", ")", ";", "}", "return", "placesList", ";", "}" ]
Return a list of place IDs for a query string. The flickr.places.find method is not a geocoder. It will round "up" to the nearest place type to which place IDs apply. For example, if you pass it a street level address it will return the city that contains the address rather than the street, or building, itself. <p> This method does not require authentication. </p> @param query @return PlacesList @throws FlickrException
[ "Return", "a", "list", "of", "place", "IDs", "for", "a", "query", "string", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L156-L178
160,027
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.getInfo
public Location getInfo(String placeId, String woeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
java
public Location getInfo(String placeId, String woeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
[ "public", "Location", "getInfo", "(", "String", "placeId", ",", "String", "woeId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INFO", ")", ";", "if", "(", "placeId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"place_id\"", ",", "placeId", ")", ";", "}", "if", "(", "woeId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"woe_id\"", ",", "woeId", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "locationElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "parseLocation", "(", "locationElement", ")", ";", "}" ]
Get informations about a place. <p> This method does not require authentication. </p> @param placeId A Flickr Places ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.) @param woeId A Where On Earth (WOE) ID. Optional, can be null. (While optional, you must pass either a valid Places ID or a WOE ID.) @return A Location @throws FlickrException
[ "Get", "informations", "about", "a", "place", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L319-L336
160,028
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.placesForUser
public PlacesList<Place> placesForUser(int placeType, String woeId, String placeId, String threshold, Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> placesList = new PlacesList<Place>(); parameters.put("method", METHOD_PLACES_FOR_USER); parameters.put("place_type", intPlaceTypeToString(placeType)); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } if (threshold != null) { parameters.put("threshold", threshold); } if (minUploadDate != null) { parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L)); } if (maxUploadDate != null) { parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L)); } if (minTakenDate != null) { parameters.put("min_taken_date", ((DateFormat) SearchParameters.MYSQL_DATE_FORMATS.get()).format(minTakenDate)); } if (maxTakenDate != null) { parameters.put("max_taken_date", ((DateFormat) SearchParameters.MYSQL_DATE_FORMATS.get()).format(maxTakenDate)); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element placesElement = response.getPayload(); NodeList placesNodes = placesElement.getElementsByTagName("place"); placesList.setPage("1"); placesList.setPages("1"); placesList.setPerPage("" + placesNodes.getLength()); placesList.setTotal("" + placesNodes.getLength()); for (int i = 0; i < placesNodes.getLength(); i++) { Element placeElement = (Element) placesNodes.item(i); placesList.add(parsePlace(placeElement)); } return placesList; }
java
public PlacesList<Place> placesForUser(int placeType, String woeId, String placeId, String threshold, Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PlacesList<Place> placesList = new PlacesList<Place>(); parameters.put("method", METHOD_PLACES_FOR_USER); parameters.put("place_type", intPlaceTypeToString(placeType)); if (placeId != null) { parameters.put("place_id", placeId); } if (woeId != null) { parameters.put("woe_id", woeId); } if (threshold != null) { parameters.put("threshold", threshold); } if (minUploadDate != null) { parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L)); } if (maxUploadDate != null) { parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L)); } if (minTakenDate != null) { parameters.put("min_taken_date", ((DateFormat) SearchParameters.MYSQL_DATE_FORMATS.get()).format(minTakenDate)); } if (maxTakenDate != null) { parameters.put("max_taken_date", ((DateFormat) SearchParameters.MYSQL_DATE_FORMATS.get()).format(maxTakenDate)); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element placesElement = response.getPayload(); NodeList placesNodes = placesElement.getElementsByTagName("place"); placesList.setPage("1"); placesList.setPages("1"); placesList.setPerPage("" + placesNodes.getLength()); placesList.setTotal("" + placesNodes.getLength()); for (int i = 0; i < placesNodes.getLength(); i++) { Element placeElement = (Element) placesNodes.item(i); placesList.add(parsePlace(placeElement)); } return placesList; }
[ "public", "PlacesList", "<", "Place", ">", "placesForUser", "(", "int", "placeType", ",", "String", "woeId", ",", "String", "placeId", ",", "String", "threshold", ",", "Date", "minUploadDate", ",", "Date", "maxUploadDate", ",", "Date", "minTakenDate", ",", "Date", "maxTakenDate", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "PlacesList", "<", "Place", ">", "placesList", "=", "new", "PlacesList", "<", "Place", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_PLACES_FOR_USER", ")", ";", "parameters", ".", "put", "(", "\"place_type\"", ",", "intPlaceTypeToString", "(", "placeType", ")", ")", ";", "if", "(", "placeId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"place_id\"", ",", "placeId", ")", ";", "}", "if", "(", "woeId", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"woe_id\"", ",", "woeId", ")", ";", "}", "if", "(", "threshold", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"threshold\"", ",", "threshold", ")", ";", "}", "if", "(", "minUploadDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"min_upload_date\"", ",", "Long", ".", "toString", "(", "minUploadDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "maxUploadDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"max_upload_date\"", ",", "Long", ".", "toString", "(", "maxUploadDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "minTakenDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"min_taken_date\"", ",", "(", "(", "DateFormat", ")", "SearchParameters", ".", "MYSQL_DATE_FORMATS", ".", "get", "(", ")", ")", ".", "format", "(", "minTakenDate", ")", ")", ";", "}", "if", "(", "maxTakenDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"max_taken_date\"", ",", "(", "(", "DateFormat", ")", "SearchParameters", ".", "MYSQL_DATE_FORMATS", ".", "get", "(", ")", ")", ".", "format", "(", "maxTakenDate", ")", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "placesElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "placesNodes", "=", "placesElement", ".", "getElementsByTagName", "(", "\"place\"", ")", ";", "placesList", ".", "setPage", "(", "\"1\"", ")", ";", "placesList", ".", "setPages", "(", "\"1\"", ")", ";", "placesList", ".", "setPerPage", "(", "\"\"", "+", "placesNodes", ".", "getLength", "(", ")", ")", ";", "placesList", ".", "setTotal", "(", "\"\"", "+", "placesNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "placesNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "placeElement", "=", "(", "Element", ")", "placesNodes", ".", "item", "(", "i", ")", ";", "placesList", ".", "add", "(", "parsePlace", "(", "placeElement", ")", ")", ";", "}", "return", "placesList", ";", "}" ]
Return a list of the top 100 unique places clustered by a given placetype for a user. @param placeType Use Type-constants at {@link Place} @param woeId A Where On Earth (WOE) ID. Optional, can be null. @param placeId A Flickr Places ID. Optional, can be null. @param threshold The minimum number of photos that a place type must have to be included. If the number of photos is lowered then the parent place type for that place will be used. Optional, can be null. @param minUploadDate Optional, can be null. @param maxUploadDate Optional, can be null. @param minTakenDate Optional, can be null. @param maxTakenDate Optional, can be null. @return A PlacesList @throws FlickrException
[ "Return", "a", "list", "of", "the", "top", "100", "unique", "places", "clustered", "by", "a", "given", "placetype", "for", "a", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L724-L768
160,029
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.resolvePlaceId
@Deprecated public Location resolvePlaceId(String placeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_ID); parameters.put("place_id", placeId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
java
@Deprecated public Location resolvePlaceId(String placeId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_ID); parameters.put("place_id", placeId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
[ "@", "Deprecated", "public", "Location", "resolvePlaceId", "(", "String", "placeId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_RESOLVE_PLACE_ID", ")", ";", "parameters", ".", "put", "(", "\"place_id\"", ",", "placeId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "locationElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "parseLocation", "(", "locationElement", ")", ";", "}" ]
Find Flickr Places information by Place ID. @deprecated This method has been deprecated. It won't be removed but you should use {@link #getInfo(String, String)} instead. @param placeId @return A Location @throws FlickrException
[ "Find", "Flickr", "Places", "information", "by", "Place", "ID", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L778-L791
160,030
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/places/PlacesInterface.java
PlacesInterface.resolvePlaceURL
@Deprecated public Location resolvePlaceURL(String flickrPlacesUrl) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_URL); parameters.put("url", flickrPlacesUrl); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
java
@Deprecated public Location resolvePlaceURL(String flickrPlacesUrl) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_RESOLVE_PLACE_URL); parameters.put("url", flickrPlacesUrl); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element locationElement = response.getPayload(); return parseLocation(locationElement); }
[ "@", "Deprecated", "public", "Location", "resolvePlaceURL", "(", "String", "flickrPlacesUrl", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_RESOLVE_PLACE_URL", ")", ";", "parameters", ".", "put", "(", "\"url\"", ",", "flickrPlacesUrl", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "locationElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "parseLocation", "(", "locationElement", ")", ";", "}" ]
Find Flickr Places information by Place URL. <p> This method does not require authentication. </p> @deprecated This method has been deprecated. It won't be removed but you should use {@link PlacesInterface#getInfoByUrl(String)} instead. @param flickrPlacesUrl @return A Location @throws FlickrException
[ "Find", "Flickr", "Places", "information", "by", "Place", "URL", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/places/PlacesInterface.java#L805-L818
160,031
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java
GroupDiscussInterface.getTopicsList
public TopicList<Topic> getTopicsList(String groupId, int perPage, int page) throws FlickrException { TopicList<Topic> topicList = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_LIST); parameters.put("group_id", groupId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element topicElements = response.getPayload(); topicList.setPage(topicElements.getAttribute("page")); topicList.setPages(topicElements.getAttribute("pages")); topicList.setPerPage(topicElements.getAttribute("perpage")); topicList.setTotal(topicElements.getAttribute("total")); topicList.setGroupId(topicElements.getAttribute("group_id")); topicList.setIconServer(Integer.parseInt(topicElements.getAttribute("iconserver"))); topicList.setIconFarm(Integer.parseInt(topicElements.getAttribute("iconfarm"))); topicList.setName(topicElements.getAttribute("name")); topicList.setMembers(Integer.parseInt(topicElements.getAttribute("members"))); topicList.setPrivacy(Integer.parseInt(topicElements.getAttribute("privacy"))); topicList.setLanguage(topicElements.getAttribute("lang")); topicList.setIsPoolModerated("1".equals(topicElements.getAttribute("ispoolmoderated"))); NodeList topicNodes = topicElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element element = (Element) topicNodes.item(i); topicList.add(parseTopic(element)); } return topicList; }
java
public TopicList<Topic> getTopicsList(String groupId, int perPage, int page) throws FlickrException { TopicList<Topic> topicList = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_LIST); parameters.put("group_id", groupId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element topicElements = response.getPayload(); topicList.setPage(topicElements.getAttribute("page")); topicList.setPages(topicElements.getAttribute("pages")); topicList.setPerPage(topicElements.getAttribute("perpage")); topicList.setTotal(topicElements.getAttribute("total")); topicList.setGroupId(topicElements.getAttribute("group_id")); topicList.setIconServer(Integer.parseInt(topicElements.getAttribute("iconserver"))); topicList.setIconFarm(Integer.parseInt(topicElements.getAttribute("iconfarm"))); topicList.setName(topicElements.getAttribute("name")); topicList.setMembers(Integer.parseInt(topicElements.getAttribute("members"))); topicList.setPrivacy(Integer.parseInt(topicElements.getAttribute("privacy"))); topicList.setLanguage(topicElements.getAttribute("lang")); topicList.setIsPoolModerated("1".equals(topicElements.getAttribute("ispoolmoderated"))); NodeList topicNodes = topicElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element element = (Element) topicNodes.item(i); topicList.add(parseTopic(element)); } return topicList; }
[ "public", "TopicList", "<", "Topic", ">", "getTopicsList", "(", "String", "groupId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "TopicList", "<", "Topic", ">", "topicList", "=", "new", "TopicList", "<", "Topic", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_TOPICS_GET_LIST", ")", ";", "parameters", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "topicElements", "=", "response", ".", "getPayload", "(", ")", ";", "topicList", ".", "setPage", "(", "topicElements", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "topicList", ".", "setPages", "(", "topicElements", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "topicList", ".", "setPerPage", "(", "topicElements", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "topicList", ".", "setTotal", "(", "topicElements", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "topicList", ".", "setGroupId", "(", "topicElements", ".", "getAttribute", "(", "\"group_id\"", ")", ")", ";", "topicList", ".", "setIconServer", "(", "Integer", ".", "parseInt", "(", "topicElements", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ")", ";", "topicList", ".", "setIconFarm", "(", "Integer", ".", "parseInt", "(", "topicElements", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ")", ";", "topicList", ".", "setName", "(", "topicElements", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "topicList", ".", "setMembers", "(", "Integer", ".", "parseInt", "(", "topicElements", ".", "getAttribute", "(", "\"members\"", ")", ")", ")", ";", "topicList", ".", "setPrivacy", "(", "Integer", ".", "parseInt", "(", "topicElements", ".", "getAttribute", "(", "\"privacy\"", ")", ")", ")", ";", "topicList", ".", "setLanguage", "(", "topicElements", ".", "getAttribute", "(", "\"lang\"", ")", ")", ";", "topicList", ".", "setIsPoolModerated", "(", "\"1\"", ".", "equals", "(", "topicElements", ".", "getAttribute", "(", "\"ispoolmoderated\"", ")", ")", ")", ";", "NodeList", "topicNodes", "=", "topicElements", ".", "getElementsByTagName", "(", "\"topic\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "topicNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "element", "=", "(", "Element", ")", "topicNodes", ".", "item", "(", "i", ")", ";", "topicList", ".", "add", "(", "parseTopic", "(", "element", ")", ")", ";", "}", "return", "topicList", ";", "}" ]
Get a list of topics from a group. @param groupId Unique identifier of a group returns a list of topics for a given group {@link Group}. @param perPage Number of records per page. @param page Result-section. @return A group topic list @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.topics.getList.html">API Documentation</a>
[ "Get", "a", "list", "of", "topics", "from", "a", "group", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java#L54-L93
160,032
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java
GroupDiscussInterface.getTopicInfo
public Topic getTopicInfo(String topicId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_INFO); parameters.put("topic_id", topicId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element topicElement = response.getPayload(); return parseTopic(topicElement); }
java
public Topic getTopicInfo(String topicId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_TOPICS_GET_INFO); parameters.put("topic_id", topicId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element topicElement = response.getPayload(); return parseTopic(topicElement); }
[ "public", "Topic", "getTopicInfo", "(", "String", "topicId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_TOPICS_GET_INFO", ")", ";", "parameters", ".", "put", "(", "\"topic_id\"", ",", "topicId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "topicElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "parseTopic", "(", "topicElement", ")", ";", "}" ]
Get info for a given topic @param topicId Unique identifier of a topic for a given group {@link Topic}. @return A group topic @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.topics.getInfo.html">API Documentation</a>
[ "Get", "info", "for", "a", "given", "topic" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java#L104-L117
160,033
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java
GroupDiscussInterface.getReplyList
public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException { ReplyList<Reply> reply = new ReplyList<Reply>(); TopicList<Topic> topic = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_LIST); parameters.put("topic_id", topicId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElements = response.getPayload(); ReplyObject ro = new ReplyObject(); NodeList replyNodes = replyElements.getElementsByTagName("reply"); for (int i = 0; i < replyNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element replyElement = XMLUtilities.getChild(replyNodeElement, "reply"); reply.add(parseReply(replyNodeElement)); ro.setReplyList(reply); } NodeList topicNodes = replyElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element topicElement = XMLUtilities.getChild(replyNodeElement, "topic"); topic.add(parseTopic(replyNodeElement)); ro.setTopicList(topic); } return ro; }
java
public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException { ReplyList<Reply> reply = new ReplyList<Reply>(); TopicList<Topic> topic = new TopicList<Topic>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_LIST); parameters.put("topic_id", topicId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElements = response.getPayload(); ReplyObject ro = new ReplyObject(); NodeList replyNodes = replyElements.getElementsByTagName("reply"); for (int i = 0; i < replyNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element replyElement = XMLUtilities.getChild(replyNodeElement, "reply"); reply.add(parseReply(replyNodeElement)); ro.setReplyList(reply); } NodeList topicNodes = replyElements.getElementsByTagName("topic"); for (int i = 0; i < topicNodes.getLength(); i++) { Element replyNodeElement = (Element) replyNodes.item(i); // Element topicElement = XMLUtilities.getChild(replyNodeElement, "topic"); topic.add(parseTopic(replyNodeElement)); ro.setTopicList(topic); } return ro; }
[ "public", "ReplyObject", "getReplyList", "(", "String", "topicId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "ReplyList", "<", "Reply", ">", "reply", "=", "new", "ReplyList", "<", "Reply", ">", "(", ")", ";", "TopicList", "<", "Topic", ">", "topic", "=", "new", "TopicList", "<", "Topic", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_REPLIES_GET_LIST", ")", ";", "parameters", ".", "put", "(", "\"topic_id\"", ",", "topicId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "replyElements", "=", "response", ".", "getPayload", "(", ")", ";", "ReplyObject", "ro", "=", "new", "ReplyObject", "(", ")", ";", "NodeList", "replyNodes", "=", "replyElements", ".", "getElementsByTagName", "(", "\"reply\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "replyNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "replyNodeElement", "=", "(", "Element", ")", "replyNodes", ".", "item", "(", "i", ")", ";", "// Element replyElement = XMLUtilities.getChild(replyNodeElement, \"reply\");\r", "reply", ".", "add", "(", "parseReply", "(", "replyNodeElement", ")", ")", ";", "ro", ".", "setReplyList", "(", "reply", ")", ";", "}", "NodeList", "topicNodes", "=", "replyElements", ".", "getElementsByTagName", "(", "\"topic\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "topicNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "replyNodeElement", "=", "(", "Element", ")", "replyNodes", ".", "item", "(", "i", ")", ";", "// Element topicElement = XMLUtilities.getChild(replyNodeElement, \"topic\");\r", "topic", ".", "add", "(", "parseTopic", "(", "replyNodeElement", ")", ")", ";", "ro", ".", "setTopicList", "(", "topic", ")", ";", "}", "return", "ro", ";", "}" ]
Get list of replies @param topicId Unique identifier of a topic for a given group {@link Topic}. @return A reply object @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.replies.getList.html">API Documentation</a>
[ "Get", "list", "of", "replies" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java#L128-L167
160,034
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java
GroupDiscussInterface.getReplyInfo
public Reply getReplyInfo(String topicId, String replyId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_INFO); parameters.put("topic_id", topicId); parameters.put("reply_id", replyId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElement = response.getPayload(); return parseReply(replyElement); }
java
public Reply getReplyInfo(String topicId, String replyId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REPLIES_GET_INFO); parameters.put("topic_id", topicId); parameters.put("reply_id", replyId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element replyElement = response.getPayload(); return parseReply(replyElement); }
[ "public", "Reply", "getReplyInfo", "(", "String", "topicId", ",", "String", "replyId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_REPLIES_GET_INFO", ")", ";", "parameters", ".", "put", "(", "\"topic_id\"", ",", "topicId", ")", ";", "parameters", ".", "put", "(", "\"reply_id\"", ",", "replyId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "replyElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "parseReply", "(", "replyElement", ")", ";", "}" ]
Get info for a given topic reply @param topicId Unique identifier of a topic for a given group {@link Topic}. @param replyId Unique identifier of a reply for a given topic {@link Reply}. @return A group topic @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.replies.getInfo.html">API Documentation</a>
[ "Get", "info", "for", "a", "given", "topic", "reply" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java#L180-L194
160,035
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java
MachinetagsInterface.getNamespaces
public NamespacesList<Namespace> getNamespaces(String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Namespace> nsList = new NamespacesList<Namespace>(); parameters.put("method", METHOD_GET_NAMESPACES); if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("namespace"); nsList.setPage("1"); nsList.setPages("1"); nsList.setPerPage("" + nsNodes.getLength()); nsList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); nsList.add(parseNamespace(element)); } return nsList; }
java
public NamespacesList<Namespace> getNamespaces(String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Namespace> nsList = new NamespacesList<Namespace>(); parameters.put("method", METHOD_GET_NAMESPACES); if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("namespace"); nsList.setPage("1"); nsList.setPages("1"); nsList.setPerPage("" + nsNodes.getLength()); nsList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); nsList.add(parseNamespace(element)); } return nsList; }
[ "public", "NamespacesList", "<", "Namespace", ">", "getNamespaces", "(", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "NamespacesList", "<", "Namespace", ">", "nsList", "=", "new", "NamespacesList", "<", "Namespace", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_NAMESPACES", ")", ";", "if", "(", "predicate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"predicate\"", ",", "predicate", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "nsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "nsNodes", "=", "nsElement", ".", "getElementsByTagName", "(", "\"namespace\"", ")", ";", "nsList", ".", "setPage", "(", "\"1\"", ")", ";", "nsList", ".", "setPages", "(", "\"1\"", ")", ";", "nsList", ".", "setPerPage", "(", "\"\"", "+", "nsNodes", ".", "getLength", "(", ")", ")", ";", "nsList", ".", "setTotal", "(", "\"\"", "+", "nsNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nsNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "element", "=", "(", "Element", ")", "nsNodes", ".", "item", "(", "i", ")", ";", "nsList", ".", "add", "(", "parseNamespace", "(", "element", ")", ")", ";", "}", "return", "nsList", ";", "}" ]
Return a list of unique namespaces, optionally limited by a given predicate, in alphabetical order. This method does not require authentication. @param predicate @param perPage @param page @return NamespacesList @throws FlickrException
[ "Return", "a", "list", "of", "unique", "namespaces", "optionally", "limited", "by", "a", "given", "predicate", "in", "alphabetical", "order", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java#L266-L296
160,036
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java
MachinetagsInterface.getPairs
public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Pair> nsList = new NamespacesList<Pair>(); parameters.put("method", METHOD_GET_PAIRS); if (namespace != null) { parameters.put("namespace", namespace); } if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("pair"); nsList.setPage(nsElement.getAttribute("page")); nsList.setPages(nsElement.getAttribute("pages")); nsList.setPerPage(nsElement.getAttribute("perPage")); nsList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); nsList.add(parsePair(element)); } return nsList; }
java
public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Pair> nsList = new NamespacesList<Pair>(); parameters.put("method", METHOD_GET_PAIRS); if (namespace != null) { parameters.put("namespace", namespace); } if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("pair"); nsList.setPage(nsElement.getAttribute("page")); nsList.setPages(nsElement.getAttribute("pages")); nsList.setPerPage(nsElement.getAttribute("perPage")); nsList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); nsList.add(parsePair(element)); } return nsList; }
[ "public", "NamespacesList", "<", "Pair", ">", "getPairs", "(", "String", "namespace", ",", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "NamespacesList", "<", "Pair", ">", "nsList", "=", "new", "NamespacesList", "<", "Pair", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PAIRS", ")", ";", "if", "(", "namespace", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"namespace\"", ",", "namespace", ")", ";", "}", "if", "(", "predicate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"predicate\"", ",", "predicate", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "nsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "nsNodes", "=", "nsElement", ".", "getElementsByTagName", "(", "\"pair\"", ")", ";", "nsList", ".", "setPage", "(", "nsElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "nsList", ".", "setPages", "(", "nsElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "nsList", ".", "setPerPage", "(", "nsElement", ".", "getAttribute", "(", "\"perPage\"", ")", ")", ";", "nsList", ".", "setTotal", "(", "\"\"", "+", "nsNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nsNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "element", "=", "(", "Element", ")", "nsNodes", ".", "item", "(", "i", ")", ";", "nsList", ".", "add", "(", "parsePair", "(", "element", ")", ")", ";", "}", "return", "nsList", ";", "}" ]
Return a list of unique namespace and predicate pairs, optionally limited by predicate or namespace, in alphabetical order. This method does not require authentication. @param namespace optional, can be null @param predicate optional, can be null @param perPage The number of photos to show per page @param page The page offset @return NamespacesList containing Pair-objects @throws FlickrException
[ "Return", "a", "list", "of", "unique", "namespace", "and", "predicate", "pairs", "optionally", "limited", "by", "predicate", "or", "namespace", "in", "alphabetical", "order", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java#L314-L347
160,037
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java
MachinetagsInterface.getValues
public NamespacesList<Value> getValues(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Value> valuesList = new NamespacesList<Value>(); parameters.put("method", METHOD_GET_VALUES); if (namespace != null) { parameters.put("namespace", namespace); } if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("value"); valuesList.setPage(nsElement.getAttribute("page")); valuesList.setPages(nsElement.getAttribute("pages")); valuesList.setPerPage(nsElement.getAttribute("perPage")); valuesList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); Value value = parseValue(element); value.setNamespace(namespace); value.setPredicate(predicate); valuesList.add(value); } return valuesList; }
java
public NamespacesList<Value> getValues(String namespace, String predicate, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); NamespacesList<Value> valuesList = new NamespacesList<Value>(); parameters.put("method", METHOD_GET_VALUES); if (namespace != null) { parameters.put("namespace", namespace); } if (predicate != null) { parameters.put("predicate", predicate); } if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element nsElement = response.getPayload(); NodeList nsNodes = nsElement.getElementsByTagName("value"); valuesList.setPage(nsElement.getAttribute("page")); valuesList.setPages(nsElement.getAttribute("pages")); valuesList.setPerPage(nsElement.getAttribute("perPage")); valuesList.setTotal("" + nsNodes.getLength()); for (int i = 0; i < nsNodes.getLength(); i++) { Element element = (Element) nsNodes.item(i); Value value = parseValue(element); value.setNamespace(namespace); value.setPredicate(predicate); valuesList.add(value); } return valuesList; }
[ "public", "NamespacesList", "<", "Value", ">", "getValues", "(", "String", "namespace", ",", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "NamespacesList", "<", "Value", ">", "valuesList", "=", "new", "NamespacesList", "<", "Value", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_VALUES", ")", ";", "if", "(", "namespace", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"namespace\"", ",", "namespace", ")", ";", "}", "if", "(", "predicate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"predicate\"", ",", "predicate", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "nsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "nsNodes", "=", "nsElement", ".", "getElementsByTagName", "(", "\"value\"", ")", ";", "valuesList", ".", "setPage", "(", "nsElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "valuesList", ".", "setPages", "(", "nsElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "valuesList", ".", "setPerPage", "(", "nsElement", ".", "getAttribute", "(", "\"perPage\"", ")", ")", ";", "valuesList", ".", "setTotal", "(", "\"\"", "+", "nsNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nsNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "element", "=", "(", "Element", ")", "nsNodes", ".", "item", "(", "i", ")", ";", "Value", "value", "=", "parseValue", "(", "element", ")", ";", "value", ".", "setNamespace", "(", "namespace", ")", ";", "value", ".", "setPredicate", "(", "predicate", ")", ";", "valuesList", ".", "add", "(", "value", ")", ";", "}", "return", "valuesList", ";", "}" ]
Return a list of unique values for a namespace and predicate. This method does not require authentication. @param namespace The namespace that all values should be restricted to. @param predicate The predicate that all values should be restricted to. @param perPage The number of photos to show per page @param page The page offset @return NamespacesList @throws FlickrException
[ "Return", "a", "list", "of", "unique", "values", "for", "a", "namespace", "and", "predicate", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/machinetags/MachinetagsInterface.java#L411-L447
160,038
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/StringUtilities.java
StringUtilities.join
public static String join(Collection<String> s, String delimiter, boolean doQuote) { StringBuffer buffer = new StringBuffer(); Iterator<String> iter = s.iterator(); while (iter.hasNext()) { if (doQuote) { buffer.append("\"" + iter.next() + "\""); } else { buffer.append(iter.next()); } if (iter.hasNext()) { buffer.append(delimiter); } } return buffer.toString(); }
java
public static String join(Collection<String> s, String delimiter, boolean doQuote) { StringBuffer buffer = new StringBuffer(); Iterator<String> iter = s.iterator(); while (iter.hasNext()) { if (doQuote) { buffer.append("\"" + iter.next() + "\""); } else { buffer.append(iter.next()); } if (iter.hasNext()) { buffer.append(delimiter); } } return buffer.toString(); }
[ "public", "static", "String", "join", "(", "Collection", "<", "String", ">", "s", ",", "String", "delimiter", ",", "boolean", "doQuote", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "<", "String", ">", "iter", "=", "s", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "if", "(", "doQuote", ")", "{", "buffer", ".", "append", "(", "\"\\\"\"", "+", "iter", ".", "next", "(", ")", "+", "\"\\\"\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "iter", ".", "next", "(", ")", ")", ";", "}", "if", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "buffer", ".", "append", "(", "delimiter", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Join the Collection of Strings using the specified delimter and optionally quoting each @param s The String collection @param delimiter the delimiter String @param doQuote whether or not to quote the Strings @return The joined String
[ "Join", "the", "Collection", "of", "Strings", "using", "the", "specified", "delimter", "and", "optionally", "quoting", "each" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/StringUtilities.java#L50-L64
160,039
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/StringUtilities.java
StringUtilities.join
public static String join(Collection<String> s, String delimiter) { return join(s, delimiter, false); }
java
public static String join(Collection<String> s, String delimiter) { return join(s, delimiter, false); }
[ "public", "static", "String", "join", "(", "Collection", "<", "String", ">", "s", ",", "String", "delimiter", ")", "{", "return", "join", "(", "s", ",", "delimiter", ",", "false", ")", ";", "}" ]
Join the Collection of Strings using the specified delimiter. @param s The String collection @param delimiter The delimiter String @return The joined String
[ "Join", "the", "Collection", "of", "Strings", "using", "the", "specified", "delimiter", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/StringUtilities.java#L75-L77
160,040
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getCollectionDomains
public DomainList getCollectionDomains(Date date, String collectionId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_COLLECTION_DOMAINS, "collection_id", collectionId, date, perPage, page); }
java
public DomainList getCollectionDomains(Date date, String collectionId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_COLLECTION_DOMAINS, "collection_id", collectionId, date, perPage, page); }
[ "public", "DomainList", "getCollectionDomains", "(", "Date", "date", ",", "String", "collectionId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getDomains", "(", "METHOD_GET_COLLECTION_DOMAINS", ",", "\"collection_id\"", ",", "collectionId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referring domains for a collection. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param collectionId (Optional) The id of the collection to get stats for. If not provided, stats for all collections will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getCollectionDomains.html"
[ "Get", "a", "list", "of", "referring", "domains", "for", "a", "collection", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L95-L97
160,041
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getCollectionReferrers
public ReferrerList getCollectionReferrers(Date date, String domain, String collectionId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_COLLECTION_REFERRERS, domain, "collection_id", collectionId, date, perPage, page); }
java
public ReferrerList getCollectionReferrers(Date date, String domain, String collectionId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_COLLECTION_REFERRERS, domain, "collection_id", collectionId, date, perPage, page); }
[ "public", "ReferrerList", "getCollectionReferrers", "(", "Date", "date", ",", "String", "domain", ",", "String", "collectionId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getReferrers", "(", "METHOD_GET_COLLECTION_REFERRERS", ",", "domain", ",", "\"collection_id\"", ",", "collectionId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referrers from a given domain to a collection. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param domain (Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname. @param collectionId (Optional) The id of the collection to get stats for. If not provided, stats for all collections will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getCollectionReferrers.html"
[ "Get", "a", "list", "of", "referrers", "from", "a", "given", "domain", "to", "a", "collection", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L115-L117
160,042
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getCollectionStats
public Stats getCollectionStats(String collectionId, Date date) throws FlickrException { return getStats(METHOD_GET_COLLECTION_STATS, "collection_id", collectionId, date); }
java
public Stats getCollectionStats(String collectionId, Date date) throws FlickrException { return getStats(METHOD_GET_COLLECTION_STATS, "collection_id", collectionId, date); }
[ "public", "Stats", "getCollectionStats", "(", "String", "collectionId", ",", "Date", "date", ")", "throws", "FlickrException", "{", "return", "getStats", "(", "METHOD_GET_COLLECTION_STATS", ",", "\"collection_id\"", ",", "collectionId", ",", "date", ")", ";", "}" ]
Get the number of views, comments and favorites on a collection for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param collectionId (Required) The id (from the URL!) of the collection to get stats for. @see "http://www.flickr.com/services/api/flickr.stats.getCollectionStats.htm"
[ "Get", "the", "number", "of", "views", "comments", "and", "favorites", "on", "a", "collection", "for", "a", "given", "date", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L129-L131
160,043
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotoDomains
public DomainList getPhotoDomains(Date date, String photoId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTO_DOMAINS, "photo_id", photoId, date, perPage, page); }
java
public DomainList getPhotoDomains(Date date, String photoId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTO_DOMAINS, "photo_id", photoId, date, perPage, page); }
[ "public", "DomainList", "getPhotoDomains", "(", "Date", "date", ",", "String", "photoId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getDomains", "(", "METHOD_GET_PHOTO_DOMAINS", ",", "\"photo_id\"", ",", "photoId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referring domains for a photo. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photoId (Optional) The id of the photo to get stats for. If not provided, stats for all photos will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotoDomains.html"
[ "Get", "a", "list", "of", "referring", "domains", "for", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L168-L170
160,044
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotoReferrers
public ReferrerList getPhotoReferrers(Date date, String domain, String photoId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTO_REFERRERS, domain, "photo_id", photoId, date, perPage, page); }
java
public ReferrerList getPhotoReferrers(Date date, String domain, String photoId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTO_REFERRERS, domain, "photo_id", photoId, date, perPage, page); }
[ "public", "ReferrerList", "getPhotoReferrers", "(", "Date", "date", ",", "String", "domain", ",", "String", "photoId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getReferrers", "(", "METHOD_GET_PHOTO_REFERRERS", ",", "domain", ",", "\"photo_id\"", ",", "photoId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referrers from a given domain to a photo. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param domain (Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname. @param photoId (Optional) The id of the photo to get stats for. If not provided, stats for all photos will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotoReferrers.html"
[ "Get", "a", "list", "of", "referrers", "from", "a", "given", "domain", "to", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L188-L190
160,045
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotoStats
public Stats getPhotoStats(String photoId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTO_STATS, "photo_id", photoId, date); }
java
public Stats getPhotoStats(String photoId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTO_STATS, "photo_id", photoId, date); }
[ "public", "Stats", "getPhotoStats", "(", "String", "photoId", ",", "Date", "date", ")", "throws", "FlickrException", "{", "return", "getStats", "(", "METHOD_GET_PHOTO_STATS", ",", "\"photo_id\"", ",", "photoId", ",", "date", ")", ";", "}" ]
Get the number of views, comments and favorites on a photo for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photoId (Required) The id of the photo to get stats for. @see "http://www.flickr.com/services/api/flickr.stats.getPhotoStats.htm"
[ "Get", "the", "number", "of", "views", "comments", "and", "favorites", "on", "a", "photo", "for", "a", "given", "date", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L202-L204
160,046
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotosetDomains
public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSET_DOMAINS, "photoset_id", photosetId, date, perPage, page); }
java
public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSET_DOMAINS, "photoset_id", photosetId, date, perPage, page); }
[ "public", "DomainList", "getPhotosetDomains", "(", "Date", "date", ",", "String", "photosetId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getDomains", "(", "METHOD_GET_PHOTOSET_DOMAINS", ",", "\"photoset_id\"", ",", "photosetId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referring domains for a photoset. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photosetId (Optional) The id of the photoset to get stats for. If not provided, stats for all photos will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotosetDomains.html"
[ "Get", "a", "list", "of", "referring", "domains", "for", "a", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L220-L222
160,047
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotosetReferrers
public ReferrerList getPhotosetReferrers(Date date, String domain, String photosetId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSET_REFERRERS, domain, "photoset_id", photosetId, date, perPage, page); }
java
public ReferrerList getPhotosetReferrers(Date date, String domain, String photosetId, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSET_REFERRERS, domain, "photoset_id", photosetId, date, perPage, page); }
[ "public", "ReferrerList", "getPhotosetReferrers", "(", "Date", "date", ",", "String", "domain", ",", "String", "photosetId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getReferrers", "(", "METHOD_GET_PHOTOSET_REFERRERS", ",", "domain", ",", "\"photoset_id\"", ",", "photosetId", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referrers from a given domain to a photoset. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param domain (Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname. @param photosetId (Optional) The id of the photoset to get stats for. If not provided, stats for all sets will be returned. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotosetReferrers.html"
[ "Get", "a", "list", "of", "referrers", "from", "a", "given", "domain", "to", "a", "photoset", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L240-L242
160,048
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotosetStats
public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTOSET_STATS, "photoset_id", photosetId, date); }
java
public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTOSET_STATS, "photoset_id", photosetId, date); }
[ "public", "Stats", "getPhotosetStats", "(", "String", "photosetId", ",", "Date", "date", ")", "throws", "FlickrException", "{", "return", "getStats", "(", "METHOD_GET_PHOTOSET_STATS", ",", "\"photoset_id\"", ",", "photosetId", ",", "date", ")", ";", "}" ]
Get the number of views, comments and favorites on a photoset for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photosetId (Required) The id of the photoset to get stats for. @see "http://www.flickr.com/services/api/flickr.stats.getPhotosetStats.htm"
[ "Get", "the", "number", "of", "views", "comments", "and", "favorites", "on", "a", "photoset", "for", "a", "given", "date", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L254-L256
160,049
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotostreamDomains
public DomainList getPhotostreamDomains(Date date, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSTREAM_DOMAINS, null, null, date, perPage, page); }
java
public DomainList getPhotostreamDomains(Date date, int perPage, int page) throws FlickrException { return getDomains(METHOD_GET_PHOTOSTREAM_DOMAINS, null, null, date, perPage, page); }
[ "public", "DomainList", "getPhotostreamDomains", "(", "Date", "date", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getDomains", "(", "METHOD_GET_PHOTOSTREAM_DOMAINS", ",", "null", ",", "null", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referring domains for a photostream. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamDomains.html"
[ "Get", "a", "list", "of", "referring", "domains", "for", "a", "photostream", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L270-L273
160,050
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotostreamReferrers
public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page); }
java
public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException { return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page); }
[ "public", "ReferrerList", "getPhotostreamReferrers", "(", "Date", "date", ",", "String", "domain", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "return", "getReferrers", "(", "METHOD_GET_PHOTOSTREAM_REFERRERS", ",", "domain", ",", "null", ",", "null", ",", "date", ",", "perPage", ",", "page", ")", ";", "}" ]
Get a list of referrers from a given domain to a user's photostream. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param domain (Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname. @param perPage (Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamReferrers.html"
[ "Get", "a", "list", "of", "referrers", "from", "a", "given", "domain", "to", "a", "user", "s", "photostream", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L289-L291
160,051
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotostreamStats
public Stats getPhotostreamStats(Date date) throws FlickrException { return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date); }
java
public Stats getPhotostreamStats(Date date) throws FlickrException { return getStats(METHOD_GET_PHOTOSTREAM_STATS, null, null, date); }
[ "public", "Stats", "getPhotostreamStats", "(", "Date", "date", ")", "throws", "FlickrException", "{", "return", "getStats", "(", "METHOD_GET_PHOTOSTREAM_STATS", ",", "null", ",", "null", ",", "date", ")", ";", "}" ]
Get the number of views, comments and favorites on a photostream for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @see "http://www.flickr.com/services/api/flickr.stats.getPhotostreamStats.htm"
[ "Get", "the", "number", "of", "views", "comments", "and", "favorites", "on", "a", "photostream", "for", "a", "given", "date", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L301-L303
160,052
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPopularPhotos
public PhotoList<Photo> getPopularPhotos(Date date, StatsSort sort, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_POPULAR_PHOTOS); if (date != null) { parameters.put("date", String.valueOf(date.getTime() / 1000L)); } if (sort != null) { parameters.put("sort", sort.name()); } addPaginationParameters(parameters, perPage, page); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } return parsePopularPhotos(response); }
java
public PhotoList<Photo> getPopularPhotos(Date date, StatsSort sort, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_POPULAR_PHOTOS); if (date != null) { parameters.put("date", String.valueOf(date.getTime() / 1000L)); } if (sort != null) { parameters.put("sort", sort.name()); } addPaginationParameters(parameters, perPage, page); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } return parsePopularPhotos(response); }
[ "public", "PhotoList", "<", "Photo", ">", "getPopularPhotos", "(", "Date", "date", ",", "StatsSort", "sort", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_POPULAR_PHOTOS", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"date\"", ",", "String", ".", "valueOf", "(", "date", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "sort", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"sort\"", ",", "sort", ".", "name", "(", ")", ")", ";", "}", "addPaginationParameters", "(", "parameters", ",", "perPage", ",", "page", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "return", "parsePopularPhotos", "(", "response", ")", ";", "}" ]
List the photos with the most views, comments or favorites. @param date (Optional) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. If no date is provided, all time view counts will be returned. @param sort (Optional) The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. Other sort options are available through flickr.photos.search. @param perPage (Optional) Number of referrers to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100. @param page (Optional) The page of results to return. If this argument is omitted, it defaults to 1. @throws FlickrException @see "http://www.flickr.com/services/api/flickr.stats.getPopularPhotos.html"
[ "List", "the", "photos", "with", "the", "most", "views", "comments", "or", "favorites", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L321-L339
160,053
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getGeoInterface
public synchronized GeoInterface getGeoInterface() { if (geoInterface == null) { geoInterface = new GeoInterface(apiKey, sharedSecret, transport); } return geoInterface; }
java
public synchronized GeoInterface getGeoInterface() { if (geoInterface == null) { geoInterface = new GeoInterface(apiKey, sharedSecret, transport); } return geoInterface; }
[ "public", "synchronized", "GeoInterface", "getGeoInterface", "(", ")", "{", "if", "(", "geoInterface", "==", "null", ")", "{", "geoInterface", "=", "new", "GeoInterface", "(", "apiKey", ",", "sharedSecret", ",", "transport", ")", ";", "}", "return", "geoInterface", ";", "}" ]
Get the geo interface. @return Access class to the flickr.photos.geo methods.
[ "Get", "the", "geo", "interface", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L124-L129
160,054
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.addTags
public void addTags(String photoId, String[] tags) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_TAGS); parameters.put("photo_id", photoId); parameters.put("tags", StringUtilities.join(tags, " ", true)); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void addTags(String photoId, String[] tags) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_TAGS); parameters.put("photo_id", photoId); parameters.put("tags", StringUtilities.join(tags, " ", true)); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "addTags", "(", "String", "photoId", ",", "String", "[", "]", "tags", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_ADD_TAGS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"tags\"", ",", "StringUtilities", ".", "join", "(", "tags", ",", "\" \"", ",", "true", ")", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Add tags to a photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param tags The tags @throws FlickrException
[ "Add", "tags", "to", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L142-L153
160,055
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.delete
public void delete(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("photo_id", photoId); // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty // sucess response if it completes without error. }
java
public void delete(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("photo_id", photoId); // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty // sucess response if it completes without error. }
[ "public", "void", "delete", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_DELETE", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "// Note: This method requires an HTTP POST request.\r", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// This method has no specific response - It returns an empty\r", "// sucess response if it completes without error.\r", "}" ]
Delete a photo from flickr. This method requires authentication with 'delete' permission. @param photoId @throws FlickrException
[ "Delete", "a", "photo", "from", "flickr", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L163-L176
160,056
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getAllContexts
public PhotoAllContext getAllContexts(String photoId) throws FlickrException { PhotoSetList<PhotoSet> setList = new PhotoSetList<PhotoSet>(); PoolList<Pool> poolList = new PoolList<Pool>(); PhotoAllContext allContext = new PhotoAllContext(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_ALL_CONTEXTS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Collection<Element> photosElement = response.getPayloadCollection(); for (Element setElement : photosElement) { if (setElement.getTagName().equals("set")) { PhotoSet pset = new PhotoSet(); pset.setTitle(setElement.getAttribute("title")); pset.setSecret(setElement.getAttribute("secret")); pset.setId(setElement.getAttribute("id")); pset.setFarm(setElement.getAttribute("farm")); pset.setPrimary(setElement.getAttribute("primary")); pset.setServer(setElement.getAttribute("server")); pset.setViewCount(Integer.parseInt(setElement.getAttribute("view_count"))); pset.setCommentCount(Integer.parseInt(setElement.getAttribute("comment_count"))); pset.setCountPhoto(Integer.parseInt(setElement.getAttribute("count_photo"))); pset.setCountVideo(Integer.parseInt(setElement.getAttribute("count_video"))); setList.add(pset); allContext.setPhotoSetList(setList); } else if (setElement.getTagName().equals("pool")) { Pool pool = new Pool(); pool.setTitle(setElement.getAttribute("title")); pool.setId(setElement.getAttribute("id")); pool.setUrl(setElement.getAttribute("url")); pool.setIconServer(setElement.getAttribute("iconserver")); pool.setIconFarm(setElement.getAttribute("iconfarm")); pool.setMemberCount(Integer.parseInt(setElement.getAttribute("members"))); pool.setPoolCount(Integer.parseInt(setElement.getAttribute("pool_count"))); poolList.add(pool); allContext.setPoolList(poolList); } } return allContext; }
java
public PhotoAllContext getAllContexts(String photoId) throws FlickrException { PhotoSetList<PhotoSet> setList = new PhotoSetList<PhotoSet>(); PoolList<Pool> poolList = new PoolList<Pool>(); PhotoAllContext allContext = new PhotoAllContext(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_ALL_CONTEXTS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Collection<Element> photosElement = response.getPayloadCollection(); for (Element setElement : photosElement) { if (setElement.getTagName().equals("set")) { PhotoSet pset = new PhotoSet(); pset.setTitle(setElement.getAttribute("title")); pset.setSecret(setElement.getAttribute("secret")); pset.setId(setElement.getAttribute("id")); pset.setFarm(setElement.getAttribute("farm")); pset.setPrimary(setElement.getAttribute("primary")); pset.setServer(setElement.getAttribute("server")); pset.setViewCount(Integer.parseInt(setElement.getAttribute("view_count"))); pset.setCommentCount(Integer.parseInt(setElement.getAttribute("comment_count"))); pset.setCountPhoto(Integer.parseInt(setElement.getAttribute("count_photo"))); pset.setCountVideo(Integer.parseInt(setElement.getAttribute("count_video"))); setList.add(pset); allContext.setPhotoSetList(setList); } else if (setElement.getTagName().equals("pool")) { Pool pool = new Pool(); pool.setTitle(setElement.getAttribute("title")); pool.setId(setElement.getAttribute("id")); pool.setUrl(setElement.getAttribute("url")); pool.setIconServer(setElement.getAttribute("iconserver")); pool.setIconFarm(setElement.getAttribute("iconfarm")); pool.setMemberCount(Integer.parseInt(setElement.getAttribute("members"))); pool.setPoolCount(Integer.parseInt(setElement.getAttribute("pool_count"))); poolList.add(pool); allContext.setPoolList(poolList); } } return allContext; }
[ "public", "PhotoAllContext", "getAllContexts", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "PhotoSetList", "<", "PhotoSet", ">", "setList", "=", "new", "PhotoSetList", "<", "PhotoSet", ">", "(", ")", ";", "PoolList", "<", "Pool", ">", "poolList", "=", "new", "PoolList", "<", "Pool", ">", "(", ")", ";", "PhotoAllContext", "allContext", "=", "new", "PhotoAllContext", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_ALL_CONTEXTS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Collection", "<", "Element", ">", "photosElement", "=", "response", ".", "getPayloadCollection", "(", ")", ";", "for", "(", "Element", "setElement", ":", "photosElement", ")", "{", "if", "(", "setElement", ".", "getTagName", "(", ")", ".", "equals", "(", "\"set\"", ")", ")", "{", "PhotoSet", "pset", "=", "new", "PhotoSet", "(", ")", ";", "pset", ".", "setTitle", "(", "setElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "pset", ".", "setSecret", "(", "setElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "pset", ".", "setId", "(", "setElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "pset", ".", "setFarm", "(", "setElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "pset", ".", "setPrimary", "(", "setElement", ".", "getAttribute", "(", "\"primary\"", ")", ")", ";", "pset", ".", "setServer", "(", "setElement", ".", "getAttribute", "(", "\"server\"", ")", ")", ";", "pset", ".", "setViewCount", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"view_count\"", ")", ")", ")", ";", "pset", ".", "setCommentCount", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"comment_count\"", ")", ")", ")", ";", "pset", ".", "setCountPhoto", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"count_photo\"", ")", ")", ")", ";", "pset", ".", "setCountVideo", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"count_video\"", ")", ")", ")", ";", "setList", ".", "add", "(", "pset", ")", ";", "allContext", ".", "setPhotoSetList", "(", "setList", ")", ";", "}", "else", "if", "(", "setElement", ".", "getTagName", "(", ")", ".", "equals", "(", "\"pool\"", ")", ")", "{", "Pool", "pool", "=", "new", "Pool", "(", ")", ";", "pool", ".", "setTitle", "(", "setElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "pool", ".", "setId", "(", "setElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "pool", ".", "setUrl", "(", "setElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "pool", ".", "setIconServer", "(", "setElement", ".", "getAttribute", "(", "\"iconserver\"", ")", ")", ";", "pool", ".", "setIconFarm", "(", "setElement", ".", "getAttribute", "(", "\"iconfarm\"", ")", ")", ";", "pool", ".", "setMemberCount", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"members\"", ")", ")", ")", ";", "pool", ".", "setPoolCount", "(", "Integer", ".", "parseInt", "(", "setElement", ".", "getAttribute", "(", "\"pool_count\"", ")", ")", ")", ";", "poolList", ".", "add", "(", "pool", ")", ";", "allContext", ".", "setPoolList", "(", "poolList", ")", ";", "}", "}", "return", "allContext", ";", "}" ]
Returns all visble sets and pools the photo belongs to. This method does not require authentication. @param photoId The photo to return information for. @return a list of {@link PhotoContext} objects @throws FlickrException
[ "Returns", "all", "visble", "sets", "and", "pools", "the", "photo", "belongs", "to", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L188-L235
160,057
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getContactsPhotos
public PhotoList<Photo> getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTACTS_PHOTOS); if (count > 0) { parameters.put("count", Integer.toString(count)); } if (justFriends) { parameters.put("just_friends", "1"); } if (singlePhoto) { parameters.put("single_photo", "1"); } if (includeSelf) { parameters.put("include_self", "1"); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); NodeList photoNodes = photosElement.getElementsByTagName("photo"); photos.setPage("1"); photos.setPages("1"); photos.setPerPage("" + photoNodes.getLength()); photos.setTotal("" + photoNodes.getLength()); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTACTS_PHOTOS); if (count > 0) { parameters.put("count", Integer.toString(count)); } if (justFriends) { parameters.put("just_friends", "1"); } if (singlePhoto) { parameters.put("single_photo", "1"); } if (includeSelf) { parameters.put("include_self", "1"); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); NodeList photoNodes = photosElement.getElementsByTagName("photo"); photos.setPage("1"); photos.setPages("1"); photos.setPerPage("" + photoNodes.getLength()); photos.setTotal("" + photoNodes.getLength()); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getContactsPhotos", "(", "int", "count", ",", "boolean", "justFriends", ",", "boolean", "singlePhoto", ",", "boolean", "includeSelf", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_CONTACTS_PHOTOS", ")", ";", "if", "(", "count", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"count\"", ",", "Integer", ".", "toString", "(", "count", ")", ")", ";", "}", "if", "(", "justFriends", ")", "{", "parameters", ".", "put", "(", "\"just_friends\"", ",", "\"1\"", ")", ";", "}", "if", "(", "singlePhoto", ")", "{", "parameters", ".", "put", "(", "\"single_photo\"", ",", "\"1\"", ")", ";", "}", "if", "(", "includeSelf", ")", "{", "parameters", ".", "put", "(", "\"include_self\"", ",", "\"1\"", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "photos", ".", "setPage", "(", "\"1\"", ")", ";", "photos", ".", "setPages", "(", "\"1\"", ")", ";", "photos", ".", "setPerPage", "(", "\"\"", "+", "photoNodes", ".", "getLength", "(", ")", ")", ";", "photos", ".", "setTotal", "(", "\"\"", "+", "photoNodes", ".", "getLength", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Get photos from the user's contacts. This method requires authentication with 'read' permission. @param count The number of photos to return @param justFriends Set to true to only show friends photos @param singlePhoto Set to true to get a single photo @param includeSelf Set to true to include self @return The Collection of photos @throws FlickrException
[ "Get", "photos", "from", "the", "user", "s", "contacts", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L253-L287
160,058
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getContactsPublicPhotos
public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException { return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf); }
java
public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException { return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf); }
[ "public", "PhotoList", "<", "Photo", ">", "getContactsPublicPhotos", "(", "String", "userId", ",", "int", "count", ",", "boolean", "justFriends", ",", "boolean", "singlePhoto", ",", "boolean", "includeSelf", ")", "throws", "FlickrException", "{", "return", "getContactsPublicPhotos", "(", "userId", ",", "Extras", ".", "MIN_EXTRAS", ",", "count", ",", "justFriends", ",", "singlePhoto", ",", "includeSelf", ")", ";", "}" ]
Get public photos from the user's contacts. This method does not require authentication. @see com.flickr4java.flickr.photos.Extras @param userId The user ID @param count The number of photos to return @param justFriends True to include friends @param singlePhoto True to get a single photo @param includeSelf True to include self @return A collection of Photo objects @throws FlickrException
[ "Get", "public", "photos", "from", "the", "user", "s", "contacts", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L308-L311
160,059
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getContext
public PhotoContext getContext(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } PhotoContext photoContext = new PhotoContext(); Collection<Element> payload = response.getPayloadCollection(); for (Element payloadElement : payload) { String tagName = payloadElement.getTagName(); if (tagName.equals("prevphoto")) { Photo photo = new Photo(); photo.setId(payloadElement.getAttribute("id")); photo.setSecret(payloadElement.getAttribute("secret")); photo.setTitle(payloadElement.getAttribute("title")); photo.setFarm(payloadElement.getAttribute("farm")); photo.setUrl(payloadElement.getAttribute("url")); photoContext.setPreviousPhoto(photo); } else if (tagName.equals("nextphoto")) { Photo photo = new Photo(); photo.setId(payloadElement.getAttribute("id")); photo.setSecret(payloadElement.getAttribute("secret")); photo.setTitle(payloadElement.getAttribute("title")); photo.setFarm(payloadElement.getAttribute("farm")); photo.setUrl(payloadElement.getAttribute("url")); photoContext.setNextPhoto(photo); } } return photoContext; }
java
public PhotoContext getContext(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_CONTEXT); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } PhotoContext photoContext = new PhotoContext(); Collection<Element> payload = response.getPayloadCollection(); for (Element payloadElement : payload) { String tagName = payloadElement.getTagName(); if (tagName.equals("prevphoto")) { Photo photo = new Photo(); photo.setId(payloadElement.getAttribute("id")); photo.setSecret(payloadElement.getAttribute("secret")); photo.setTitle(payloadElement.getAttribute("title")); photo.setFarm(payloadElement.getAttribute("farm")); photo.setUrl(payloadElement.getAttribute("url")); photoContext.setPreviousPhoto(photo); } else if (tagName.equals("nextphoto")) { Photo photo = new Photo(); photo.setId(payloadElement.getAttribute("id")); photo.setSecret(payloadElement.getAttribute("secret")); photo.setTitle(payloadElement.getAttribute("title")); photo.setFarm(payloadElement.getAttribute("farm")); photo.setUrl(payloadElement.getAttribute("url")); photoContext.setNextPhoto(photo); } } return photoContext; }
[ "public", "PhotoContext", "getContext", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_CONTEXT", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "PhotoContext", "photoContext", "=", "new", "PhotoContext", "(", ")", ";", "Collection", "<", "Element", ">", "payload", "=", "response", ".", "getPayloadCollection", "(", ")", ";", "for", "(", "Element", "payloadElement", ":", "payload", ")", "{", "String", "tagName", "=", "payloadElement", ".", "getTagName", "(", ")", ";", "if", "(", "tagName", ".", "equals", "(", "\"prevphoto\"", ")", ")", "{", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "payloadElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "photo", ".", "setSecret", "(", "payloadElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "photo", ".", "setTitle", "(", "payloadElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "photo", ".", "setFarm", "(", "payloadElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "photo", ".", "setUrl", "(", "payloadElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "photoContext", ".", "setPreviousPhoto", "(", "photo", ")", ";", "}", "else", "if", "(", "tagName", ".", "equals", "(", "\"nextphoto\"", ")", ")", "{", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "payloadElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "photo", ".", "setSecret", "(", "payloadElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "photo", ".", "setTitle", "(", "payloadElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "photo", ".", "setFarm", "(", "payloadElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "photo", ".", "setUrl", "(", "payloadElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "photoContext", ".", "setNextPhoto", "(", "photo", ")", ";", "}", "}", "return", "photoContext", ";", "}" ]
Get the context for the specified photo. This method does not require authentication. @param photoId The photo ID @return The PhotoContext @throws FlickrException
[ "Get", "the", "context", "for", "the", "specified", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L374-L407
160,060
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getCounts
public Collection<Photocount> getCounts(Date[] dates, Date[] takenDates) throws FlickrException { List<Photocount> photocounts = new ArrayList<Photocount>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_COUNTS); if (dates == null && takenDates == null) { throw new IllegalArgumentException("You must provide a value for either dates or takenDates"); } if (dates != null) { List<String> dateList = new ArrayList<String>(); for (int i = 0; i < dates.length; i++) { dateList.add(String.valueOf(dates[i].getTime() / 1000L)); } parameters.put("dates", StringUtilities.join(dateList, ",")); } if (takenDates != null) { List<String> takenDateList = new ArrayList<String>(); for (int i = 0; i < takenDates.length; i++) { takenDateList.add(String.valueOf(takenDates[i].getTime() / 1000L)); } parameters.put("taken_dates", StringUtilities.join(takenDateList, ",")); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photocountsElement = response.getPayload(); NodeList photocountNodes = photocountsElement.getElementsByTagName("photocount"); for (int i = 0; i < photocountNodes.getLength(); i++) { Element photocountElement = (Element) photocountNodes.item(i); Photocount photocount = new Photocount(); photocount.setCount(photocountElement.getAttribute("count")); photocount.setFromDate(photocountElement.getAttribute("fromdate")); photocount.setToDate(photocountElement.getAttribute("todate")); photocounts.add(photocount); } return photocounts; }
java
public Collection<Photocount> getCounts(Date[] dates, Date[] takenDates) throws FlickrException { List<Photocount> photocounts = new ArrayList<Photocount>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_COUNTS); if (dates == null && takenDates == null) { throw new IllegalArgumentException("You must provide a value for either dates or takenDates"); } if (dates != null) { List<String> dateList = new ArrayList<String>(); for (int i = 0; i < dates.length; i++) { dateList.add(String.valueOf(dates[i].getTime() / 1000L)); } parameters.put("dates", StringUtilities.join(dateList, ",")); } if (takenDates != null) { List<String> takenDateList = new ArrayList<String>(); for (int i = 0; i < takenDates.length; i++) { takenDateList.add(String.valueOf(takenDates[i].getTime() / 1000L)); } parameters.put("taken_dates", StringUtilities.join(takenDateList, ",")); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photocountsElement = response.getPayload(); NodeList photocountNodes = photocountsElement.getElementsByTagName("photocount"); for (int i = 0; i < photocountNodes.getLength(); i++) { Element photocountElement = (Element) photocountNodes.item(i); Photocount photocount = new Photocount(); photocount.setCount(photocountElement.getAttribute("count")); photocount.setFromDate(photocountElement.getAttribute("fromdate")); photocount.setToDate(photocountElement.getAttribute("todate")); photocounts.add(photocount); } return photocounts; }
[ "public", "Collection", "<", "Photocount", ">", "getCounts", "(", "Date", "[", "]", "dates", ",", "Date", "[", "]", "takenDates", ")", "throws", "FlickrException", "{", "List", "<", "Photocount", ">", "photocounts", "=", "new", "ArrayList", "<", "Photocount", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_COUNTS", ")", ";", "if", "(", "dates", "==", "null", "&&", "takenDates", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"You must provide a value for either dates or takenDates\"", ")", ";", "}", "if", "(", "dates", "!=", "null", ")", "{", "List", "<", "String", ">", "dateList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dates", ".", "length", ";", "i", "++", ")", "{", "dateList", ".", "add", "(", "String", ".", "valueOf", "(", "dates", "[", "i", "]", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "parameters", ".", "put", "(", "\"dates\"", ",", "StringUtilities", ".", "join", "(", "dateList", ",", "\",\"", ")", ")", ";", "}", "if", "(", "takenDates", "!=", "null", ")", "{", "List", "<", "String", ">", "takenDateList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "takenDates", ".", "length", ";", "i", "++", ")", "{", "takenDateList", ".", "add", "(", "String", ".", "valueOf", "(", "takenDates", "[", "i", "]", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "parameters", ".", "put", "(", "\"taken_dates\"", ",", "StringUtilities", ".", "join", "(", "takenDateList", ",", "\",\"", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photocountsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "photocountNodes", "=", "photocountsElement", ".", "getElementsByTagName", "(", "\"photocount\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photocountNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photocountElement", "=", "(", "Element", ")", "photocountNodes", ".", "item", "(", "i", ")", ";", "Photocount", "photocount", "=", "new", "Photocount", "(", ")", ";", "photocount", ".", "setCount", "(", "photocountElement", ".", "getAttribute", "(", "\"count\"", ")", ")", ";", "photocount", ".", "setFromDate", "(", "photocountElement", ".", "getAttribute", "(", "\"fromdate\"", ")", ")", ";", "photocount", ".", "setToDate", "(", "photocountElement", ".", "getAttribute", "(", "\"todate\"", ")", ")", ";", "photocounts", ".", "add", "(", "photocount", ")", ";", "}", "return", "photocounts", ";", "}" ]
Gets a collection of photo counts for the given date ranges for the calling user. This method requires authentication with 'read' permission. @param dates An array of dates, denoting the periods to return counts for. They should be specified smallest first. @param takenDates An array of dates, denoting the periods to return counts for. They should be specified smallest first. @return A Collection of Photocount objects
[ "Gets", "a", "collection", "of", "photo", "counts", "for", "the", "given", "date", "ranges", "for", "the", "calling", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L420-L461
160,061
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getExif
public Collection<Exif> getExif(String photoId, String secret) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_EXIF); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<Exif> exifs = new ArrayList<Exif>(); Element photoElement = response.getPayload(); NodeList exifElements = photoElement.getElementsByTagName("exif"); for (int i = 0; i < exifElements.getLength(); i++) { Element exifElement = (Element) exifElements.item(i); Exif exif = new Exif(); exif.setTagspace(exifElement.getAttribute("tagspace")); exif.setTagspaceId(exifElement.getAttribute("tagspaceid")); exif.setTag(exifElement.getAttribute("tag")); exif.setLabel(exifElement.getAttribute("label")); exif.setRaw(XMLUtilities.getChildValue(exifElement, "raw")); exif.setClean(XMLUtilities.getChildValue(exifElement, "clean")); exifs.add(exif); } return exifs; }
java
public Collection<Exif> getExif(String photoId, String secret) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_EXIF); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<Exif> exifs = new ArrayList<Exif>(); Element photoElement = response.getPayload(); NodeList exifElements = photoElement.getElementsByTagName("exif"); for (int i = 0; i < exifElements.getLength(); i++) { Element exifElement = (Element) exifElements.item(i); Exif exif = new Exif(); exif.setTagspace(exifElement.getAttribute("tagspace")); exif.setTagspaceId(exifElement.getAttribute("tagspaceid")); exif.setTag(exifElement.getAttribute("tag")); exif.setLabel(exifElement.getAttribute("label")); exif.setRaw(XMLUtilities.getChildValue(exifElement, "raw")); exif.setClean(XMLUtilities.getChildValue(exifElement, "clean")); exifs.add(exif); } return exifs; }
[ "public", "Collection", "<", "Exif", ">", "getExif", "(", "String", "photoId", ",", "String", "secret", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_EXIF", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "secret", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"secret\"", ",", "secret", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "List", "<", "Exif", ">", "exifs", "=", "new", "ArrayList", "<", "Exif", ">", "(", ")", ";", "Element", "photoElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "exifElements", "=", "photoElement", ".", "getElementsByTagName", "(", "\"exif\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "exifElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "exifElement", "=", "(", "Element", ")", "exifElements", ".", "item", "(", "i", ")", ";", "Exif", "exif", "=", "new", "Exif", "(", ")", ";", "exif", ".", "setTagspace", "(", "exifElement", ".", "getAttribute", "(", "\"tagspace\"", ")", ")", ";", "exif", ".", "setTagspaceId", "(", "exifElement", ".", "getAttribute", "(", "\"tagspaceid\"", ")", ")", ";", "exif", ".", "setTag", "(", "exifElement", ".", "getAttribute", "(", "\"tag\"", ")", ")", ";", "exif", ".", "setLabel", "(", "exifElement", ".", "getAttribute", "(", "\"label\"", ")", ")", ";", "exif", ".", "setRaw", "(", "XMLUtilities", ".", "getChildValue", "(", "exifElement", ",", "\"raw\"", ")", ")", ";", "exif", ".", "setClean", "(", "XMLUtilities", ".", "getChildValue", "(", "exifElement", ",", "\"clean\"", ")", ")", ";", "exifs", ".", "add", "(", "exif", ")", ";", "}", "return", "exifs", ";", "}" ]
Get the Exif data for the photo. The calling user must have permission to view the photo. This method does not require authentication. @param photoId The photo ID @param secret The secret @return A collection of Exif objects @throws FlickrException
[ "Get", "the", "Exif", "data", "for", "the", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L477-L505
160,062
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getFavorites
public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_FAVORITES); parameters.put("photo_id", photoId); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<User> users = new ArrayList<User>(); Element userRoot = response.getPayload(); NodeList userNodes = userRoot.getElementsByTagName("person"); for (int i = 0; i < userNodes.getLength(); i++) { Element userElement = (Element) userNodes.item(i); User user = new User(); user.setId(userElement.getAttribute("nsid")); user.setUsername(userElement.getAttribute("username")); user.setFaveDate(userElement.getAttribute("favedate")); users.add(user); } return users; }
java
public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_FAVORITES); parameters.put("photo_id", photoId); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } List<User> users = new ArrayList<User>(); Element userRoot = response.getPayload(); NodeList userNodes = userRoot.getElementsByTagName("person"); for (int i = 0; i < userNodes.getLength(); i++) { Element userElement = (Element) userNodes.item(i); User user = new User(); user.setId(userElement.getAttribute("nsid")); user.setUsername(userElement.getAttribute("username")); user.setFaveDate(userElement.getAttribute("favedate")); users.add(user); } return users; }
[ "public", "Collection", "<", "User", ">", "getFavorites", "(", "String", "photoId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_FAVORITES", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "List", "<", "User", ">", "users", "=", "new", "ArrayList", "<", "User", ">", "(", ")", ";", "Element", "userRoot", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "userNodes", "=", "userRoot", ".", "getElementsByTagName", "(", "\"person\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "userNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "userElement", "=", "(", "Element", ")", "userNodes", ".", "item", "(", "i", ")", ";", "User", "user", "=", "new", "User", "(", ")", ";", "user", ".", "setId", "(", "userElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "user", ".", "setUsername", "(", "userElement", ".", "getAttribute", "(", "\"username\"", ")", ")", ";", "user", ".", "setFaveDate", "(", "userElement", ".", "getAttribute", "(", "\"favedate\"", ")", ")", ";", "users", ".", "add", "(", "user", ")", ";", "}", "return", "users", ";", "}" ]
Returns the list of people who have favorited a given photo. This method does not require authentication. @param photoId @param perPage @param page @return List of {@link com.flickr4java.flickr.people.User}
[ "Returns", "the", "list", "of", "people", "who", "have", "favorited", "a", "given", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L517-L549
160,063
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getInfo
public Photo getInfo(String photoId, String secret) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); return PhotoUtils.createPhoto(photoElement); }
java
public Photo getInfo(String photoId, String secret) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INFO); parameters.put("photo_id", photoId); if (secret != null) { parameters.put("secret", secret); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photoElement = response.getPayload(); return PhotoUtils.createPhoto(photoElement); }
[ "public", "Photo", "getInfo", "(", "String", "photoId", ",", "String", "secret", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INFO", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "secret", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"secret\"", ",", "secret", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photoElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ";", "}" ]
Get all info for the specified photo. The calling user must have permission to view the photo. This method does not require authentication. @param photoId The photo Id @param secret The optional secret String @return The Photo @throws FlickrException
[ "Get", "all", "info", "for", "the", "specified", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L565-L581
160,064
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getNotInSet
public PhotoList<Photo> getNotInSet(int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", PhotosInterface.METHOD_GET_NOT_IN_SET); RequestContext requestContext = RequestContext.getRequestContext(); List<String> extras = requestContext.getExtras(); if (extras.size() > 0) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoElements = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> getNotInSet(int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", PhotosInterface.METHOD_GET_NOT_IN_SET); RequestContext requestContext = RequestContext.getRequestContext(); List<String> extras = requestContext.getExtras(); if (extras.size() > 0) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoElements = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getNotInSet", "(", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "PhotosInterface", ".", "METHOD_GET_NOT_IN_SET", ")", ";", "RequestContext", "requestContext", "=", "RequestContext", ".", "getRequestContext", "(", ")", ";", "List", "<", "String", ">", "extras", "=", "requestContext", ".", "getExtras", "(", ")", ";", "if", "(", "extras", ".", "size", "(", ")", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"extras\"", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoElements", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoElements", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Return a collection of Photo objects not in part of any sets. This method requires authentication with 'read' permission. @param perPage The per page @param page The page @return The collection of Photo objects @throws FlickrException
[ "Return", "a", "collection", "of", "Photo", "objects", "not", "in", "part", "of", "any", "sets", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L595-L631
160,065
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getPerms
public Permissions getPerms(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PERMS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element permissionsElement = response.getPayload(); Permissions permissions = new Permissions(); permissions.setId(permissionsElement.getAttribute("id")); permissions.setPublicFlag("1".equals(permissionsElement.getAttribute("ispublic"))); permissions.setFamilyFlag("1".equals(permissionsElement.getAttribute("isfamily"))); permissions.setFriendFlag("1".equals(permissionsElement.getAttribute("isfriend"))); permissions.setComment(permissionsElement.getAttribute("permcomment")); permissions.setAddmeta(permissionsElement.getAttribute("permaddmeta")); return permissions; }
java
public Permissions getPerms(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PERMS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element permissionsElement = response.getPayload(); Permissions permissions = new Permissions(); permissions.setId(permissionsElement.getAttribute("id")); permissions.setPublicFlag("1".equals(permissionsElement.getAttribute("ispublic"))); permissions.setFamilyFlag("1".equals(permissionsElement.getAttribute("isfamily"))); permissions.setFriendFlag("1".equals(permissionsElement.getAttribute("isfriend"))); permissions.setComment(permissionsElement.getAttribute("permcomment")); permissions.setAddmeta(permissionsElement.getAttribute("permaddmeta")); return permissions; }
[ "public", "Permissions", "getPerms", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PERMS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "permissionsElement", "=", "response", ".", "getPayload", "(", ")", ";", "Permissions", "permissions", "=", "new", "Permissions", "(", ")", ";", "permissions", ".", "setId", "(", "permissionsElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "permissions", ".", "setPublicFlag", "(", "\"1\"", ".", "equals", "(", "permissionsElement", ".", "getAttribute", "(", "\"ispublic\"", ")", ")", ")", ";", "permissions", ".", "setFamilyFlag", "(", "\"1\"", ".", "equals", "(", "permissionsElement", ".", "getAttribute", "(", "\"isfamily\"", ")", ")", ")", ";", "permissions", ".", "setFriendFlag", "(", "\"1\"", ".", "equals", "(", "permissionsElement", ".", "getAttribute", "(", "\"isfriend\"", ")", ")", ")", ";", "permissions", ".", "setComment", "(", "permissionsElement", ".", "getAttribute", "(", "\"permcomment\"", ")", ")", ";", "permissions", ".", "setAddmeta", "(", "permissionsElement", ".", "getAttribute", "(", "\"permaddmeta\"", ")", ")", ";", "return", "permissions", ";", "}" ]
Get the permission information for the specified photo. This method requires authentication with 'read' permission. @param photoId The photo id @return The Permissions object @throws FlickrException
[ "Get", "the", "permission", "information", "for", "the", "specified", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L643-L662
160,066
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getRecent
public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_RECENT); if (extras != null && !extras.isEmpty()) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
java
public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_RECENT); if (extras != null && !extras.isEmpty()) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getRecent", "(", "Set", "<", "String", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_RECENT", ")", ";", "if", "(", "extras", "!=", "null", "&&", "!", "extras", ".", "isEmpty", "(", ")", ")", "{", "parameters", ".", "put", "(", "Extras", ".", "KEY_EXTRAS", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "PhotoList", "<", "Photo", ">", "photos", "=", "PhotoUtils", ".", "createPhotoList", "(", "photosElement", ")", ";", "return", "photos", ";", "}" ]
Get a collection of recent photos. This method does not require authentication. @see com.flickr4java.flickr.photos.Extras @param extras Set of extra-fields @param perPage The number of photos per page @param page The page offset @return A collection of Photo objects @throws FlickrException
[ "Get", "a", "collection", "of", "recent", "photos", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L679-L700
160,067
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getSizes
public Collection<Size> getSizes(String photoId, boolean sign) throws FlickrException { SizeList<Size> sizes = new SizeList<Size>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SIZES); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element sizesElement = response.getPayload(); sizes.setIsCanBlog("1".equals(sizesElement.getAttribute("canblog"))); sizes.setIsCanDownload("1".equals(sizesElement.getAttribute("candownload"))); sizes.setIsCanPrint("1".equals(sizesElement.getAttribute("canprint"))); NodeList sizeNodes = sizesElement.getElementsByTagName("size"); for (int i = 0; i < sizeNodes.getLength(); i++) { Element sizeElement = (Element) sizeNodes.item(i); Size size = new Size(); size.setLabel(sizeElement.getAttribute("label")); size.setWidth(sizeElement.getAttribute("width")); size.setHeight(sizeElement.getAttribute("height")); size.setSource(sizeElement.getAttribute("source")); size.setUrl(sizeElement.getAttribute("url")); size.setMedia(sizeElement.getAttribute("media")); sizes.add(size); } return sizes; }
java
public Collection<Size> getSizes(String photoId, boolean sign) throws FlickrException { SizeList<Size> sizes = new SizeList<Size>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_SIZES); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element sizesElement = response.getPayload(); sizes.setIsCanBlog("1".equals(sizesElement.getAttribute("canblog"))); sizes.setIsCanDownload("1".equals(sizesElement.getAttribute("candownload"))); sizes.setIsCanPrint("1".equals(sizesElement.getAttribute("canprint"))); NodeList sizeNodes = sizesElement.getElementsByTagName("size"); for (int i = 0; i < sizeNodes.getLength(); i++) { Element sizeElement = (Element) sizeNodes.item(i); Size size = new Size(); size.setLabel(sizeElement.getAttribute("label")); size.setWidth(sizeElement.getAttribute("width")); size.setHeight(sizeElement.getAttribute("height")); size.setSource(sizeElement.getAttribute("source")); size.setUrl(sizeElement.getAttribute("url")); size.setMedia(sizeElement.getAttribute("media")); sizes.add(size); } return sizes; }
[ "public", "Collection", "<", "Size", ">", "getSizes", "(", "String", "photoId", ",", "boolean", "sign", ")", "throws", "FlickrException", "{", "SizeList", "<", "Size", ">", "sizes", "=", "new", "SizeList", "<", "Size", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_SIZES", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "sizesElement", "=", "response", ".", "getPayload", "(", ")", ";", "sizes", ".", "setIsCanBlog", "(", "\"1\"", ".", "equals", "(", "sizesElement", ".", "getAttribute", "(", "\"canblog\"", ")", ")", ")", ";", "sizes", ".", "setIsCanDownload", "(", "\"1\"", ".", "equals", "(", "sizesElement", ".", "getAttribute", "(", "\"candownload\"", ")", ")", ")", ";", "sizes", ".", "setIsCanPrint", "(", "\"1\"", ".", "equals", "(", "sizesElement", ".", "getAttribute", "(", "\"canprint\"", ")", ")", ")", ";", "NodeList", "sizeNodes", "=", "sizesElement", ".", "getElementsByTagName", "(", "\"size\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sizeNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "sizeElement", "=", "(", "Element", ")", "sizeNodes", ".", "item", "(", "i", ")", ";", "Size", "size", "=", "new", "Size", "(", ")", ";", "size", ".", "setLabel", "(", "sizeElement", ".", "getAttribute", "(", "\"label\"", ")", ")", ";", "size", ".", "setWidth", "(", "sizeElement", ".", "getAttribute", "(", "\"width\"", ")", ")", ";", "size", ".", "setHeight", "(", "sizeElement", ".", "getAttribute", "(", "\"height\"", ")", ")", ";", "size", ".", "setSource", "(", "sizeElement", ".", "getAttribute", "(", "\"source\"", ")", ")", ";", "size", ".", "setUrl", "(", "sizeElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "size", ".", "setMedia", "(", "sizeElement", ".", "getAttribute", "(", "\"media\"", ")", ")", ";", "sizes", ".", "add", "(", "size", ")", ";", "}", "return", "sizes", ";", "}" ]
Get the available sizes of a Photo. The boolean toggle allows to (api-)sign the call. This way the calling user can retrieve sizes for <b>his own</b> private photos. @param photoId The photo ID @param sign toggle to allow optionally signing the call (Authenticate) @return A collection of {@link Size} @throws FlickrException
[ "Get", "the", "available", "sizes", "of", "a", "Photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L732-L761
160,068
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getUntagged
public PhotoList<Photo> getUntagged(int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_UNTAGGED); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
java
public PhotoList<Photo> getUntagged(int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_UNTAGGED); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getUntagged", "(", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_UNTAGGED", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "PhotoList", "<", "Photo", ">", "photos", "=", "PhotoUtils", ".", "createPhotoList", "(", "photosElement", ")", ";", "return", "photos", ";", "}" ]
Get the collection of untagged photos. This method requires authentication with 'read' permission. @param perPage @param page @return A Collection of Photos @throws FlickrException
[ "Get", "the", "collection", "of", "untagged", "photos", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L773-L791
160,069
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getWithGeoData
public PhotoList<Photo> getWithGeoData(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate, int privacyFilter, String sort, Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_WITH_GEO_DATA); if (minUploadDate != null) { parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L)); } if (maxUploadDate != null) { parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L)); } if (minTakenDate != null) { parameters.put("min_taken_date", Long.toString(minTakenDate.getTime() / 1000L)); } if (maxTakenDate != null) { parameters.put("max_taken_date", Long.toString(maxTakenDate.getTime() / 1000L)); } if (privacyFilter > 0) { parameters.put("privacy_filter", Integer.toString(privacyFilter)); } if (sort != null) { parameters.put("sort", sort); } if (extras != null && !extras.isEmpty()) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
java
public PhotoList<Photo> getWithGeoData(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate, int privacyFilter, String sort, Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_WITH_GEO_DATA); if (minUploadDate != null) { parameters.put("min_upload_date", Long.toString(minUploadDate.getTime() / 1000L)); } if (maxUploadDate != null) { parameters.put("max_upload_date", Long.toString(maxUploadDate.getTime() / 1000L)); } if (minTakenDate != null) { parameters.put("min_taken_date", Long.toString(minTakenDate.getTime() / 1000L)); } if (maxTakenDate != null) { parameters.put("max_taken_date", Long.toString(maxTakenDate.getTime() / 1000L)); } if (privacyFilter > 0) { parameters.put("privacy_filter", Integer.toString(privacyFilter)); } if (sort != null) { parameters.put("sort", sort); } if (extras != null && !extras.isEmpty()) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement); return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getWithGeoData", "(", "Date", "minUploadDate", ",", "Date", "maxUploadDate", ",", "Date", "minTakenDate", ",", "Date", "maxTakenDate", ",", "int", "privacyFilter", ",", "String", "sort", ",", "Set", "<", "String", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_WITH_GEO_DATA", ")", ";", "if", "(", "minUploadDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"min_upload_date\"", ",", "Long", ".", "toString", "(", "minUploadDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "maxUploadDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"max_upload_date\"", ",", "Long", ".", "toString", "(", "maxUploadDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "minTakenDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"min_taken_date\"", ",", "Long", ".", "toString", "(", "minTakenDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "maxTakenDate", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"max_taken_date\"", ",", "Long", ".", "toString", "(", "maxTakenDate", ".", "getTime", "(", ")", "/", "1000L", ")", ")", ";", "}", "if", "(", "privacyFilter", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"privacy_filter\"", ",", "Integer", ".", "toString", "(", "privacyFilter", ")", ")", ";", "}", "if", "(", "sort", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"sort\"", ",", "sort", ")", ";", "}", "if", "(", "extras", "!=", "null", "&&", "!", "extras", ".", "isEmpty", "(", ")", ")", "{", "parameters", ".", "put", "(", "\"extras\"", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "PhotoList", "<", "Photo", ">", "photos", "=", "PhotoUtils", ".", "createPhotoList", "(", "photosElement", ")", ";", "return", "photos", ";", "}" ]
Returns a list of your geo-tagged photos. This method requires authentication with 'read' permission. @param minUploadDate Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. Set to null to not specify a date. @param maxUploadDate Maximum upload date. Photos with an upload date less than or equal to this value will be returned. Set to null to not specify a date. @param minTakenDate Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. Set to null to not specify a date. @param maxTakenDate Maximum taken date. Photos with an taken date less than or equal to this value will be returned. Set to null to not specify a date. @param privacyFilter Return photos only matching a certain privacy level. Valid values are: <ul> <li>1 public photos</li> <li>2 private photos visible to friends</li> <li>3 private photos visible to family</li> <li>4 private photos visible to friends & family</li> <li>5 completely private photos</li> </ul> Set to 0 to not specify a privacy Filter. @see com.flickr4java.flickr.photos.Extras @param sort The order in which to sort returned photos. Deafults to date-posted-desc. The possible values are: date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc, interestingness-desc, and interestingness-asc. @param extras A set of Strings controlling the extra information to fetch for each returned record. Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo. Set to null or an empty set to not specify any extras. @param perPage Number of photos to return per page. If this argument is 0, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is 0, it defaults to 1. @return photos @throws FlickrException
[ "Returns", "a", "list", "of", "your", "geo", "-", "tagged", "photos", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L831-L871
160,070
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.removeTag
public void removeTag(String tagId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE_TAG); parameters.put("tag_id", tagId); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void removeTag(String tagId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE_TAG); parameters.put("tag_id", tagId); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "removeTag", "(", "String", "tagId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_REMOVE_TAG", ")", ";", "parameters", ".", "put", "(", "\"tag_id\"", ",", "tagId", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Remove a tag from a photo. This method requires authentication with 'write' permission. @param tagId The tag ID @throws FlickrException
[ "Remove", "a", "tag", "from", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1006-L1016
160,071
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.search
public PhotoList<Photo> search(SearchParameters params, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SEARCH); parameters.putAll(params.getAsParameters()); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> search(SearchParameters params, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SEARCH); parameters.putAll(params.getAsParameters()); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "search", "(", "SearchParameters", "params", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SEARCH", ")", ";", "parameters", ".", "putAll", "(", "params", ".", "getAsParameters", "(", ")", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Search for photos which match the given search parameters. @param params The search parameters @param perPage The number of photos to show per page @param page The page offset @return A PhotoList @throws FlickrException
[ "Search", "for", "photos", "which", "match", "the", "given", "search", "parameters", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1030-L1061
160,072
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.searchInterestingness
public PhotoList<Photo> searchInterestingness(SearchParameters params, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INTERESTINGNESS); parameters.putAll(params.getAsParameters()); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); Photo photo = new Photo(); photo.setId(photoElement.getAttribute("id")); User owner = new User(); owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setSecret(photoElement.getAttribute("secret")); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm")); photo.setTitle(photoElement.getAttribute("title")); photo.setPublicFlag("1".equals(photoElement.getAttribute("ispublic"))); photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend"))); photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily"))); photos.add(photo); } return photos; }
java
public PhotoList<Photo> searchInterestingness(SearchParameters params, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_INTERESTINGNESS); parameters.putAll(params.getAsParameters()); if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); Photo photo = new Photo(); photo.setId(photoElement.getAttribute("id")); User owner = new User(); owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setSecret(photoElement.getAttribute("secret")); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm")); photo.setTitle(photoElement.getAttribute("title")); photo.setPublicFlag("1".equals(photoElement.getAttribute("ispublic"))); photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend"))); photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily"))); photos.add(photo); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "searchInterestingness", "(", "SearchParameters", "params", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_INTERESTINGNESS", ")", ";", "parameters", ".", "putAll", "(", "params", ".", "getAsParameters", "(", ")", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "Photo", "photo", "=", "new", "Photo", "(", ")", ";", "photo", ".", "setId", "(", "photoElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "User", "owner", "=", "new", "User", "(", ")", ";", "owner", ".", "setId", "(", "photoElement", ".", "getAttribute", "(", "\"owner\"", ")", ")", ";", "photo", ".", "setOwner", "(", "owner", ")", ";", "photo", ".", "setSecret", "(", "photoElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "photo", ".", "setServer", "(", "photoElement", ".", "getAttribute", "(", "\"server\"", ")", ")", ";", "photo", ".", "setFarm", "(", "photoElement", ".", "getAttribute", "(", "\"farm\"", ")", ")", ";", "photo", ".", "setTitle", "(", "photoElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "photo", ".", "setPublicFlag", "(", "\"1\"", ".", "equals", "(", "photoElement", ".", "getAttribute", "(", "\"ispublic\"", ")", ")", ")", ";", "photo", ".", "setFriendFlag", "(", "\"1\"", ".", "equals", "(", "photoElement", ".", "getAttribute", "(", "\"isfriend\"", ")", ")", ")", ";", "photo", ".", "setFamilyFlag", "(", "\"1\"", ".", "equals", "(", "photoElement", ".", "getAttribute", "(", "\"isfamily\"", ")", ")", ")", ";", "photos", ".", "add", "(", "photo", ")", ";", "}", "return", "photos", ";", "}" ]
Search for interesting photos using the Flickr Interestingness algorithm. @param params Any search parameters @param perPage Number of items per page @param page The page to start on @return A PhotoList @throws FlickrException
[ "Search", "for", "interesting", "photos", "using", "the", "Flickr", "Interestingness", "algorithm", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1075-L1120
160,073
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setContentType
public void setContentType(String photoId, String contentType) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_CONTENTTYPE); parameters.put("photo_id", photoId); parameters.put("content_type", contentType); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setContentType(String photoId, String contentType) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_CONTENTTYPE); parameters.put("photo_id", photoId); parameters.put("content_type", contentType); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setContentType", "(", "String", "photoId", ",", "String", "contentType", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_CONTENTTYPE", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"content_type\"", ",", "contentType", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the content type of a photo. This method requires authentication with 'write' permission. @see com.flickr4java.flickr.Flickr#CONTENTTYPE_PHOTO @see com.flickr4java.flickr.Flickr#CONTENTTYPE_SCREENSHOT @see com.flickr4java.flickr.Flickr#CONTENTTYPE_OTHER @param photoId The photo ID @param contentType The contentType to set @throws FlickrException
[ "Set", "the", "content", "type", "of", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1136-L1147
160,074
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setDates
public void setDates(String photoId, Date datePosted, Date dateTaken, String dateTakenGranularity) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_DATES); parameters.put("photo_id", photoId); if (datePosted != null) { parameters.put("date_posted", Long.toString(datePosted.getTime() / 1000)); } if (dateTaken != null) { parameters.put("date_taken", ((DateFormat) DATE_FORMATS.get()).format(dateTaken)); } if (dateTakenGranularity != null) { parameters.put("date_taken_granularity", dateTakenGranularity); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setDates(String photoId, Date datePosted, Date dateTaken, String dateTakenGranularity) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_DATES); parameters.put("photo_id", photoId); if (datePosted != null) { parameters.put("date_posted", Long.toString(datePosted.getTime() / 1000)); } if (dateTaken != null) { parameters.put("date_taken", ((DateFormat) DATE_FORMATS.get()).format(dateTaken)); } if (dateTakenGranularity != null) { parameters.put("date_taken_granularity", dateTakenGranularity); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setDates", "(", "String", "photoId", ",", "Date", "datePosted", ",", "Date", "dateTaken", ",", "String", "dateTakenGranularity", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_DATES", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "datePosted", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"date_posted\"", ",", "Long", ".", "toString", "(", "datePosted", ".", "getTime", "(", ")", "/", "1000", ")", ")", ";", "}", "if", "(", "dateTaken", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"date_taken\"", ",", "(", "(", "DateFormat", ")", "DATE_FORMATS", ".", "get", "(", ")", ")", ".", "format", "(", "dateTaken", ")", ")", ";", "}", "if", "(", "dateTakenGranularity", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"date_taken_granularity\"", ",", "dateTakenGranularity", ")", ";", "}", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the dates for the specified photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param datePosted The date the photo was posted or null @param dateTaken The date the photo was taken or null @param dateTakenGranularity The granularity of the taken date or null @throws FlickrException
[ "Set", "the", "dates", "for", "the", "specified", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1164-L1186
160,075
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setMeta
public void setMeta(String photoId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setMeta(String photoId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setMeta", "(", "String", "photoId", ",", "String", "title", ",", "String", "description", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_META", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"title\"", ",", "title", ")", ";", "parameters", ".", "put", "(", "\"description\"", ",", "description", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the meta data for the photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param title The new title @param description The new description @throws FlickrException
[ "Set", "the", "meta", "data", "for", "the", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1201-L1213
160,076
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setPerms
public void setPerms(String photoId, Permissions permissions) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_PERMS); parameters.put("photo_id", photoId); parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0"); parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0"); parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0"); parameters.put("perm_comment", Integer.toString(permissions.getComment())); parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta())); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setPerms(String photoId, Permissions permissions) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_PERMS); parameters.put("photo_id", photoId); parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0"); parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0"); parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0"); parameters.put("perm_comment", Integer.toString(permissions.getComment())); parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta())); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setPerms", "(", "String", "photoId", ",", "Permissions", "permissions", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_PERMS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"is_public\"", ",", "permissions", ".", "isPublicFlag", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"is_friend\"", ",", "permissions", ".", "isFriendFlag", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"is_family\"", ",", "permissions", ".", "isFamilyFlag", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"perm_comment\"", ",", "Integer", ".", "toString", "(", "permissions", ".", "getComment", "(", ")", ")", ")", ";", "parameters", ".", "put", "(", "\"perm_addmeta\"", ",", "Integer", ".", "toString", "(", "permissions", ".", "getAddmeta", "(", ")", ")", ")", ";", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the permissions for the photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param permissions The permissions object @throws FlickrException
[ "Set", "the", "permissions", "for", "the", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1226-L1241
160,077
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/upload/UploadInterface.java
UploadInterface.checkTickets
public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_CHECK_TICKETS); StringBuffer sb = new StringBuffer(); Iterator<String> it = tickets.iterator(); while (it.hasNext()) { if (sb.length() > 0) { sb.append(","); } Object obj = it.next(); if (obj instanceof Ticket) { sb.append(((Ticket) obj).getTicketId()); } else { sb.append(obj); } } parameters.put("tickets", sb.toString()); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // <uploader> // <ticket id="128" complete="1" photoid="2995" /> // <ticket id="129" complete="0" /> // <ticket id="130" complete="2" /> // <ticket id="131" invalid="1" /> // </uploader> List<Ticket> list = new ArrayList<Ticket>(); Element uploaderElement = response.getPayload(); NodeList ticketNodes = uploaderElement.getElementsByTagName("ticket"); int n = ticketNodes.getLength(); for (int i = 0; i < n; i++) { Element ticketElement = (Element) ticketNodes.item(i); String id = ticketElement.getAttribute("id"); String complete = ticketElement.getAttribute("complete"); boolean invalid = "1".equals(ticketElement.getAttribute("invalid")); String photoId = ticketElement.getAttribute("photoid"); Ticket info = new Ticket(); info.setTicketId(id); info.setInvalid(invalid); info.setStatus(Integer.parseInt(complete)); info.setPhotoId(photoId); list.add(info); } return list; }
java
public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_CHECK_TICKETS); StringBuffer sb = new StringBuffer(); Iterator<String> it = tickets.iterator(); while (it.hasNext()) { if (sb.length() > 0) { sb.append(","); } Object obj = it.next(); if (obj instanceof Ticket) { sb.append(((Ticket) obj).getTicketId()); } else { sb.append(obj); } } parameters.put("tickets", sb.toString()); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // <uploader> // <ticket id="128" complete="1" photoid="2995" /> // <ticket id="129" complete="0" /> // <ticket id="130" complete="2" /> // <ticket id="131" invalid="1" /> // </uploader> List<Ticket> list = new ArrayList<Ticket>(); Element uploaderElement = response.getPayload(); NodeList ticketNodes = uploaderElement.getElementsByTagName("ticket"); int n = ticketNodes.getLength(); for (int i = 0; i < n; i++) { Element ticketElement = (Element) ticketNodes.item(i); String id = ticketElement.getAttribute("id"); String complete = ticketElement.getAttribute("complete"); boolean invalid = "1".equals(ticketElement.getAttribute("invalid")); String photoId = ticketElement.getAttribute("photoid"); Ticket info = new Ticket(); info.setTicketId(id); info.setInvalid(invalid); info.setStatus(Integer.parseInt(complete)); info.setPhotoId(photoId); list.add(info); } return list; }
[ "public", "List", "<", "Ticket", ">", "checkTickets", "(", "Set", "<", "String", ">", "tickets", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_CHECK_TICKETS", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "<", "String", ">", "it", "=", "tickets", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "Object", "obj", "=", "it", ".", "next", "(", ")", ";", "if", "(", "obj", "instanceof", "Ticket", ")", "{", "sb", ".", "append", "(", "(", "(", "Ticket", ")", "obj", ")", ".", "getTicketId", "(", ")", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "obj", ")", ";", "}", "}", "parameters", ".", "put", "(", "\"tickets\"", ",", "sb", ".", "toString", "(", ")", ")", ";", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// <uploader>\r", "// <ticket id=\"128\" complete=\"1\" photoid=\"2995\" />\r", "// <ticket id=\"129\" complete=\"0\" />\r", "// <ticket id=\"130\" complete=\"2\" />\r", "// <ticket id=\"131\" invalid=\"1\" />\r", "// </uploader>\r", "List", "<", "Ticket", ">", "list", "=", "new", "ArrayList", "<", "Ticket", ">", "(", ")", ";", "Element", "uploaderElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "ticketNodes", "=", "uploaderElement", ".", "getElementsByTagName", "(", "\"ticket\"", ")", ";", "int", "n", "=", "ticketNodes", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "Element", "ticketElement", "=", "(", "Element", ")", "ticketNodes", ".", "item", "(", "i", ")", ";", "String", "id", "=", "ticketElement", ".", "getAttribute", "(", "\"id\"", ")", ";", "String", "complete", "=", "ticketElement", ".", "getAttribute", "(", "\"complete\"", ")", ";", "boolean", "invalid", "=", "\"1\"", ".", "equals", "(", "ticketElement", ".", "getAttribute", "(", "\"invalid\"", ")", ")", ";", "String", "photoId", "=", "ticketElement", ".", "getAttribute", "(", "\"photoid\"", ")", ";", "Ticket", "info", "=", "new", "Ticket", "(", ")", ";", "info", ".", "setTicketId", "(", "id", ")", ";", "info", ".", "setInvalid", "(", "invalid", ")", ";", "info", ".", "setStatus", "(", "Integer", ".", "parseInt", "(", "complete", ")", ")", ";", "info", ".", "setPhotoId", "(", "photoId", ")", ";", "list", ".", "add", "(", "info", ")", ";", "}", "return", "list", ";", "}" ]
Checks the status of one or more asynchronous photo upload tickets. This method does not require authentication. @param tickets a set of ticket ids (Strings) or {@link Ticket} objects containing ids @return a list of {@link Ticket} objects. @throws FlickrException
[ "Checks", "the", "status", "of", "one", "or", "more", "asynchronous", "photo", "upload", "tickets", ".", "This", "method", "does", "not", "require", "authentication", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/upload/UploadInterface.java#L46-L95
160,078
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/REST.java
REST.setProxy
public void setProxy(String proxyHost, int proxyPort) { System.setProperty("http.proxySet", "true"); System.setProperty("http.proxyHost", proxyHost); System.setProperty("http.proxyPort", "" + proxyPort); System.setProperty("https.proxyHost", proxyHost); System.setProperty("https.proxyPort", "" + proxyPort); }
java
public void setProxy(String proxyHost, int proxyPort) { System.setProperty("http.proxySet", "true"); System.setProperty("http.proxyHost", proxyHost); System.setProperty("http.proxyPort", "" + proxyPort); System.setProperty("https.proxyHost", proxyHost); System.setProperty("https.proxyPort", "" + proxyPort); }
[ "public", "void", "setProxy", "(", "String", "proxyHost", ",", "int", "proxyPort", ")", "{", "System", ".", "setProperty", "(", "\"http.proxySet\"", ",", "\"true\"", ")", ";", "System", ".", "setProperty", "(", "\"http.proxyHost\"", ",", "proxyHost", ")", ";", "System", ".", "setProperty", "(", "\"http.proxyPort\"", ",", "\"\"", "+", "proxyPort", ")", ";", "System", ".", "setProperty", "(", "\"https.proxyHost\"", ",", "proxyHost", ")", ";", "System", ".", "setProperty", "(", "\"https.proxyPort\"", ",", "\"\"", "+", "proxyPort", ")", ";", "}" ]
Set a proxy for REST-requests. @param proxyHost @param proxyPort
[ "Set", "a", "proxy", "for", "REST", "-", "requests", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L103-L109
160,079
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/REST.java
REST.setProxy
public void setProxy(String proxyHost, int proxyPort, String username, String password) { setProxy(proxyHost, proxyPort); proxyAuth = true; proxyUser = username; proxyPassword = password; }
java
public void setProxy(String proxyHost, int proxyPort, String username, String password) { setProxy(proxyHost, proxyPort); proxyAuth = true; proxyUser = username; proxyPassword = password; }
[ "public", "void", "setProxy", "(", "String", "proxyHost", ",", "int", "proxyPort", ",", "String", "username", ",", "String", "password", ")", "{", "setProxy", "(", "proxyHost", ",", "proxyPort", ")", ";", "proxyAuth", "=", "true", ";", "proxyUser", "=", "username", ";", "proxyPassword", "=", "password", ";", "}" ]
Set a proxy with authentication for REST-requests. @param proxyHost @param proxyPort @param username @param password
[ "Set", "a", "proxy", "with", "authentication", "for", "REST", "-", "requests", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L119-L124
160,080
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/REST.java
REST.get
@Override public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException { OAuthRequest request = new OAuthRequest(Verb.GET, buildUrl(path)); for (Map.Entry<String, Object> entry : parameters.entrySet()) { request.addQuerystringParameter(entry.getKey(), String.valueOf(entry.getValue())); } if (proxyAuth) { request.addHeader("Proxy-Authorization", "Basic " + getProxyCredentials()); } RequestContext requestContext = RequestContext.getRequestContext(); Auth auth = requestContext.getAuth(); OAuth10aService service = createOAuthService(apiKey, sharedSecret); if (auth != null) { OAuth1AccessToken requestToken = new OAuth1AccessToken(auth.getToken(), auth.getTokenSecret()); service.signRequest(requestToken, request); } else { // For calls that do not require authorization e.g. flickr.people.findByUsername which could be the // first call if the user did not supply the user-id (i.e. nsid). if (!parameters.containsKey(Flickr.API_KEY)) { request.addQuerystringParameter(Flickr.API_KEY, apiKey); } } if (Flickr.debugRequest) { logger.debug("GET: " + request.getCompleteUrl()); } try { return handleResponse(request, service); } catch (IllegalAccessException | InstantiationException | SAXException | IOException | InterruptedException | ExecutionException | ParserConfigurationException e) { throw new FlickrRuntimeException(e); } }
java
@Override public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException { OAuthRequest request = new OAuthRequest(Verb.GET, buildUrl(path)); for (Map.Entry<String, Object> entry : parameters.entrySet()) { request.addQuerystringParameter(entry.getKey(), String.valueOf(entry.getValue())); } if (proxyAuth) { request.addHeader("Proxy-Authorization", "Basic " + getProxyCredentials()); } RequestContext requestContext = RequestContext.getRequestContext(); Auth auth = requestContext.getAuth(); OAuth10aService service = createOAuthService(apiKey, sharedSecret); if (auth != null) { OAuth1AccessToken requestToken = new OAuth1AccessToken(auth.getToken(), auth.getTokenSecret()); service.signRequest(requestToken, request); } else { // For calls that do not require authorization e.g. flickr.people.findByUsername which could be the // first call if the user did not supply the user-id (i.e. nsid). if (!parameters.containsKey(Flickr.API_KEY)) { request.addQuerystringParameter(Flickr.API_KEY, apiKey); } } if (Flickr.debugRequest) { logger.debug("GET: " + request.getCompleteUrl()); } try { return handleResponse(request, service); } catch (IllegalAccessException | InstantiationException | SAXException | IOException | InterruptedException | ExecutionException | ParserConfigurationException e) { throw new FlickrRuntimeException(e); } }
[ "@", "Override", "public", "com", ".", "flickr4java", ".", "flickr", ".", "Response", "get", "(", "String", "path", ",", "Map", "<", "String", ",", "Object", ">", "parameters", ",", "String", "apiKey", ",", "String", "sharedSecret", ")", "throws", "FlickrException", "{", "OAuthRequest", "request", "=", "new", "OAuthRequest", "(", "Verb", ".", "GET", ",", "buildUrl", "(", "path", ")", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "parameters", ".", "entrySet", "(", ")", ")", "{", "request", ".", "addQuerystringParameter", "(", "entry", ".", "getKey", "(", ")", ",", "String", ".", "valueOf", "(", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "if", "(", "proxyAuth", ")", "{", "request", ".", "addHeader", "(", "\"Proxy-Authorization\"", ",", "\"Basic \"", "+", "getProxyCredentials", "(", ")", ")", ";", "}", "RequestContext", "requestContext", "=", "RequestContext", ".", "getRequestContext", "(", ")", ";", "Auth", "auth", "=", "requestContext", ".", "getAuth", "(", ")", ";", "OAuth10aService", "service", "=", "createOAuthService", "(", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "auth", "!=", "null", ")", "{", "OAuth1AccessToken", "requestToken", "=", "new", "OAuth1AccessToken", "(", "auth", ".", "getToken", "(", ")", ",", "auth", ".", "getTokenSecret", "(", ")", ")", ";", "service", ".", "signRequest", "(", "requestToken", ",", "request", ")", ";", "}", "else", "{", "// For calls that do not require authorization e.g. flickr.people.findByUsername which could be the", "// first call if the user did not supply the user-id (i.e. nsid).", "if", "(", "!", "parameters", ".", "containsKey", "(", "Flickr", ".", "API_KEY", ")", ")", "{", "request", ".", "addQuerystringParameter", "(", "Flickr", ".", "API_KEY", ",", "apiKey", ")", ";", "}", "}", "if", "(", "Flickr", ".", "debugRequest", ")", "{", "logger", ".", "debug", "(", "\"GET: \"", "+", "request", ".", "getCompleteUrl", "(", ")", ")", ";", "}", "try", "{", "return", "handleResponse", "(", "request", ",", "service", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "InstantiationException", "|", "SAXException", "|", "IOException", "|", "InterruptedException", "|", "ExecutionException", "|", "ParserConfigurationException", "e", ")", "{", "throw", "new", "FlickrRuntimeException", "(", "e", ")", ";", "}", "}" ]
Invoke an HTTP GET request on a remote host. You must close the InputStream after you are done with. @param path The request path @param parameters The parameters (collection of Parameter objects) @return The Response
[ "Invoke", "an", "HTTP", "GET", "request", "on", "a", "remote", "host", ".", "You", "must", "close", "the", "InputStream", "after", "you", "are", "done", "with", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/REST.java#L133-L168
160,081
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java
PhotosetsCommentsInterface.addComment
public String addComment(String photosetId, String commentText) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_COMMENT); parameters.put("photoset_id", photosetId); parameters.put("comment_text", commentText); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // response: // <comment id="97777-12492-72057594037942601" /> Element commentElement = response.getPayload(); return commentElement.getAttribute("id"); }
java
public String addComment(String photosetId, String commentText) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_COMMENT); parameters.put("photoset_id", photosetId); parameters.put("comment_text", commentText); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // response: // <comment id="97777-12492-72057594037942601" /> Element commentElement = response.getPayload(); return commentElement.getAttribute("id"); }
[ "public", "String", "addComment", "(", "String", "photosetId", ",", "String", "commentText", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_ADD_COMMENT", ")", ";", "parameters", ".", "put", "(", "\"photoset_id\"", ",", "photosetId", ")", ";", "parameters", ".", "put", "(", "\"comment_text\"", ",", "commentText", ")", ";", "// Note: This method requires an HTTP POST request.\r", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// response:\r", "// <comment id=\"97777-12492-72057594037942601\" />\r", "Element", "commentElement", "=", "response", ".", "getPayload", "(", ")", ";", "return", "commentElement", ".", "getAttribute", "(", "\"id\"", ")", ";", "}" ]
Add a comment to a photoset. This method requires authentication with 'write' permission. @param photosetId The id of the photoset to add a comment to. @param commentText Text of the comment @return the comment id @throws FlickrException
[ "Add", "a", "comment", "to", "a", "photoset", ".", "This", "method", "requires", "authentication", "with", "write", "permission", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java#L55-L71
160,082
boncey/Flickr4Java
src/examples/java/FlickrCrawler.java
FlickrCrawler.convertToFileSystemChar
public static String convertToFileSystemChar(String name) { String erg = ""; Matcher m = Pattern.compile("[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]", Pattern.CASE_INSENSITIVE).matcher(name); while (m.find()) { erg += name.substring(m.start(), m.end()); } if (erg.length() > 200) { erg = erg.substring(0, 200); System.out.println("cut filename: " + erg); } return erg; }
java
public static String convertToFileSystemChar(String name) { String erg = ""; Matcher m = Pattern.compile("[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]", Pattern.CASE_INSENSITIVE).matcher(name); while (m.find()) { erg += name.substring(m.start(), m.end()); } if (erg.length() > 200) { erg = erg.substring(0, 200); System.out.println("cut filename: " + erg); } return erg; }
[ "public", "static", "String", "convertToFileSystemChar", "(", "String", "name", ")", "{", "String", "erg", "=", "\"\"", ";", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "\"[a-z0-9 _#&@\\\\[\\\\(\\\\)\\\\]\\\\-\\\\.]\"", ",", "Pattern", ".", "CASE_INSENSITIVE", ")", ".", "matcher", "(", "name", ")", ";", "while", "(", "m", ".", "find", "(", ")", ")", "{", "erg", "+=", "name", ".", "substring", "(", "m", ".", "start", "(", ")", ",", "m", ".", "end", "(", ")", ")", ";", "}", "if", "(", "erg", ".", "length", "(", ")", ">", "200", ")", "{", "erg", "=", "erg", ".", "substring", "(", "0", ",", "200", ")", ";", "System", ".", "out", ".", "println", "(", "\"cut filename: \"", "+", "erg", ")", ";", "}", "return", "erg", ";", "}" ]
convert filename to clean filename
[ "convert", "filename", "to", "clean", "filename" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/examples/java/FlickrCrawler.java#L28-L39
160,083
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java
GeoInterface.getPerms
public GeoPermissions getPerms(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PERMS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // response: // <perms id="240935723" ispublic="1" iscontact="0" isfriend="0" isfamily="0"/> GeoPermissions perms = new GeoPermissions(); Element permsElement = response.getPayload(); perms.setPublic("1".equals(permsElement.getAttribute("ispublic"))); perms.setContact("1".equals(permsElement.getAttribute("iscontact"))); perms.setFriend("1".equals(permsElement.getAttribute("isfriend"))); perms.setFamily("1".equals(permsElement.getAttribute("isfamily"))); perms.setId(permsElement.getAttribute("id")); // I ignore the id attribute. should be the same as the given // photo id. return perms; }
java
public GeoPermissions getPerms(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PERMS); parameters.put("photo_id", photoId); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // response: // <perms id="240935723" ispublic="1" iscontact="0" isfriend="0" isfamily="0"/> GeoPermissions perms = new GeoPermissions(); Element permsElement = response.getPayload(); perms.setPublic("1".equals(permsElement.getAttribute("ispublic"))); perms.setContact("1".equals(permsElement.getAttribute("iscontact"))); perms.setFriend("1".equals(permsElement.getAttribute("isfriend"))); perms.setFamily("1".equals(permsElement.getAttribute("isfamily"))); perms.setId(permsElement.getAttribute("id")); // I ignore the id attribute. should be the same as the given // photo id. return perms; }
[ "public", "GeoPermissions", "getPerms", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PERMS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// response:\r", "// <perms id=\"240935723\" ispublic=\"1\" iscontact=\"0\" isfriend=\"0\" isfamily=\"0\"/>\r", "GeoPermissions", "perms", "=", "new", "GeoPermissions", "(", ")", ";", "Element", "permsElement", "=", "response", ".", "getPayload", "(", ")", ";", "perms", ".", "setPublic", "(", "\"1\"", ".", "equals", "(", "permsElement", ".", "getAttribute", "(", "\"ispublic\"", ")", ")", ")", ";", "perms", ".", "setContact", "(", "\"1\"", ".", "equals", "(", "permsElement", ".", "getAttribute", "(", "\"iscontact\"", ")", ")", ")", ";", "perms", ".", "setFriend", "(", "\"1\"", ".", "equals", "(", "permsElement", ".", "getAttribute", "(", "\"isfriend\"", ")", ")", ")", ";", "perms", ".", "setFamily", "(", "\"1\"", ".", "equals", "(", "permsElement", ".", "getAttribute", "(", "\"isfamily\"", ")", ")", ")", ";", "perms", ".", "setId", "(", "permsElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "// I ignore the id attribute. should be the same as the given\r", "// photo id.\r", "return", "perms", ";", "}" ]
Get permissions for who may view geo data for a photo. This method requires authentication with 'read' permission. @param photoId reqired photo id, not null @return the permissions @throws FlickrException if photo id is invalid, if photo has no geodata or if any other error has been reported in the response.
[ "Get", "permissions", "for", "who", "may", "view", "geo", "data", "for", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L105-L126
160,084
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java
GeoInterface.setPerms
public void setPerms(String photoId, GeoPermissions perms) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_PERMS); parameters.put("photo_id", photoId); parameters.put("is_public", perms.isPublic() ? "1" : "0"); parameters.put("is_contact", perms.isContact() ? "1" : "0"); parameters.put("is_friend", perms.isFriend() ? "1" : "0"); parameters.put("is_family", perms.isFamily() ? "1" : "0"); // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); // This method has no specific response - It returns an empty sucess response // if it completes without error. if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setPerms(String photoId, GeoPermissions perms) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_PERMS); parameters.put("photo_id", photoId); parameters.put("is_public", perms.isPublic() ? "1" : "0"); parameters.put("is_contact", perms.isContact() ? "1" : "0"); parameters.put("is_friend", perms.isFriend() ? "1" : "0"); parameters.put("is_family", perms.isFamily() ? "1" : "0"); // Note: This method requires an HTTP POST request. Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); // This method has no specific response - It returns an empty sucess response // if it completes without error. if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setPerms", "(", "String", "photoId", ",", "GeoPermissions", "perms", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_PERMS", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"is_public\"", ",", "perms", ".", "isPublic", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"is_contact\"", ",", "perms", ".", "isContact", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"is_friend\"", ",", "perms", ".", "isFriend", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "parameters", ".", "put", "(", "\"is_family\"", ",", "perms", ".", "isFamily", "(", ")", "?", "\"1\"", ":", "\"0\"", ")", ";", "// Note: This method requires an HTTP POST request.\r", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "// This method has no specific response - It returns an empty sucess response\r", "// if it completes without error.\r", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "}" ]
Set the permission for who may view the geo data associated with a photo. This method requires authentication with 'write' permission. @param photoId The id of the photo to set permissions for. @param perms Permissions, who can see the geo data of this photo @throws FlickrException
[ "Set", "the", "permission", "for", "who", "may", "view", "the", "geo", "data", "associated", "with", "a", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L194-L210
160,085
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java
GeoInterface.photosForLocation
public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PhotoList<Photo> photos = new PhotoList<Photo>(); parameters.put("method", METHOD_PHOTOS_FOR_LOCATION); if (extras.size() > 0) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } parameters.put("lat", Float.toString(location.getLatitude())); parameters.put("lon", Float.toString(location.getLongitude())); parameters.put("accuracy", Integer.toString(location.getAccuracy())); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoElements = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); PhotoList<Photo> photos = new PhotoList<Photo>(); parameters.put("method", METHOD_PHOTOS_FOR_LOCATION); if (extras.size() > 0) { parameters.put("extras", StringUtilities.join(extras, ",")); } if (perPage > 0) { parameters.put("per_page", Integer.toString(perPage)); } if (page > 0) { parameters.put("page", Integer.toString(page)); } parameters.put("lat", Float.toString(location.getLatitude())); parameters.put("lon", Float.toString(location.getLongitude())); parameters.put("accuracy", Integer.toString(location.getAccuracy())); Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoElements = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "photosForLocation", "(", "GeoData", "location", ",", "Set", "<", "String", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_PHOTOS_FOR_LOCATION", ")", ";", "if", "(", "extras", ".", "size", "(", ")", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"extras\"", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "parameters", ".", "put", "(", "\"lat\"", ",", "Float", ".", "toString", "(", "location", ".", "getLatitude", "(", ")", ")", ")", ";", "parameters", ".", "put", "(", "\"lon\"", ",", "Float", ".", "toString", "(", "location", ".", "getLongitude", "(", ")", ")", ")", ";", "parameters", ".", "put", "(", "\"accuracy\"", ",", "Integer", ".", "toString", "(", "location", ".", "getAccuracy", "(", ")", ")", ")", ";", "Response", "response", "=", "transport", ".", "get", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoElements", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoElements", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Return a list of photos for a user at a specific latitude, longitude and accuracy. @param location @param extras @param perPage @param page @return The collection of Photo objects @throws FlickrException @see com.flickr4java.flickr.photos.Extras
[ "Return", "a", "list", "of", "photos", "for", "a", "user", "at", "a", "specific", "latitude", "longitude", "and", "accuracy", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L291-L324
160,086
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java
CollectionsInterface.parseCollection
private Collection parseCollection(Element collectionElement) { Collection collection = new Collection(); collection.setId(collectionElement.getAttribute("id")); collection.setServer(collectionElement.getAttribute("server")); collection.setSecret(collectionElement.getAttribute("secret")); collection.setChildCount(collectionElement.getAttribute("child_count")); collection.setIconLarge(collectionElement.getAttribute("iconlarge")); collection.setIconSmall(collectionElement.getAttribute("iconsmall")); collection.setDateCreated(collectionElement.getAttribute("datecreate")); collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title")); collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description")); Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos"); if (iconPhotos != null) { NodeList photoElements = iconPhotos.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); collection.addPhoto(PhotoUtils.createPhoto(photoElement)); } } return collection; }
java
private Collection parseCollection(Element collectionElement) { Collection collection = new Collection(); collection.setId(collectionElement.getAttribute("id")); collection.setServer(collectionElement.getAttribute("server")); collection.setSecret(collectionElement.getAttribute("secret")); collection.setChildCount(collectionElement.getAttribute("child_count")); collection.setIconLarge(collectionElement.getAttribute("iconlarge")); collection.setIconSmall(collectionElement.getAttribute("iconsmall")); collection.setDateCreated(collectionElement.getAttribute("datecreate")); collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title")); collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description")); Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos"); if (iconPhotos != null) { NodeList photoElements = iconPhotos.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); collection.addPhoto(PhotoUtils.createPhoto(photoElement)); } } return collection; }
[ "private", "Collection", "parseCollection", "(", "Element", "collectionElement", ")", "{", "Collection", "collection", "=", "new", "Collection", "(", ")", ";", "collection", ".", "setId", "(", "collectionElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "collection", ".", "setServer", "(", "collectionElement", ".", "getAttribute", "(", "\"server\"", ")", ")", ";", "collection", ".", "setSecret", "(", "collectionElement", ".", "getAttribute", "(", "\"secret\"", ")", ")", ";", "collection", ".", "setChildCount", "(", "collectionElement", ".", "getAttribute", "(", "\"child_count\"", ")", ")", ";", "collection", ".", "setIconLarge", "(", "collectionElement", ".", "getAttribute", "(", "\"iconlarge\"", ")", ")", ";", "collection", ".", "setIconSmall", "(", "collectionElement", ".", "getAttribute", "(", "\"iconsmall\"", ")", ")", ";", "collection", ".", "setDateCreated", "(", "collectionElement", ".", "getAttribute", "(", "\"datecreate\"", ")", ")", ";", "collection", ".", "setTitle", "(", "XMLUtilities", ".", "getChildValue", "(", "collectionElement", ",", "\"title\"", ")", ")", ";", "collection", ".", "setDescription", "(", "XMLUtilities", ".", "getChildValue", "(", "collectionElement", ",", "\"description\"", ")", ")", ";", "Element", "iconPhotos", "=", "XMLUtilities", ".", "getChild", "(", "collectionElement", ",", "\"iconphotos\"", ")", ";", "if", "(", "iconPhotos", "!=", "null", ")", "{", "NodeList", "photoElements", "=", "iconPhotos", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoElements", ".", "item", "(", "i", ")", ";", "collection", ".", "addPhoto", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "}", "return", "collection", ";", "}" ]
Parse the XML for a collection as returned by getInfo call. @param collectionElement @return
[ "Parse", "the", "XML", "for", "a", "collection", "as", "returned", "by", "getInfo", "call", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java#L120-L143
160,087
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java
CollectionsInterface.parseTreeCollection
private Collection parseTreeCollection(Element collectionElement) { Collection collection = new Collection(); parseCommonFields(collectionElement, collection); collection.setTitle(collectionElement.getAttribute("title")); collection.setDescription(collectionElement.getAttribute("description")); // Collections can contain either sets or collections (but not both) NodeList childCollectionElements = collectionElement.getElementsByTagName("collection"); for (int i = 0; i < childCollectionElements.getLength(); i++) { Element childCollectionElement = (Element) childCollectionElements.item(i); collection.addCollection(parseTreeCollection(childCollectionElement)); } NodeList childPhotosetElements = collectionElement.getElementsByTagName("set"); for (int i = 0; i < childPhotosetElements.getLength(); i++) { Element childPhotosetElement = (Element) childPhotosetElements.item(i); collection.addPhotoset(createPhotoset(childPhotosetElement)); } return collection; }
java
private Collection parseTreeCollection(Element collectionElement) { Collection collection = new Collection(); parseCommonFields(collectionElement, collection); collection.setTitle(collectionElement.getAttribute("title")); collection.setDescription(collectionElement.getAttribute("description")); // Collections can contain either sets or collections (but not both) NodeList childCollectionElements = collectionElement.getElementsByTagName("collection"); for (int i = 0; i < childCollectionElements.getLength(); i++) { Element childCollectionElement = (Element) childCollectionElements.item(i); collection.addCollection(parseTreeCollection(childCollectionElement)); } NodeList childPhotosetElements = collectionElement.getElementsByTagName("set"); for (int i = 0; i < childPhotosetElements.getLength(); i++) { Element childPhotosetElement = (Element) childPhotosetElements.item(i); collection.addPhotoset(createPhotoset(childPhotosetElement)); } return collection; }
[ "private", "Collection", "parseTreeCollection", "(", "Element", "collectionElement", ")", "{", "Collection", "collection", "=", "new", "Collection", "(", ")", ";", "parseCommonFields", "(", "collectionElement", ",", "collection", ")", ";", "collection", ".", "setTitle", "(", "collectionElement", ".", "getAttribute", "(", "\"title\"", ")", ")", ";", "collection", ".", "setDescription", "(", "collectionElement", ".", "getAttribute", "(", "\"description\"", ")", ")", ";", "// Collections can contain either sets or collections (but not both)", "NodeList", "childCollectionElements", "=", "collectionElement", ".", "getElementsByTagName", "(", "\"collection\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childCollectionElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "childCollectionElement", "=", "(", "Element", ")", "childCollectionElements", ".", "item", "(", "i", ")", ";", "collection", ".", "addCollection", "(", "parseTreeCollection", "(", "childCollectionElement", ")", ")", ";", "}", "NodeList", "childPhotosetElements", "=", "collectionElement", ".", "getElementsByTagName", "(", "\"set\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childPhotosetElements", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "childPhotosetElement", "=", "(", "Element", ")", "childPhotosetElements", ".", "item", "(", "i", ")", ";", "collection", ".", "addPhotoset", "(", "createPhotoset", "(", "childPhotosetElement", ")", ")", ";", "}", "return", "collection", ";", "}" ]
Parse the XML for a collection as returned by getTree call. @param collectionElement @return
[ "Parse", "the", "XML", "for", "a", "collection", "as", "returned", "by", "getTree", "call", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/collections/CollectionsInterface.java#L151-L172
160,088
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/XMLUtilities.java
XMLUtilities.getValue
public static String getValue(Element element) { if (element != null) { Node dataNode = element.getFirstChild(); if (dataNode != null) { return ((Text) dataNode).getData(); } } return null; }
java
public static String getValue(Element element) { if (element != null) { Node dataNode = element.getFirstChild(); if (dataNode != null) { return ((Text) dataNode).getData(); } } return null; }
[ "public", "static", "String", "getValue", "(", "Element", "element", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "Node", "dataNode", "=", "element", ".", "getFirstChild", "(", ")", ";", "if", "(", "dataNode", "!=", "null", ")", "{", "return", "(", "(", "Text", ")", "dataNode", ")", ".", "getData", "(", ")", ";", "}", "}", "return", "null", ";", "}" ]
Get the text value for the specified element. If the element is null, or the element's body is empty then this method will return null. @param element The Element @return The value String or null
[ "Get", "the", "text", "value", "for", "the", "specified", "element", ".", "If", "the", "element", "is", "null", "or", "the", "element", "s", "body", "is", "empty", "then", "this", "method", "will", "return", "null", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L41-L49
160,089
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/XMLUtilities.java
XMLUtilities.getChild
public static Element getChild(Element element, String name) { return (Element) element.getElementsByTagName(name).item(0); }
java
public static Element getChild(Element element, String name) { return (Element) element.getElementsByTagName(name).item(0); }
[ "public", "static", "Element", "getChild", "(", "Element", "element", ",", "String", "name", ")", "{", "return", "(", "Element", ")", "element", ".", "getElementsByTagName", "(", "name", ")", ".", "item", "(", "0", ")", ";", "}" ]
Get the first child element with the given name. @param element The parent element @param name The child element name @return The child element or null
[ "Get", "the", "first", "child", "element", "with", "the", "given", "name", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L60-L62
160,090
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/util/XMLUtilities.java
XMLUtilities.getChildValue
public static String getChildValue(Element element, String name) { return getValue(getChild(element, name)); }
java
public static String getChildValue(Element element, String name) { return getValue(getChild(element, name)); }
[ "public", "static", "String", "getChildValue", "(", "Element", "element", ",", "String", "name", ")", "{", "return", "getValue", "(", "getChild", "(", "element", ",", "name", ")", ")", ";", "}" ]
Get the value of the fist child element with the given name. @param element The parent element @param name The child element name @return The child element value or null
[ "Get", "the", "value", "of", "the", "fist", "child", "element", "with", "the", "given", "name", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/XMLUtilities.java#L73-L75
160,091
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.findByEmail
public User findByEmail(String email) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_FIND_BY_EMAIL); parameters.put("find_email", email); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("nsid")); user.setUsername(XMLUtilities.getChildValue(userElement, "username")); return user; }
java
public User findByEmail(String email) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_FIND_BY_EMAIL); parameters.put("find_email", email); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("nsid")); user.setUsername(XMLUtilities.getChildValue(userElement, "username")); return user; }
[ "public", "User", "findByEmail", "(", "String", "email", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_FIND_BY_EMAIL", ")", ";", "parameters", ".", "put", "(", "\"find_email\"", ",", "email", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "userElement", "=", "response", ".", "getPayload", "(", ")", ";", "User", "user", "=", "new", "User", "(", ")", ";", "user", ".", "setId", "(", "userElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "user", ".", "setUsername", "(", "XMLUtilities", ".", "getChildValue", "(", "userElement", ",", "\"username\"", ")", ")", ";", "return", "user", ";", "}" ]
Find the user by their email address. This method does not require authentication. @param email The email address @return The User @throws FlickrException
[ "Find", "the", "user", "by", "their", "email", "address", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L80-L95
160,092
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.getPublicGroups
public Collection<Group> getPublicGroups(String userId) throws FlickrException { List<Group> groups = new ArrayList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_GROUPS); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); NodeList groupNodes = groupsElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("nsid")); group.setName(groupElement.getAttribute("name")); group.setAdmin("1".equals(groupElement.getAttribute("admin"))); group.setEighteenPlus(groupElement.getAttribute("eighteenplus").equals("0") ? false : true); groups.add(group); } return groups; }
java
public Collection<Group> getPublicGroups(String userId) throws FlickrException { List<Group> groups = new ArrayList<Group>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_GROUPS); parameters.put("user_id", userId); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element groupsElement = response.getPayload(); NodeList groupNodes = groupsElement.getElementsByTagName("group"); for (int i = 0; i < groupNodes.getLength(); i++) { Element groupElement = (Element) groupNodes.item(i); Group group = new Group(); group.setId(groupElement.getAttribute("nsid")); group.setName(groupElement.getAttribute("name")); group.setAdmin("1".equals(groupElement.getAttribute("admin"))); group.setEighteenPlus(groupElement.getAttribute("eighteenplus").equals("0") ? false : true); groups.add(group); } return groups; }
[ "public", "Collection", "<", "Group", ">", "getPublicGroups", "(", "String", "userId", ")", "throws", "FlickrException", "{", "List", "<", "Group", ">", "groups", "=", "new", "ArrayList", "<", "Group", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PUBLIC_GROUPS", ")", ";", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "groupsElement", "=", "response", ".", "getPayload", "(", ")", ";", "NodeList", "groupNodes", "=", "groupsElement", ".", "getElementsByTagName", "(", "\"group\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "groupElement", "=", "(", "Element", ")", "groupNodes", ".", "item", "(", "i", ")", ";", "Group", "group", "=", "new", "Group", "(", ")", ";", "group", ".", "setId", "(", "groupElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "group", ".", "setName", "(", "groupElement", ".", "getAttribute", "(", "\"name\"", ")", ")", ";", "group", ".", "setAdmin", "(", "\"1\"", ".", "equals", "(", "groupElement", ".", "getAttribute", "(", "\"admin\"", ")", ")", ")", ";", "group", ".", "setEighteenPlus", "(", "groupElement", ".", "getAttribute", "(", "\"eighteenplus\"", ")", ".", "equals", "(", "\"0\"", ")", "?", "false", ":", "true", ")", ";", "groups", ".", "add", "(", "group", ")", ";", "}", "return", "groups", ";", "}" ]
Get a collection of public groups for the user. The groups will contain only the members nsid, name, admin and eighteenplus. If you want the whole group-information, you have to call {@link com.flickr4java.flickr.groups.GroupsInterface#getInfo(String)}. This method does not require authentication. @param userId The user ID @return The public groups @throws FlickrException
[ "Get", "a", "collection", "of", "public", "groups", "for", "the", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L201-L225
160,093
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.getPublicPhotos
public PhotoList<Photo> getPublicPhotos(String userId, Set<String> extras, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_PHOTOS); parameters.put("user_id", userId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } if (extras != null) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
java
public PhotoList<Photo> getPublicPhotos(String userId, Set<String> extras, int perPage, int page) throws FlickrException { PhotoList<Photo> photos = new PhotoList<Photo>(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_PUBLIC_PHOTOS); parameters.put("user_id", userId); if (perPage > 0) { parameters.put("per_page", "" + perPage); } if (page > 0) { parameters.put("page", "" + page); } if (extras != null) { parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, ",")); } Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element photosElement = response.getPayload(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
[ "public", "PhotoList", "<", "Photo", ">", "getPublicPhotos", "(", "String", "userId", ",", "Set", "<", "String", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "PhotoList", "<", "Photo", ">", "photos", "=", "new", "PhotoList", "<", "Photo", ">", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_PUBLIC_PHOTOS", ")", ";", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "\"\"", "+", "perPage", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "\"\"", "+", "page", ")", ";", "}", "if", "(", "extras", "!=", "null", ")", "{", "parameters", ".", "put", "(", "Extras", ".", "KEY_EXTRAS", ",", "StringUtilities", ".", "join", "(", "extras", ",", "\",\"", ")", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "photosElement", "=", "response", ".", "getPayload", "(", ")", ";", "photos", ".", "setPage", "(", "photosElement", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "photos", ".", "setPages", "(", "photosElement", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "photos", ".", "setPerPage", "(", "photosElement", ".", "getAttribute", "(", "\"perpage\"", ")", ")", ";", "photos", ".", "setTotal", "(", "photosElement", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "photoNodes", "=", "photosElement", ".", "getElementsByTagName", "(", "\"photo\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "photoElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "photos", ".", "add", "(", "PhotoUtils", ".", "createPhoto", "(", "photoElement", ")", ")", ";", "}", "return", "photos", ";", "}" ]
Get a collection of public photos for the specified user ID. This method does not require authentication. @see com.flickr4java.flickr.photos.Extras @param userId The User ID @param extras Set of extra-attributes to include (may be null) @param perPage The number of photos per page @param page The page offset @return The PhotoList collection @throws FlickrException
[ "Get", "a", "collection", "of", "public", "photos", "for", "the", "specified", "user", "ID", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L248-L283
160,094
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.getUploadStatus
public User getUploadStatus() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_UPLOAD_STATUS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("id")); user.setPro("1".equals(userElement.getAttribute("ispro"))); user.setUsername(XMLUtilities.getChildValue(userElement, "username")); Element bandwidthElement = XMLUtilities.getChild(userElement, "bandwidth"); user.setBandwidthMax(bandwidthElement.getAttribute("max")); user.setBandwidthUsed(bandwidthElement.getAttribute("used")); user.setIsBandwidthUnlimited("1".equals(bandwidthElement.getAttribute("unlimited"))); Element filesizeElement = XMLUtilities.getChild(userElement, "filesize"); user.setFilesizeMax(filesizeElement.getAttribute("max")); Element setsElement = XMLUtilities.getChild(userElement, "sets"); user.setSetsCreated(setsElement.getAttribute("created")); user.setSetsRemaining(setsElement.getAttribute("remaining")); Element videosElement = XMLUtilities.getChild(userElement, "videos"); user.setVideosUploaded(videosElement.getAttribute("uploaded")); user.setVideosRemaining(videosElement.getAttribute("remaining")); Element videoSizeElement = XMLUtilities.getChild(userElement, "videosize"); user.setVideoSizeMax(videoSizeElement.getAttribute("maxbytes")); return user; }
java
public User getUploadStatus() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_UPLOAD_STATUS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("id")); user.setPro("1".equals(userElement.getAttribute("ispro"))); user.setUsername(XMLUtilities.getChildValue(userElement, "username")); Element bandwidthElement = XMLUtilities.getChild(userElement, "bandwidth"); user.setBandwidthMax(bandwidthElement.getAttribute("max")); user.setBandwidthUsed(bandwidthElement.getAttribute("used")); user.setIsBandwidthUnlimited("1".equals(bandwidthElement.getAttribute("unlimited"))); Element filesizeElement = XMLUtilities.getChild(userElement, "filesize"); user.setFilesizeMax(filesizeElement.getAttribute("max")); Element setsElement = XMLUtilities.getChild(userElement, "sets"); user.setSetsCreated(setsElement.getAttribute("created")); user.setSetsRemaining(setsElement.getAttribute("remaining")); Element videosElement = XMLUtilities.getChild(userElement, "videos"); user.setVideosUploaded(videosElement.getAttribute("uploaded")); user.setVideosRemaining(videosElement.getAttribute("remaining")); Element videoSizeElement = XMLUtilities.getChild(userElement, "videosize"); user.setVideoSizeMax(videoSizeElement.getAttribute("maxbytes")); return user; }
[ "public", "User", "getUploadStatus", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_UPLOAD_STATUS", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "userElement", "=", "response", ".", "getPayload", "(", ")", ";", "User", "user", "=", "new", "User", "(", ")", ";", "user", ".", "setId", "(", "userElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "user", ".", "setPro", "(", "\"1\"", ".", "equals", "(", "userElement", ".", "getAttribute", "(", "\"ispro\"", ")", ")", ")", ";", "user", ".", "setUsername", "(", "XMLUtilities", ".", "getChildValue", "(", "userElement", ",", "\"username\"", ")", ")", ";", "Element", "bandwidthElement", "=", "XMLUtilities", ".", "getChild", "(", "userElement", ",", "\"bandwidth\"", ")", ";", "user", ".", "setBandwidthMax", "(", "bandwidthElement", ".", "getAttribute", "(", "\"max\"", ")", ")", ";", "user", ".", "setBandwidthUsed", "(", "bandwidthElement", ".", "getAttribute", "(", "\"used\"", ")", ")", ";", "user", ".", "setIsBandwidthUnlimited", "(", "\"1\"", ".", "equals", "(", "bandwidthElement", ".", "getAttribute", "(", "\"unlimited\"", ")", ")", ")", ";", "Element", "filesizeElement", "=", "XMLUtilities", ".", "getChild", "(", "userElement", ",", "\"filesize\"", ")", ";", "user", ".", "setFilesizeMax", "(", "filesizeElement", ".", "getAttribute", "(", "\"max\"", ")", ")", ";", "Element", "setsElement", "=", "XMLUtilities", ".", "getChild", "(", "userElement", ",", "\"sets\"", ")", ";", "user", ".", "setSetsCreated", "(", "setsElement", ".", "getAttribute", "(", "\"created\"", ")", ")", ";", "user", ".", "setSetsRemaining", "(", "setsElement", ".", "getAttribute", "(", "\"remaining\"", ")", ")", ";", "Element", "videosElement", "=", "XMLUtilities", ".", "getChild", "(", "userElement", ",", "\"videos\"", ")", ";", "user", ".", "setVideosUploaded", "(", "videosElement", ".", "getAttribute", "(", "\"uploaded\"", ")", ")", ";", "user", ".", "setVideosRemaining", "(", "videosElement", ".", "getAttribute", "(", "\"remaining\"", ")", ")", ";", "Element", "videoSizeElement", "=", "XMLUtilities", ".", "getChild", "(", "userElement", ",", "\"videosize\"", ")", ";", "user", ".", "setVideoSizeMax", "(", "videoSizeElement", ".", "getAttribute", "(", "\"maxbytes\"", ")", ")", ";", "return", "user", ";", "}" ]
Get upload status for the currently authenticated user. Requires authentication with 'read' permission using the new authentication API. @return A User object with upload status data fields filled @throws FlickrException
[ "Get", "upload", "status", "for", "the", "currently", "authenticated", "user", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L293-L327
160,095
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.add
public void add(String photoId, String userId, Rectangle bounds) throws FlickrException { // Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI); pi.add(photoId, userId, bounds); }
java
public void add(String photoId, String userId, Rectangle bounds) throws FlickrException { // Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI); pi.add(photoId, userId, bounds); }
[ "public", "void", "add", "(", "String", "photoId", ",", "String", "userId", ",", "Rectangle", "bounds", ")", "throws", "FlickrException", "{", "// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues\r", "com", ".", "flickr4java", ".", "flickr", ".", "photos", ".", "people", ".", "PeopleInterface", "pi", "=", "new", "com", ".", "flickr4java", ".", "flickr", ".", "photos", ".", "people", ".", "PeopleInterface", "(", "apiKey", ",", "sharedSecret", ",", "transportAPI", ")", ";", "pi", ".", "add", "(", "photoId", ",", "userId", ",", "bounds", ")", ";", "}" ]
Add the given person to the photo. Optionally, send in co-ordinates @param photoId @param userId @param bounds @throws FlickrException
[ "Add", "the", "given", "person", "to", "the", "photo", ".", "Optionally", "send", "in", "co", "-", "ordinates" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L445-L450
160,096
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.getList
public PersonTagList<PersonTag> getList(String photoId) throws FlickrException { // Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI); return pi.getList(photoId); }
java
public PersonTagList<PersonTag> getList(String photoId) throws FlickrException { // Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues com.flickr4java.flickr.photos.people.PeopleInterface pi = new com.flickr4java.flickr.photos.people.PeopleInterface(apiKey, sharedSecret, transportAPI); return pi.getList(photoId); }
[ "public", "PersonTagList", "<", "PersonTag", ">", "getList", "(", "String", "photoId", ")", "throws", "FlickrException", "{", "// Delegating this to photos.people.PeopleInterface - Naming standard would be to use PeopleInterface but having 2 the same name can cause issues\r", "com", ".", "flickr4java", ".", "flickr", ".", "photos", ".", "people", ".", "PeopleInterface", "pi", "=", "new", "com", ".", "flickr4java", ".", "flickr", ".", "photos", ".", "people", ".", "PeopleInterface", "(", "apiKey", ",", "sharedSecret", ",", "transportAPI", ")", ";", "return", "pi", ".", "getList", "(", "photoId", ")", ";", "}" ]
Get a list of people in a given photo. @param photoId @throws FlickrException
[ "Get", "a", "list", "of", "people", "in", "a", "given", "photo", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L501-L506
160,097
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/people/PeopleInterface.java
PeopleInterface.getLimits
public User getLimits() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIMITS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("nsid")); NodeList photoNodes = userElement.getElementsByTagName("photos"); for (int i = 0; i < photoNodes.getLength(); i++) { Element plElement = (Element) photoNodes.item(i); PhotoLimits pl = new PhotoLimits(); user.setPhotoLimits(pl); pl.setMaxDisplay(plElement.getAttribute("maxdisplaypx")); pl.setMaxUpload(plElement.getAttribute("maxupload")); } NodeList videoNodes = userElement.getElementsByTagName("videos"); for (int i = 0; i < videoNodes.getLength(); i++) { Element vlElement = (Element) videoNodes.item(i); VideoLimits vl = new VideoLimits(); user.setPhotoLimits(vl); vl.setMaxDuration(vlElement.getAttribute("maxduration")); vl.setMaxUpload(vlElement.getAttribute("maxupload")); } return user; }
java
public User getLimits() throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIMITS); Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element userElement = response.getPayload(); User user = new User(); user.setId(userElement.getAttribute("nsid")); NodeList photoNodes = userElement.getElementsByTagName("photos"); for (int i = 0; i < photoNodes.getLength(); i++) { Element plElement = (Element) photoNodes.item(i); PhotoLimits pl = new PhotoLimits(); user.setPhotoLimits(pl); pl.setMaxDisplay(plElement.getAttribute("maxdisplaypx")); pl.setMaxUpload(plElement.getAttribute("maxupload")); } NodeList videoNodes = userElement.getElementsByTagName("videos"); for (int i = 0; i < videoNodes.getLength(); i++) { Element vlElement = (Element) videoNodes.item(i); VideoLimits vl = new VideoLimits(); user.setPhotoLimits(vl); vl.setMaxDuration(vlElement.getAttribute("maxduration")); vl.setMaxUpload(vlElement.getAttribute("maxupload")); } return user; }
[ "public", "User", "getLimits", "(", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIMITS", ")", ";", "Response", "response", "=", "transportAPI", ".", "get", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "userElement", "=", "response", ".", "getPayload", "(", ")", ";", "User", "user", "=", "new", "User", "(", ")", ";", "user", ".", "setId", "(", "userElement", ".", "getAttribute", "(", "\"nsid\"", ")", ")", ";", "NodeList", "photoNodes", "=", "userElement", ".", "getElementsByTagName", "(", "\"photos\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "photoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "plElement", "=", "(", "Element", ")", "photoNodes", ".", "item", "(", "i", ")", ";", "PhotoLimits", "pl", "=", "new", "PhotoLimits", "(", ")", ";", "user", ".", "setPhotoLimits", "(", "pl", ")", ";", "pl", ".", "setMaxDisplay", "(", "plElement", ".", "getAttribute", "(", "\"maxdisplaypx\"", ")", ")", ";", "pl", ".", "setMaxUpload", "(", "plElement", ".", "getAttribute", "(", "\"maxupload\"", ")", ")", ";", "}", "NodeList", "videoNodes", "=", "userElement", ".", "getElementsByTagName", "(", "\"videos\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "videoNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "vlElement", "=", "(", "Element", ")", "videoNodes", ".", "item", "(", "i", ")", ";", "VideoLimits", "vl", "=", "new", "VideoLimits", "(", ")", ";", "user", ".", "setPhotoLimits", "(", "vl", ")", ";", "vl", ".", "setMaxDuration", "(", "vlElement", ".", "getAttribute", "(", "\"maxduration\"", ")", ")", ";", "vl", ".", "setMaxUpload", "(", "vlElement", ".", "getAttribute", "(", "\"maxupload\"", ")", ")", ";", "}", "return", "user", ";", "}" ]
Get's the user's current upload limits, User object only contains user_id @return Media Limits
[ "Get", "s", "the", "user", "s", "current", "upload", "limits", "User", "object", "only", "contains", "user_id" ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/people/PeopleInterface.java#L552-L580
160,098
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/galleries/GalleriesInterface.java
GalleriesInterface.getList
public List<Gallery> getList(String userId, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); parameters.put("user_id", userId); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element element = response.getPayload(); GalleryList<Gallery> galleries = new GalleryList<Gallery>(); galleries.setPage(element.getAttribute("page")); galleries.setPages(element.getAttribute("pages")); galleries.setPerPage(element.getAttribute("per_page")); galleries.setTotal(element.getAttribute("total")); NodeList galleryNodes = element.getElementsByTagName("gallery"); for (int i = 0; i < galleryNodes.getLength(); i++) { Element galleryElement = (Element) galleryNodes.item(i); Gallery gallery = new Gallery(); gallery.setId(galleryElement.getAttribute("id")); gallery.setUrl(galleryElement.getAttribute("url")); User owner = new User(); owner.setId(galleryElement.getAttribute("owner")); gallery.setOwner(owner); gallery.setCreateDate(galleryElement.getAttribute("date_create")); gallery.setUpdateDate(galleryElement.getAttribute("date_update")); gallery.setPrimaryPhotoId(galleryElement.getAttribute("primary_photo_id")); gallery.setPrimaryPhotoServer(galleryElement.getAttribute("primary_photo_server")); gallery.setPrimaryPhotoFarm(galleryElement.getAttribute("primary_photo_farm")); gallery.setPrimaryPhotoSecret(galleryElement.getAttribute("primary_photo_secret")); gallery.setPhotoCount(galleryElement.getAttribute("count_photos")); gallery.setVideoCount(galleryElement.getAttribute("count_videos")); galleries.add(gallery); } return galleries; }
java
public List<Gallery> getList(String userId, int perPage, int page) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_GET_LIST); parameters.put("user_id", userId); if (perPage > 0) { parameters.put("per_page", String.valueOf(perPage)); } if (page > 0) { parameters.put("page", String.valueOf(page)); } Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element element = response.getPayload(); GalleryList<Gallery> galleries = new GalleryList<Gallery>(); galleries.setPage(element.getAttribute("page")); galleries.setPages(element.getAttribute("pages")); galleries.setPerPage(element.getAttribute("per_page")); galleries.setTotal(element.getAttribute("total")); NodeList galleryNodes = element.getElementsByTagName("gallery"); for (int i = 0; i < galleryNodes.getLength(); i++) { Element galleryElement = (Element) galleryNodes.item(i); Gallery gallery = new Gallery(); gallery.setId(galleryElement.getAttribute("id")); gallery.setUrl(galleryElement.getAttribute("url")); User owner = new User(); owner.setId(galleryElement.getAttribute("owner")); gallery.setOwner(owner); gallery.setCreateDate(galleryElement.getAttribute("date_create")); gallery.setUpdateDate(galleryElement.getAttribute("date_update")); gallery.setPrimaryPhotoId(galleryElement.getAttribute("primary_photo_id")); gallery.setPrimaryPhotoServer(galleryElement.getAttribute("primary_photo_server")); gallery.setPrimaryPhotoFarm(galleryElement.getAttribute("primary_photo_farm")); gallery.setPrimaryPhotoSecret(galleryElement.getAttribute("primary_photo_secret")); gallery.setPhotoCount(galleryElement.getAttribute("count_photos")); gallery.setVideoCount(galleryElement.getAttribute("count_videos")); galleries.add(gallery); } return galleries; }
[ "public", "List", "<", "Gallery", ">", "getList", "(", "String", "userId", ",", "int", "perPage", ",", "int", "page", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_GET_LIST", ")", ";", "parameters", ".", "put", "(", "\"user_id\"", ",", "userId", ")", ";", "if", "(", "perPage", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"per_page\"", ",", "String", ".", "valueOf", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "String", ".", "valueOf", "(", "page", ")", ")", ";", "}", "Response", "response", "=", "transport", ".", "post", "(", "transport", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "element", "=", "response", ".", "getPayload", "(", ")", ";", "GalleryList", "<", "Gallery", ">", "galleries", "=", "new", "GalleryList", "<", "Gallery", ">", "(", ")", ";", "galleries", ".", "setPage", "(", "element", ".", "getAttribute", "(", "\"page\"", ")", ")", ";", "galleries", ".", "setPages", "(", "element", ".", "getAttribute", "(", "\"pages\"", ")", ")", ";", "galleries", ".", "setPerPage", "(", "element", ".", "getAttribute", "(", "\"per_page\"", ")", ")", ";", "galleries", ".", "setTotal", "(", "element", ".", "getAttribute", "(", "\"total\"", ")", ")", ";", "NodeList", "galleryNodes", "=", "element", ".", "getElementsByTagName", "(", "\"gallery\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "galleryNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "galleryElement", "=", "(", "Element", ")", "galleryNodes", ".", "item", "(", "i", ")", ";", "Gallery", "gallery", "=", "new", "Gallery", "(", ")", ";", "gallery", ".", "setId", "(", "galleryElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "gallery", ".", "setUrl", "(", "galleryElement", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "User", "owner", "=", "new", "User", "(", ")", ";", "owner", ".", "setId", "(", "galleryElement", ".", "getAttribute", "(", "\"owner\"", ")", ")", ";", "gallery", ".", "setOwner", "(", "owner", ")", ";", "gallery", ".", "setCreateDate", "(", "galleryElement", ".", "getAttribute", "(", "\"date_create\"", ")", ")", ";", "gallery", ".", "setUpdateDate", "(", "galleryElement", ".", "getAttribute", "(", "\"date_update\"", ")", ")", ";", "gallery", ".", "setPrimaryPhotoId", "(", "galleryElement", ".", "getAttribute", "(", "\"primary_photo_id\"", ")", ")", ";", "gallery", ".", "setPrimaryPhotoServer", "(", "galleryElement", ".", "getAttribute", "(", "\"primary_photo_server\"", ")", ")", ";", "gallery", ".", "setPrimaryPhotoFarm", "(", "galleryElement", ".", "getAttribute", "(", "\"primary_photo_farm\"", ")", ")", ";", "gallery", ".", "setPrimaryPhotoSecret", "(", "galleryElement", ".", "getAttribute", "(", "\"primary_photo_secret\"", ")", ")", ";", "gallery", ".", "setPhotoCount", "(", "galleryElement", ".", "getAttribute", "(", "\"count_photos\"", ")", ")", ";", "gallery", ".", "setVideoCount", "(", "galleryElement", ".", "getAttribute", "(", "\"count_videos\"", ")", ")", ";", "galleries", ".", "add", "(", "gallery", ")", ";", "}", "return", "galleries", ";", "}" ]
Return the list of galleries created by a user. Sorted from newest to oldest. @param userId The user you want to check for @param perPage Number of galleries per page @param page The page number @return gallery @throws FlickrException @see <a hrerf="http://www.flickr.com/services/api/flickr.galleries.getList.html">flickr.galleries.getList</a>
[ "Return", "the", "list", "of", "galleries", "created", "by", "a", "user", ".", "Sorted", "from", "newest", "to", "oldest", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/galleries/GalleriesInterface.java#L82-L127
160,099
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java
NotesInterface.add
public Note add(String photoId, Note note) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD); parameters.put("photo_id", photoId); Rectangle bounds = note.getBounds(); if (bounds != null) { parameters.put("note_x", String.valueOf(bounds.x)); parameters.put("note_y", String.valueOf(bounds.y)); parameters.put("note_w", String.valueOf(bounds.width)); parameters.put("note_h", String.valueOf(bounds.height)); } String text = note.getText(); if (text != null) { parameters.put("note_text", text); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element noteElement = response.getPayload(); note.setId(noteElement.getAttribute("id")); return note; }
java
public Note add(String photoId, Note note) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD); parameters.put("photo_id", photoId); Rectangle bounds = note.getBounds(); if (bounds != null) { parameters.put("note_x", String.valueOf(bounds.x)); parameters.put("note_y", String.valueOf(bounds.y)); parameters.put("note_w", String.valueOf(bounds.width)); parameters.put("note_h", String.valueOf(bounds.height)); } String text = note.getText(); if (text != null) { parameters.put("note_text", text); } Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } Element noteElement = response.getPayload(); note.setId(noteElement.getAttribute("id")); return note; }
[ "public", "Note", "add", "(", "String", "photoId", ",", "Note", "note", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_ADD", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "Rectangle", "bounds", "=", "note", ".", "getBounds", "(", ")", ";", "if", "(", "bounds", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"note_x\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "x", ")", ")", ";", "parameters", ".", "put", "(", "\"note_y\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "y", ")", ")", ";", "parameters", ".", "put", "(", "\"note_w\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "width", ")", ")", ";", "parameters", ".", "put", "(", "\"note_h\"", ",", "String", ".", "valueOf", "(", "bounds", ".", "height", ")", ")", ";", "}", "String", "text", "=", "note", ".", "getText", "(", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"note_text\"", ",", "text", ")", ";", "}", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "Element", "noteElement", "=", "response", ".", "getPayload", "(", ")", ";", "note", ".", "setId", "(", "noteElement", ".", "getAttribute", "(", "\"id\"", ")", ")", ";", "return", "note", ";", "}" ]
Add a note to a photo. The Note object bounds and text must be specified. @param photoId The photo ID @param note The Note object @return The updated Note object
[ "Add", "a", "note", "to", "a", "photo", ".", "The", "Note", "object", "bounds", "and", "text", "must", "be", "specified", "." ]
f66987ba0e360e5fb7730efbbb8c51f3d978fc25
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/notes/NotesInterface.java#L48-L73