update sample code, update test case

This commit is contained in:
wing328
2016-03-19 16:03:36 +08:00
parent 56122b4a01
commit 95cd8b73a6
14 changed files with 264 additions and 231 deletions

View File

@@ -618,11 +618,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
@@ -630,6 +625,11 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@@ -725,11 +725,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
@@ -737,6 +732,11 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@@ -832,11 +832,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
@@ -844,6 +839,11 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(

View File

@@ -525,16 +525,16 @@ class StoreApi
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
if (strlen($apiKey) !== 0) {
$queryParams['test_api_key_query'] = $apiKey;
$headerParams['test_api_key_header'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
if (strlen($apiKey) !== 0) {
$headerParams['test_api_key_header'] = $apiKey;
$queryParams['test_api_key_query'] = $apiKey;
}