Simon Fell just left me a little Objective-C/Cocoa
hint in the comments to my
last
post.
I have been trying out a lot of feed readers in the past months and I somehow lost
his entry, but I have now re-subscribed (I have settled on Google Reader, of course).
It looks like he has a good case of the
Objective-C
addiction too.
To return the favor... Simon: I use Quicken on the Mac. It is nothing
like Money. Worth spending money on (pun intended).
Based on Simon's advice, the new API is:
@interface AtomClient : NSObject
-(XmlDocument*) feedAt: (NSURL*) aURL;
-(XmlElement*) addEntry: (XmlElement*) anEntry to: (NSURL*) aURL;
-(XmlElement*) addEntry: (NSData*) aNSData with: (NSString*) aContentType
to: (NSURL*) aURL;
-(XmlElement*) entryAt: (NSURL*) aURL;
-(void) deleteEntryAt: (NSURL*) aURL;
-(void) updateEntryAt: (NSURL*) aURL with: (XmlElement*) anEntry;
-(void) updateEntryAt: (NSURL*) aURL withData: (NSData*) aNSData;
@end
Note that I decided to use my "dots over XML" code from a previous post (
Slash-dot
Problem, Part 4) rather than "statically typed" feed and entry classes.
This still let's me do:
AtomClient* client = [AtomClient new];
XmlDocument* feed = [client feedAt: [NSURL URLWithString:@"http://foo/atom"]];
NSLog("Last title=%@", [[[feed entry] objectAtIndex:0] title]);
The issue is going to be support for "set" values, which I need to add.
Lastly, I am also adding the below subclass to handle the Google's
Account
Authentication for Installed Applications (I am sure that there will be more such
additions):
@interface GDataClient : AtomClient
-(id)initWithUser: (NSString*) aUserId
password: (NSString*) aPassword
error: (LoginError**) anError;
-(id)initWithUser: (User*) aUser error: (LoginError**) anError;
@end