|
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
|
14 |
|
public function __construct($statusCode, array $allowedContentTypes, Parameters $parameters) |
|
21
|
|
|
{ |
|
22
|
14 |
|
$this->statusCode = $statusCode; |
|
23
|
14 |
|
$this->contentTypes = $allowedContentTypes; |
|
24
|
14 |
|
$this->parameters = $parameters; |
|
25
|
14 |
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @return int |
|
29
|
|
|
*/ |
|
30
|
13 |
|
public function getStatusCode() |
|
31
|
|
|
{ |
|
32
|
13 |
|
return $this->statusCode; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return bool |
|
37
|
|
|
*/ |
|
38
|
|
|
public function hasBodySchema() |
|
39
|
|
|
{ |
|
40
|
1 |
|
return $this->parameters->hasBodySchema(); |
|
41
|
|
|
} |
|
42
|
1 |
|
|
|
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
|
2 |
|
|
|
61
|
|
|
/** |
|
62
|
2 |
|
* Supported response types |
|
63
|
|
|
* @return array |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getContentTypes() |
|
66
|
1 |
|
{ |
|
67
|
|
|
return $this->contentTypes; |
|
68
|
1 |
|
} |
|
69
|
1 |
|
|
|
70
|
1 |
|
public function serialize() |
|
71
|
1 |
|
{ |
|
72
|
|
|
return serialize([ |
|
73
|
|
|
'statusCode' => $this->statusCode, |
|
74
|
|
|
'contentTypes' => $this->contentTypes, |
|
75
|
|
|
'parameters' => $this->parameters |
|
76
|
1 |
|
]); |
|
77
|
|
|
} |
|
78
|
1 |
|
|
|
79
|
1 |
|
public function unserialize($serialized) |
|
80
|
1 |
|
{ |
|
81
|
1 |
|
$data = unserialize($serialized); |
|
82
|
1 |
|
$this->statusCode = $data['statusCode']; |
|
83
|
|
|
$this->contentTypes = $data['contentTypes']; |
|
84
|
|
|
$this->parameters = $data['parameters']; |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|