Skip to content

Commit f643292

Browse files
algolia-botmillotpFluf22
committed
chore: generated code for commit e974ffc. [skip ci]
Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent e974ffc commit f643292

File tree

26 files changed

+458
-80
lines changed

26 files changed

+458
-80
lines changed

clients/algoliasearch-client-swift/Sources/Core/Networking/HTTP/AlgoliaError.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ public enum AlgoliaError: Error, LocalizedError {
2525
case let .httpError(error):
2626
"HTTP error: \(error)"
2727
case let .noReachableHosts(errors, exposeIntermediateErrors):
28-
"All hosts are unreachable. " + (exposeIntermediateErrors ? "Intermediate errors:\n- \(errors.map(\.localizedDescription).joined(separator: "\n- "))" : "You can use 'exposeIntermediateErrors: true' in the config to investigate.")
28+
"All hosts are unreachable. " +
29+
(
30+
exposeIntermediateErrors ?
31+
"Intermediate errors:\n- \(errors.map(\.localizedDescription).joined(separator: "\n- "))" :
32+
"You can use 'exposeIntermediateErrors: true' in the config to investigate."
33+
)
2934
case .missingData:
3035
"Missing response data"
3136
case .decodingFailure:

clients/algoliasearch-client-swift/Sources/Core/Networking/RetryStrategy/AlgoliaRetryStrategy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AlgoliaRetryStrategy: RetryStrategy {
4040
if !self.hosts.contains(where: { $0.supports(callType) && $0.isUp }) {
4141
self.hosts.resetAll(for: callType)
4242
}
43-
43+
4444
var hostIterator = self.hosts
4545
.sorted { $0.lastUpdated.compare($1.lastUpdated) == .orderedAscending }
4646
.filter { $0.supports(callType) && $0.isUp }

clients/algoliasearch-client-swift/Sources/Core/Networking/Transporter.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ open class Transporter {
142142
}
143143
}
144144

145-
throw AlgoliaError.noReachableHosts(intermediateErrors: intermediateErrors, exposeIntermediateErrors: self.exposeIntermediateErrors)
145+
throw AlgoliaError.noReachableHosts(
146+
intermediateErrors: intermediateErrors,
147+
exposeIntermediateErrors: self.exposeIntermediateErrors
148+
)
146149
}
147150
}

tests/output/csharp/src/generated/client/Search.test.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,38 @@ public async Task ApiTest2()
9393
);
9494
}
9595

96-
[Fact(DisplayName = "test the compression strategy")]
96+
[Fact(DisplayName = "tests the retry strategy error")]
9797
public async Task ApiTest3()
98+
{
99+
SearchConfig _config = new SearchConfig("test-app-id", "test-api-key")
100+
{
101+
CustomHosts = new List<StatefulHost>
102+
{
103+
new()
104+
{
105+
Scheme = HttpScheme.Http,
106+
Url = "localhost",
107+
Port = 6676,
108+
Up = true,
109+
LastUse = DateTime.UtcNow,
110+
Accept = CallType.Read | CallType.Write,
111+
}
112+
}
113+
};
114+
var client = new SearchClient(_config);
115+
116+
_ex = await Assert.ThrowsAnyAsync<Exception>(async () =>
117+
{
118+
var res = await client.CustomGetAsync("1/test/hang/csharp");
119+
});
120+
Assert.Equal(
121+
"RetryStrategy failed to connect to Algolia. Reason: The operation has timed out.".ToLowerInvariant(),
122+
_ex.Message.ToLowerInvariant()
123+
);
124+
}
125+
126+
[Fact(DisplayName = "test the compression strategy")]
127+
public async Task ApiTest4()
98128
{
99129
SearchConfig _config = new SearchConfig("test-app-id", "test-api-key")
100130
{

tests/output/dart/test/client/insights_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void main() {
124124

125125
test('throws when incorrect region is given', () async {
126126
final requester = RequestInterceptor();
127-
expectError(
127+
await expectError(
128128
'`region` must be one of the following: de, us',
129129
() async {
130130
final client = InsightsClient(

tests/output/dart/test/client/search_test.dart

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ void main() {
6262
}
6363
});
6464

65+
test('tests the retry strategy error', () async {
66+
final requester = RequestInterceptor();
67+
final client = SearchClient(
68+
appId: "test-app-id",
69+
apiKey: "test-api-key",
70+
options: ClientOptions(hosts: [
71+
Host.create(url: 'localhost:6676', scheme: 'http'),
72+
]));
73+
await expectError(
74+
'UnreachableHostsException{errors: [AlgoliaTimeoutException{error: DioException [receive timeout]: The request took longer than 0:00:05.000000 to receive data. It was aborted. To get rid of this exception, try raising the RequestOptions.receiveTimeout above the duration of 0:00:05.000000 or improve the response time of the server.}]}',
75+
() async {
76+
try {
77+
final res = await client.customGet(
78+
path: "1/test/hang/dart",
79+
);
80+
} on InterceptionException catch (_) {
81+
// Ignore InterceptionException
82+
}
83+
},
84+
);
85+
});
86+
6587
test('calls api with correct user agent', () async {
6688
final requester = RequestInterceptor();
6789
final client = SearchClient(
@@ -121,7 +143,7 @@ void main() {
121143

122144
test('client throws with invalid parameters', () async {
123145
final requester = RequestInterceptor();
124-
expectError(
146+
await expectError(
125147
'`appId` is missing.',
126148
() async {
127149
final client = SearchClient(
@@ -130,7 +152,7 @@ void main() {
130152
options: ClientOptions(requester: requester));
131153
},
132154
);
133-
expectError(
155+
await expectError(
134156
'`appId` is missing.',
135157
() async {
136158
final client = SearchClient(
@@ -139,7 +161,7 @@ void main() {
139161
options: ClientOptions(requester: requester));
140162
},
141163
);
142-
expectError(
164+
await expectError(
143165
'`apiKey` is missing.',
144166
() async {
145167
final client = SearchClient(
@@ -157,7 +179,7 @@ void main() {
157179
apiKey: 'apiKey',
158180
options: ClientOptions(requester: requester),
159181
);
160-
expectError(
182+
await expectError(
161183
'Parameter `apiKey` is required when calling `addApiKey`.',
162184
() async {
163185
try {
@@ -178,7 +200,7 @@ void main() {
178200
apiKey: 'apiKey',
179201
options: ClientOptions(requester: requester),
180202
);
181-
expectError(
203+
await expectError(
182204
'Parameter `indexName` is required when calling `addOrUpdateObject`.',
183205
() async {
184206
try {
@@ -192,7 +214,7 @@ void main() {
192214
}
193215
},
194216
);
195-
expectError(
217+
await expectError(
196218
'Parameter `objectID` is required when calling `addOrUpdateObject`.',
197219
() async {
198220
try {
@@ -206,7 +228,7 @@ void main() {
206228
}
207229
},
208230
);
209-
expectError(
231+
await expectError(
210232
'Parameter `body` is required when calling `addOrUpdateObject`.',
211233
() async {
212234
try {

tests/output/go/tests/benchmark/search_test.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/output/go/tests/client/abtesting_test.go

Lines changed: 17 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/output/go/tests/client/analytics_test.go

Lines changed: 20 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)