Skip to content

Commit 078cfe0

Browse files
committed
feat(api): Add filterValue option to ListPagesOption for icon filtering
1 parent 3eb50f2 commit 078cfe0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

api/pages/project.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,23 @@ export interface ListPagesOption<R extends Response | undefined>
3737
| "linked"
3838
| "views"
3939
| "title";
40+
4041
/** the index getting page list from
4142
*
4243
* @default {0}
4344
*/
4445
skip?: number;
46+
4547
/** threshold of the length of page list
4648
*
4749
* @default {100}
4850
*/
4951
limit?: number;
52+
53+
/**
54+
* The title of an icon to filter the page list by
55+
*/
56+
filterValue?: string;
5057
}
5158

5259
/** Constructs a request for the `/api/pages/:project` endpoint
@@ -59,13 +66,17 @@ export const makeGetRequest = <R extends Response | undefined>(
5966
project: string,
6067
options?: ListPagesOption<R>,
6168
): Request => {
62-
const { sid, baseURL, sort, limit, skip } = setDefaults(
69+
const { sid, baseURL, sort, limit, skip, filterValue } = setDefaults(
6370
options ?? {},
6471
);
6572
const params = new URLSearchParams();
6673
if (sort !== undefined) params.append("sort", sort);
6774
if (limit !== undefined) params.append("limit", `${limit}`);
6875
if (skip !== undefined) params.append("skip", `${skip}`);
76+
if (filterValue) {
77+
params.append("filterType", "icon");
78+
params.append("filterValue", filterValue);
79+
}
6980

7081
return new Request(
7182
`${baseURL}api/pages/${project}?${params}`,

rest/pages.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,23 @@ export interface ListPagesOption extends BaseOptions {
161161
| "linked"
162162
| "views"
163163
| "title";
164+
164165
/** the index getting page list from
165166
*
166167
* @default {0}
167168
*/
168169
skip?: number;
170+
169171
/** threshold of the length of page list
170172
*
171173
* @default {100}
172174
*/
173175
limit?: number;
176+
177+
/**
178+
* The title of an icon to filter the page list by
179+
*/
180+
filterValue?: string;
174181
}
175182

176183
export interface ListPages {
@@ -210,13 +217,17 @@ export type ListPagesError =
210217
| HTTPError;
211218

212219
const listPages_toRequest: ListPages["toRequest"] = (project, options) => {
213-
const { sid, hostName, sort, limit, skip } = setDefaults(
220+
const { sid, hostName, sort, limit, skip, filterValue } = setDefaults(
214221
options ?? {},
215222
);
216223
const params = new URLSearchParams();
217224
if (sort !== undefined) params.append("sort", sort);
218225
if (limit !== undefined) params.append("limit", `${limit}`);
219226
if (skip !== undefined) params.append("skip", `${skip}`);
227+
if (filterValue) {
228+
params.append("filterType", "icon");
229+
params.append("filterValue", filterValue);
230+
}
220231

221232
return new Request(
222233
`https://${hostName}/api/pages/${project}?${params}`,

0 commit comments

Comments
 (0)