Skip to content

Commit d6ce665

Browse files
feat(specs): add fields for metadata in composition injectedItems (generated)
algolia/api-clients-automation#5241 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Gavin Wade <[email protected]>
1 parent e394c52 commit d6ce665

File tree

2 files changed

+258
-0
lines changed

2 files changed

+258
-0
lines changed

lib/Model/Composition/Hit.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Hit extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSe
2727
'snippetResult' => 'array<string,\Algolia\AlgoliaSearch\Model\Composition\SnippetResult>',
2828
'rankingInfo' => '\Algolia\AlgoliaSearch\Model\Composition\HitRankingInfo',
2929
'distinctSeqID' => 'int',
30+
'extra' => '\Algolia\AlgoliaSearch\Model\Composition\HitMetadata',
3031
];
3132

3233
/**
@@ -40,6 +41,7 @@ class Hit extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSe
4041
'snippetResult' => null,
4142
'rankingInfo' => null,
4243
'distinctSeqID' => null,
44+
'extra' => null,
4345
];
4446

4547
/**
@@ -54,6 +56,7 @@ class Hit extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSe
5456
'snippetResult' => '_snippetResult',
5557
'rankingInfo' => '_rankingInfo',
5658
'distinctSeqID' => '_distinctSeqID',
59+
'extra' => '_extra',
5760
];
5861

5962
/**
@@ -67,6 +70,7 @@ class Hit extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSe
6770
'snippetResult' => 'setSnippetResult',
6871
'rankingInfo' => 'setRankingInfo',
6972
'distinctSeqID' => 'setDistinctSeqID',
73+
'extra' => 'setExtra',
7074
];
7175

7276
/**
@@ -80,6 +84,7 @@ class Hit extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSe
8084
'snippetResult' => 'getSnippetResult',
8185
'rankingInfo' => 'getRankingInfo',
8286
'distinctSeqID' => 'getDistinctSeqID',
87+
'extra' => 'getExtra',
8388
];
8489

8590
/**
@@ -111,6 +116,9 @@ public function __construct(?array $data = null)
111116
if (isset($data['distinctSeqID'])) {
112117
$this->container['distinctSeqID'] = $data['distinctSeqID'];
113118
}
119+
if (isset($data['extra'])) {
120+
$this->container['extra'] = $data['extra'];
121+
}
114122
}
115123

116124
/**
@@ -311,6 +319,30 @@ public function setDistinctSeqID($distinctSeqID)
311319
return $this;
312320
}
313321

322+
/**
323+
* Gets extra.
324+
*
325+
* @return null|HitMetadata
326+
*/
327+
public function getExtra()
328+
{
329+
return $this->container['extra'] ?? null;
330+
}
331+
332+
/**
333+
* Sets extra.
334+
*
335+
* @param null|HitMetadata $extra extra
336+
*
337+
* @return self
338+
*/
339+
public function setExtra($extra)
340+
{
341+
$this->container['extra'] = $extra;
342+
343+
return $this;
344+
}
345+
314346
/**
315347
* Returns true if offset exists. False otherwise.
316348
*
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<?php
2+
3+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
4+
5+
namespace Algolia\AlgoliaSearch\Model\Composition;
6+
7+
use Algolia\AlgoliaSearch\Model\AbstractModel;
8+
use Algolia\AlgoliaSearch\Model\ModelInterface;
9+
10+
/**
11+
* HitMetadata Class Doc Comment.
12+
*
13+
* @category Class
14+
*
15+
* @description An object that contains the extra key-value pairs provided in the injectedItem definition.
16+
*/
17+
class HitMetadata extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
18+
{
19+
/**
20+
* Array of property to type mappings. Used for (de)serialization.
21+
*
22+
* @var string[]
23+
*/
24+
protected static $modelTypes = [
25+
'injectedItemKey' => 'string',
26+
];
27+
28+
/**
29+
* Array of property to format mappings. Used for (de)serialization.
30+
*
31+
* @var string[]
32+
*/
33+
protected static $modelFormats = [
34+
'injectedItemKey' => null,
35+
];
36+
37+
/**
38+
* Array of attributes where the key is the local name,
39+
* and the value is the original name.
40+
*
41+
* @var string[]
42+
*/
43+
protected static $attributeMap = [
44+
'injectedItemKey' => '_injectedItemKey',
45+
];
46+
47+
/**
48+
* Array of attributes to setter functions (for deserialization of responses).
49+
*
50+
* @var string[]
51+
*/
52+
protected static $setters = [
53+
'injectedItemKey' => 'setInjectedItemKey',
54+
];
55+
56+
/**
57+
* Array of attributes to getter functions (for serialization of requests).
58+
*
59+
* @var string[]
60+
*/
61+
protected static $getters = [
62+
'injectedItemKey' => 'getInjectedItemKey',
63+
];
64+
65+
/**
66+
* Associative array for storing property values.
67+
*
68+
* @var mixed[]
69+
*/
70+
protected $container = [];
71+
72+
/**
73+
* Constructor.
74+
*
75+
* @param mixed[] $data Associated array of property values
76+
*/
77+
public function __construct(?array $data = null)
78+
{
79+
if (isset($data['injectedItemKey'])) {
80+
$this->container['injectedItemKey'] = $data['injectedItemKey'];
81+
}
82+
}
83+
84+
/**
85+
* Array of attributes where the key is the local name,
86+
* and the value is the original name.
87+
*
88+
* @return array
89+
*/
90+
public static function attributeMap()
91+
{
92+
return self::$attributeMap;
93+
}
94+
95+
/**
96+
* Array of property to type mappings. Used for (de)serialization.
97+
*
98+
* @return array
99+
*/
100+
public static function modelTypes()
101+
{
102+
return self::$modelTypes;
103+
}
104+
105+
/**
106+
* Array of property to format mappings. Used for (de)serialization.
107+
*
108+
* @return array
109+
*/
110+
public static function modelFormats()
111+
{
112+
return self::$modelFormats;
113+
}
114+
115+
/**
116+
* Array of attributes to setter functions (for deserialization of responses).
117+
*
118+
* @return array
119+
*/
120+
public static function setters()
121+
{
122+
return self::$setters;
123+
}
124+
125+
/**
126+
* Array of attributes to getter functions (for serialization of requests).
127+
*
128+
* @return array
129+
*/
130+
public static function getters()
131+
{
132+
return self::$getters;
133+
}
134+
135+
/**
136+
* Show all the invalid properties with reasons.
137+
*
138+
* @return array invalid properties with reasons
139+
*/
140+
public function listInvalidProperties()
141+
{
142+
return [];
143+
}
144+
145+
/**
146+
* Validate all the properties in the model
147+
* return true if all passed.
148+
*
149+
* @return bool True if all properties are valid
150+
*/
151+
public function valid()
152+
{
153+
return 0 === count($this->listInvalidProperties());
154+
}
155+
156+
/**
157+
* Gets injectedItemKey.
158+
*
159+
* @return null|string
160+
*/
161+
public function getInjectedItemKey()
162+
{
163+
return $this->container['injectedItemKey'] ?? null;
164+
}
165+
166+
/**
167+
* Sets injectedItemKey.
168+
*
169+
* @param null|string $injectedItemKey the key of the injectedItem that inserted this metadata
170+
*
171+
* @return self
172+
*/
173+
public function setInjectedItemKey($injectedItemKey)
174+
{
175+
$this->container['injectedItemKey'] = $injectedItemKey;
176+
177+
return $this;
178+
}
179+
180+
/**
181+
* Returns true if offset exists. False otherwise.
182+
*
183+
* @param int $offset Offset
184+
*/
185+
public function offsetExists($offset): bool
186+
{
187+
return isset($this->container[$offset]);
188+
}
189+
190+
/**
191+
* Gets offset.
192+
*
193+
* @param int $offset Offset
194+
*
195+
* @return null|mixed
196+
*/
197+
public function offsetGet($offset): mixed
198+
{
199+
return $this->container[$offset] ?? null;
200+
}
201+
202+
/**
203+
* Sets value based on offset.
204+
*
205+
* @param null|int $offset Offset
206+
* @param mixed $value Value to be set
207+
*/
208+
public function offsetSet($offset, $value): void
209+
{
210+
if (is_null($offset)) {
211+
$this->container[] = $value;
212+
} else {
213+
$this->container[$offset] = $value;
214+
}
215+
}
216+
217+
/**
218+
* Unsets offset.
219+
*
220+
* @param int $offset Offset
221+
*/
222+
public function offsetUnset($offset): void
223+
{
224+
unset($this->container[$offset]);
225+
}
226+
}

0 commit comments

Comments
 (0)