Skip to content

Commit d7e0c41

Browse files
algolia-botcdhawkemillotp
committed
feat(specs): add estimate path and responses [skip-bc] (generated)
algolia/api-clients-automation#4057 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Christopher Hawke <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 0c5e91d commit d7e0c41

File tree

6 files changed

+912
-20
lines changed

6 files changed

+912
-20
lines changed

lib/Api/AbtestingClient.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Algolia\AlgoliaSearch\Algolia;
88
use Algolia\AlgoliaSearch\Configuration\AbtestingConfig;
99
use Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsRequest;
10+
use Algolia\AlgoliaSearch\Model\Abtesting\EstimateABTestRequest;
1011
use Algolia\AlgoliaSearch\Model\Abtesting\ScheduleABTestsRequest;
1112
use Algolia\AlgoliaSearch\ObjectSerializer;
1213
use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper;
@@ -338,6 +339,39 @@ public function deleteABTest($id, $requestOptions = [])
338339
return $this->sendRequest('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
339340
}
340341

342+
/**
343+
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
344+
*
345+
* Required API Key ACLs:
346+
* - analytics
347+
*
348+
* @param array $estimateABTestRequest estimateABTestRequest (required)
349+
* - $estimateABTestRequest['configuration'] => (array) (required)
350+
* - $estimateABTestRequest['variants'] => (array) A/B test variants. (required)
351+
*
352+
* @see EstimateABTestRequest
353+
*
354+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
355+
*
356+
* @return \Algolia\AlgoliaSearch\Model\Abtesting\EstimateABTestResponse|array<string, mixed>
357+
*/
358+
public function estimateABTest($estimateABTestRequest, $requestOptions = [])
359+
{
360+
// verify the required parameter 'estimateABTestRequest' is set
361+
if (!isset($estimateABTestRequest)) {
362+
throw new \InvalidArgumentException(
363+
'Parameter `estimateABTestRequest` is required when calling `estimateABTest`.'
364+
);
365+
}
366+
367+
$resourcePath = '/2/abtests/estimate';
368+
$queryParameters = [];
369+
$headers = [];
370+
$httpBody = $estimateABTestRequest;
371+
372+
return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
373+
}
374+
341375
/**
342376
* Retrieves the details for an A/B test by its ID.
343377
*

lib/Model/Abtesting/Effect.php renamed to lib/Model/Abtesting/EffectMetric.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace Algolia\AlgoliaSearch\Model\Abtesting;
66

77
/**
8-
* Effect Class Doc Comment.
8+
* EffectMetric Class Doc Comment.
99
*
1010
* @category Class
1111
*
1212
* @description Metric for which you want to detect the smallest relative difference.
1313
*/
14-
class Effect
14+
class EffectMetric
1515
{
1616
/**
1717
* Possible values of this enum.
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
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\Abtesting;
6+
7+
use Algolia\AlgoliaSearch\Model\AbstractModel;
8+
use Algolia\AlgoliaSearch\Model\ModelInterface;
9+
10+
/**
11+
* EstimateABTestRequest Class Doc Comment.
12+
*
13+
* @category Class
14+
*/
15+
class EstimateABTestRequest extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
16+
{
17+
/**
18+
* Array of property to type mappings. Used for (de)serialization.
19+
*
20+
* @var string[]
21+
*/
22+
protected static $modelTypes = [
23+
'configuration' => '\Algolia\AlgoliaSearch\Model\Abtesting\EstimateConfiguration',
24+
'variants' => '\Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsVariant[]',
25+
];
26+
27+
/**
28+
* Array of property to format mappings. Used for (de)serialization.
29+
*
30+
* @var string[]
31+
*/
32+
protected static $modelFormats = [
33+
'configuration' => null,
34+
'variants' => 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+
'configuration' => 'configuration',
45+
'variants' => 'variants',
46+
];
47+
48+
/**
49+
* Array of attributes to setter functions (for deserialization of responses).
50+
*
51+
* @var string[]
52+
*/
53+
protected static $setters = [
54+
'configuration' => 'setConfiguration',
55+
'variants' => 'setVariants',
56+
];
57+
58+
/**
59+
* Array of attributes to getter functions (for serialization of requests).
60+
*
61+
* @var string[]
62+
*/
63+
protected static $getters = [
64+
'configuration' => 'getConfiguration',
65+
'variants' => 'getVariants',
66+
];
67+
68+
/**
69+
* Associative array for storing property values.
70+
*
71+
* @var mixed[]
72+
*/
73+
protected $container = [];
74+
75+
/**
76+
* Constructor.
77+
*
78+
* @param mixed[] $data Associated array of property values
79+
*/
80+
public function __construct(?array $data = null)
81+
{
82+
if (isset($data['configuration'])) {
83+
$this->container['configuration'] = $data['configuration'];
84+
}
85+
if (isset($data['variants'])) {
86+
$this->container['variants'] = $data['variants'];
87+
}
88+
}
89+
90+
/**
91+
* Array of attributes where the key is the local name,
92+
* and the value is the original name.
93+
*
94+
* @return array
95+
*/
96+
public static function attributeMap()
97+
{
98+
return self::$attributeMap;
99+
}
100+
101+
/**
102+
* Array of property to type mappings. Used for (de)serialization.
103+
*
104+
* @return array
105+
*/
106+
public static function modelTypes()
107+
{
108+
return self::$modelTypes;
109+
}
110+
111+
/**
112+
* Array of property to format mappings. Used for (de)serialization.
113+
*
114+
* @return array
115+
*/
116+
public static function modelFormats()
117+
{
118+
return self::$modelFormats;
119+
}
120+
121+
/**
122+
* Array of attributes to setter functions (for deserialization of responses).
123+
*
124+
* @return array
125+
*/
126+
public static function setters()
127+
{
128+
return self::$setters;
129+
}
130+
131+
/**
132+
* Array of attributes to getter functions (for serialization of requests).
133+
*
134+
* @return array
135+
*/
136+
public static function getters()
137+
{
138+
return self::$getters;
139+
}
140+
141+
/**
142+
* Show all the invalid properties with reasons.
143+
*
144+
* @return array invalid properties with reasons
145+
*/
146+
public function listInvalidProperties()
147+
{
148+
$invalidProperties = [];
149+
150+
if (!isset($this->container['configuration']) || null === $this->container['configuration']) {
151+
$invalidProperties[] = "'configuration' can't be null";
152+
}
153+
if (!isset($this->container['variants']) || null === $this->container['variants']) {
154+
$invalidProperties[] = "'variants' can't be null";
155+
}
156+
157+
return $invalidProperties;
158+
}
159+
160+
/**
161+
* Validate all the properties in the model
162+
* return true if all passed.
163+
*
164+
* @return bool True if all properties are valid
165+
*/
166+
public function valid()
167+
{
168+
return 0 === count($this->listInvalidProperties());
169+
}
170+
171+
/**
172+
* Gets configuration.
173+
*
174+
* @return EstimateConfiguration
175+
*/
176+
public function getConfiguration()
177+
{
178+
return $this->container['configuration'] ?? null;
179+
}
180+
181+
/**
182+
* Sets configuration.
183+
*
184+
* @param EstimateConfiguration $configuration configuration
185+
*
186+
* @return self
187+
*/
188+
public function setConfiguration($configuration)
189+
{
190+
$this->container['configuration'] = $configuration;
191+
192+
return $this;
193+
}
194+
195+
/**
196+
* Gets variants.
197+
*
198+
* @return \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsVariant[]
199+
*/
200+
public function getVariants()
201+
{
202+
return $this->container['variants'] ?? null;
203+
}
204+
205+
/**
206+
* Sets variants.
207+
*
208+
* @param \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsVariant[] $variants A/B test variants
209+
*
210+
* @return self
211+
*/
212+
public function setVariants($variants)
213+
{
214+
$this->container['variants'] = $variants;
215+
216+
return $this;
217+
}
218+
219+
/**
220+
* Returns true if offset exists. False otherwise.
221+
*
222+
* @param int $offset Offset
223+
*/
224+
public function offsetExists($offset): bool
225+
{
226+
return isset($this->container[$offset]);
227+
}
228+
229+
/**
230+
* Gets offset.
231+
*
232+
* @param int $offset Offset
233+
*
234+
* @return null|mixed
235+
*/
236+
public function offsetGet($offset): mixed
237+
{
238+
return $this->container[$offset] ?? null;
239+
}
240+
241+
/**
242+
* Sets value based on offset.
243+
*
244+
* @param null|int $offset Offset
245+
* @param mixed $value Value to be set
246+
*/
247+
public function offsetSet($offset, $value): void
248+
{
249+
if (is_null($offset)) {
250+
$this->container[] = $value;
251+
} else {
252+
$this->container[$offset] = $value;
253+
}
254+
}
255+
256+
/**
257+
* Unsets offset.
258+
*
259+
* @param int $offset Offset
260+
*/
261+
public function offsetUnset($offset): void
262+
{
263+
unset($this->container[$offset]);
264+
}
265+
}

0 commit comments

Comments
 (0)