-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathReaderSiteService.h
77 lines (62 loc) · 2.49 KB
/
ReaderSiteService.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#import <Foundation/Foundation.h>
#import "ReaderTopicService.h"
@import WordPressData;
typedef NS_ENUM(NSUInteger, ReaderSiteServiceError) {
ReaderSiteServiceErrorNotLoggedIn,
ReaderSiteServiceErrorAlreadyFollowingSite
};
extern NSString * const ReaderSiteServiceErrorDomain;
@interface ReaderSiteService : CoreDataService
/**
Follow a site by its URL.
Attempts to determine if the site is self-hosted or a WordPress.com site, then
calls the appropriate follow method.
@param siteURL The URL of the site.
@param success block called on a successful fetch.
@param failure block called if there is any error. `error` can be any underlying network error.
*/
- (void)followSiteByURL:(NSURL *)siteURL
success:(void (^)(void))success
failure:(void(^)(NSError *error))failure;
/**
Follow a wpcom site by ID.
@param siteID The ID of the site.
@param success block called on a successful follow.
@param failure block called if there is any error. `error` can be any underlying network error.
*/
- (void)followSiteWithID:(NSUInteger)siteID
success:(void(^)(void))success
failure:(void(^)(NSError *error))failure;
/**
Unfollow a wpcom site by ID
@param siteID The ID of the site.
@param success block called on a successful unfollow.
@param failure block called if there is any error. `error` can be any underlying network error.
*/
- (void)unfollowSiteWithID:(NSUInteger)siteID
success:(void(^)(void))success
failure:(void(^)(NSError *error))failure;
/**
Follow a wpcom or wporg site by URL.
@param siteURL The URL of the site as a string.
@param success block called on a successful follow.
@param failure block called if there is any error. `error` can be any underlying network error.
*/
- (void)followSiteAtURL:(NSString *)siteURL
success:(void(^)(void))success
failure:(void(^)(NSError *error))failure;
/**
Unfollow a wpcom or wporg site by URL.
@param siteURL The URL of the site as a string.
@param success block called on a successful unfollow.
@param failure block called if there is any error. `error` can be any underlying network error.
*/
- (void)unfollowSiteAtURL:(NSString *)siteURL
success:(void(^)(void))success
failure:(void(^)(NSError *error))failure;
/**
Sync posts for the 'sites I follow endpoint if it exists. Maybe called whenever
a site/feed is followed or unfollowed.
*/
- (void)syncPostsForFollowedSites;
@end