/** * Invoke an HTTP POST request on a remote host. * * @param path * The request path * @param parameters * The parameters (List of Parameter objects) * @param apiKey * @param sharedSecret * @return The Response object * @throws FlickrException */ public Response post(String path, Map<String, Object> parameters, String apiKey, String sharedSecret) throws FlickrException { return post(path, parameters, apiKey, sharedSecret, false); }
public void addPhoto(String strGalleryId, String photoId, String strComment) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_PHOTO); parameters.put("gallery_id", strGalleryId); parameters.put("photo_id", photoId); parameters.put("comment", strComment); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editPhoto(String strGalleryId, String strPhotoId, String strComment) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTO); parameters.put("gallery_id", strGalleryId); parameters.put("photo_id", strPhotoId); parameters.put("comment", strComment); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editPhotos(String strGalleryId, String strPrimaryPhotoId, String strPhotoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTOS); parameters.put("gallery_id", strGalleryId); parameters.put("primary_photo_id", strPrimaryPhotoId); parameters.put("photo_ids", strPhotoIds); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void addPhoto(String strGalleryId, String photoId, String strComment) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD_PHOTO); parameters.put("gallery_id", strGalleryId); parameters.put("photo_id", photoId); parameters.put("comment", strComment); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editPhoto(String strGalleryId, String strPhotoId, String strComment) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTO); parameters.put("gallery_id", strGalleryId); parameters.put("photo_id", strPhotoId); parameters.put("comment", strComment); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editPhotos(String strGalleryId, String strPrimaryPhotoId, String strPhotoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_PHOTOS); parameters.put("gallery_id", strGalleryId); parameters.put("primary_photo_id", strPrimaryPhotoId); parameters.put("photo_ids", strPhotoIds); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editMeta(String strGalleryId, String strTitle, String strDescription) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("title", strTitle); parameters.put("description", strDescription); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
public void editMeta(String strGalleryId, String strTitle, String strDescription) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_EDIT_META); parameters.put("title", strTitle); parameters.put("description", strDescription); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Remove the specified photo from the user's favorites. * * @param photoId * The photo id */ public void remove(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE); parameters.put("photo_id", photoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Add a photo to the user's favorites. * * @param photoId * The photo ID * @throws FlickrException */ public void add(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD); parameters.put("photo_id", photoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Delete the specified photoset. * * @param photosetId * The photoset ID * @throws FlickrException */ public void delete(String photosetId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("photoset_id", photosetId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Delete the specified note. * * @param noteId * The node ID * @throws FlickrException */ public void delete(String noteId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("note_id", noteId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Remove the specified photo from the user's favorites. * * @param photoId * The photo id */ public void remove(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE); parameters.put("photo_id", photoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Delete the specified note. * * @param noteId * The node ID * @throws FlickrException */ public void delete(String noteId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("note_id", noteId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Add a photo to the user's favorites. * * @param photoId * The photo ID * @throws FlickrException */ public void add(String photoId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_ADD); parameters.put("photo_id", photoId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Delete the specified photoset. * * @param photosetId * The photoset ID * @throws FlickrException */ public void delete(String photosetId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE); parameters.put("photoset_id", photosetId); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
/** * Delete a photoset comment as the currently authenticated user. * * @param commentId * The id of the comment to delete from a photoset. * @throws FlickrException */ public void deleteComment(String commentId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_DELETE_COMMENT); parameters.put("comment_id", commentId); // 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()); } // This method has no specific response - It returns an empty sucess response if it completes without error. }
/** * Remove a tag from a photo. * * This method requires authentication with 'write' permission. * * @param tagId * The tag ID * @throws FlickrException */ 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()); } }
/** * Call the post multipart end point. * * @param parameters * @param path * @return * @throws FlickrException */ private UploaderResponse postPhoto(Map<String, Object> parameters, String path) throws FlickrException { UploaderResponse response = (UploaderResponse) transport.post(path, parameters, apiKey, sharedSecret, true); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } return response; }