Compare commits
2 Commits
7cd6339996
...
5c11fc0552
Author | SHA1 | Date |
---|---|---|
Fred | 5c11fc0552 | |
Fred | 8c3c022f0c |
|
@ -8,17 +8,18 @@ class APIgoatDoc extends APIgoatTemplate
|
||||||
$content = '';
|
$content = '';
|
||||||
$menu = '';
|
$menu = '';
|
||||||
|
|
||||||
//preprint($data);
|
|
||||||
|
|
||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
|
|
||||||
$menu .= li(href($row['name'], '#' . $row['title']), "class='page_item current_page_item'");
|
$menu .= li(href($row['name'], '#' . $row['title']), "class='page_item wd-state-closed'");
|
||||||
$content .= div(
|
$content .= div(
|
||||||
anchor($row['title']) . h3($row['name'])
|
anchor($row['title'])
|
||||||
. h2($row['title'], "class='entry-title'")
|
. h2($row['title'], "class='entry-title'")
|
||||||
. p($row['type'] . " " . $row['value'])
|
. h3($row['name'])
|
||||||
. ((!empty($row['example'])) ? pre(htmlentities($row['example'])) : '')
|
. span($row['type'] . " " . $row['value'])
|
||||||
. p(trim($row['text']))
|
. p(trim($row['text']))
|
||||||
|
. ((!empty($row['example'])) ? div(span("Example:") . pre(htmlentities($row['example']))) : ''),
|
||||||
|
"",
|
||||||
|
"class='doc-item'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ class APIgoatFetchAPI
|
||||||
{
|
{
|
||||||
|
|
||||||
private $username = 'wp-behavior@apigoat.com';
|
private $username = 'wp-behavior@apigoat.com';
|
||||||
private $password = '0sKtegdSSk';
|
private $password = 'iDhj3wsyYs7WrrS';
|
||||||
private $baseURI = 'https://goat.local/p/goatcheese/api/v1/';
|
private $baseURI = 'https://x.apigoat.com/api/v1/';
|
||||||
private $jwt_pubkey = '9sKjdjuue8sSjwh6';
|
private $jwt_pubkey = '9sKjdjuue8sSjwh6';
|
||||||
private $jwt_alg = ['HS256'];
|
private $jwt_alg = ['HS256'];
|
||||||
private $client;
|
private $client;
|
||||||
|
@ -21,9 +21,10 @@ class APIgoatFetchAPI
|
||||||
{
|
{
|
||||||
$this->client = new APIClient($this->baseURI);
|
$this->client = new APIClient($this->baseURI);
|
||||||
$this->clientOptions = [
|
$this->clientOptions = [
|
||||||
'verify' => false,
|
'verify' => true,
|
||||||
'content-Type' => 'application/json',
|
'content-Type' => 'application/json',
|
||||||
'accept' => 'application/json'
|
'accept' => 'application/json',
|
||||||
|
'debug' => false
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$this->authenticationValid()) {
|
if (!$this->authenticationValid()) {
|
||||||
|
@ -40,7 +41,7 @@ class APIgoatFetchAPI
|
||||||
{
|
{
|
||||||
$clientOptions = $this->clientOptions;
|
$clientOptions = $this->clientOptions;
|
||||||
$clientOptions['query'] = [
|
$clientOptions['query'] = [
|
||||||
"Query" => [
|
"query" => [
|
||||||
"select" => [
|
"select" => [
|
||||||
["behavior.name", "name"], ["code", "title"], ["description", "text"], "value", "example", "type", ["behavior_category.name", "category_name"]
|
["behavior.name", "name"], ["code", "title"], ["description", "text"], "value", "example", "type", ["behavior_category.name", "category_name"]
|
||||||
],
|
],
|
||||||
|
@ -51,7 +52,8 @@ class APIgoatFetchAPI
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"join" => ["behavior_category"],
|
"join" => ["behavior_category"],
|
||||||
"limit" => 20
|
"limit" => 20,
|
||||||
|
"recurse" => "behavior_file"
|
||||||
],
|
],
|
||||||
"debug" => true
|
"debug" => true
|
||||||
];
|
];
|
||||||
|
@ -90,6 +92,8 @@ class APIgoatFetchAPI
|
||||||
// authenticate on API to get token
|
// authenticate on API to get token
|
||||||
$response = $this->client->post('Authy/auth', $options);
|
$response = $this->client->post('Authy/auth', $options);
|
||||||
$loginResponseDecoded = json_decode($response->getBody()->getContents(), true);
|
$loginResponseDecoded = json_decode($response->getBody()->getContents(), true);
|
||||||
|
/*print_r($loginResponseDecoded);
|
||||||
|
die();*/
|
||||||
|
|
||||||
$this->credentials = new AccessTokenCredentials($loginResponseDecoded['token']);
|
$this->credentials = new AccessTokenCredentials($loginResponseDecoded['token']);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue