Skip to content

Commit 4b8ca56

Browse files
committed
Update client code for dde48b65b2768e991a47279c36e132efa9b7a392
1 parent a1ae009 commit 4b8ca56

28 files changed

+10934
-0
lines changed

src/lib/client/Api/SecWareOpenControllerApi.php

Lines changed: 660 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
1+
<?php
2+
/**
3+
* TransactionSecurityControllerApi
4+
* PHP version 5
5+
*
6+
* @category Class
7+
* @package Swagger\Client
8+
* @author Swagger Codegen team
9+
* @link https://github.com/swagger-api/swagger-codegen
10+
*/
11+
12+
/**
13+
* GoPlus Security API Document
14+
*
15+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
16+
*
17+
* OpenAPI spec version: 1.0
18+
*
19+
* Generated by: https://github.com/swagger-api/swagger-codegen.git
20+
* Swagger Codegen version: 3.0.45
21+
*/
22+
/**
23+
* NOTE: This class is auto generated by the swagger code generator program.
24+
* https://github.com/swagger-api/swagger-codegen
25+
* Do not edit the class manually.
26+
*/
27+
28+
namespace Swagger\Client\Api;
29+
30+
use GuzzleHttp\Client;
31+
use GuzzleHttp\ClientInterface;
32+
use GuzzleHttp\Exception\RequestException;
33+
use GuzzleHttp\Psr7\MultipartStream;
34+
use GuzzleHttp\Psr7\Request;
35+
use GuzzleHttp\RequestOptions;
36+
use Swagger\Client\ApiException;
37+
use Swagger\Client\Configuration;
38+
use Swagger\Client\HeaderSelector;
39+
use Swagger\Client\ObjectSerializer;
40+
41+
/**
42+
* TransactionSecurityControllerApi Class Doc Comment
43+
*
44+
* @category Class
45+
* @package Swagger\Client
46+
* @author Swagger Codegen team
47+
* @link https://github.com/swagger-api/swagger-codegen
48+
*/
49+
class TransactionSecurityControllerApi
50+
{
51+
/**
52+
* @var ClientInterface
53+
*/
54+
protected $client;
55+
56+
/**
57+
* @var Configuration
58+
*/
59+
protected $config;
60+
61+
/**
62+
* @var HeaderSelector
63+
*/
64+
protected $headerSelector;
65+
66+
/**
67+
* @param ClientInterface $client
68+
* @param Configuration $config
69+
* @param HeaderSelector $selector
70+
*/
71+
public function __construct(
72+
ClientInterface $client = null,
73+
Configuration $config = null,
74+
HeaderSelector $selector = null
75+
) {
76+
$this->client = $client ?: new Client();
77+
$this->config = $config ?: new Configuration();
78+
$this->headerSelector = $selector ?: new HeaderSelector();
79+
}
80+
81+
/**
82+
* @return Configuration
83+
*/
84+
public function getConfig()
85+
{
86+
return $this->config;
87+
}
88+
89+
/**
90+
* Operation getTransactionSecurityInfoUsingPOST
91+
*
92+
* Transaction Simulation
93+
*
94+
* @param \Swagger\Client\Model\TransactionSecurityRequest $body transactionSecurityRequest (required)
95+
* @param string $authorization Authorization (test:Bearer 81|9ihH8JzEuFu4MQ9DjWmH5WrNCPW...) (optional)
96+
*
97+
* @throws \Swagger\Client\ApiException on non-2xx response
98+
* @throws \InvalidArgumentException
99+
* @return \Swagger\Client\Model\ResponseWrapperTransactionSecurityResponse
100+
*/
101+
public function getTransactionSecurityInfoUsingPOST($body, $authorization = null)
102+
{
103+
list($response) = $this->getTransactionSecurityInfoUsingPOSTWithHttpInfo($body, $authorization);
104+
return $response;
105+
}
106+
107+
/**
108+
* Operation getTransactionSecurityInfoUsingPOSTWithHttpInfo
109+
*
110+
* Transaction Simulation
111+
*
112+
* @param \Swagger\Client\Model\TransactionSecurityRequest $body transactionSecurityRequest (required)
113+
* @param string $authorization Authorization (test:Bearer 81|9ihH8JzEuFu4MQ9DjWmH5WrNCPW...) (optional)
114+
*
115+
* @throws \Swagger\Client\ApiException on non-2xx response
116+
* @throws \InvalidArgumentException
117+
* @return array of \Swagger\Client\Model\ResponseWrapperTransactionSecurityResponse, HTTP status code, HTTP response headers (array of strings)
118+
*/
119+
public function getTransactionSecurityInfoUsingPOSTWithHttpInfo($body, $authorization = null)
120+
{
121+
$returnType = '\Swagger\Client\Model\ResponseWrapperTransactionSecurityResponse';
122+
$request = $this->getTransactionSecurityInfoUsingPOSTRequest($body, $authorization);
123+
124+
try {
125+
$options = $this->createHttpClientOption();
126+
try {
127+
$response = $this->client->send($request, $options);
128+
} catch (RequestException $e) {
129+
throw new ApiException(
130+
"[{$e->getCode()}] {$e->getMessage()}",
131+
$e->getCode(),
132+
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
133+
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
134+
);
135+
}
136+
137+
$statusCode = $response->getStatusCode();
138+
139+
if ($statusCode < 200 || $statusCode > 299) {
140+
throw new ApiException(
141+
sprintf(
142+
'[%d] Error connecting to the API (%s)',
143+
$statusCode,
144+
$request->getUri()
145+
),
146+
$statusCode,
147+
$response->getHeaders(),
148+
$response->getBody()
149+
);
150+
}
151+
152+
$responseBody = $response->getBody();
153+
if ($returnType === '\SplFileObject') {
154+
$content = $responseBody; //stream goes to serializer
155+
} else {
156+
$content = $responseBody->getContents();
157+
if (!in_array($returnType, ['string','integer','bool'])) {
158+
$content = json_decode($content);
159+
}
160+
}
161+
162+
return [
163+
ObjectSerializer::deserialize($content, $returnType, []),
164+
$response->getStatusCode(),
165+
$response->getHeaders()
166+
];
167+
168+
} catch (ApiException $e) {
169+
switch ($e->getCode()) {
170+
case 200:
171+
$data = ObjectSerializer::deserialize(
172+
$e->getResponseBody(),
173+
'\Swagger\Client\Model\ResponseWrapperTransactionSecurityResponse',
174+
$e->getResponseHeaders()
175+
);
176+
$e->setResponseObject($data);
177+
break;
178+
}
179+
throw $e;
180+
}
181+
}
182+
183+
/**
184+
* Operation getTransactionSecurityInfoUsingPOSTAsync
185+
*
186+
* Transaction Simulation
187+
*
188+
* @param \Swagger\Client\Model\TransactionSecurityRequest $body transactionSecurityRequest (required)
189+
* @param string $authorization Authorization (test:Bearer 81|9ihH8JzEuFu4MQ9DjWmH5WrNCPW...) (optional)
190+
*
191+
* @throws \InvalidArgumentException
192+
* @return \GuzzleHttp\Promise\PromiseInterface
193+
*/
194+
public function getTransactionSecurityInfoUsingPOSTAsync($body, $authorization = null)
195+
{
196+
return $this->getTransactionSecurityInfoUsingPOSTAsyncWithHttpInfo($body, $authorization)
197+
->then(
198+
function ($response) {
199+
return $response[0];
200+
}
201+
);
202+
}
203+
204+
/**
205+
* Operation getTransactionSecurityInfoUsingPOSTAsyncWithHttpInfo
206+
*
207+
* Transaction Simulation
208+
*
209+
* @param \Swagger\Client\Model\TransactionSecurityRequest $body transactionSecurityRequest (required)
210+
* @param string $authorization Authorization (test:Bearer 81|9ihH8JzEuFu4MQ9DjWmH5WrNCPW...) (optional)
211+
*
212+
* @throws \InvalidArgumentException
213+
* @return \GuzzleHttp\Promise\PromiseInterface
214+
*/
215+
public function getTransactionSecurityInfoUsingPOSTAsyncWithHttpInfo($body, $authorization = null)
216+
{
217+
$returnType = '\Swagger\Client\Model\ResponseWrapperTransactionSecurityResponse';
218+
$request = $this->getTransactionSecurityInfoUsingPOSTRequest($body, $authorization);
219+
220+
return $this->client
221+
->sendAsync($request, $this->createHttpClientOption())
222+
->then(
223+
function ($response) use ($returnType) {
224+
$responseBody = $response->getBody();
225+
if ($returnType === '\SplFileObject') {
226+
$content = $responseBody; //stream goes to serializer
227+
} else {
228+
$content = $responseBody->getContents();
229+
if ($returnType !== 'string') {
230+
$content = json_decode($content);
231+
}
232+
}
233+
234+
return [
235+
ObjectSerializer::deserialize($content, $returnType, []),
236+
$response->getStatusCode(),
237+
$response->getHeaders()
238+
];
239+
},
240+
function ($exception) {
241+
$response = $exception->getResponse();
242+
$statusCode = $response->getStatusCode();
243+
throw new ApiException(
244+
sprintf(
245+
'[%d] Error connecting to the API (%s)',
246+
$statusCode,
247+
$exception->getRequest()->getUri()
248+
),
249+
$statusCode,
250+
$response->getHeaders(),
251+
$response->getBody()
252+
);
253+
}
254+
);
255+
}
256+
257+
/**
258+
* Create request for operation 'getTransactionSecurityInfoUsingPOST'
259+
*
260+
* @param \Swagger\Client\Model\TransactionSecurityRequest $body transactionSecurityRequest (required)
261+
* @param string $authorization Authorization (test:Bearer 81|9ihH8JzEuFu4MQ9DjWmH5WrNCPW...) (optional)
262+
*
263+
* @throws \InvalidArgumentException
264+
* @return \GuzzleHttp\Psr7\Request
265+
*/
266+
protected function getTransactionSecurityInfoUsingPOSTRequest($body, $authorization = null)
267+
{
268+
// verify the required parameter 'body' is set
269+
if ($body === null || (is_array($body) && count($body) === 0)) {
270+
throw new \InvalidArgumentException(
271+
'Missing the required parameter $body when calling getTransactionSecurityInfoUsingPOST'
272+
);
273+
}
274+
275+
$resourcePath = '/api/v1/transaction_simulation';
276+
$formParams = [];
277+
$queryParams = [];
278+
$headerParams = [];
279+
$httpBody = '';
280+
$multipart = false;
281+
282+
// header params
283+
if ($authorization !== null) {
284+
$headerParams['Authorization'] = ObjectSerializer::toHeaderValue($authorization);
285+
}
286+
287+
288+
// body params
289+
$_tempBody = null;
290+
if (isset($body)) {
291+
$_tempBody = $body;
292+
}
293+
294+
if ($multipart) {
295+
$headers = $this->headerSelector->selectHeadersForMultipart(
296+
['*/*']
297+
);
298+
} else {
299+
$headers = $this->headerSelector->selectHeaders(
300+
['*/*'],
301+
['application/json']
302+
);
303+
}
304+
305+
// for model (json/xml)
306+
if (isset($_tempBody)) {
307+
// $_tempBody is the method argument, if present
308+
$httpBody = $_tempBody;
309+
// \stdClass has no __toString(), so we should encode it manually
310+
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
311+
$httpBody = \GuzzleHttp\json_encode($httpBody);
312+
}
313+
} elseif (count($formParams) > 0) {
314+
if ($multipart) {
315+
$multipartContents = [];
316+
foreach ($formParams as $formParamName => $formParamValue) {
317+
$multipartContents[] = [
318+
'name' => $formParamName,
319+
'contents' => $formParamValue
320+
];
321+
}
322+
// for HTTP post (form)
323+
$httpBody = new MultipartStream($multipartContents);
324+
325+
} elseif ($headers['Content-Type'] === 'application/json') {
326+
$httpBody = \GuzzleHttp\json_encode($formParams);
327+
328+
} else {
329+
// for HTTP post (form)
330+
$httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
331+
}
332+
}
333+
334+
335+
$defaultHeaders = [];
336+
if ($this->config->getUserAgent()) {
337+
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
338+
}
339+
340+
$headers = array_merge(
341+
$defaultHeaders,
342+
$headerParams,
343+
$headers
344+
);
345+
346+
$query = \GuzzleHttp\Psr7\Query::build($queryParams);
347+
return new Request(
348+
'POST',
349+
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
350+
$headers,
351+
$httpBody
352+
);
353+
}
354+
355+
/**
356+
* Create http client option
357+
*
358+
* @throws \RuntimeException on file opening failure
359+
* @return array of http client options
360+
*/
361+
protected function createHttpClientOption()
362+
{
363+
$options = [];
364+
if ($this->config->getDebug()) {
365+
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
366+
if (!$options[RequestOptions::DEBUG]) {
367+
throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
368+
}
369+
}
370+
371+
return $options;
372+
}
373+
}

0 commit comments

Comments
 (0)