Skip to content

Commit

Permalink
wsapi_v2 v2.2.0 Swagger SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
dforsber committed Aug 1, 2017
1 parent ca5a212 commit 7d741bc
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 0 deletions.
1 change: 1 addition & 0 deletions wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Class | Method | HTTP request | Description
*SessionApi* | [**initLogin**](docs/Api/SessionApi.md#initlogin) | **GET** /session/{Email}/{Mode} | InitLogin
*SessionApi* | [**login**](docs/Api/SessionApi.md#login) | **POST** /session/{Email}/{Mode} | Login
*SessionApi* | [**loginMFA**](docs/Api/SessionApi.md#loginmfa) | **PUT** /session/{Email}/{Mode}/mfacode | LoginMFA
*SessionApi* | [**logout**](docs/Api/SessionApi.md#logout) | **DELETE** /session/{Email}/{Mode} | Logout


## Documentation For Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**initLogin**](SessionApi.md#initLogin) | **GET** /session/{Email}/{Mode} | InitLogin
[**login**](SessionApi.md#login) | **POST** /session/{Email}/{Mode} | Login
[**loginMFA**](SessionApi.md#loginMFA) | **PUT** /session/{Email}/{Mode}/mfacode | LoginMFA
[**logout**](SessionApi.md#logout) | **DELETE** /session/{Email}/{Mode} | Logout


# **initLogin**
Expand Down Expand Up @@ -154,3 +155,61 @@ No authorization required

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **logout**
> \Swagger\Client\Model\Response logout($authorization, $email, $mode)
Logout

Logout invalidates _IdToken_.

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Authorizer
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
// Configure API key authorization: X-Api-Key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');

$api_instance = new Swagger\Client\Api\SessionApi();
$authorization = "authorization_example"; // string | Use _IdToken_ from the Login response as the Authorization header
$email = "email_example"; // string | Email address as the account username, e.g. `dan.forsberg@isecure.fi`
$mode = "mode_example"; // string | Administer account with `admin` mode, exchange files with `data` mode

try {
$result = $api_instance->logout($authorization, $email, $mode);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SessionApi->logout: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**authorization** | **string**| Use _IdToken_ from the Login response as the Authorization header |
**email** | **string**| Email address as the account username, e.g. &#x60;dan.forsberg@isecure.fi&#x60; |
**mode** | **string**| Administer account with &#x60;admin&#x60; mode, exchange files with &#x60;data&#x60; mode |

### Return type

[**\Swagger\Client\Model\Response**](../Model/Response.md)

### Authorization

[Authorizer](../../README.md#Authorizer), [X-Api-Key](../../README.md#X-Api-Key)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

135 changes: 135 additions & 0 deletions wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/lib/Api/SessionApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,139 @@ public function loginMFAWithHttpInfo($login_mfa_req, $email, $mode)
throw $e;
}
}

/**
* Operation logout
*
* Logout
*
* @param string $authorization Use _IdToken_ from the Login response as the Authorization header (required)
* @param string $email Email address as the account username, e.g. &#x60;dan.forsberg@isecure.fi&#x60; (required)
* @param string $mode Administer account with &#x60;admin&#x60; mode, exchange files with &#x60;data&#x60; mode (required)
* @throws \Swagger\Client\ApiException on non-2xx response
* @return \Swagger\Client\Model\Response
*/
public function logout($authorization, $email, $mode)
{
list($response) = $this->logoutWithHttpInfo($authorization, $email, $mode);
return $response;
}

/**
* Operation logoutWithHttpInfo
*
* Logout
*
* @param string $authorization Use _IdToken_ from the Login response as the Authorization header (required)
* @param string $email Email address as the account username, e.g. &#x60;dan.forsberg@isecure.fi&#x60; (required)
* @param string $mode Administer account with &#x60;admin&#x60; mode, exchange files with &#x60;data&#x60; mode (required)
* @throws \Swagger\Client\ApiException on non-2xx response
* @return array of \Swagger\Client\Model\Response, HTTP status code, HTTP response headers (array of strings)
*/
public function logoutWithHttpInfo($authorization, $email, $mode)
{
// verify the required parameter 'authorization' is set
if ($authorization === null) {
throw new \InvalidArgumentException('Missing the required parameter $authorization when calling logout');
}
// verify the required parameter 'email' is set
if ($email === null) {
throw new \InvalidArgumentException('Missing the required parameter $email when calling logout');
}
// verify the required parameter 'mode' is set
if ($mode === null) {
throw new \InvalidArgumentException('Missing the required parameter $mode when calling logout');
}
// parse inputs
$resourcePath = "/session/{Email}/{Mode}";
$httpBody = '';
$queryParams = [];
$headerParams = [];
$formParams = [];
$_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);

// header params
if ($authorization !== null) {
$headerParams['Authorization'] = $this->apiClient->getSerializer()->toHeaderValue($authorization);
}
// path params
if ($email !== null) {
$resourcePath = str_replace(
"{" . "Email" . "}",
$this->apiClient->getSerializer()->toPathValue($email),
$resourcePath
);
}
// path params
if ($mode !== null) {
$resourcePath = str_replace(
"{" . "Mode" . "}",
$this->apiClient->getSerializer()->toPathValue($mode),
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);


// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization');
if (strlen($apiKey) !== 0) {
$headerParams['Authorization'] = $apiKey;
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('x-api-key');
if (strlen($apiKey) !== 0) {
$headerParams['x-api-key'] = $apiKey;
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath,
'DELETE',
$queryParams,
$httpBody,
$headerParams,
'\Swagger\Client\Model\Response',
'/session/{Email}/{Mode}'
);

return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Response', $httpHeader), $statusCode, $httpHeader];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Response', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 400:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 401:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 403:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 500:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}

throw $e;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ public function testLoginMFA()

}

/**
* Test case for logout
*
* Logout.
*
*/
public function testLogout()
{

}

}

0 comments on commit 7d741bc

Please sign in to comment.