-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pagination for AppGroups Apps (#306)
- Loading branch information
1 parent
248e5ac
commit 293f113
Showing
6 changed files
with
227 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Apigee\Edge\Api\ApigeeX\Controller; | ||
|
||
use Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerTrait; | ||
use Apigee\Edge\Api\Management\Serializer\AppEntitySerializer; | ||
use Apigee\Edge\ClientInterface; | ||
use Apigee\Edge\Controller\EntityCrudOperationsControllerTrait; | ||
use Apigee\Edge\Controller\EntityListingControllerTrait; | ||
use Apigee\Edge\Controller\StatusAwareEntityControllerTrait; | ||
use Apigee\Edge\Serializer\EntitySerializerInterface; | ||
|
||
/** | ||
* Common parent class for appgroup and developer app controllers. | ||
*/ | ||
abstract class AppByOwnerController extends PaginatedEntityController implements AppByOwnerControllerInterface | ||
{ | ||
use AttributesAwareEntityControllerTrait; | ||
use EntityCrudOperationsControllerTrait; | ||
use EntityListingControllerTrait; | ||
use PaginatedEntityListingControllerTrait; | ||
use PaginationHelperTrait; | ||
use StatusAwareEntityControllerTrait; | ||
|
||
/** | ||
* AppByOwnerController constructor. | ||
* | ||
* @param string $organization | ||
* @param ClientInterface $client | ||
* @param EntitySerializerInterface|null $entitySerializer | ||
*/ | ||
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null) | ||
{ | ||
$entitySerializer = $entitySerializer ?? new AppEntitySerializer(); | ||
parent::__construct($organization, $client, $entitySerializer); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/Api/ApigeeX/Controller/AppByOwnerControllerInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Apigee\Edge\Api\ApigeeX\Controller; | ||
|
||
use Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface; | ||
use Apigee\Edge\Controller\EntityControllerInterface; | ||
use Apigee\Edge\Controller\EntityCrudOperationsControllerInterface; | ||
use Apigee\Edge\Controller\StatusAwareEntityControllerInterface; | ||
|
||
/** | ||
* Describes common operations for appgroup and developer apps. | ||
*/ | ||
interface AppByOwnerControllerInterface extends | ||
AttributesAwareEntityControllerInterface, | ||
EntityControllerInterface, | ||
EntityCrudOperationsControllerInterface, | ||
StatusAwareEntityControllerInterface | ||
{ | ||
/** | ||
* Returns a list of entities from Apigee Edge. | ||
* | ||
* It only returns maximum 100 entities in case of developer- and appgroup | ||
* apps. Check the related API documentation for more information. | ||
* Use implementation of the AppControllerInterface to load _all_ apps | ||
* from Apigee Edge. | ||
* | ||
* @return \Apigee\Edge\Entity\EntityInterface[] | ||
*/ | ||
public function getEntities(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=4phpunit_test_app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"app": [ | ||
{ | ||
"appFamily": "default", | ||
"appId": "b3e71cbb-7eb5-4444-b384-ac82bca1d9dc", | ||
"attributes": [ | ||
{ | ||
"name": "DisplayName", | ||
"value": "PHP Unit: Test app" | ||
}, | ||
{ | ||
"name": "Notes", | ||
"value": "This is a test app created by PHP Unit." | ||
}, | ||
{ | ||
"name": "foo", | ||
"value": "foo" | ||
}, | ||
{ | ||
"name": "bar", | ||
"value": "baz" | ||
} | ||
], | ||
"callbackUrl": "http://example.com", | ||
"createdAt": 648345600000, | ||
"createdBy": "[email protected]", | ||
"credentials": [ | ||
{ | ||
"apiProducts": [], | ||
"attributes": [], | ||
"consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY", | ||
"consumerSecret": "S8YjnsjmdBqDAegR", | ||
"issuedAt": 648345600000, | ||
"scopes": [], | ||
"status": "approved" | ||
} | ||
], | ||
"appGroup": "phpunit", | ||
"lastModifiedAt": 648345600000, | ||
"lastModifiedBy": "[email protected]", | ||
"name": "4phpunit_test_app", | ||
"scopes": [], | ||
"status": "approved" | ||
}, | ||
{ | ||
"appFamily": "default", | ||
"appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc", | ||
"attributes": [ | ||
{ | ||
"name": "DisplayName", | ||
"value": "PHP Unit: Test app" | ||
}, | ||
{ | ||
"name": "Notes", | ||
"value": "This is a test app created by PHP Unit." | ||
}, | ||
{ | ||
"name": "foo", | ||
"value": "bar" | ||
} | ||
], | ||
"callbackUrl": "http://example.com", | ||
"createdAt": 648345600000, | ||
"createdBy": "[email protected]", | ||
"credentials": [ | ||
{ | ||
"apiProducts": [], | ||
"attributes": [], | ||
"consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY", | ||
"consumerSecret": "S8YjnsjmdBqDAegR", | ||
"issuedAt": 648345600000, | ||
"scopes": [], | ||
"status": "approved" | ||
} | ||
], | ||
"appGroup": "phpunit", | ||
"lastModifiedAt": 648345600000, | ||
"lastModifiedBy": "[email protected]", | ||
"name": "5phpunit_test_app", | ||
"scopes": [], | ||
"status": "approved" | ||
} | ||
] | ||
} |
42 changes: 42 additions & 0 deletions
42
...data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=5phpunit_test_app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"app": [ | ||
{ | ||
"appFamily": "default", | ||
"appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc", | ||
"attributes": [ | ||
{ | ||
"name": "DisplayName", | ||
"value": "PHP Unit: Test app" | ||
}, | ||
{ | ||
"name": "Notes", | ||
"value": "This is a test app created by PHP Unit." | ||
}, | ||
{ | ||
"name": "foo", | ||
"value": "bar" | ||
} | ||
], | ||
"callbackUrl": "http://example.com", | ||
"createdAt": 648345600000, | ||
"createdBy": "[email protected]", | ||
"credentials": [ | ||
{ | ||
"apiProducts": [], | ||
"attributes": [], | ||
"consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY", | ||
"consumerSecret": "S8YjnsjmdBqDAegR", | ||
"issuedAt": 648345600000, | ||
"scopes": [], | ||
"status": "approved" | ||
} | ||
], | ||
"appGroup": "phpunit", | ||
"lastModifiedAt": 648345600000, | ||
"lastModifiedBy": "[email protected]", | ||
"name": "5phpunit_test_app", | ||
"scopes": [], | ||
"status": "approved" | ||
} | ||
] | ||
} |