summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-11-03 21:56:37 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2020-11-03 23:12:01 +0100
commitaf2fd96825d6ae2c7802e9f3bac9054e85093396 (patch)
treee95ec3d0524f0153c0510f77aeee34f77c83e95f
parentab149a7870281d4ed02806575734424849db755c (diff)
Controllers: Use v2 services
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
-rw-r--r--CHANGELOG.md1
-rw-r--r--composer.lock157
-rw-r--r--docs/externalapi/Legacy.md60
-rw-r--r--lib/Controller/AdminController.php20
-rw-r--r--lib/Controller/ApiController.php2
-rw-r--r--lib/Controller/FeedApiController.php66
-rw-r--r--lib/Controller/FeedController.php3
-rw-r--r--lib/Controller/FolderApiController.php26
-rw-r--r--lib/Controller/FolderController.php3
-rw-r--r--lib/Controller/ItemApiController.php75
-rw-r--r--lib/Service/FeedServiceV2.php4
-rw-r--r--lib/Service/FolderServiceV2.php8
-rw-r--r--tests/Unit/Controller/FeedApiControllerTest.php119
-rw-r--r--tests/Unit/Controller/FolderApiControllerTest.php26
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php85
15 files changed, 420 insertions, 235 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96f2afb57..ce1a8b881 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Upload codecoverage to codecov.io
- Use foreign keys in db
- Fix delete api not working
+- Move controllers to use V2 services
## 15.0.6
diff --git a/composer.lock b/composer.lock
index 7c9837f5e..b480d54b7 100644
--- a/composer.lock
+++ b/composer.lock
@@ -57,6 +57,10 @@
"html",
"readability"
],
+ "support": {
+ "issues": "https://github.com/andreskrey/readability.php/issues",
+ "source": "https://github.com/andreskrey/readability.php/tree/v2.1.0"
+ },
"time": "2019-07-22T21:42:25+00:00"
},
{
@@ -110,6 +114,11 @@
"finder",
"icon"
],
+ "support": {
+ "issues": "https://github.com/ArthurHoaro/favicon/issues",
+ "source": "https://github.com/ArthurHoaro/favicon/tree/v1.3.1",
+ "sources": "https://github.com/ArthurHoaro/favicon"
+ },
"time": "2020-10-14T09:32:44+00:00"
},
{
@@ -173,6 +182,10 @@
"news",
"rss"
],
+ "support": {
+ "issues": "https://github.com/alexdebril/feed-io/issues",
+ "source": "https://github.com/alexdebril/feed-io/tree/v4.7.10"
+ },
"funding": [
{
"url": "https://github.com/alexdebril",
@@ -229,6 +242,10 @@
"keywords": [
"html"
],
+ "support": {
+ "issues": "https://github.com/ezyang/htmlpurifier/issues",
+ "source": "https://github.com/ezyang/htmlpurifier/tree/master"
+ },
"time": "2020-06-29T00:56:53+00:00"
},
{
@@ -293,6 +310,10 @@
"uri",
"url"
],
+ "support": {
+ "issues": "https://pear.php.net/bugs/search.php?cmd=display&package_name[]=Net_URL2",
+ "source": "https://github.com/pear/Net_URL2"
+ },
"time": "2017-08-25T06:16:11+00:00"
},
{
@@ -340,6 +361,9 @@
"psr",
"psr-3"
],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/1.1.3"
+ },
"time": "2020-03-23T09:12:05+00:00"
},
{
@@ -390,6 +414,10 @@
"path",
"system"
],
+ "support": {
+ "issues": "https://github.com/Riimu/Kit-PathJoin/issues",
+ "source": "https://github.com/Riimu/Kit-PathJoin/tree/master"
+ },
"time": "2017-07-09T14:41:04+00:00"
},
{
@@ -504,6 +532,10 @@
"constructor",
"instantiate"
],
+ "support": {
+ "issues": "https://github.com/doctrine/instantiator/issues",
+ "source": "https://github.com/doctrine/instantiator/tree/1.3.x"
+ },
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
@@ -566,6 +598,10 @@
"object",
"object graph"
],
+ "support": {
+ "issues": "https://github.com/myclabs/DeepCopy/issues",
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.x"
+ },
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
@@ -627,6 +663,10 @@
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
+ "support": {
+ "issues": "https://github.com/phar-io/manifest/issues",
+ "source": "https://github.com/phar-io/manifest/tree/master"
+ },
"time": "2018-07-08T19:23:20+00:00"
},
{
@@ -674,6 +714,10 @@
}
],
"description": "Library for handling version information and constraints",
+ "support": {
+ "issues": "https://github.com/phar-io/version/issues",
+ "source": "https://github.com/phar-io/version/tree/master"
+ },
"time": "2018-07-08T19:19:57+00:00"
},
{
@@ -723,6 +767,10 @@
"reflection",
"static analysis"
],
+ "support": {
+ "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
+ "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
+ },
"time": "2020-06-27T09:03:43+00:00"
},
{
@@ -775,6 +823,10 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+ "support": {
+ "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
+ "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
+ },
"time": "2020-09-03T19:13:55+00:00"
},
{
@@ -820,6 +872,10 @@
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
+ "support": {
+ "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
+ "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
+ },
"time": "2020-09-17T18:55:26+00:00"
},
{
@@ -883,6 +939,10 @@
"spy",
"stub"
],
+ "support": {
+ "issues": "https://github.com/phpspec/prophecy/issues",
+ "source": "https://github.com/phpspec/prophecy/tree/1.12.1"
+ },
"time": "2020-09-29T09:10:42+00:00"
},
{
@@ -925,6 +985,10 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
+ "support": {
+ "issues": "https://github.com/phpstan/phpstan/issues",
+ "source": "https://github.com/phpstan/phpstan/tree/0.12.53"
+ },
"funding": [
{
"url": "https://github.com/ondrejmirtes",
@@ -1003,6 +1067,10 @@
"testing",
"xunit"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/8.0.2"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1059,6 +1127,10 @@
"filesystem",
"iterator"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
+ "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1118,6 +1190,10 @@
"keywords": [
"process"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-invoker/issues",
+ "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1173,6 +1249,10 @@
"keywords": [
"template"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-text-template/issues",
+ "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1228,6 +1308,10 @@
"keywords": [
"timer"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-timer/issues",
+ "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1283,6 +1367,10 @@
"keywords": [
"tokenizer"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
+ "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1378,6 +1466,10 @@
"testing",
"xunit"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/phpunit/issues",
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/9.2.6"
+ },
"funding": [
{
"url": "https://phpunit.de/donate.html",
@@ -1434,6 +1526,10 @@
],
"description": "Collection of value objects that represent the PHP code units",
"homepage": "https://github.com/sebastianbergmann/code-unit",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1485,6 +1581,10 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1555,6 +1655,10 @@
"compare",
"equality"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/comparator/issues",
+ "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1617,6 +1721,10 @@
"unidiff",
"unified diff"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/diff/issues",
+ "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1676,6 +1784,10 @@
"environment",
"hhvm"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/environment/issues",
+ "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1749,6 +1861,10 @@
"export",
"exporter"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/exporter/issues",
+ "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1809,6 +1925,10 @@
"keywords": [
"global state"
],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/global-state/issues",
+ "source": "https://github.com/sebastianbergmann/global-state/tree/master"
+ },
"time": "2020-02-07T06:11:37+00:00"
},
{
@@ -1856,6 +1976,10 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
+ "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1907,6 +2031,10 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-reflector/issues",
+ "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -1966,6 +2094,10 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
+ "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -2017,6 +2149,10 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/resource-operations/issues",
+ "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -2069,6 +2205,10 @@
],
"description": "Collection of value objects that represent the types of the PHP type system",
"homepage": "https://github.com/sebastianbergmann/type",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/type/issues",
+ "source": "https://github.com/sebastianbergmann/type/tree/2.3.1"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -2118,6 +2258,10 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/version/issues",
+ "source": "https://github.com/sebastianbergmann/version/tree/3.0.2"
+ },
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@@ -2186,6 +2330,9 @@
"polyfill",
"portable"
],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -2240,6 +2387,10 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
+ "support": {
+ "issues": "https://github.com/theseer/tokenizer/issues",
+ "source": "https://github.com/theseer/tokenizer/tree/master"
+ },
"funding": [
{
"url": "https://github.com/theseer",
@@ -2295,6 +2446,10 @@
"check",
"validate"
],
+ "support": {
+ "issues": "https://github.com/webmozart/assert/issues",
+ "source": "https://github.com/webmozart/assert/tree/master"
+ },
"time": "2020-07-08T17:02:28+00:00"
}
],
@@ -2312,5 +2467,5 @@
"ext-curl": "*"
},
"platform-dev": [],
- "plugin-api-version": "1.1.0"
+ "plugin-api-version": "2.0.0"
}
diff --git a/docs/externalapi/Legacy.md b/docs/externalapi/Legacy.md
index f8ec4fb61..e5df7a8e1 100644
--- a/docs/externalapi/Legacy.md
+++ b/docs/externalapi/Legacy.md
@@ -132,7 +132,7 @@ angular.module('YourApp', [])
In general the input parameters can be in the URL or request body, the App Framework doesnt differentiate between them.
So JSON in the request body like:
-```js
+```json
{
"id": 3
}
@@ -159,7 +159,7 @@ The output is JSON.
* **Route**: /folders
* **Parameters**: none
* **Returns**:
-```js
+```json
{
"folders": [
{
@@ -177,7 +177,7 @@ Creates a new folder and returns a new folder object
* **Method**: POST
* **Route**: /folders
* **Parameters**:
-```js
+```json
{
"name": "folder name"
}
@@ -186,7 +186,7 @@ Creates a new folder and returns a new folder object
* **HTTP 409**: If the folder exists already
* **HTTP 422**: If the folder name is invalid (for instance empty)
* **Returns**:
-```js
+```json
{
"folders": [
{
@@ -215,7 +215,7 @@ Only the name can be updated
* **Method**: PUT
* **Route**: /folders/{folderId}
* **Parameters**:
-```js
+```json
{
"name": "folder name"
}
@@ -232,7 +232,7 @@ Only the name can be updated
* **Method**: PUT
* **Route**: /folders/{folderId}/read
* **Parameters**:
-```js
+```json
{
// mark all items read lower than equal that id
// this is mean to prevent marking items as read which the client/user does not yet know of
@@ -259,7 +259,7 @@ The following attributes are **not sanitized** meaning: including them in your w
* **Route**: /feeds
* **Parameters**: none
* **Returns**:
-```js
+```json
{
"feeds": [
{
@@ -294,7 +294,7 @@ Creates a new feed and returns the feed
* **Method**: POST
* **Route**: /feeds
* **Parameters**:
-```js
+```json
{
"url": "http:\/\/www.cyanogenmod.org\/wp-content\/themes\/cyanogenmod\/images\/favicon.ico",
"folderId": 81 // id of the parent folder, 0 for root
@@ -304,7 +304,7 @@ Creates a new feed and returns the feed
* **HTTP 409**: If the feed exists already
* **HTTP 422**: If the feed cant be read (most likely contains errors)
* **Returns**:
-```js
+```json
{
"feeds": [
{
@@ -341,7 +341,7 @@ Deletes a feed with the id feedId and all of its items
* **Method**: PUT
* **Route**: /feeds/{feedId}/move
* **Parameters**:
-```js
+```json
{
"folderId": 0 // id of the parent folder, 0 for root
}
@@ -356,7 +356,7 @@ Deletes a feed with the id feedId and all of its items
* **Method**: PUT
* **Route**: /feeds/{feedId}/rename
* **Parameters**:
-```js
+```json
{
"feedTitle": 'New Title'
}
@@ -371,7 +371,7 @@ Deletes a feed with the id feedId and all of its items
* **Method**: PUT
* **Route**: /feeds/{feedId}/read
* **Parameters**:
-```js
+```json
{
// mark all items read lower than equal that id
// this is mean to prevent marking items as read which the client/user does not yet know of
@@ -402,7 +402,7 @@ The following attributes are **not sanitized** meaning: including them in your w
* **Method**: GET
* **Route**: /items
* **Parameters**:
-```js
+```json
{
"batchSize": 10, // the number of items that should be returned, defaults to -1, new in 5.2.3: -1 returns all items
"offset": 30, // only return older (lower than equal that id) items than the one with id 30
@@ -413,7 +413,7 @@ The following attributes are **not sanitized** meaning: including them in your w
}
```
* **Returns**:
-```js
+```json
{
"items": [
{
@@ -446,7 +446,7 @@ Autopaging would work like this:
* Get the **first 20** items from a feed with **id 12**
**GET /items**:
-```js
+```json
{
"batchSize": 20,
"offset": 0,
@@ -460,7 +460,7 @@ The item with the lowest item id is 43.
* Get the next **20** items: **GET /items**:
-```js
+```json
{
"batchSize": 20,
"offset": 43,
@@ -478,7 +478,7 @@ This is used to stay up to date.
* **Method**: GET
* **Route**: /items/updated
* **Parameters**:
-```js
+```json
{
"lastModified": 123231, // returns only items with a lastModified timestamp >= than this one
// this may also return already existing items whose read or starred status
@@ -488,7 +488,7 @@ This is used to stay up to date.
}
```
* **Returns**:
-```js
+```json
{
"items": [
{
@@ -526,7 +526,7 @@ This is used to stay up to date.
* **Method**: PUT
* **Route**: /items/read/multiple
* **Parameters**:
-```js
+```json
{
"items": [2, 3] // ids of the items
}
@@ -547,7 +547,7 @@ This is used to stay up to date.
* **Method**: PUT
* **Route**: /items/unread/multiple
* **Parameters**:
-```js
+```json
{
"items": [2, 3] // ids of the items
}
@@ -568,7 +568,7 @@ This is used to stay up to date.
* **Method**: PUT
* **Route**: /items/star/multiple
* **Parameters**:
-```js
+```json
{
"items": [
{
@@ -594,7 +594,7 @@ This is used to stay up to date.
* **Method**: PUT
* **Route**: /items/unstar/multiple
* **Parameters**:
-```js
+```json
{