FDWClient Class Reference
| 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
-
+ APIBaseURLThe API’s base URL Defaults to “https://feedwrangler.net/api/v2/”
Initialization
-
+ sharedClientReturns the singleton shared client, with no default accessToken set
-
+ sharedClientWithAccessToken:Returns the singleton shared client, with the access token set to
accessToken -
– initWithAccessToken:baseURL:Initializes a client with the given baseURL and access token
Authentication
-
– authenticateEmail:password:clientKey:completionHandler:Authenticates a FeedWrangler user, must be called (and completed) before any other requests can be made
-
accessTokenThe 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 -
– isAuthenticatedReturns true if and only if the client has an access token and can make calls to the API
-
authenticatedUserThe client’s authenticatd user, or nil
property -
– logOutLogs the user out of the API, invalidating the access token, canceling all pending operations, and flushing the cache
Subscriptions
-
– fetchCurrentSubscriptionsWithCompletionHandler:Fetches the user’s current list of subscriptions
-
– subscribeToURL:completionHandler:Subscribes the user to a feed
-
– unsubscribeFromFeed:completionHandler:Unsubscribes the user from a feed
Feed Items
-
– fetchFeedItemsWithRead:starred:feedID:createdSince:updatedSince:limit:offset:completionHandler:Fetches feed items based on the passed criterion
-
– fetchFeedItemsWithRead:starred:feed:createdSince:updatedSince:limit:offset:completionHandler:Fetches feed items based on the passed criterion
-
– searchForFeedItemsWithTerm:limit:offset:completionHandler:Searches for items matching a search term
-
– updateFeedItem:withRead:starred:readLater:completionHandler:Updates a feed item
-
– markFeedItemsAsRead:feed:createdBefore:completionHandler:Marks an array of feed items as read
Streams
-
– fetchCurrentStreamsWithCompletionHandler:Fetch the user’s current smart streams
-
– fetchStreamItems:limit:offset:completionHandler:Fetch a smart stream’s items
-
– destroyStream:completionHandler:Destroys a smart stream
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 *accessTokenDeclared In
FDWClient.hClass Methods
APIBaseURL
The API’s base URL Defaults to “https://feedwrangler.net/api/v2/”
+ (NSURL *)APIBaseURLReturn Value
The API’s base URL
Declared In
FDWClient.hsharedClient
Returns the singleton shared client, with no default accessToken set
+ (instancetype)sharedClientReturn Value
The shared client
Declared In
FDWClient.hsharedClientWithAccessToken:
Returns the singleton shared client, with the access token set to accessToken
+ (instancetype)sharedClientWithAccessToken:(NSString *)accessTokenParameters
- accessToken
The initial access token
Return Value
The shared client
Declared In
FDWClient.hInstance 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 ))completionHandlerParameters
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.hdestroyStream:completionHandler:
Destroys a smart stream
- (void)destroyStream:(FDWStream *)stream completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandlerParameters
- 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.hfetchCurrentStreamsWithCompletionHandler:
Fetch the user’s current smart streams
- (void)fetchCurrentStreamsWithCompletionHandler:(void ( ^ ) ( BOOL success , NSArray *streams , NSError *error ))completionHandlerParameters
- 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.hfetchCurrentSubscriptionsWithCompletionHandler:
Fetches the user’s current list of subscriptions
- (void)fetchCurrentSubscriptionsWithCompletionHandler:(void ( ^ ) ( BOOL success , NSArray *subscriptions , NSError *error ))completionHandlerParameters
- 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.hfetchFeedItemsWithRead: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 ))completionHandlerParameters
- read
filter based on read status (
@YESor@NO), or dont filter ifnil
- starred
filter based on starred status (
@YESor@NO), or dont filter ifnil
- feed
the feed to restrict request to, or
nilif 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.hfetchFeedItemsWithRead: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 ))completionHandlerParameters
- read
filter based on read status (
@YESor@NO), or dont filter ifnil
- starred
filter based on starred status (
@YESor@NO), or dont filter ifnil
- feedID
the feed ID to restrict request to, or
nilif 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.hfetchStreamItems: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 ))completionHandlerParameters
- stream
The stream whose items are to be fetched
- limit
Maximum number of items to return, or
nilfor API default
- offset
Number of items to skip before returning results, or
nilfor 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.hinitWithAccessToken:baseURL:
Initializes a client with the given baseURL and access token
- (id)initWithAccessToken:(NSString *)accessToken baseURL:(NSURL *)baseURLParameters
- 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.hisAuthenticated
Returns true if and only if the client has an access token and can make calls to the API
- (BOOL)isAuthenticatedDeclared In
FDWClient.hlogOut
Logs the user out of the API, invalidating the access token, canceling all pending operations, and flushing the cache
- (void)logOutDiscussion
Documentation: https://feedwrangler.net/developers/users#logout
Declared In
FDWClient.hmarkFeedItemsAsRead: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 ))completionHandlerParameters
- feedItems
Array of
FDWItems to mark as read, ornilif no limit
- feed
Only update items within a particular feed, or
nilif no limit
- createdBefore
Limit the application to items created on or before, or
nilif no limitIt is recommended that you pass in a
createdBeforedate 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.hsearchForFeedItemsWithTerm: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 ))completionHandlerParameters
- 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.hsubscribeToURL:completionHandler:
Subscribes the user to a feed
- (void)subscribeToURL:(NSString *)url completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandlerParameters
- 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.hunsubscribeFromFeed:completionHandler:
Unsubscribes the user from a feed
- (void)unsubscribeFromFeed:(FDWFeed *)feed completionHandler:(void ( ^ ) ( BOOL success , NSError *error ))completionHandlerParameters
- 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.hupdateFeedItem: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 ))completionHandlerParameters
- feedItem
The feed item to update
- read
Changes the read status to @YES or @NO, or pass
nilif no change
- starred
Changes the starred status to @YES or @NO, or pass
nilif no change
- readLater
Changes the read later status to @YES or @NO, or pass
nilif 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