added examples shortcode

This commit is contained in:
2020-12-07 06:37:19 +08:00
parent 92f6e190dc
commit 8d4b6efe34
5 changed files with 91 additions and 1 deletions

View File

@@ -68,6 +68,31 @@ class APIgoatFetchAPI
}
}
public function fetchExamples()
{
$clientOptions = $this->clientOptions;
$clientOptions['query'] = [
"query" => [
"select" => [
"name", ["description", "text"], ["example_category.name", "category_name"], "json"
],
"join" => ["example_category"]
]
];
//$clientOptions['debug'] = true;
$response = $this->client->get('Example', $clientOptions);
$body = json_decode($response->getBody()->getContents(), true);
//$body['debug'][] = $clientOptions['query'];
if ($response->getStatusCode() == 200) {
return $body;
} else {
$body = json_decode($response->getBody(), true);
return $body;
}
}
private function saveCredentials()
{
if (!empty($this->jwt_pubkey)) {