-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathBlogServiceRemoteREST.m
More file actions
507 lines (442 loc) · 25.9 KB
/
BlogServiceRemoteREST.m
File metadata and controls
507 lines (442 loc) · 25.9 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
#import <Foundation/Foundation.h>
#import "BlogServiceRemoteREST.h"
#import "NSMutableDictionary+Helpers.h"
#import "RemotePostType.h"
#import "WPKitLogging.h"
@import WordPressShared;
@import WordPressKitModels;
@import NSObject_SafeExpectations;
#pragma mark - Parsing Keys
static NSString * const RemoteBlogNameKey = @"name";
static NSString * const RemoteBlogTaglineKey = @"description";
static NSString * const RemoteBlogPrivacyKey = @"blog_public";
static NSString * const RemoteBlogLanguageKey = @"lang_id";
static NSString * const RemoteBlogIconKey = @"site_icon";
static NSString * const RemoteBlogGMTOffsetKey = @"gmt_offset";
static NSString * const RemoteBlogTimezoneStringKey = @"timezone_string";
static NSString * const RemoteBlogSettingsKey = @"settings";
static NSString * const RemoteBlogDefaultCategoryKey = @"default_category";
static NSString * const RemoteBlogDefaultPostFormatKey = @"default_post_format";
static NSString * const RemoteBlogDateFormatKey = @"date_format";
static NSString * const RemoteBlogTimeFormatKey = @"time_format";
static NSString * const RemoteBlogStartOfWeekKey = @"start_of_week";
static NSString * const RemoteBlogPostsPerPageKey = @"posts_per_page";
static NSString * const RemoteBlogCommentsAllowedKey = @"default_comment_status";
static NSString * const RemoteBlogCommentsBlocklistKeys = @"blacklist_keys";
static NSString * const RemoteBlogCommentsCloseAutomaticallyKey = @"close_comments_for_old_posts";
static NSString * const RemoteBlogCommentsCloseAutomaticallyAfterDaysKey = @"close_comments_days_old";
static NSString * const RemoteBlogCommentsKnownUsersAllowlistKey = @"comment_whitelist";
static NSString * const RemoteBlogCommentsMaxLinksKey = @"comment_max_links";
static NSString * const RemoteBlogCommentsModerationKeys = @"moderation_keys";
static NSString * const RemoteBlogCommentsPagingEnabledKey = @"page_comments";
static NSString * const RemoteBlogCommentsPageSizeKey = @"comments_per_page";
static NSString * const RemoteBlogCommentsRequireModerationKey = @"comment_moderation";
static NSString * const RemoteBlogCommentsRequireNameAndEmailKey = @"require_name_email";
static NSString * const RemoteBlogCommentsRequireRegistrationKey = @"comment_registration";
static NSString * const RemoteBlogCommentsSortOrderKey = @"comment_order";
static NSString * const RemoteBlogCommentsThreadingEnabledKey = @"thread_comments";
static NSString * const RemoteBlogCommentsThreadingDepthKey = @"thread_comments_depth";
static NSString * const RemoteBlogCommentsPingbackOutboundKey = @"default_pingback_flag";
static NSString * const RemoteBlogCommentsPingbackInboundKey = @"default_ping_status";
static NSString * const RemoteBlogRelatedPostsAllowedKey = @"jetpack_relatedposts_allowed";
static NSString * const RemoteBlogRelatedPostsEnabledKey = @"jetpack_relatedposts_enabled";
static NSString * const RemoteBlogRelatedPostsShowHeadlineKey = @"jetpack_relatedposts_show_headline";
static NSString * const RemoteBlogRelatedPostsShowThumbnailsKey = @"jetpack_relatedposts_show_thumbnails";
static NSString * const RemoteBlogAmpSupportedKey = @"amp_is_supported";
static NSString * const RemoteBlogAmpEnabledKey = @"amp_is_enabled";
static NSString * const RemoteBlogSharingButtonStyle = @"sharing_button_style";
static NSString * const RemoteBlogSharingLabel = @"sharing_label";
static NSString * const RemoteBlogSharingTwitterName = @"twitter_via";
static NSString * const RemoteBlogSharingCommentLikesEnabled = @"jetpack_comment_likes_enabled";
static NSString * const RemoteBlogSharingDisabledLikes = @"disabled_likes";
static NSString * const RemoteBlogSharingDisabledReblogs = @"disabled_reblogs";
static NSString * const RemotePostTypesKey = @"post_types";
static NSString * const RemotePostTypeNameKey = @"name";
static NSString * const RemotePostTypeLabelKey = @"label";
static NSString * const RemotePostTypeQueryableKey = @"api_queryable";
#pragma mark - Keys used for Update Calls
// Note: Only god knows why these don't match the "Parsing Keys"
static NSString * const RemoteBlogNameForUpdateKey = @"blogname";
static NSString * const RemoteBlogTaglineForUpdateKey = @"blogdescription";
#pragma mark - Defaults
static NSString * const RemoteBlogDefaultPostFormat = @"standard";
static NSInteger const RemoteBlogUncategorizedCategory = 1;
@implementation BlogServiceRemoteREST
- (void)getAllAuthorsWithSuccess:(UsersHandler)success
failure:(void (^)(NSError *error))failure
{
[self getAllAuthorsWithRemoteUsers:nil
offset:nil
success:success
failure:failure];
}
/**
This method is called recursively to fetch all authors.
The success block is called whenever the response users array is nil or empty.
@param remoteUsers The loaded remote users
@param offset The first n users to be skipped in the returned array
@param success The block that will be executed on success
@param failure The block that will be executed on failure
*/
- (void)getAllAuthorsWithRemoteUsers:(NSMutableArray <RemoteUser *>*)remoteUsers
offset:(NSNumber *)offset
success:(UsersHandler)success
failure:(void (^)(NSError *error))failure
{
NSMutableDictionary *parameters = [@{ @"authors_only":@(YES),
@"number": @(100)
} mutableCopy];
if ([offset wp_isValidObject]) {
parameters[@"offset"] = offset.stringValue;
}
NSString *path = [self pathForUsers];
NSString *requestUrl = [self pathForEndpoint:path
withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI get:requestUrl
parameters:parameters
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
if (success) {
NSArray *responseUsers = responseObject[@"users"];
NSMutableArray *users = [remoteUsers wp_isValidObject] ? [remoteUsers mutableCopy] : [NSMutableArray array];
if (![responseUsers wp_isValidObject] || responseUsers.count == 0) {
success([users copy]);
} else {
[users addObjectsFromArray:[self usersFromJSONArray:responseUsers]];
[self getAllAuthorsWithRemoteUsers:users
offset:@(users.count)
success:success
failure:failure];
}
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)syncPostTypesWithSuccess:(PostTypesHandler)success
failure:(void (^)(NSError *error))failure
{
NSString *path = [self pathForPostTypes];
NSString *requestUrl = [self pathForEndpoint:path
withVersion:WordPressComRESTAPIVersion_1_1];
NSDictionary *parameters = @{@"context": @"edit"};
[self.wordPressComRESTAPI get:requestUrl
parameters:parameters
success:^(NSDictionary *responseObject, NSHTTPURLResponse *httpResponse) {
NSAssert([responseObject isKindOfClass:[NSDictionary class]], @"Response should be a dictionary.");
NSArray <RemotePostType *> *postTypes = [[responseObject arrayForKey:RemotePostTypesKey] wp_map:^id(NSDictionary *json) {
return [self remotePostTypeWithDictionary:json];
}];
if (!postTypes.count) {
WPKitLogError(@"Response to %@ did not include post types for site.", requestUrl);
failure(nil);
return;
}
if (success) {
success(postTypes);
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)syncPostFormatsWithSuccess:(PostFormatsHandler)success
failure:(void (^)(NSError *))failure
{
NSString *path = [self pathForPostFormats];
NSString *requestUrl = [self pathForEndpoint:path
withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI get:requestUrl
parameters:nil
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
NSDictionary *formats = [self mapPostFormatsFromResponse:responseObject[@"formats"]];
if (success) {
success(formats);
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)syncBlogWithSuccess:(BlogDetailsHandler)success
failure:(void (^)(NSError *))failure
{
NSString *path = [self pathForSite];
NSString *requestUrl = [self pathForEndpoint:path
withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI get:requestUrl
parameters:nil
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
NSDictionary *responseDict = (NSDictionary *)responseObject;
RemoteBlog *remoteBlog = [[RemoteBlog alloc] initWithJSONDictionary:responseDict];
if (success) {
success(remoteBlog);
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)syncBlogSettingsWithSuccess:(SettingsHandler)success
failure:(void (^)(NSError *error))failure
{
NSString *path = [self pathForSettings];
NSString *requestUrl = [self pathForEndpoint:path withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI get:requestUrl
parameters:nil
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
if (![responseObject isKindOfClass:[NSDictionary class]]){
if (failure) {
failure(nil);
}
return;
}
RemoteBlogSettings *remoteSettings = [self remoteBlogSettingFromJSONDictionary:responseObject];
if (success) {
success(remoteSettings);
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)updateBlogSettings:(RemoteBlogSettings *)settings
success:(SuccessHandler)success
failure:(void (^)(NSError *error))failure;
{
NSParameterAssert(settings);
NSDictionary *parameters = [self remoteSettingsToDictionary:settings];
NSString *path = [NSString stringWithFormat:@"sites/%@/settings?context=edit", self.siteID];
NSString *requestUrl = [self pathForEndpoint:path withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI post:requestUrl
parameters:parameters
success:^(NSDictionary *responseDict, NSHTTPURLResponse *httpResponse) {
if (![responseDict isKindOfClass:[NSDictionary class]]) {
if (failure) {
failure(nil);
}
return;
}
if (!responseDict[@"updated"]) {
if (failure) {
failure(nil);
}
} else if (success) {
success();
}
}
failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)fetchSiteInfoForAddress:(NSString *)siteAddress
success:(void(^)(NSDictionary *siteInfoDict))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"sites/%@", siteAddress];
NSString *requestUrl = [self pathForEndpoint:path
withVersion:WordPressComRESTAPIVersion_1_1];
[self.wordPressComRESTAPI get:requestUrl
parameters:nil
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
if (success) {
success((NSDictionary *)responseObject);
return;
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if (failure) {
failure(error);
}
}];
}
- (void)fetchUnauthenticatedSiteInfoForAddress:(NSString *)siteAddress
success:(void(^)(NSDictionary *siteInfoDict))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [self pathForEndpoint:@"connect/site-info" withVersion:WordPressComRESTAPIVersion_1_1];
NSURL *siteURL = [NSURL URLWithString:siteAddress];
[self.wordPressComRESTAPI get:path
parameters:@{ @"url": siteURL.absoluteString }
success:^(id responseObject, NSHTTPURLResponse *httpResponse) {
if (success) {
success((NSDictionary *)responseObject);
}
} failure:^(NSError *error, NSHTTPURLResponse *httpResponse) {
if(failure) {
failure(error);
}
}];
}
#pragma mark - API paths
- (NSString *)pathForUsers
{
return [NSString stringWithFormat:@"sites/%@/users", self.siteID];
}
- (NSString *)pathForSite
{
return [NSString stringWithFormat:@"sites/%@", self.siteID];
}
- (NSString *)pathForPostTypes
{
return [NSString stringWithFormat:@"sites/%@/post-types", self.siteID];
}
- (NSString *)pathForPostFormats
{
return [NSString stringWithFormat:@"sites/%@/post-formats", self.siteID];
}
- (NSString *)pathForSettings
{
return [NSString stringWithFormat:@"sites/%@/settings", self.siteID];
}
#pragma mark - Mapping methods
- (NSArray *)usersFromJSONArray:(NSArray *)jsonUsers
{
return [jsonUsers wp_map:^RemoteUser *(NSDictionary *jsonUser) {
return [self userFromJSONDictionary:jsonUser];
}];
}
- (RemoteUser *)userFromJSONDictionary:(NSDictionary *)jsonUser
{
RemoteUser *user = [RemoteUser new];
user.userID = jsonUser[@"ID"];
user.username = jsonUser[@"login"];
user.email = jsonUser[@"email"];
user.displayName = jsonUser[@"name"];
user.primaryBlogID = jsonUser[@"site_ID"];
user.avatarURL = jsonUser[@"avatar_URL"];
user.linkedUserID = jsonUser[@"linked_user_ID"];
return user;
}
- (NSDictionary *)mapPostFormatsFromResponse:(id)response
{
if ([response isKindOfClass:[NSDictionary class]]) {
return response;
} else {
return @{};
}
}
- (RemotePostType *)remotePostTypeWithDictionary:(NSDictionary *)json
{
RemotePostType *postType = [[RemotePostType alloc] init];
postType.name = [json stringForKey:RemotePostTypeNameKey];
postType.label = [json stringForKey:RemotePostTypeLabelKey];
postType.apiQueryable = [json numberForKey:RemotePostTypeQueryableKey];
return postType;
}
- (RemoteBlogSettings *)remoteBlogSettingFromJSONDictionary:(NSDictionary *)json
{
NSAssert([json isKindOfClass:[NSDictionary class]], @"Invalid Settings Kind");
RemoteBlogSettings *settings = [RemoteBlogSettings new];
NSDictionary *rawSettings = [json dictionaryForKey:RemoteBlogSettingsKey];
// General
settings.name = [json stringForKey:RemoteBlogNameKey];
settings.tagline = [json stringForKey:RemoteBlogTaglineKey];
settings.privacy = [rawSettings numberForKey:RemoteBlogPrivacyKey];
settings.languageID = [rawSettings numberForKey:RemoteBlogLanguageKey];
settings.iconMediaID = [rawSettings numberForKey:RemoteBlogIconKey];
settings.gmtOffset = [rawSettings numberForKey:RemoteBlogGMTOffsetKey];
settings.timezoneString = [rawSettings stringForKey:RemoteBlogTimezoneStringKey];
// Writing
settings.defaultCategoryID = [rawSettings numberForKey:RemoteBlogDefaultCategoryKey] ?: @(RemoteBlogUncategorizedCategory);
// Note: the backend might send '0' as a number, OR a string value. Ref. Issue #4187
if ([[rawSettings numberForKey:RemoteBlogDefaultPostFormatKey] isEqualToNumber:@(0)] ||
[[rawSettings stringForKey:RemoteBlogDefaultPostFormatKey] isEqualToString:@"0"])
{
settings.defaultPostFormat = RemoteBlogDefaultPostFormat;
} else {
settings.defaultPostFormat = [rawSettings stringForKey:RemoteBlogDefaultPostFormatKey];
}
settings.dateFormat = [rawSettings stringForKey:RemoteBlogDateFormatKey];
settings.timeFormat = [rawSettings stringForKey:RemoteBlogTimeFormatKey];
settings.startOfWeek = [rawSettings stringForKey:RemoteBlogStartOfWeekKey];
settings.postsPerPage = [rawSettings numberForKey:RemoteBlogPostsPerPageKey];
// Discussion
settings.commentsAllowed = [rawSettings numberForKey:RemoteBlogCommentsAllowedKey];
settings.commentsBlocklistKeys = [rawSettings stringForKey:RemoteBlogCommentsBlocklistKeys];
settings.commentsCloseAutomatically = [rawSettings numberForKey:RemoteBlogCommentsCloseAutomaticallyKey];
settings.commentsCloseAutomaticallyAfterDays = [rawSettings numberForKey:RemoteBlogCommentsCloseAutomaticallyAfterDaysKey];
settings.commentsFromKnownUsersAllowlisted = [rawSettings numberForKey:RemoteBlogCommentsKnownUsersAllowlistKey];
settings.commentsMaximumLinks = [rawSettings numberForKey:RemoteBlogCommentsMaxLinksKey];
settings.commentsModerationKeys = [rawSettings stringForKey:RemoteBlogCommentsModerationKeys];
settings.commentsPagingEnabled = [rawSettings numberForKey:RemoteBlogCommentsPagingEnabledKey];
settings.commentsPageSize = [rawSettings numberForKey:RemoteBlogCommentsPageSizeKey];
settings.commentsRequireManualModeration = [rawSettings numberForKey:RemoteBlogCommentsRequireModerationKey];
settings.commentsRequireNameAndEmail = [rawSettings numberForKey:RemoteBlogCommentsRequireNameAndEmailKey];
settings.commentsRequireRegistration = [rawSettings numberForKey:RemoteBlogCommentsRequireRegistrationKey];
settings.commentsSortOrder = [rawSettings stringForKey:RemoteBlogCommentsSortOrderKey];
settings.commentsThreadingEnabled = [rawSettings numberForKey:RemoteBlogCommentsThreadingEnabledKey];
settings.commentsThreadingDepth = [rawSettings numberForKey:RemoteBlogCommentsThreadingDepthKey];
settings.pingbackOutboundEnabled = [rawSettings numberForKey:RemoteBlogCommentsPingbackOutboundKey];
settings.pingbackInboundEnabled = [rawSettings numberForKey:RemoteBlogCommentsPingbackInboundKey];
// Related Posts
settings.relatedPostsAllowed = [rawSettings numberForKey:RemoteBlogRelatedPostsAllowedKey];
settings.relatedPostsEnabled = [rawSettings numberForKey:RemoteBlogRelatedPostsEnabledKey];
settings.relatedPostsShowHeadline = [rawSettings numberForKey:RemoteBlogRelatedPostsShowHeadlineKey];
settings.relatedPostsShowThumbnails = [rawSettings numberForKey:RemoteBlogRelatedPostsShowThumbnailsKey];
// AMP
settings.ampSupported = [rawSettings numberForKey:RemoteBlogAmpSupportedKey];
settings.ampEnabled = [rawSettings numberForKey:RemoteBlogAmpEnabledKey];
// Sharing
settings.sharingButtonStyle = [rawSettings stringForKey:RemoteBlogSharingButtonStyle];
settings.sharingLabel = [rawSettings stringForKey:RemoteBlogSharingLabel];
settings.sharingTwitterName = [rawSettings stringForKey:RemoteBlogSharingTwitterName];
settings.sharingCommentLikesEnabled = [rawSettings numberForKey:RemoteBlogSharingCommentLikesEnabled];
settings.sharingDisabledLikes = [rawSettings numberForKey:RemoteBlogSharingDisabledLikes];
settings.sharingDisabledReblogs = [rawSettings numberForKey:RemoteBlogSharingDisabledReblogs];
return settings;
}
- (NSDictionary *)remoteSettingsToDictionary:(RemoteBlogSettings *)settings
{
NSParameterAssert(settings);
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
[parameters setValueIfNotNil:settings.name forKey:RemoteBlogNameForUpdateKey];
[parameters setValueIfNotNil:settings.tagline forKey:RemoteBlogTaglineForUpdateKey];
[parameters setValueIfNotNil:settings.privacy forKey:RemoteBlogPrivacyKey];
[parameters setValueIfNotNil:settings.languageID forKey:RemoteBlogLanguageKey];
[parameters setValueIfNotNil:settings.iconMediaID forKey:RemoteBlogIconKey];
[parameters setValueIfNotNil:settings.gmtOffset forKey:RemoteBlogGMTOffsetKey];
[parameters setValueIfNotNil:settings.timezoneString forKey:RemoteBlogTimezoneStringKey];
[parameters setValueIfNotNil:settings.defaultCategoryID forKey:RemoteBlogDefaultCategoryKey];
[parameters setValueIfNotNil:settings.defaultPostFormat forKey:RemoteBlogDefaultPostFormatKey];
[parameters setValueIfNotNil:settings.dateFormat forKey:RemoteBlogDateFormatKey];
[parameters setValueIfNotNil:settings.timeFormat forKey:RemoteBlogTimeFormatKey];
[parameters setValueIfNotNil:settings.startOfWeek forKey:RemoteBlogStartOfWeekKey];
[parameters setValueIfNotNil:settings.postsPerPage forKey:RemoteBlogPostsPerPageKey];
[parameters setValueIfNotNil:settings.commentsAllowed forKey:RemoteBlogCommentsAllowedKey];
[parameters setValueIfNotNil:settings.commentsBlocklistKeys forKey:RemoteBlogCommentsBlocklistKeys];
[parameters setValueIfNotNil:settings.commentsCloseAutomatically forKey:RemoteBlogCommentsCloseAutomaticallyKey];
[parameters setValueIfNotNil:settings.commentsCloseAutomaticallyAfterDays forKey:RemoteBlogCommentsCloseAutomaticallyAfterDaysKey];
[parameters setValueIfNotNil:settings.commentsFromKnownUsersAllowlisted forKey:RemoteBlogCommentsKnownUsersAllowlistKey];
[parameters setValueIfNotNil:settings.commentsMaximumLinks forKey:RemoteBlogCommentsMaxLinksKey];
[parameters setValueIfNotNil:settings.commentsModerationKeys forKey:RemoteBlogCommentsModerationKeys];
[parameters setValueIfNotNil:settings.commentsPagingEnabled forKey:RemoteBlogCommentsPagingEnabledKey];
[parameters setValueIfNotNil:settings.commentsPageSize forKey:RemoteBlogCommentsPageSizeKey];
[parameters setValueIfNotNil:settings.commentsRequireManualModeration forKey:RemoteBlogCommentsRequireModerationKey];
[parameters setValueIfNotNil:settings.commentsRequireNameAndEmail forKey:RemoteBlogCommentsRequireNameAndEmailKey];
[parameters setValueIfNotNil:settings.commentsRequireRegistration forKey:RemoteBlogCommentsRequireRegistrationKey];
[parameters setValueIfNotNil:settings.commentsSortOrder forKey:RemoteBlogCommentsSortOrderKey];
[parameters setValueIfNotNil:settings.commentsThreadingEnabled forKey:RemoteBlogCommentsThreadingEnabledKey];
[parameters setValueIfNotNil:settings.commentsThreadingDepth forKey:RemoteBlogCommentsThreadingDepthKey];
[parameters setValueIfNotNil:settings.pingbackOutboundEnabled forKey:RemoteBlogCommentsPingbackOutboundKey];
[parameters setValueIfNotNil:settings.pingbackInboundEnabled forKey:RemoteBlogCommentsPingbackInboundKey];
[parameters setValueIfNotNil:settings.relatedPostsEnabled forKey:RemoteBlogRelatedPostsEnabledKey];
[parameters setValueIfNotNil:settings.relatedPostsShowHeadline forKey:RemoteBlogRelatedPostsShowHeadlineKey];
[parameters setValueIfNotNil:settings.relatedPostsShowThumbnails forKey:RemoteBlogRelatedPostsShowThumbnailsKey];
[parameters setValueIfNotNil:settings.ampEnabled forKey:RemoteBlogAmpEnabledKey];
// Sharing
[parameters setValueIfNotNil:settings.sharingButtonStyle forKey:RemoteBlogSharingButtonStyle];
[parameters setValueIfNotNil:settings.sharingLabel forKey:RemoteBlogSharingLabel];
[parameters setValueIfNotNil:settings.sharingTwitterName forKey:RemoteBlogSharingTwitterName];
[parameters setValueIfNotNil:settings.sharingCommentLikesEnabled forKey:RemoteBlogSharingCommentLikesEnabled];
[parameters setValueIfNotNil:settings.sharingDisabledLikes forKey:RemoteBlogSharingDisabledLikes];
[parameters setValueIfNotNil:settings.sharingDisabledReblogs forKey:RemoteBlogSharingDisabledReblogs];
return parameters;
}
@end