| 1 | /* |
| 2 | * Flickr.h |
| 3 | * -------- |
| 4 | * |
| 5 | * Author: Chris Lee <clee@mg8.org> |
| 6 | * License: GPL v2 <http://www.opensource.org/licenses/gpl-license.php> |
| 7 | */ |
| 8 | |
| 9 | #define FLICKR_AUTH_URL @"http://flickr.com/services/auth/" |
| 10 | #define FLICKR_REST_URL @"http://api.flickr.com/services/rest/" |
| 11 | #define FLICKR_UPLOAD_URL @"http://api.flickr.com/services/upload/" |
| 12 | #define FLICKR_FINISHED_URL @"http://www.flickr.com/tools/uploader_edit.gne" |
| 13 | |
| 14 | #define FLICKR_GET_FROB @"flickr.auth.getFrob" |
| 15 | #define FLICKR_GET_TOKEN @"flickr.auth.getToken" |
| 16 | #define FLICKR_GET_TAGS @"flickr.tags.getListUser" |
| 17 | #define FLICKR_CHECK_TOKEN @"flickr.auth.checkToken" |
| 18 | |
| 19 | #define FLICKR_WRITE_PERMS @"write" |
| 20 | |
| 21 | #if !defined(API_KEY) || !defined(SHARED_SECRET) |
| 22 | #error "You need to define an API key and a shared secret. The MobilePushr API key is not contained in the source code." |
| 23 | #else |
| 24 | #define PUSHR_API_KEY @API_KEY |
| 25 | #define PUSHR_SHARED_SECRET @SHARED_SECRET |
| 26 | #endif |
| 27 | |
| 28 | #define MIME_BOUNDARY "----16c17a9ea1d7b327e7489190e394d411----" |
| 29 | #define CONTENT_TYPE "multipart/form-data; boundary=" MIME_BOUNDARY |
| 30 | |
| 31 | #import <Foundation/Foundation.h> |
| 32 | |
| 33 | #import "FlickrCategory.h" |
| 34 | |
| 35 | @class MobilePushr; |
| 36 | |
| 37 | @interface Flickr : NSObject |
| 38 | { |
| 39 | MobilePushr *_pushr; |
| 40 | NSUserDefaults *_settings; |
| 41 | } |
| 42 | |
| 43 | - (id)initWithPushr: (MobilePushr *)pushr; |
| 44 | |
| 45 | #pragma mark XML helper functions |
| 46 | - (NSArray *)getXMLNodesNamed: (NSString *)nodeName fromResponse: (NSData *)responseData; |
| 47 | - (NSDictionary *)getXMLNodesAndAttributesFromResponse: (NSData *)responseData; |
| 48 | |
| 49 | #pragma mark internal functions |
| 50 | - (NSURL *)signedURL: (NSDictionary *)parameters withBase: (NSString *)base; |
| 51 | - (NSURL *)signedURL: (NSDictionary *)parameters; |
| 52 | - (NSURL *)authURL; |
| 53 | - (NSString *)frob; |
| 54 | |
| 55 | #pragma mark externally-visible interface |
| 56 | - (NSArray *)tags; |
| 57 | - (void)sendToGrantPermission; |
| 58 | - (void)tradeFrobForToken; |
| 59 | - (void)checkToken; |
| 60 | - (void)triggerUpload: (id)unused; |
| 61 | |
| 62 | @end |
| 63 | |