Skip to content

Commit 7a1838d

Browse files
chore: generated code for commit 12f246e. [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 12f246e commit 7a1838d

File tree

46 files changed

+29739
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+29739
-124
lines changed

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/AbtestingClient.java

Lines changed: 955 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/AnalyticsClient.java

Lines changed: 3432 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/InsightsClient.java

Lines changed: 581 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/PersonalizationClient.java

Lines changed: 882 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/PredictClient.java

Lines changed: 600 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/QuerySuggestionsClient.java

Lines changed: 1158 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/RecommendClient.java

Lines changed: 626 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/api/SearchClient.java

Lines changed: 6644 additions & 0 deletions
Large diffs are not rendered by default.

clients/algoliasearch-client-javascript/packages/algoliasearch-lite/builds/browser.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ import {
77
import { createXhrRequester } from '@experimental-api-clients-automation/requester-browser-xhr';
88

99
import {
10-
createAlgoliasearchLiteApi,
10+
createAlgoliasearchLiteClient,
1111
apiClientVersion,
12-
} from '../src/algoliasearchLiteApi';
13-
import type { AlgoliasearchLiteApi } from '../src/algoliasearchLiteApi';
12+
} from '../src/algoliasearchLiteClient';
13+
import type { AlgoliasearchLiteClient } from '../src/algoliasearchLiteClient';
1414

15-
export * from '../src/algoliasearchLiteApi';
15+
export * from '../src/algoliasearchLiteClient';
1616

17-
export function algoliasearchLiteApi(
17+
export function algoliasearchLiteClient(
1818
appId: string,
1919
apiKey: string,
2020
options?: InitClientOptions
21-
): AlgoliasearchLiteApi {
21+
): AlgoliasearchLiteClient {
2222
if (!appId) {
2323
throw new Error('`appId` is missing.');
2424
}
@@ -27,7 +27,7 @@ export function algoliasearchLiteApi(
2727
throw new Error('`apiKey` is missing.');
2828
}
2929

30-
return createAlgoliasearchLiteApi({
30+
return createAlgoliasearchLiteClient({
3131
appId,
3232
apiKey,
3333
timeouts: {

clients/algoliasearch-client-javascript/packages/algoliasearch-lite/builds/node.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import {
55
} from '@experimental-api-clients-automation/client-common';
66
import { createHttpRequester } from '@experimental-api-clients-automation/requester-node-http';
77

8-
import { createAlgoliasearchLiteApi } from '../src/algoliasearchLiteApi';
9-
import type { AlgoliasearchLiteApi } from '../src/algoliasearchLiteApi';
8+
import { createAlgoliasearchLiteClient } from '../src/algoliasearchLiteClient';
9+
import type { AlgoliasearchLiteClient } from '../src/algoliasearchLiteClient';
1010

11-
export * from '../src/algoliasearchLiteApi';
11+
export * from '../src/algoliasearchLiteClient';
1212

13-
export function algoliasearchLiteApi(
13+
export function algoliasearchLiteClient(
1414
appId: string,
1515
apiKey: string,
1616
options?: InitClientOptions
17-
): AlgoliasearchLiteApi {
17+
): AlgoliasearchLiteClient {
1818
if (!appId) {
1919
throw new Error('`appId` is missing.');
2020
}
@@ -23,7 +23,7 @@ export function algoliasearchLiteApi(
2323
throw new Error('`apiKey` is missing.');
2424
}
2525

26-
return createAlgoliasearchLiteApi({
26+
return createAlgoliasearchLiteClient({
2727
appId,
2828
apiKey,
2929
timeouts: {
Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
import {
2+
createAuth,
3+
createTransporter,
4+
getUserAgent,
5+
shuffle,
6+
} from '@experimental-api-clients-automation/client-common';
7+
import type {
8+
CreateClientOptions,
9+
Headers,
10+
Host,
11+
Request,
12+
RequestOptions,
13+
QueryParameters,
14+
} from '@experimental-api-clients-automation/client-common';
15+
16+
import type { MultipleQueriesParams } from '../model/multipleQueriesParams';
17+
import type { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
18+
import type { SearchForFacetValuesRequest } from '../model/searchForFacetValuesRequest';
19+
import type { SearchForFacetValuesResponse } from '../model/searchForFacetValuesResponse';
20+
import type { SearchParams } from '../model/searchParams';
21+
import type { SearchResponse } from '../model/searchResponse';
22+
23+
export * from '../model';
24+
export const apiClientVersion = '0.0.5';
25+
26+
function getDefaultHosts(appId: string): Host[] {
27+
return (
28+
[
29+
{
30+
url: `${appId}-dsn.algolia.net`,
31+
accept: 'read',
32+
protocol: 'https',
33+
},
34+
{
35+
url: `${appId}.algolia.net`,
36+
accept: 'write',
37+
protocol: 'https',
38+
},
39+
] as Host[]
40+
).concat(
41+
shuffle([
42+
{
43+
url: `${appId}-1.algolianet.com`,
44+
accept: 'readWrite',
45+
protocol: 'https',
46+
},
47+
{
48+
url: `${appId}-2.algolianet.com`,
49+
accept: 'readWrite',
50+
protocol: 'https',
51+
},
52+
{
53+
url: `${appId}-3.algolianet.com`,
54+
accept: 'readWrite',
55+
protocol: 'https',
56+
},
57+
])
58+
);
59+
}
60+
61+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
62+
export function createAlgoliasearchLiteClient(options: CreateClientOptions) {
63+
const auth = createAuth(options.appId, options.apiKey, options.authMode);
64+
const transporter = createTransporter({
65+
hosts: options?.hosts ?? getDefaultHosts(options.appId),
66+
hostsCache: options.hostsCache,
67+
requestsCache: options.requestsCache,
68+
responsesCache: options.responsesCache,
69+
baseHeaders: {
70+
'content-type': 'application/x-www-form-urlencoded',
71+
...auth.headers(),
72+
},
73+
baseQueryParameters: auth.queryParameters(),
74+
userAgent: getUserAgent({
75+
userAgents: options.userAgents,
76+
client: 'AlgoliasearchLite',
77+
version: apiClientVersion,
78+
}),
79+
timeouts: options.timeouts,
80+
requester: options.requester,
81+
});
82+
83+
function addUserAgent(segment: string, version?: string): void {
84+
transporter.userAgent.add({ segment, version });
85+
}
86+
87+
return {
88+
addUserAgent,
89+
/**
90+
* Get search results for the given requests.
91+
*
92+
* @summary Get search results for the given requests.
93+
* @param multipleQueriesParams - The multipleQueriesParams object.
94+
*/
95+
multipleQueries(
96+
multipleQueriesParams: MultipleQueriesParams,
97+
requestOptions?: RequestOptions
98+
): Promise<MultipleQueriesResponse> {
99+
if (!multipleQueriesParams) {
100+
throw new Error(
101+
'Parameter `multipleQueriesParams` is required when calling `multipleQueries`.'
102+
);
103+
}
104+
105+
if (!multipleQueriesParams.requests) {
106+
throw new Error(
107+
'Parameter `multipleQueriesParams.requests` is required when calling `multipleQueries`.'
108+
);
109+
}
110+
111+
const requestPath = '/1/indexes/*/queries';
112+
const headers: Headers = {};
113+
const queryParameters: QueryParameters = {};
114+
115+
const request: Request = {
116+
method: 'POST',
117+
path: requestPath,
118+
data: multipleQueriesParams,
119+
};
120+
121+
return transporter.request(
122+
request,
123+
{
124+
queryParameters,
125+
headers,
126+
},
127+
requestOptions
128+
);
129+
},
130+
131+
/**
132+
* This method allow you to send requests to the Algolia REST API.
133+
*
134+
* @summary Send requests to the Algolia REST API.
135+
* @param post - The post object.
136+
* @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
137+
* @param post.parameters - Query parameters to be applied to the current query.
138+
* @param post.body - The parameters to send with the custom request.
139+
*/
140+
post(
141+
{ path, parameters, body }: PostProps,
142+
requestOptions?: RequestOptions
143+
): Promise<Record<string, any>> {
144+
if (!path) {
145+
throw new Error('Parameter `path` is required when calling `post`.');
146+
}
147+
148+
const requestPath = '/1{path}'.replace('{path}', path);
149+
const headers: Headers = {};
150+
const queryParameters: QueryParameters = parameters || {};
151+
152+
const request: Request = {
153+
method: 'POST',
154+
path: requestPath,
155+
data: body,
156+
};
157+
158+
return transporter.request(
159+
request,
160+
{
161+
queryParameters,
162+
headers,
163+
},
164+
requestOptions
165+
);
166+
},
167+
168+
/**
169+
* Get search results.
170+
*
171+
* @summary Get search results.
172+
* @param search - The search object.
173+
* @param search.indexName - The index in which to perform the request.
174+
* @param search.searchParams - The searchParams object.
175+
*/
176+
search(
177+
{ indexName, searchParams }: SearchProps,
178+
requestOptions?: RequestOptions
179+
): Promise<SearchResponse> {
180+
if (!indexName) {
181+
throw new Error(
182+
'Parameter `indexName` is required when calling `search`.'
183+
);
184+
}
185+
186+
if (!searchParams) {
187+
throw new Error(
188+
'Parameter `searchParams` is required when calling `search`.'
189+
);
190+
}
191+
192+
const requestPath = '/1/indexes/{indexName}/query'.replace(
193+
'{indexName}',
194+
encodeURIComponent(indexName)
195+
);
196+
const headers: Headers = {};
197+
const queryParameters: QueryParameters = {};
198+
199+
const request: Request = {
200+
method: 'POST',
201+
path: requestPath,
202+
data: searchParams,
203+
};
204+
205+
return transporter.request(
206+
request,
207+
{
208+
queryParameters,
209+
headers,
210+
},
211+
requestOptions
212+
);
213+
},
214+
215+
/**
216+
* Search for values of a given facet, optionally restricting the returned values to those contained in objects matching other search criteria.
217+
*
218+
* @summary Search for values of a given facet.
219+
* @param searchForFacetValues - The searchForFacetValues object.
220+
* @param searchForFacetValues.indexName - The index in which to perform the request.
221+
* @param searchForFacetValues.facetName - The facet name.
222+
* @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object.
223+
*/
224+
searchForFacetValues(
225+
{
226+
indexName,
227+
facetName,
228+
searchForFacetValuesRequest,
229+
}: SearchForFacetValuesProps,
230+
requestOptions?: RequestOptions
231+
): Promise<SearchForFacetValuesResponse> {
232+
if (!indexName) {
233+
throw new Error(
234+
'Parameter `indexName` is required when calling `searchForFacetValues`.'
235+
);
236+
}
237+
238+
if (!facetName) {
239+
throw new Error(
240+
'Parameter `facetName` is required when calling `searchForFacetValues`.'
241+
);
242+
}
243+
244+
const requestPath = '/1/indexes/{indexName}/facets/{facetName}/query'
245+
.replace('{indexName}', encodeURIComponent(indexName))
246+
.replace('{facetName}', encodeURIComponent(facetName));
247+
const headers: Headers = {};
248+
const queryParameters: QueryParameters = {};
249+
250+
const request: Request = {
251+
method: 'POST',
252+
path: requestPath,
253+
data: searchForFacetValuesRequest,
254+
};
255+
256+
return transporter.request(
257+
request,
258+
{
259+
queryParameters,
260+
headers,
261+
},
262+
requestOptions
263+
);
264+
},
265+
};
266+
}
267+
268+
export type AlgoliasearchLiteClient = ReturnType<
269+
typeof createAlgoliasearchLiteClient
270+
>;
271+
272+
export type PostProps = {
273+
/**
274+
* The path of the API endpoint to target, anything after the /1 needs to be specified.
275+
*/
276+
path: string;
277+
/**
278+
* Query parameters to be applied to the current query.
279+
*/
280+
parameters?: Record<string, any>;
281+
/**
282+
* The parameters to send with the custom request.
283+
*/
284+
body?: Record<string, any>;
285+
};
286+
287+
export type SearchProps = {
288+
/**
289+
* The index in which to perform the request.
290+
*/
291+
indexName: string;
292+
searchParams: SearchParams;
293+
};
294+
295+
export type SearchForFacetValuesProps = {
296+
/**
297+
* The index in which to perform the request.
298+
*/
299+
indexName: string;
300+
/**
301+
* The facet name.
302+
*/
303+
facetName: string;
304+
searchForFacetValuesRequest?: SearchForFacetValuesRequest;
305+
};

0 commit comments

Comments
 (0)