Skip to content

Commit 4605c84

Browse files
committed
Add Organization::getSetupOptions() method
1 parent 89c0b69 commit 4605c84

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/Model/Organization/Organization.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Platformsh\Client\Model\Ref\UserRef;
1010
use Platformsh\Client\Model\ResourceWithReferences;
1111
use Platformsh\Client\Model\Result;
12+
use Platformsh\Client\Model\SetupOptions;
1213
use Platformsh\Client\Model\Subscription;
1314

1415
/**
@@ -78,6 +79,16 @@ public function getSubscription($id)
7879
return Subscription::get($id, $this->getUri() . '/subscriptions', $this->client);
7980
}
8081

82+
/**
83+
* Returns setup options for the organization.
84+
*
85+
* @return SetupOptions
86+
*/
87+
public function getSetupOptions()
88+
{
89+
return SetupOptions::get($this->getUri() . '/setup/options', $this->client);
90+
}
91+
8192
/**
8293
* Returns a list of organization subscriptions.
8394
*

src/Model/SetupOptions.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SetupOptions
1717
use ReadOnlyStructureTrait;
1818

1919
/**
20-
* Creates a setup options list.
20+
* Creates a setup options list based on passed data.
2121
*
2222
* @param array $body array of the data to send in the post.
2323
* @param string $url The URL of the setup options api.
@@ -30,4 +30,18 @@ public static function create(array $body, $url, ClientInterface $client)
3030
$response = $client->post($url, ['json' => $body]);
3131
return new self($response->json());
3232
}
33+
34+
/**
35+
* Fetches a setup options list from a known URL.
36+
*
37+
* @param string $url
38+
* @param ClientInterface $client
39+
*
40+
* @return SetupOptions
41+
*/
42+
public static function get($url, ClientInterface $client)
43+
{
44+
$response = $client->get($url);
45+
return new self($response->json());
46+
}
3347
}

0 commit comments

Comments
 (0)