Skip to content

Commit

Permalink
chore: generated code for commit 97c1aaf. (#364)
Browse files Browse the repository at this point in the history
Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
Co-authored-by: Damien Couchez <damien.couchez@gmail.com>
  • Loading branch information
4 people authored Apr 11, 2022
1 parent 4fb7b6a commit c6dd9aa
Show file tree
Hide file tree
Showing 224 changed files with 75,284 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.algolia.exceptions.*;
import com.algolia.utils.Requester;
import com.algolia.utils.UserAgent;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
Expand All @@ -28,8 +29,21 @@ public class ApiClient {
/*
* Constructor for ApiClient with custom Requester
*/
public ApiClient(String appId, String apiKey, Requester requester) {
setUserAgent("OpenAPI-Generator/0.1.0/java");
public ApiClient(
String appId,
String apiKey,
Requester requester,
String clientName,
UserAgent.Segment[] segments
) {
UserAgent ua = new UserAgent("0.0.1");
ua.addSegment(new UserAgent.Segment(clientName, "0.0.1"));
if (segments != null) {
for (UserAgent.Segment segment : segments) {
ua.addSegment(segment);
}
}
setUserAgent(ua.toString());

this.appId = appId;
this.apiKey = apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,33 @@
public class SearchApi extends ApiClient {

public SearchApi(String appId, String apiKey) {
super(appId, apiKey, new HttpRequester(getDefaultHosts(appId)));
this(appId, apiKey, new HttpRequester(getDefaultHosts(appId)), null);
}

public SearchApi(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(appId)),
userAgentSegments
);
}

public SearchApi(String appId, String apiKey, Requester requester) {
super(appId, apiKey, requester);
this(appId, apiKey, requester, null);
}

public SearchApi(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
) {
super(appId, apiKey, requester, "Search", userAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String appId) {
Expand Down
33 changes: 19 additions & 14 deletions clients/algoliasearch-client-php/lib/Api/AbtestingApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function create($appId = null, $apiKey = null, $region = null)
}

/**
* Instantiate the client with congiguration
* Instantiate the client with configuration
*
* @param AbtestingConfig $config Configuration
*/
Expand Down Expand Up @@ -90,8 +90,13 @@ public function getClientConfig()
* Creates a new A/B test with provided configuration.
*
* @param array $addABTestsRequest addABTestsRequest (required)
* - $addABTestsRequest['name'] => (string) A/B test name. (required)
* - $addABTestsRequest['variant'] => (array) List of 2 variants for the A/B test. (required)
* - $addABTestsRequest['endAt'] => (string) End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ. (required)
*
* @return array<string, mixed>
* @see \Algolia\AlgoliaSearch\Model\Abtesting\AddABTestsRequest
*
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
*/
public function addABTests($addABTestsRequest)
{
Expand Down Expand Up @@ -120,7 +125,7 @@ public function addABTests($addABTestsRequest)
* @param array $parameters Query parameters to be applied to the current query. (optional)
* @param array $body The parameters to send with the custom request. (optional)
*
* @return array<string, mixed>
* @return array<string, mixed>|object
*/
public function del($path, $parameters = null, $body = null)
{
Expand Down Expand Up @@ -149,7 +154,7 @@ public function del($path, $parameters = null, $body = null)
if ($path !== null) {
$resourcePath = str_replace(
'{path}',
path,
$path,
$resourcePath
);
}
Expand All @@ -166,7 +171,7 @@ public function del($path, $parameters = null, $body = null)
*
* @param int $id The A/B test ID. (required)
*
* @return array<string, mixed>
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
*/
public function deleteABTest($id)
{
Expand Down Expand Up @@ -199,7 +204,7 @@ public function deleteABTest($id)
* @param string $path The path of the API endpoint to target, anything after the /1 needs to be specified. (required)
* @param array $parameters Query parameters to be applied to the current query. (optional)
*
* @return array<string, mixed>
* @return array<string, mixed>|object
*/
public function get($path, $parameters = null)
{
Expand Down Expand Up @@ -228,7 +233,7 @@ public function get($path, $parameters = null)
if ($path !== null) {
$resourcePath = str_replace(
'{path}',
path,
$path,
$resourcePath
);
}
Expand All @@ -241,7 +246,7 @@ public function get($path, $parameters = null)
*
* @param int $id The A/B test ID. (required)
*
* @return array<string, mixed>
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTest
*/
public function getABTest($id)
{
Expand Down Expand Up @@ -274,7 +279,7 @@ public function getABTest($id)
* @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0)
* @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10)
*
* @return array<string, mixed>
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ListABTestsResponse
*/
public function listABTests($offset = 0, $limit = 10)
{
Expand Down Expand Up @@ -312,7 +317,7 @@ public function listABTests($offset = 0, $limit = 10)
* @param array $parameters Query parameters to be applied to the current query. (optional)
* @param array $body The parameters to send with the custom request. (optional)
*
* @return array<string, mixed>
* @return array<string, mixed>|object
*/
public function post($path, $parameters = null, $body = null)
{
Expand Down Expand Up @@ -341,7 +346,7 @@ public function post($path, $parameters = null, $body = null)
if ($path !== null) {
$resourcePath = str_replace(
'{path}',
path,
$path,
$resourcePath
);
}
Expand All @@ -360,7 +365,7 @@ public function post($path, $parameters = null, $body = null)
* @param array $parameters Query parameters to be applied to the current query. (optional)
* @param array $body The parameters to send with the custom request. (optional)
*
* @return array<string, mixed>
* @return array<string, mixed>|object
*/
public function put($path, $parameters = null, $body = null)
{
Expand Down Expand Up @@ -389,7 +394,7 @@ public function put($path, $parameters = null, $body = null)
if ($path !== null) {
$resourcePath = str_replace(
'{path}',
path,
$path,
$resourcePath
);
}
Expand All @@ -406,7 +411,7 @@ public function put($path, $parameters = null, $body = null)
*
* @param int $id The A/B test ID. (required)
*
* @return array<string, mixed>
* @return array<string, mixed>|\Algolia\AlgoliaSearch\Model\Abtesting\ABTestResponse
*/
public function stopABTest($id)
{
Expand Down
Loading

0 comments on commit c6dd9aa

Please sign in to comment.