Inherits from AFHTTPClient
Declared in FDWClient.h

Overview

Handles interaction with the FeedWrangler API, as documented at https://feedwrangler.net/developers

Multi-User Support

To support multiple users, all you have to do is use one distinct FDWClient per user

Tasks

API Defaults

Initialization

Authentication

Subscriptions

Feed Items

Streams

Properties

accessToken

The access token that the FeedWrangler API requires for all calls (outside of authenticate) This property will be set upon authentication, or upon initialization (via sharedClientWithAccessToken: or initWithAccessToken:baseURL:)

@property (readonly, strong) NSString *accessToken

Declared In

FDWClient.h

authenticatedUser

The client’s authenticatd user, or nil

@property (readonly, strong) FDWUser *authenticatedUser

Declared In

FDWClient.h

Class Methods

APIBaseURL

The API’s base URL Defaults to “https://feedwrangler.net/api/v2/

+ (NSURL *)APIBaseURL

Return Value

The API’s base URL

Declared In

FDWClient.h

sharedClient

Returns the singleton shared client, with no default accessToken set

+ (instancetype)sharedClient

Return Value

The shared client

Declared In

FDWClient.h

sharedClientWithAccessToken:

Returns the singleton shared client, with the access token set to accessToken

+ (instancetype)sharedClientWithAccessToken:(NSString *)accessToken

Parameters

accessToken

The initial access token

Return Value

The shared client

Declared In

FDWClient.h

Instance Methods

authenticateEmail:password:clientKey:completionHandler:

Authenticates a FeedWrangler user, must be called (and completed) before any other requests can be made

- (void)authenticateEmail:(NSString *)email password:(NSString *)password clientKey:(NSString *)clientKey completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

email

The user’s email

password

The user’s password

clientKey

Your FeedWrangler client key

Go to https://feedwrangler.net/developers/clients to manake your client keys

completionHandler

Completion handler that fires after the request finishes

Discussion

Authenticates the user, setting up the client with a valid access key so that all the other requests can succeed

Documentation: https://feedwrangler.net/developers/users#login

Note: As a side effect, this method will cache the user’s list of subscriptions

Note: This method is currently the only way to create an FDWUser object

Declared In

FDWClient.h

destroyStream:completionHandler:

Destroys a smart stream

- (void)destroyStream:(FDWStream *)stream completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

stream

The smart stream to destroy

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes two arguments: the request’s success and an error

Discussion

Documentation: https://feedwrangler.net/developers/streams#destroy

Declared In

FDWClient.h

fetchCurrentStreamsWithCompletionHandler:

Fetch the user’s current smart streams

- (void)fetchCurrentStreamsWithCompletionHandler:(void ( ^ ) ( BOOL success , NSArray *streams , NSError *error ))completionHandler

Parameters

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWStream objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/streams#list

Declared In

FDWClient.h

fetchCurrentSubscriptionsWithCompletionHandler:

Fetches the user’s current list of subscriptions

- (void)fetchCurrentSubscriptionsWithCompletionHandler:(void ( ^ ) ( BOOL success , NSArray *subscriptions , NSError *error ))completionHandler

Parameters

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWFeed objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/subscriptions#list

Declared In

FDWClient.h

fetchFeedItemsWithRead:starred:feed:createdSince:updatedSince:limit:offset:completionHandler:

Fetches feed items based on the passed criterion

- (void)fetchFeedItemsWithRead:(NSNumber *)read starred:(NSNumber *)starred feed:(FDWFeed *)feed createdSince:(NSDate *)createdSince updatedSince:(NSDate *)updatedSince limit:(NSNumber *)limit offset:(NSNumber *)offset completionHandler:(void ( ^ ) ( BOOL success , NSArray *feedItems , NSError *error ))completionHandler

Parameters

read

filter based on read status (@YES or @NO), or dont filter if nil

starred

filter based on starred status (@YES or @NO), or dont filter if nil

feed

the feed to restrict request to, or nil if all feeds

createdSince

the oldest created date to fetch from, or no limit if nil

updatedSince

the oldest updated date to fetch from, or no limit if nil

limit

Maximum number of items to return, or API max if nil

offset

Number of items to skip before returning results, or none if nil

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWItem objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/feed_items#list

Note: this method is the same as fetchFeedItemsWithRead:starred:feedID:createdSince:updatedSince:limit:offset:completionHandler, except it takes an FDWFeed object instead of a raw feed id

Declared In

FDWClient.h

fetchFeedItemsWithRead:starred:feedID:createdSince:updatedSince:limit:offset:completionHandler:

Fetches feed items based on the passed criterion

- (void)fetchFeedItemsWithRead:(NSNumber *)read starred:(NSNumber *)starred feedID:(NSString *)feedID createdSince:(NSDate *)createdSince updatedSince:(NSDate *)updatedSince limit:(NSNumber *)limit offset:(NSNumber *)offset completionHandler:(void ( ^ ) ( BOOL success , NSArray *feedItems , NSError *error ))completionHandler

Parameters

read

