File tree 3 files changed +13
-4
lines changed
Sources/WordPressKit/Services
Tests/WordPressKitTests/Tests 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,15 @@ typedef void(^ThemeServiceRemoteFailureBlock)(NSError *error);
60
60
*
61
61
* @param freeOnly Only fetch free themes, if false all WP themes will be returned
62
62
* @param page Results page to return.
63
+ * @param search Search term to filter themes. Can be nil or empty string.
63
64
* @param success The success handler. Can be nil.
64
65
* @param failure The failure handler. Can be nil.
65
66
*
66
67
* @returns A progress object that can be used to track progress and/or cancel the task
67
68
*/
68
69
- (NSProgress *)getWPThemesPage : (NSInteger )page
69
70
freeOnly : (BOOL )freeOnly
71
+ search : (NSString *)search
70
72
success : (ThemeServiceRemoteThemesRequestSuccessBlock)success
71
73
failure : (ThemeServiceRemoteFailureBlock)failure ;
72
74
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ - (NSProgress *)getThemeId:(NSString*)themeId
99
99
100
100
- (NSProgress *)getWPThemesPage : (NSInteger )page
101
101
freeOnly : (BOOL )freeOnly
102
+ search : (NSString *)search
102
103
success : (ThemeServiceRemoteThemesRequestSuccessBlock)success
103
104
failure : (ThemeServiceRemoteFailureBlock)failure
104
105
{
@@ -107,10 +108,15 @@ - (NSProgress *)getWPThemesPage:(NSInteger)page
107
108
NSString *requestUrl = [self pathForEndpoint: @" themes"
108
109
withVersion: WordPressComRESTAPIVersion_1_2];
109
110
110
- NSDictionary *parameters = @{ThemeRequestTierKey: freeOnly ? ThemeRequestTierFreeValue : ThemeRequestTierAllValue,
111
- ThemeRequestNumberKey: @(ThemeRequestNumberValue),
112
- ThemeRequestPageKey: @(page),
113
- };
111
+ NSMutableDictionary *parameters = [@{
112
+ ThemeRequestTierKey: freeOnly ? ThemeRequestTierFreeValue : ThemeRequestTierAllValue,
113
+ ThemeRequestNumberKey: @(ThemeRequestNumberValue),
114
+ ThemeRequestPageKey: @(page)
115
+ } mutableCopy];
116
+
117
+ if (search && search.length > 0 ) {
118
+ parameters[@" search" ] = search;
119
+ }
114
120
115
121
return [self getThemesWithRequestUrl: requestUrl
116
122
page: page
Original file line number Diff line number Diff line change @@ -225,6 +225,7 @@ - (void)testThatGetThemesWorks
225
225
226
226
XCTAssertNoThrow ([service getWPThemesPage: 1
227
227
freeOnly: NO
228
+ search: nil
228
229
success: successBlock
229
230
failure: nil ]);
230
231
}
You can’t perform that action at this time.
0 commit comments