Skip to content

Commit 52b2e14

Browse files
algolia-botben-kalmusClaraMuller
committed
feat(specs): add compositions deduplication setting (generated)
algolia/api-clients-automation#5418 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Ben Kalmus <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent cd70e2d commit 52b2e14

File tree

3 files changed

+299
-0
lines changed

3 files changed

+299
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
/**
8+
* DedupPositioning Class Doc Comment.
9+
*
10+
* @category Class
11+
*
12+
* @description Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results. Current configuration supports: - 'highest': always select the item in the highest position, and remove duplicates that appear lower in the results. - 'highestInjected': duplicate result will be moved to its highest possible injected position, but not higher. If a duplicate appears higher in main search results, it will be removed to stay it's intended group position (which could be lower than main).
13+
*/
14+
class DedupPositioning
15+
{
16+
/**
17+
* Possible values of this enum.
18+
*/
19+
public const HIGHEST = 'highest';
20+
21+
public const HIGHEST_INJECTED = 'highestInjected';
22+
23+
/**
24+
* Gets allowable values of the enum.
25+
*
26+
* @return string[]
27+
*/
28+
public static function getAllowableEnumValues()
29+
{
30+
return [
31+
self::HIGHEST,
32+
self::HIGHEST_INJECTED,
33+
];
34+
}
35+
}
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
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+
* Deduplication Class Doc Comment.
12+
*
13+
* @category Class
14+
*
15+
* @description Deduplication configures the methods used to resolve duplicate items between main search results and injected group results.
16+
*/
17+
class Deduplication 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+
'positioning' => '\Algolia\AlgoliaSearch\Model\Composition\DedupPositioning',
26+
];
27+
28+
/**
29+
* Array of property to format mappings. Used for (de)serialization.
30+
*
31+
* @var string[]
32+
*/
33+
protected static $modelFormats = [
34+
'positioning' => 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+
'positioning' => 'positioning',
45+
];
46+
47+
/**
48+
* Array of attributes to setter functions (for deserialization of responses).
49+
*
50+
* @var string[]
51+
*/
52+
protected static $setters = [
53+
'positioning' => 'setPositioning',
54+
];
55+
56+
/**
57+
* Array of attributes to getter functions (for serialization of requests).
58+
*
59+
* @var string[]
60+
*/
61+
protected static $getters = [
62+
'positioning' => 'getPositioning',
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['positioning'])) {
80+
$this->container['positioning'] = $data['positioning'];
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+
$invalidProperties = [];
143+
144+
if (!isset($this->container['positioning']) || null === $this->container['positioning']) {
145+
$invalidProperties[] = "'positioning' can't be null";
146+
}
147+
148+
return $invalidProperties;
149+
}
150+
151+
/**
152+
* Validate all the properties in the model
153+
* return true if all passed.
154+
*
155+
* @return bool True if all properties are valid
156+
*/
157+
public function valid()
158+
{
159+
return 0 === count($this->listInvalidProperties());
160+
}
161+
162+
/**
163+
* Gets positioning.
164+
*
165+
* @return DedupPositioning
166+
*/
167+
public function getPositioning()
168+
{
169+
return $this->container['positioning'] ?? null;
170+
}
171+
172+
/**
173+
* Sets positioning.
174+
*
175+
* @param DedupPositioning $positioning positioning
176+
*
177+
* @return self
178+
*/
179+
public function setPositioning($positioning)
180+
{
181+
$this->container['positioning'] = $positioning;
182+
183+
return $this;
184+
}
185+
186+
/**
187+
* Returns true if offset exists. False otherwise.
188+
*
189+
* @param int $offset Offset
190+
*/
191+
public function offsetExists($offset): bool
192+
{
193+
return isset($this->container[$offset]);
194+
}
195+
196+
/**
197+
* Gets offset.
198+
*
199+
* @param int $offset Offset
200+
*
201+
* @return null|mixed
202+
*/
203+
public function offsetGet($offset): mixed
204+
{
205+
return $this->container[$offset] ?? null;
206+
}
207+
208+
/**
209+
* Sets value based on offset.
210+
*
211+
* @param null|int $offset Offset
212+
* @param mixed $value Value to be set
213+
*/
214+
public function offsetSet($offset, $value): void
215+
{
216+
if (is_null($offset)) {
217+
$this->container[] = $value;
218+
} else {
219+
$this->container[$offset] = $value;
220+
}
221+
}
222+
223+
/**
224+
* Unsets offset.
225+
*
226+
* @param int $offset Offset
227+
*/
228+
public function offsetUnset($offset): void
229+
{
230+
unset($this->container[$offset]);
231+
}
232+
}

lib/Model/Composition/Injection.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Injection extends AbstractModel implements ModelInterface, \ArrayAccess, \
2222
protected static $modelTypes = [
2323
'main' => '\Algolia\AlgoliaSearch\Model\Composition\Main',
2424
'injectedItems' => '\Algolia\AlgoliaSearch\Model\Composition\InjectedItem[]',
25+
'deduplication' => '\Algolia\AlgoliaSearch\Model\Composition\Deduplication',
2526
];
2627

2728
/**
@@ -32,6 +33,7 @@ class Injection extends AbstractModel implements ModelInterface, \ArrayAccess, \
3233
protected static $modelFormats = [
3334
'main' => null,
3435
'injectedItems' => null,
36+
'deduplication' => null,
3537
];
3638

3739
/**
@@ -43,6 +45,7 @@ class Injection extends AbstractModel implements ModelInterface, \ArrayAccess, \
4345
protected static $attributeMap = [
4446
'main' => 'main',
4547
'injectedItems' => 'injectedItems',
48+
'deduplication' => 'deduplication',
4649
];
4750

4851
/**
@@ -53,6 +56,7 @@ class Injection extends AbstractModel implements ModelInterface, \ArrayAccess, \
5356
protected static $setters = [
5457
'main' => 'setMain',
5558
'injectedItems' => 'setInjectedItems',
59+
'deduplication' => 'setDeduplication',
5660
];
5761

5862
/**
@@ -63,6 +67,7 @@ class Injection extends AbstractModel implements ModelInterface, \ArrayAccess, \
6367
protected static $getters = [
6468
'main' => 'getMain',
6569
'injectedItems' => 'getInjectedItems',
70+
'deduplication' => 'getDeduplication',
6671
];
6772

6873
/**
@@ -85,6 +90,9 @@ public function __construct(?array $data = null)
8590
if (isset($data['injectedItems'])) {
8691
$this->container['injectedItems'] = $data['injectedItems'];
8792
}
93+
if (isset($data['deduplication'])) {
94+
$this->container['deduplication'] = $data['deduplication'];
95+
}
8896
}
8997

9098
/**
@@ -213,6 +221,30 @@ public function setInjectedItems($injectedItems)
213221
return $this;
214222
}
215223

224+
/**
225+
* Gets deduplication.
226+
*
227+
* @return null|Deduplication
228+
*/
229+
public function getDeduplication()
230+
{
231+
return $this->container['deduplication'] ?? null;
232+
}
233+
234+
/**
235+
* Sets deduplication.
236+
*
237+
* @param null|Deduplication $deduplication deduplication
238+
*
239+
* @return self
240+
*/
241+
public function setDeduplication($deduplication)
242+
{
243+
$this->container['deduplication'] = $deduplication;
244+
245+
return $this;
246+
}
247+
216248
/**
217249
* Returns true if offset exists. False otherwise.
218250
*

0 commit comments

Comments
 (0)