Skip to content

Commit 25e0431

Browse files
algolia-bote-krebsshortcutsmillotp
committed
feat(specs): rename composition to composition-full (private) and add composition (public) (generated)
algolia/api-clients-automation#4357 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Emmanuel Krebs <[email protected]> Co-authored-by: shortcuts <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 44b85a2 commit 25e0431

File tree

109 files changed

+5587
-4
lines changed

Some content is hidden

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

109 files changed

+5587
-4
lines changed

packages/algoliasearch/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ dev_dependencies:
2222
json_serializable: ^6.7.0
2323
lints: ^5.0.0
2424
logging: ^1.2.0
25-
test: ^1.25.8
25+
test: ^1.25.8

packages/client_composition/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2013-Present Algolia
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
targets:
2+
$default:
3+
builders:
4+
json_serializable:
5+
options:
6+
any_map: false
7+
checked: true
8+
create_factory: true
9+
create_to_json: true
10+
disallow_unrecognized_keys: false
11+
explicit_to_json: true
12+
field_rename: none
13+
ignore_unannotated: false
14+
include_if_null: false
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// A sub-package of the AlgoliaSearch library, offering composition-specific functionalities for enhanced search and discovery in Dart/Flutter apps.
2+
library;
3+
4+
export 'package:algolia_client_core/algolia_client_core.dart';
5+
6+
export 'src/api/composition_client.dart';
7+
8+
export 'src/model/around_radius_all.dart';
9+
export 'src/model/banner.dart';
10+
export 'src/model/banner_image.dart';
11+
export 'src/model/banner_image_url.dart';
12+
export 'src/model/banner_link.dart';
13+
export 'src/model/base_search_response.dart';
14+
export 'src/model/composition_base_search_response.dart';
15+
export 'src/model/composition_id_ranking_info.dart';
16+
export 'src/model/composition_ranking_info.dart';
17+
export 'src/model/composition_run_applied_rules.dart';
18+
export 'src/model/composition_run_search_response.dart';
19+
export 'src/model/compositions_search_response.dart';
20+
export 'src/model/error_base.dart';
21+
export 'src/model/exhaustive.dart';
22+
export 'src/model/facet_hits.dart';
23+
export 'src/model/facet_ordering.dart';
24+
export 'src/model/facet_stats.dart';
25+
export 'src/model/facets.dart';
26+
export 'src/model/highlight_result_option.dart';
27+
export 'src/model/hit.dart';
28+
export 'src/model/hit_ranking_info.dart';
29+
export 'src/model/match_level.dart';
30+
export 'src/model/matched_geo_location.dart';
31+
export 'src/model/params.dart';
32+
export 'src/model/personalization.dart';
33+
export 'src/model/range.dart';
34+
export 'src/model/ranking_info.dart';
35+
export 'src/model/redirect.dart';
36+
export 'src/model/redirect_rule_index_data.dart';
37+
export 'src/model/redirect_rule_index_metadata.dart';
38+
export 'src/model/redirect_url.dart';
39+
export 'src/model/rendering_content.dart';
40+
export 'src/model/request_body.dart';
41+
export 'src/model/results_composition_info_response.dart';
42+
export 'src/model/results_compositions_response.dart';
43+
export 'src/model/results_injected_item_applied_rules_info_response.dart';
44+
export 'src/model/results_injected_item_info_response.dart';
45+
export 'src/model/search_for_facet_values_params.dart';
46+
export 'src/model/search_for_facet_values_request.dart';
47+
export 'src/model/search_for_facet_values_response.dart';
48+
export 'src/model/search_for_facet_values_results.dart';
49+
export 'src/model/search_hits.dart';
50+
export 'src/model/search_pagination.dart';
51+
export 'src/model/search_response.dart';
52+
export 'src/model/search_results.dart';
53+
export 'src/model/search_results_item.dart';
54+
export 'src/model/snippet_result_option.dart';
55+
export 'src/model/sort_remaining_by.dart';
56+
export 'src/model/supported_language.dart';
57+
export 'src/model/value.dart';
58+
export 'src/model/widgets.dart';
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// 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.
2+
3+
import 'package:algolia_client_core/algolia_client_core.dart';
4+
import 'package:algolia_client_composition/src/deserialize.dart';
5+
import 'package:algolia_client_composition/src/version.dart';
6+
7+
import 'package:algolia_client_composition/src/model/request_body.dart';
8+
import 'package:algolia_client_composition/src/model/search_for_facet_values_request.dart';
9+
import 'package:algolia_client_composition/src/model/search_for_facet_values_response.dart';
10+
import 'package:algolia_client_composition/src/model/search_response.dart';
11+
12+
final class CompositionClient implements ApiClient {
13+
@override
14+
final ClientOptions options;
15+
16+
final RetryStrategy _retryStrategy;
17+
18+
CompositionClient({
19+
required String appId,
20+
required String apiKey,
21+
this.options = const ClientOptions(),
22+
}) : _retryStrategy = RetryStrategy.create(
23+
segment: AgentSegment(value: "Composition", version: packageVersion),
24+
appId: appId,
25+
apiKey: apiKey,
26+
options: options,
27+
defaultHosts: () =>
28+
[
29+
Host(url: '$appId-dsn.algolia.net', callType: CallType.read),
30+
Host(url: '$appId.algolia.net', callType: CallType.write),
31+
] +
32+
([
33+
Host(url: '$appId-1.algolianet.com'),
34+
Host(url: '$appId-2.algolianet.com'),
35+
Host(url: '$appId-3.algolianet.com'),
36+
]..shuffle()),
37+
) {
38+
assert(appId.isNotEmpty, '`appId` is missing.');
39+
assert(apiKey.isNotEmpty, '`apiKey` is missing.');
40+
}
41+
42+
/// Allows to switch the API key used to authenticate requests.
43+
@override
44+
void setClientApiKey({required String apiKey}) {
45+
_retryStrategy.requester.setClientApiKey(apiKey);
46+
}
47+
48+
/// Runs a query on a single composition and returns matching results.
49+
///
50+
/// Required API Key ACLs:
51+
/// - search
52+
///
53+
/// Parameters:
54+
/// * [compositionID] Unique Composition ObjectID.
55+
/// * [requestBody]
56+
/// * [requestOptions] additional request configuration.
57+
Future<SearchResponse> search({
58+
required String compositionID,
59+
required RequestBody requestBody,
60+
RequestOptions? requestOptions,
61+
}) async {
62+
assert(
63+
compositionID.isNotEmpty,
64+
'Parameter `compositionID` is required when calling `search`.',
65+
);
66+
final request = ApiRequest(
67+
method: RequestMethod.post,
68+
path: r'/1/compositions/{compositionID}/run'.replaceAll(
69+
'{' r'compositionID' '}',
70+
Uri.encodeComponent(compositionID.toString())),
71+
isRead: true,
72+
body: requestBody.toJson(),
73+
);
74+
final response = await _retryStrategy.execute(
75+
request: request,
76+
options: requestOptions,
77+
);
78+
return deserialize<SearchResponse, SearchResponse>(
79+
response,
80+
'SearchResponse',
81+
growable: true,
82+
);
83+
}
84+
85+
/// Searches for values of a specified facet attribute on the composition's main source's index. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than 65 searchable facets and searchable attributes combined**.
86+
///
87+
/// Required API Key ACLs:
88+
/// - search
89+
///
90+
/// Parameters:
91+
/// * [compositionID] Unique Composition ObjectID.
92+
/// * [facetName] Facet attribute in which to search for values. This attribute must be included in the `attributesForFaceting` index setting with the `searchable()` modifier.
93+
/// * [searchForFacetValuesRequest]
94+
/// * [requestOptions] additional request configuration.
95+
Future<SearchForFacetValuesResponse> searchForFacetValues({
96+
required String compositionID,
97+
required String facetName,
98+
SearchForFacetValuesRequest? searchForFacetValuesRequest,
99+
RequestOptions? requestOptions,
100+
}) async {
101+
assert(
102+
compositionID.isNotEmpty,
103+
'Parameter `compositionID` is required when calling `searchForFacetValues`.',
104+
);
105+
assert(
106+
facetName.isNotEmpty,
107+
'Parameter `facetName` is required when calling `searchForFacetValues`.',
108+
);
109+
final request = ApiRequest(
110+
method: RequestMethod.post,
111+
path: r'/1/compositions/{compositionID}/facets/{facetName}/query'
112+
.replaceAll('{' r'compositionID' '}',
113+
Uri.encodeComponent(compositionID.toString()))
114+
.replaceAll(
115+
'{' r'facetName' '}', Uri.encodeComponent(facetName.toString())),
116+
isRead: true,
117+
body: searchForFacetValuesRequest?.toJson(),
118+
);
119+
final response = await _retryStrategy.execute(
120+
request: request,
121+
options: requestOptions,
122+
);
123+
return deserialize<SearchForFacetValuesResponse,
124+
SearchForFacetValuesResponse>(
125+
response,
126+
'SearchForFacetValuesResponse',
127+
growable: true,
128+
);
129+
}
130+
131+
@override
132+
void dispose() => _retryStrategy.dispose();
133+
}

0 commit comments

Comments
 (0)