1
|
|
|
<?php |
2
|
|
|
namespace ElevenLabs\Api\Definition; |
3
|
|
|
|
4
|
|
|
class ResponseDefinition implements \Serializable, MessageDefinition |
5
|
|
|
{ |
6
|
|
|
/** @var int */ |
7
|
|
|
private $statusCode; |
8
|
|
|
|
9
|
|
|
/** @var array */ |
10
|
|
|
private $contentTypes; |
11
|
|
|
|
12
|
|
|
/** @var Parameters */ |
13
|
|
|
private $parameters; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @param int $statusCode |
17
|
|
|
* @param array $allowedContentTypes |
18
|
|
|
* @param Parameters $parameters |
19
|
|
|
*/ |
20
|
1 |
|
public function __construct($statusCode, array $allowedContentTypes, Parameters $parameters) |
21
|
|
|
{ |
22
|
1 |
|
$this->statusCode = $statusCode; |
23
|
1 |
|
$this->contentTypes = $allowedContentTypes; |
24
|
1 |
|
$this->parameters = $parameters; |
25
|
1 |
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @return int |
29
|
|
|
*/ |
30
|
|
|
public function getStatusCode() |
31
|
|
|
{ |
32
|
|
|
return $this->statusCode; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @return bool |
37
|
|
|
*/ |
38
|
|
|
public function hasBodySchema() |
39
|
|
|
{ |
40
|
|
|
return $this->parameters->hasBodySchema(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return \stdClass |
45
|
|
|
*/ |
46
|
|
|
public function getBodySchema() |
47
|
|
|
{ |
48
|
|
|
return $this->parameters->getBodySchema(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function hasHeadersSchema() |
52
|
|
|
{ |
53
|
|
|
return $this->parameters->hasHeadersSchema(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getHeadersSchema() |
57
|
|
|
{ |
58
|
|
|
return $this->parameters->getHeadersSchema(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Supported response types |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
public function getContentTypes() |
66
|
|
|
{ |
67
|
|
|
return $this->contentTypes; |
68
|
|
|
} |
69
|
|
|
|
70
|
1 |
|
public function serialize() |
71
|
|
|
{ |
72
|
1 |
|
return serialize([ |
73
|
1 |
|
'statusCode' => $this->statusCode, |
74
|
1 |
|
'contentTypes' => $this->contentTypes, |
75
|
1 |
|
'parameters' => $this->parameters |
76
|
|
|
]); |
77
|
|
|
} |
78
|
|
|
|
79
|
1 |
|
public function unserialize($serialized) |
80
|
|
|
{ |
81
|
1 |
|
$data = unserialize($serialized); |
82
|
1 |
|
$this->statusCode = $data['statusCode']; |
83
|
1 |
|
$this->contentTypes = $data['contentTypes']; |
84
|
1 |
|
$this->parameters = $data['parameters']; |
85
|
1 |
|
} |
86
|
|
|
} |
87
|
|
|
|