Skip to content

Commit d17d0c7

Browse files
committed
Add integrators API
1 parent 10ef655 commit d17d0c7

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

wscli-php-sdk/src/WsCli.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,29 @@ private function handleCerts($api, $cmd)
563563
}
564564
}
565565

566+
private function handleIntegrator($api, $cmd)
567+
{
568+
if (!array_key_exists('idtoken', $this->opts) || !$this->opts['idtoken']) {
569+
$this->log->error("no valid idtoken specified! please try re-login.");
570+
return 2;
571+
}
572+
switch ($cmd) {
573+
case "listAccounts":
574+
$error = $this->checkArgs(['apikey', 'idtoken']);
575+
if ($error) {
576+
return $error;
577+
}
578+
$resp = $this->${"api"}->${"cmd"}(
579+
$this->opts['idtoken']
580+
);
581+
$this->log->debug(print_r($resp, true));
582+
return $resp;
583+
default:
584+
$this->log->error("Unknown api command");
585+
return 3;
586+
}
587+
}
588+
566589
public function __call($methodCmd, $methodApi)
567590
{
568591
// $methodApi array is populated on our internal calls to
@@ -585,6 +608,8 @@ public function __call($methodCmd, $methodApi)
585608
return $this->handlePgp($api, $cmd, $methodApi, $methodCmd);
586609
case "certs":
587610
return $this->handleCerts($api, $cmd, $methodApi, $methodCmd);
611+
case "integrator":
612+
return $this->handleIntegrator($api, $cmd, $methodApi, $methodCmd);
588613
default:
589614
return 3;
590615
}

wscli-php/src/wscli.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
wscli certs importCert [-c CONF] [-a APIKEY] [-i IDTOKEN] [-b BANK] [--certificate=<pem>] [--privatekey=<pem>]
4848
[--wsuserid=<wsuserid>] [--wstargetid=<wstargetid>] [--enccertificate=<pem>] [--encprivatekey=<pem>]
4949
wscli pgp listKeys [-c CONF] [-a APIKEY] [-i IDTOKEN]
50-
wscli pgp uploadKey [-c CONF] [-a APIKEY] [-i IDTOKEN] [--pgpkeycontents=<pgpkeycontents>]
5150
wscli pgp deleteKey [-c CONF] [-a APIKEY] [-i IDTOKEN] [--pgpkeyid=<pgpkeyid>]
51+
wscli pgp uploadKey [-c CONF] [-a APIKEY] [-i IDTOKEN]
52+
[--pgpkeycontents=<pgpkeycontents>]
53+
wscli integrator listAccounts [-c CONF] [-a APIKEY] [-i IDTOKEN]
5254
5355
5456
Options:

0 commit comments

Comments
 (0)