Skip to content

Commit eba56c6

Browse files
fix(clients): correly parse usage hosts (generated)
algolia/api-clients-automation#3622 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent b452ef6 commit eba56c6

File tree

1 file changed

+7
-36
lines changed

1 file changed

+7
-36
lines changed

packages/client-usage/src/usageClient.ts

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// 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.
22

3-
import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from '@algolia/client-common';
3+
import { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';
44
import type {
55
CreateClientOptions,
66
Headers,
@@ -22,39 +22,11 @@ import type { IndexUsage } from '../model/indexUsage';
2222

2323
export const apiClientVersion = '1.2.3';
2424

25-
function getDefaultHosts(appId: string): Host[] {
26-
return (
27-
[
28-
{
29-
url: `${appId}-dsn.algolia.net`,
30-
accept: 'read',
31-
protocol: 'https',
32-
},
33-
{
34-
url: `${appId}.algolia.net`,
35-
accept: 'write',
36-
protocol: 'https',
37-
},
38-
] as Host[]
39-
).concat(
40-
shuffle([
41-
{
42-
url: `${appId}-1.algolianet.com`,
43-
accept: 'readWrite',
44-
protocol: 'https',
45-
},
46-
{
47-
url: `${appId}-2.algolianet.com`,
48-
accept: 'readWrite',
49-
protocol: 'https',
50-
},
51-
{
52-
url: `${appId}-3.algolianet.com`,
53-
accept: 'readWrite',
54-
protocol: 'https',
55-
},
56-
]),
57-
);
25+
function getDefaultHosts(): Host[] {
26+
return [
27+
{ url: 'usage.algolia.com', accept: 'readWrite', protocol: 'https' },
28+
{ url: 'usage-dev.algolia.com', accept: 'readWrite', protocol: 'https' },
29+
];
5830
}
5931

6032
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -67,7 +39,7 @@ export function createUsageClient({
6739
}: CreateClientOptions) {
6840
const auth = createAuth(appIdOption, apiKeyOption, authMode);
6941
const transporter = createTransporter({
70-
hosts: getDefaultHosts(appIdOption),
42+
hosts: getDefaultHosts(),
7143
...options,
7244
algoliaAgent: getAlgoliaAgent({
7345
algoliaAgents,
@@ -274,7 +246,6 @@ export function createUsageClient({
274246
.replace('{indexName}', encodeURIComponent(indexName));
275247
const headers: Headers = {};
276248
const queryParameters: QueryParameters = {};
277-
278249
if (startDate !== undefined) {
279250
queryParameters.startDate = startDate.toString();
280251
}

0 commit comments

Comments
 (0)