@@ -25,7 +25,8 @@ class ParamsPostList {
2525 final List <int > includeTags;
2626 final List <int > excludeTags;
2727 final bool ? sticky;
28-
28+ /// Which fields to retrieve. If empty, gets all fields.
29+ final List <String > fields;
2930 ParamsPostList ({
3031 this .context = WordPressContext .view,
3132 this .pageNum = 1 ,
@@ -47,6 +48,7 @@ class ParamsPostList {
4748 this .includeTags = const [],
4849 this .excludeTags = const [],
4950 this .sticky,
51+ this .fields = const []
5052 });
5153
5254 Map <String , String > toMap () {
@@ -71,36 +73,37 @@ class ParamsPostList {
7173 'tags' : '${listToUrlString (includeTags )}' ,
7274 'tags_exclude' : '${listToUrlString (excludeTags )}' ,
7375 'sticky' : '${this .sticky == null ? '' : this .sticky }' ,
76+ '_fields' : this .fields.join (',' ),
7477 };
7578 }
7679
77- ParamsPostList copyWith ({
78- int ? pageNum,
79- int ? perPage,
80- }) {
81- return ParamsPostList (
82- afterDate: afterDate,
83- beforeDate: beforeDate,
84- context: context,
85- excludeAuthorIDs: excludeAuthorIDs,
86- excludeCategories: excludeCategories,
87- excludePostIDs: excludePostIDs,
88- excludeTags: excludeTags,
89- includeAuthorIDs: includeAuthorIDs,
90- includeCategories: includeCategories,
91- includePostIDs: includePostIDs,
92- includeTags: includeTags,
93- offset: offset,
94- order: order,
95- orderBy: orderBy,
96- pageNum: pageNum ?? this .pageNum,
97- perPage: perPage ?? this .perPage,
98- postStatus: postStatus,
99- searchQuery: searchQuery,
100- slug: slug,
101- sticky: sticky
102- );
103- }
80+ ParamsPostList copyWith ({
81+ int ? pageNum,
82+ int ? perPage,
83+ }) {
84+ return ParamsPostList (
85+ afterDate: afterDate,
86+ beforeDate: beforeDate,
87+ context: context,
88+ excludeAuthorIDs: excludeAuthorIDs,
89+ excludeCategories: excludeCategories,
90+ excludePostIDs: excludePostIDs,
91+ excludeTags: excludeTags,
92+ includeAuthorIDs: includeAuthorIDs,
93+ includeCategories: includeCategories,
94+ includePostIDs: includePostIDs,
95+ includeTags: includeTags,
96+ offset: offset,
97+ order: order,
98+ orderBy: orderBy,
99+ pageNum: pageNum ?? this .pageNum,
100+ perPage: perPage ?? this .perPage,
101+ postStatus: postStatus,
102+ searchQuery: searchQuery,
103+ slug: slug,
104+ sticky: sticky,
105+ fields : fields );
106+ }
104107
105108 @override
106109 String toString () {
0 commit comments