Skip to content

Commit

Permalink
Merge branch 'exposeExternalId' into 'master'
Browse files Browse the repository at this point in the history
Allow querying on resourceIdentifier

See merge request transip/restapi-php-library!284
  • Loading branch information
roeldijkstra committed Jul 30, 2024
2 parents 1cffcda + 72ce717 commit 657be0f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

6.52.2
---
* Add `resourceType` field to Actions
* Add `resourceIdentifier` field to Actions
* Add querying on `resourceIdentifier` for Actions

6.52.1
---
* Add `isDefault` field to Operating System
Expand Down
30 changes: 30 additions & 0 deletions src/Entity/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class Action extends AbstractEntity
*/
protected $status;

/**
* @var string $resourceType
*/
protected $resourceType;

/**
* @var string $resourceIdentifier
*/
protected $resourceIdentifier;

/**
* @var array<mixed> $metadata
*/
Expand Down Expand Up @@ -72,6 +82,26 @@ public function getStatus()
return $this->status;
}

/**
* Get $resourceType
*
* @return string
*/
public function getResourceType()
{
return $this->resourceType;
}

/**
* Get $resourceIdentifier
*
* @return string
*/
public function getResourceIdentifier()
{
return $this->resourceIdentifier;
}

/**
* Get $metadata
*
Expand Down
18 changes: 18 additions & 0 deletions src/Repository/Action/ActionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,22 @@ public function getAll(): array

return $actions;
}

/**
* @return Action[]
*/
public function getByResourceIdentifier(string $resourceIdentifier, string $resourceType): array
{
$actions = [];

$query = ['resourceIdentifier' => $resourceIdentifier, 'resourceType' => $resourceType];
$response = $this->httpClient->get($this->getResourceUrl(), $query);
$actions = $this->getParameterFromResponse($response, self::RESOURCE_PARAMETER_PLURAL);

foreach ($actions as $action) {
$actions[] = new Action($action);
}

return $actions;
}
}
2 changes: 1 addition & 1 deletion src/TransipAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
class TransipAPI
{
public const TRANSIP_API_ENDPOINT = "https://api.transip.nl/v6";
public const TRANSIP_API_LIBRARY_VERSION = "6.52.1";
public const TRANSIP_API_LIBRARY_VERSION = "6.52.2";
public const TRANSIP_API_DEMO_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw";

/**
Expand Down

0 comments on commit 657be0f

Please sign in to comment.