filter based on read status (@YES or @NO), or dont filter if nil

starred

filter based on starred status (@YES or @NO), or dont filter if nil

feedID

the feed ID to restrict request to, or nil if all feeds

createdSince

the oldest created date to fetch from, or no limit if nil

updatedSince

the oldest updated date to fetch from, or no limit if nil

limit

Maximum number of items to return, or API max if nil

offset

Number of items to skip before returning results, or none if nil

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWItem objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/feed_items#list

Note: this method is the same as fetchFeedItemsWithRead:starred:feed:createdSince:updatedSince:limit:offset:completionHandler, except it takes a raw feed id instead of an FDWFeed object

Declared In

FDWClient.h

fetchStreamItems:limit:offset:completionHandler:

Fetch a smart stream’s items

- (void)fetchStreamItems:(FDWStream *)stream limit:(NSNumber *)limit offset:(NSNumber *)offset completionHandler:(void ( ^ ) ( BOOL success , NSArray *feedItems , NSError *error ))completionHandler

Parameters

stream

The stream whose items are to be fetched

limit

Maximum number of items to return, or nil for API default

offset

Number of items to skip before returning results, or nil for no offset

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWItem objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/streams#stream_items

Declared In

FDWClient.h

initWithAccessToken:baseURL:

Initializes a client with the given baseURL and access token

- (id)initWithAccessToken:(NSString *)accessToken baseURL:(NSURL *)baseURL

Parameters

accessToken

The initial access token for the client

baseURL

The baseURL for the client (should be set to [FDWClient APIBaseURL] unless you have a reason not to)

Return Value

A client with the given access token and base url

Discussion

Note: This is the suggested way to implement multi-user support (by initing multiple clients, one per user – can also be done with any other init method)

Declared In

FDWClient.h

isAuthenticated

Returns true if and only if the client has an access token and can make calls to the API

- (BOOL)isAuthenticated

Declared In

FDWClient.h

logOut

Logs the user out of the API, invalidating the access token, canceling all pending operations, and flushing the cache

- (void)logOut

Discussion

Documentation: https://feedwrangler.net/developers/users#logout

Declared In

FDWClient.h

markFeedItemsAsRead:feed:createdBefore:completionHandler:

Marks an array of feed items as read

- (void)markFeedItemsAsRead:(NSArray *)feedItems feed:(FDWFeed *)feed createdBefore:(NSDate *)createdBefore completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

feedItems

Array of FDWItems to mark as read, or nil if no limit

feed

Only update items within a particular feed, or nil if no limit

createdBefore

Limit the application to items created on or before, or nil if no limit

It is recommended that you pass in a createdBefore date of the last time you fetched the specific goup of items from the server

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes two arguments: the request’s success and an error

Discussion

Documentation: https://feedwrangler.net/developers/feed_items#mark_all_read

Note: This method only marks the items as read upon success

Declared In

FDWClient.h

searchForFeedItemsWithTerm:limit:offset:completionHandler:

Searches for items matching a search term

- (void)searchForFeedItemsWithTerm:(NSString *)searchTerm limit:(NSNumber *)limit offset:(NSString *)offset completionHandler:(void ( ^ ) ( BOOL success , NSArray *feedItems , NSError *error ))completionHandler

Parameters

searchTerm

String to match for the search

limit

Maximum number of items to return, or API max if nil

offset

Number of items to skip before returning results, or none if nil

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWItem objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/feed_items#search

Declared In

FDWClient.h

subscribeToURL:completionHandler:

Subscribes the user to a feed

- (void)subscribeToURL:(NSString *)url completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

url

The URL to subscribe to

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes two arguments: the request’s success and an error

Discussion

Documentation: https://feedwrangler.net/developers/subscriptions#add_feed

Declared In

FDWClient.h

unsubscribeFromFeed:completionHandler:

Unsubscribes the user from a feed

- (void)unsubscribeFromFeed:(FDWFeed *)feed completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandler

Parameters

feed

The feed to unsubscribe from

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes two arguments: the request’s success and an error

Discussion

Documentation: https://feedwrangler.net/developers/subscriptions#remove_feed

Declared In

FDWClient.h

updateFeedItem:withRead:starred:readLater:completionHandler:

Updates a feed item

- (void)updateFeedItem:(FDWItem *)feedItem withRead:(NSNumber *)read starred:(NSNumber *)starred readLater:(NSNumber *)readLater completionHandler:(void ( ^ ) ( BOOL success , FDWItem *feedItem , NSError *error ))completionHandler

Parameters

feedItem

The feed item to update

read

Changes the read status to @YES or @NO, or pass nil if no change

starred

Changes the starred status to @YES or @NO, or pass nil if no change

readLater

Changes the read later status to @YES or @NO, or pass nil if no change

completionHandler

A block object to be executed when the request finishes. The block has no return value and takes three arguments: the request’s success, an NSArray of FDWItem objects, and an error

Discussion

Documentation: https://feedwrangler.net/developers/feed_items#update

Note: This method only changes the feed item upon success

Declared In

FDWClient.h