Skip to content

Commit

Permalink
Merge branch '3.x' into patch-nextpagetoken
Browse files Browse the repository at this point in the history
  • Loading branch information
shishir-intelli authored Jan 29, 2024
2 parents 29d693c + b561085 commit eff2d45
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 60 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# CHANGELOG
## [3.0.4](https://github.com/apigee/apigee-client-php/milestone/28?closed=1)
* [#343] Fix Invalid payload issue while editing/updating AppGroup/Teams in Apigee X.
* [#342] Fix for test failing for symfony 6.4.
* [#340] Fix for attribute values lost in PUT call while creating AppGroup.
* [#337] Fix for Team app credentials listings sorted in ascending order.
* [#334] Fix for \Apigee\Edge\HttpClient\Plugin\Authentication\GceServiceAccount::isAvailable() throws exception when called on non-GCE context.

## [3.0.3](https://github.com/apigee/apigee-client-php/milestone/26?closed=1)
* [#323] Add union type to suppress deprecation warning.
* [#325] Fix error when AppGroup list is empty or do not returns appgroups array.
Expand Down
24 changes: 22 additions & 2 deletions src/Api/ApigeeX/Controller/AppGroupMembersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Apigee\Edge\Api\ApigeeX\Serializer\AppGroupMembershipSerializer;
use Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership;
use Apigee\Edge\Api\Management\Serializer\AttributesPropertyAwareEntitySerializer;
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Controller\AbstractController;
use Apigee\Edge\Controller\OrganizationAwareControllerTrait;
Expand Down Expand Up @@ -47,7 +48,7 @@ class AppGroupMembersController extends AbstractController implements AppGroupMe
*
* @param string $appGroup
* @param string $organization
* @param \Apigee\Edge\ClientInterface $client
* @param ClientInterface $client
*/
public function __construct(string $appGroup, string $organization, ClientInterface $client)
{
Expand All @@ -73,8 +74,10 @@ public function getMembers(): AppGroupMembership
public function setMembers(AppGroupMembership $members): AppGroupMembership
{
$members = $this->serializer->normalize($members);
$apigeeReservedMembers = new AttributesProperty();

// We don't have a separate API to get appgroup attributes,
// that is why we are calling getAppGroupAttributes() method.
$apigeeReservedMembers = $this->getAppGroupAttributes();
// Adding the new members into the attribute.
$apigeeReservedMembers->add('__apigee_reserved__developer_details', json_encode($members));
$response = $this->client->put(
Expand All @@ -101,6 +104,23 @@ public function removeMember(string $email): void
$this->client->delete($this->getBaseEndpointUri()->withPath("{$this->getBaseEndpointUri()->getPath()}/{$encoded}"));
}

/**
* Helper function for getting all attributes in AppGroup.
*
* @return AttributesProperty
*/
public function getAppGroupAttributes(): AttributesProperty
{
$appGroup = $this->responseToArray($this->client->get($this->getBaseEndpointUri()));
$serializer = new AttributesPropertyAwareEntitySerializer();
$appGroupAttributes = $serializer->denormalize(
$appGroup['attributes'],
AttributesProperty::class
);

return $appGroupAttributes;
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface AppGroupMembersControllerInterface extends AppGroupAwareControllerInte
/**
* List all developers associated with a appgroup.
*
* @return \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership
* @return AppGroupMembership
* Array of developers with their optional roles in the appgroup.
*/
public function getMembers(): AppGroupMembership;
Expand All @@ -39,10 +39,10 @@ public function getMembers(): AppGroupMembership;
* WARNING! If you pass en empty membership object you remove all developers
* from the appgroup.
*
* @param \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership $members
* @param AppGroupMembership $members
* Membership object with the changes to be applied.
*
* @return \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership
* @return AppGroupMembership
* Membership object with the applied changes, it does not contain all
* members. Use getMembers() to retrieve them.
*/
Expand Down
10 changes: 8 additions & 2 deletions src/Api/ApigeeX/Entity/AppGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,24 @@

namespace Apigee\Edge\Api\ApigeeX\Entity;

use Apigee\Edge\Api\Management\Entity\AppOwner;
use Apigee\Edge\Entity\CommonEntityPropertiesAwareTrait;
use Apigee\Edge\Entity\Entity;
use Apigee\Edge\Entity\Property\AttributesPropertyAwareTrait;
use Apigee\Edge\Entity\Property\DisplayNamePropertyAwareTrait;
use Apigee\Edge\Entity\Property\NamePropertyAwareTrait;
use Apigee\Edge\Entity\Property\StatusPropertyAwareTrait;
use Apigee\Edge\Structure\AttributesProperty;

/**
* Describes an AppGroup entity.
*/
class AppGroup extends AppOwner implements AppGroupInterface
class AppGroup extends Entity implements AppGroupInterface
{
use DisplayNamePropertyAwareTrait;
use NamePropertyAwareTrait;
use AttributesPropertyAwareTrait;
use CommonEntityPropertiesAwareTrait;
use StatusPropertyAwareTrait;

/** @var string|null */
protected $channelUri;
Expand Down
10 changes: 7 additions & 3 deletions src/Api/ApigeeX/Entity/AppGroupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@

namespace Apigee\Edge\Api\ApigeeX\Entity;

use Apigee\Edge\Api\Management\Entity\AppOwnerInterface;
use Apigee\Edge\Entity\CommonEntityPropertiesInterface;
use Apigee\Edge\Entity\Property\AttributesPropertyInterface;
use Apigee\Edge\Entity\Property\DisplayNamePropertyInterface;
use Apigee\Edge\Entity\Property\NamePropertyInterface;
use Apigee\Edge\Entity\Property\StatusPropertyInterface;

/**
* Interface AppGroupInterface.
*/
interface AppGroupInterface extends AppOwnerInterface,
interface AppGroupInterface extends AttributesPropertyInterface,
DisplayNamePropertyInterface,
NamePropertyInterface
NamePropertyInterface,
StatusPropertyInterface,
CommonEntityPropertiesInterface
{
/**
* @param string $channelUri
Expand Down
24 changes: 12 additions & 12 deletions src/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ interface ClientInterface extends HttpClient
*/
public const APIGEE_ON_GCP_ENDPOINT = 'https://apigee.googleapis.com/v1';

public const VERSION = '3.0.3';
public const VERSION = '3.0.4';

/**
* Allows access to the last request, response and exception.
*
* @return \Apigee\Edge\HttpClient\Utility\JournalInterface
* @return JournalInterface
*/
public function getJournal(): JournalInterface;

Expand Down Expand Up @@ -108,10 +108,10 @@ public function getEndpoint(): string;
* @param \Psr\Http\Message\UriInterface|string $uri
* @param array $headers
*
* @throws \Apigee\Edge\Exception\ApiException
* @throws Exception\ApiException
* @throws \Http\Client\Exception
*
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function get($uri, array $headers = []): ResponseInterface;

Expand All @@ -121,10 +121,10 @@ public function get($uri, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\UriInterface|string $uri
* @param array $headers
*
* @throws \Apigee\Edge\Exception\ApiException
* @throws Exception\ApiException
* @throws \Http\Client\Exception
*
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function head($uri, array $headers = []): ResponseInterface;

Expand All @@ -135,10 +135,10 @@ public function head($uri, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
* @throws \Apigee\Edge\Exception\ApiException
* @throws Exception\ApiException
* @throws \Http\Client\Exception
*
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function post($uri, $body = null, array $headers = []): ResponseInterface;

Expand All @@ -149,10 +149,10 @@ public function post($uri, $body = null, array $headers = []): ResponseInterface
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
* @throws \Apigee\Edge\Exception\ApiException
* @throws Exception\ApiException
* @throws \Http\Client\Exception
*
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function put($uri, $body = null, array $headers = []): ResponseInterface;

Expand All @@ -163,10 +163,10 @@ public function put($uri, $body = null, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
* @throws \Apigee\Edge\Exception\ApiException
* @throws Exception\ApiException
* @throws \Http\Client\Exception
*
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function delete($uri, $body = null, array $headers = []): ResponseInterface;
}
Loading

0 comments on commit eff2d45

Please sign in to comment.