Skip to content

Commit

Permalink
chore: generated code for commit 0389b9d. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Haroen Viaene <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
3 people committed May 18, 2022
1 parent 0389b9d commit d0b9625
Show file tree
Hide file tree
Showing 49 changed files with 143 additions and 143 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.algolia;

import com.algolia.exceptions.*;
import com.algolia.utils.AlgoliaAgent;
import com.algolia.utils.JSON;
import com.algolia.utils.RequestOptions;
import com.algolia.utils.Requester;
import com.algolia.utils.UserAgent;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -37,18 +37,18 @@ public ApiClient(
String apiKey,
Requester requester,
String clientName,
UserAgent.Segment[] segments
AlgoliaAgent.Segment[] segments
) {
this.contentType = "application/json";

UserAgent ua = new UserAgent("0.0.1");
ua.addSegment(new UserAgent.Segment(clientName, "0.0.1"));
AlgoliaAgent ua = new AlgoliaAgent("0.0.1");
ua.addSegment(new AlgoliaAgent.Segment(clientName, "0.0.1"));
if (segments != null) {
for (UserAgent.Segment segment : segments) {
for (AlgoliaAgent.Segment segment : segments) {
ua.addSegment(segment);
}
}
setUserAgent(ua.toString());
setAlgoliaAgent(ua.toString());

defaultHeaderMap.put("X-Algolia-Application-Id", appId);
defaultHeaderMap.put("X-Algolia-API-Key", apiKey);
Expand All @@ -65,11 +65,11 @@ public DateFormat getDateFormat() {
/**
* Set the User-Agent header's value (by adding to the default header map).
*
* @param userAgent HTTP request's user agent
* @param algoliaAgent HTTP request's user agent
* @return ApiClient
*/
public ApiClient setUserAgent(String userAgent) {
addDefaultHeader("User-Agent", userAgent);
public ApiClient setAlgoliaAgent(String algoliaAgent) {
addDefaultHeader("User-Agent", algoliaAgent);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public AbtestingClient(String appId, String apiKey) {
public AbtestingClient(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(null)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -44,13 +44,13 @@ public AbtestingClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -62,9 +62,9 @@ public AbtestingClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Abtesting", userAgentSegments);
super(appId, apiKey, requester, "Abtesting", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public AnalyticsClient(String appId, String apiKey) {
public AnalyticsClient(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(null)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -44,13 +44,13 @@ public AnalyticsClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -62,9 +62,9 @@ public AnalyticsClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Analytics", userAgentSegments);
super(appId, apiKey, requester, "Analytics", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public InsightsClient(String appId, String apiKey) {
public InsightsClient(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(null)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -44,13 +44,13 @@ public InsightsClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -62,9 +62,9 @@ public InsightsClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Insights", userAgentSegments);
super(appId, apiKey, requester, "Insights", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public PersonalizationClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -49,9 +49,9 @@ public PersonalizationClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Personalization", userAgentSegments);
super(appId, apiKey, requester, "Personalization", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public PredictClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -45,9 +45,9 @@ public PredictClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Predict", userAgentSegments);
super(appId, apiKey, requester, "Predict", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public QuerySuggestionsClient(
String appId,
String apiKey,
String region,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(region)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -49,9 +49,9 @@ public QuerySuggestionsClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "QuerySuggestions", userAgentSegments);
super(appId, apiKey, requester, "QuerySuggestions", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public RecommendClient(String appId, String apiKey) {
public RecommendClient(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(appId)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -48,9 +48,9 @@ public RecommendClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Recommend", userAgentSegments);
super(appId, apiKey, requester, "Recommend", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String appId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public SearchClient(String appId, String apiKey) {
public SearchClient(
String appId,
String apiKey,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
this(
appId,
apiKey,
new HttpRequester(getDefaultHosts(appId)),
userAgentSegments
algoliaAgentSegments
);
}

Expand All @@ -48,9 +48,9 @@ public SearchClient(
String appId,
String apiKey,
Requester requester,
UserAgent.Segment[] userAgentSegments
AlgoliaAgent.Segment[] algoliaAgentSegments
) {
super(appId, apiKey, requester, "Search", userAgentSegments);
super(appId, apiKey, requester, "Search", algoliaAgentSegments);
}

private static List<StatefulHost> getDefaultHosts(String appId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function algoliasearchLiteClient(
write: 30,
},
requester: options?.requester ?? createXhrRequester(),
userAgents: [{ segment: 'Browser' }],
algoliaAgents: [{ segment: 'Browser' }],
authMode: 'WithinQueryParameters',
responsesCache: options?.responsesCache ?? createMemoryCache(),
requestsCache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function algoliasearchLiteClient(
write: 30,
},
requester: options?.requester ?? createHttpRequester(),
userAgents: [{ segment: 'Node.js', version: process.versions.node }],
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
responsesCache: options?.responsesCache ?? createNullCache(),
requestsCache: options?.requestsCache ?? createNullCache(),
hostsCache: options?.hostsCache ?? createMemoryCache(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
createAuth,
createTransporter,
getUserAgent,
getAlgoliaAgent,
shuffle,
} from '@experimental-api-clients-automation/client-common';
import type {
Expand Down Expand Up @@ -71,21 +71,21 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) {
...auth.headers(),
},
baseQueryParameters: auth.queryParameters(),
userAgent: getUserAgent({
userAgents: options.userAgents,
algoliaAgent: getAlgoliaAgent({
algoliaAgents: options.algoliaAgents,
client: 'AlgoliasearchLite',
version: apiClientVersion,
}),
timeouts: options.timeouts,
requester: options.requester,
});

function addUserAgent(segment: string, version?: string): void {
transporter.userAgent.add({ segment, version });
function addAlgoliaAgent(segment: string, version?: string): void {
transporter.algoliaAgent.add({ segment, version });
}

return {
addUserAgent,
addAlgoliaAgent,
/**
* Perform a search operation targeting one or many indices.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function abtestingClient(
write: 30,
},
requester: options?.requester ?? createXhrRequester(),
userAgents: [{ segment: 'Browser' }],
algoliaAgents: [{ segment: 'Browser' }],
authMode: 'WithinQueryParameters',
responsesCache: options?.responsesCache ?? createMemoryCache(),
requestsCache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function abtestingClient(
write: 30,
},
requester: options?.requester ?? createHttpRequester(),
userAgents: [{ segment: 'Node.js', version: process.versions.node }],
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
responsesCache: options?.responsesCache ?? createNullCache(),
requestsCache: options?.requestsCache ?? createNullCache(),
hostsCache: options?.hostsCache ?? createMemoryCache(),
Expand Down
Loading

0 comments on commit d0b9625

Please sign in to comment.