-
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.
Merge pull request #51 from mxr576/DRUP-487
DRUP-487 Added support for Monetization Reports API
- Loading branch information
Showing
70 changed files
with
3,447 additions
and
113 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
63 changes: 63 additions & 0 deletions
63
src/Api/Monetization/Controller/CompanyReportDefinitionController.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,63 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2018 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\Monetization\Controller; | ||
|
||
use Apigee\Edge\Api\Monetization\Entity\CompanyReportDefinition; | ||
use Apigee\Edge\ClientInterface; | ||
use Apigee\Edge\Serializer\EntitySerializerInterface; | ||
use Psr\Http\Message\UriInterface; | ||
|
||
class CompanyReportDefinitionController extends LegalEntityReportDefinitionController implements CompanyReportDefinitionControllerInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $companyName; | ||
|
||
/** | ||
* CompanyReportDefinitionController constructor. | ||
* | ||
* @param string $developerId | ||
* @param string $organization | ||
* @param \Apigee\Edge\ClientInterface $client | ||
* @param \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface|null $reportDefinitionController | ||
* @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer | ||
*/ | ||
public function __construct(string $developerId, string $organization, ClientInterface $client, ?ReportDefinitionControllerInterface $reportDefinitionController = null, ?EntitySerializerInterface $entitySerializer = null) | ||
{ | ||
$this->companyName = $developerId; | ||
parent::__construct($organization, $client, $reportDefinitionController, $entitySerializer); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getBaseEndpointUri(): UriInterface | ||
{ | ||
return $this->client->getUriFactory()->createUri("/mint/organizations/{$this->organization}/companies/{$this->companyName}/report-definitions"); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getEntityClass(): string | ||
{ | ||
return CompanyReportDefinition::class; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Api/Monetization/Controller/CompanyReportDefinitionControllerInterface.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,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2018 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\Monetization\Controller; | ||
|
||
interface CompanyReportDefinitionControllerInterface extends ReportDefinitionControllerInterface | ||
{ | ||
} |
63 changes: 63 additions & 0 deletions
63
src/Api/Monetization/Controller/DeveloperReportDefinitionController.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,63 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2018 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\Monetization\Controller; | ||
|
||
use Apigee\Edge\Api\Monetization\Entity\DeveloperReportDefinition; | ||
use Apigee\Edge\ClientInterface; | ||
use Apigee\Edge\Serializer\EntitySerializerInterface; | ||
use Psr\Http\Message\UriInterface; | ||
|
||
class DeveloperReportDefinitionController extends LegalEntityReportDefinitionController implements DeveloperReportDefinitionControllerInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $developerId; | ||
|
||
/** | ||
* DeveloperReportDefinitionController constructor. | ||
* | ||
* @param string $developerId | ||
* @param string $organization | ||
* @param \Apigee\Edge\ClientInterface $client | ||
* @param \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface|null $reportDefinitionController | ||
* @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer | ||
*/ | ||
public function __construct(string $developerId, string $organization, ClientInterface $client, ?ReportDefinitionControllerInterface $reportDefinitionController = null, ?EntitySerializerInterface $entitySerializer = null) | ||
{ | ||
$this->developerId = $developerId; | ||
parent::__construct($organization, $client, $reportDefinitionController, $entitySerializer); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getBaseEndpointUri(): UriInterface | ||
{ | ||
return $this->client->getUriFactory()->createUri("/mint/organizations/{$this->organization}/developers/{$this->developerId}/report-definitions"); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getEntityClass(): string | ||
{ | ||
return DeveloperReportDefinition::class; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Api/Monetization/Controller/DeveloperReportDefinitionControllerInterface.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,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2018 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\Monetization\Controller; | ||
|
||
interface DeveloperReportDefinitionControllerInterface extends ReportDefinitionControllerInterface | ||
{ | ||
} |
40 changes: 40 additions & 0 deletions
40
src/Api/Monetization/Controller/FilteredReportDefinitionsTrait.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,40 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2018 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\Monetization\Controller; | ||
|
||
use Apigee\Edge\Controller\BaseEndpointAwareControllerTrait; | ||
|
||
trait FilteredReportDefinitionsTrait | ||
{ | ||
use BaseEndpointAwareControllerTrait; | ||
use PaginatedListingHelperTrait; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getFilteredEntities(int $limit = null, int $page = 1, string $sort = null): array | ||
{ | ||
$queryParams = []; | ||
if (null !== $sort) { | ||
$queryParams = ['sort' => $sort]; | ||
} | ||
|
||
return $this->listEntitiesInRange($this->getBaseEndpointUri()->withQuery(http_build_query($queryParams)), $limit, $page); | ||
} | ||
} |
Oops, something went wrong.