diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2019-05-21 11:18:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-21 11:18:19 +0200 |
commit | a2b5d67560341011e791b678422578ab8d6b1e3f (patch) | |
tree | bfe5a7d8f3d8cfbbe8131d8ee6ade29dfea88853 /src/Wallabag/ApiBundle/Controller | |
parent | b8b37ccdea6b453aa228cb79755752b5738b98b9 (diff) | |
parent | 2c290747cb0d235392f6e5d22205a706c6474168 (diff) | |
download | wallabag-a2b5d67560341011e791b678422578ab8d6b1e3f.tar.gz wallabag-a2b5d67560341011e791b678422578ab8d6b1e3f.tar.zst wallabag-a2b5d67560341011e791b678422578ab8d6b1e3f.zip |
Merge pull request #3960 from wallabag/api-entries-2817
api/entries: add parameter detail to exclude or include content in response
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 06520af9..aff0534a 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -103,6 +103,7 @@ class EntryRestController extends WallabagRestController | |||
103 | * {"name"="tags", "dataType"="string", "required"=false, "format"="api,rest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."}, | 103 | * {"name"="tags", "dataType"="string", "required"=false, "format"="api,rest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."}, |
104 | * {"name"="since", "dataType"="integer", "required"=false, "format"="default '0'", "description"="The timestamp since when you want entries updated."}, | 104 | * {"name"="since", "dataType"="integer", "required"=false, "format"="default '0'", "description"="The timestamp since when you want entries updated."}, |
105 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"}, | 105 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"}, |
106 | * {"name"="detail", "dataType"="string", "required"=false, "format"="metadata or full, metadata by default", "description"="include content field if 'full'. 'full' by default for backward compatibility."}, | ||
106 | * } | 107 | * } |
107 | * ) | 108 | * ) |
108 | * | 109 | * |
@@ -121,6 +122,7 @@ class EntryRestController extends WallabagRestController | |||
121 | $perPage = (int) $request->query->get('perPage', 30); | 122 | $perPage = (int) $request->query->get('perPage', 30); |
122 | $tags = \is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', ''); | 123 | $tags = \is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', ''); |
123 | $since = $request->query->get('since', 0); | 124 | $since = $request->query->get('since', 0); |
125 | $detail = strtolower($request->query->get('detail', 'full')); | ||
124 | 126 | ||
125 | try { | 127 | try { |
126 | /** @var \Pagerfanta\Pagerfanta $pager */ | 128 | /** @var \Pagerfanta\Pagerfanta $pager */ |
@@ -132,7 +134,8 @@ class EntryRestController extends WallabagRestController | |||
132 | $sort, | 134 | $sort, |
133 | $order, | 135 | $order, |
134 | $since, | 136 | $since, |
135 | $tags | 137 | $tags, |
138 | $detail | ||
136 | ); | 139 | ); |
137 | } catch (\Exception $e) { | 140 | } catch (\Exception $e) { |
138 | throw new BadRequestHttpException($e->getMessage()); | 141 | throw new BadRequestHttpException($e->getMessage()); |
@@ -156,6 +159,7 @@ class EntryRestController extends WallabagRestController | |||
156 | 'perPage' => $perPage, | 159 | 'perPage' => $perPage, |
157 | 'tags' => $tags, | 160 | 'tags' => $tags, |
158 | 'since' => $since, | 161 | 'since' => $since, |
162 | 'detail' => $detail, | ||
159 | ], | 163 | ], |
160 | true | 164 | true |
161 | ) | 165 | ) |