Skip to content

Commit d51643f

Browse files
committed
feat(scala): searchRecentlyPublishedBooks
1 parent ffd9ee8 commit d51643f

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

generators/src/main/java/com/algolia/codegen/cts/guides/GuidesGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
5454
bundle.put("isSearchClient", true);
5555
}
5656
bundle.put("isSyncClient", true);
57+
bundle.put("isGuide", true);
5758
// nothing to do here, the mustache uses dynamicSnippets lambda
5859
}
5960
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Foundation
2+
#if os(Linux) // For linux interop
3+
import FoundationNetworking
4+
#endif
5+
6+
import Core
7+
{{> snippets/import}}
8+
9+
func searchRecentlyPublishedBooks() async throws {
10+
do {
11+
{{> snippets/init}}
12+
13+
let dateTimestamp = Int(Date().timeIntervalSince1970)
14+
let searchParams = SearchSearchParams.searchSearchParamsObject(
15+
SearchSearchParamsObject(query: "<YOUR_SEARCH_QUERY>", filters: "date_timestamp > \(dateTimestamp)")
16+
)
17+
18+
let response: SearchResponse<Hit> = {{#dynamicSnippet}}searchRecentlyPublishedBooks{{/dynamicSnippet}}
19+
print(response)
20+
} catch {
21+
print(error)
22+
}
23+
}

templates/swift/tests/method.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
try {{#isAsyncMethod}}await {{/isAsyncMethod}}client.{{method}}{{^isHelper}}WithHTTPInfo{{/isHelper}}({{#hasParams}}{{#parametersWithDataType}}{{> tests/generateParams }}{{^-last}}, {{/-last}}{{/parametersWithDataType}}{{/hasParams}}{{#hasRequestOptions}}{{#requestOptions}}, requestOptions: RequestOptions(
1+
try {{#isAsyncMethod}}await {{/isAsyncMethod}}client.{{method}}{{^isHelper}}{{^isGuide}}WithHTTPInfo{{/isGuide}}{{/isHelper}}({{#hasParams}}{{#parametersWithDataType}}{{> tests/generateParams }}{{^-last}}, {{/-last}}{{/parametersWithDataType}}{{/hasParams}}{{#hasRequestOptions}}{{#requestOptions}}, requestOptions: RequestOptions(
22
{{#headers}}
33
headers: [{{#parametersWithDataType}}"{{key}}": {{> tests/paramValue }}{{^-last}}, {{/-last}}{{/parametersWithDataType}}]{{#queryParameters}},{{/queryParameters}}
44
{{/headers}}

tests/CTS/guides/search.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@
2424
"parameters": {
2525
"requests": "$var: requests"
2626
}
27+
},
28+
"searchRecentlyPublishedBooks": {
29+
"method": "searchSingleIndex",
30+
"parameters": {
31+
"indexName": "indexName",
32+
"searchParams": "$var: searchParams"
33+
}
2734
}
2835
}

0 commit comments

Comments
 (0)