File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 99
1010class BrancherApp extends AbstractService
1111{
12+ /**
13+ * List all brancher nodes for given parent app.
14+ *
15+ * @param string $app Name of the parent app
16+ * @param array|null $data Extra data to be provided
17+ * @return array Array containing brancher nodes
18+ * @throws HypernodeApiClientException
19+ * @throws HypernodeApiServerException
20+ */
21+ public function list (string $ app , ?array $ data = null ): array
22+ {
23+ $ url = sprintf (App::V2_APP_BRANCHER_URL , $ app );
24+
25+ $ response = $ this ->client ->api ->get ($ url , [], $ data ? json_encode ($ data ) : null );
26+
27+ $ this ->client ->maybeThrowApiExceptions ($ response );
28+
29+ $ data = $ this ->client ->getJsonFromResponse ($ response );
30+
31+ return $ data ['branchers ' ];
32+ }
33+
1234 /**
1335 * Create a brancher app for given parent app.
1436 *
@@ -20,7 +42,7 @@ class BrancherApp extends AbstractService
2042 */
2143 public function create (string $ app , ?array $ data = null ): string
2244 {
23- $ url = sprintf (App::V2_BRANCHER_APP_URL , $ app );
45+ $ url = sprintf (App::V2_APP_BRANCHER_URL , $ app );
2446
2547 $ response = $ this ->client ->api ->post ($ url , [], $ data ? json_encode ($ data ) : null );
2648
You can’t perform that action at this time.
0 commit comments