Skip to content

Commit 276da13

Browse files
committed
fix dart
1 parent 2214b11 commit 276da13

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

clients/algoliasearch-client-php/lib/FormDataProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
*/
1313

1414
/**
15-
* Search API.
15+
* Composition API.
1616
*
17-
* The Algolia Search API lets you search, configure, and manage your indices and records. ## Client libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. The official API clients are covered by Algolia's [Service Level Agreement](https://www.algolia.com/policies/sla/). See: [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## Base URLs The base URLs for requests to the Search API are: - `https://{APPLICATION_ID}.algolia.net` - `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## Retry strategy To guarantee high availability, implement a retry strategy for all API requests using the URLs of your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed as query parameters for GET and DELETE requests, and in the request body for POST and PUT requests. Query parameters must be [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. Arrays as query parameters must be one of: - A comma-separated string: `attributesToRetrieve=title,description` - A URL-encoded JSON array: `attributesToRetrieve=%5B%22title%22,%22description%22%D` ## Response status and errors The Search API returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current version of the Search API is version 1, as indicated by the `/1/` in each endpoint's URL.
17+
* The Algolia Composition API lets you run composed search requests on your Compositions. ## Client libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. See: [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## Base URLs The base URLs for requests to the Composition API are: - `https://{APPLICATION_ID}.algolia.net` - `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## Retry strategy To guarantee high availability, implement a retry strategy for all API requests using the URLs of your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed in the request body for POST and PUT requests. Query parameters must be [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. ## Response status and errors The Composition API returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current version of the Composition API is version 1, as indicated by the `/1/` in each endpoint's URL.
1818
*
1919
* The version of the OpenAPI document: 1.0.0
2020
* Generated by: https://openapi-generator.tech
@@ -29,7 +29,7 @@
2929

3030
namespace Algolia\AlgoliaSearch;
3131

32-
use Algolia\AlgoliaSearch\Model\Search\ModelInterface;
32+
use Algolia\AlgoliaSearch\Model\Composition\ModelInterface;
3333
use DateTime;
3434
use GuzzleHttp\Psr7\Utils;
3535
use Psr\Http\Message\StreamInterface;

generators/src/main/java/com/algolia/codegen/AlgoliaDartGenerator.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import static org.apache.commons.lang3.StringUtils.*;
44

55
import com.algolia.codegen.utils.*;
6-
import com.google.common.collect.ImmutableMap;
7-
import com.samskivert.mustache.Mustache;
86
import io.swagger.v3.oas.models.OpenAPI;
97
import io.swagger.v3.oas.models.Operation;
108
import io.swagger.v3.oas.models.servers.Server;
@@ -112,11 +110,6 @@ public void processOpts() {
112110
additionalProperties.put("packageVersion", version);
113111
}
114112

115-
@Override
116-
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
117-
return super.addMustacheLambdas();
118-
}
119-
120113
@Override
121114
public void processOpenAPI(OpenAPI openAPI) {
122115
super.processOpenAPI(openAPI);
@@ -153,6 +146,15 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
153146
public String toModelFilename(String name) {
154147
return support.classnames().contains(name) ? null : super.toModelFilename(name);
155148
}
149+
150+
@Override
151+
public String toModelName(String name) {
152+
if (name.equals("external")) {
153+
return "External";
154+
}
155+
156+
return super.toModelName(name);
157+
}
156158
}
157159

158160
class SchemaSupport {

generators/src/main/java/com/algolia/codegen/cts/manager/DartCTSManager.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.algolia.codegen.exceptions.GeneratorException;
44
import com.algolia.codegen.utils.*;
5+
import com.samskivert.mustache.Mustache.Lambda;
56
import java.util.List;
67
import java.util.Map;
78
import org.apache.commons.lang3.StringUtils;
@@ -51,4 +52,16 @@ public void addTestsSupportingFiles(List<SupportingFile> supportingFiles) {
5152
supportingFiles.add(new SupportingFile("pubspec.tests.mustache", "tests/output/dart/pubspec.yaml"));
5253
supportingFiles.add(new SupportingFile("pubspec_overrides.tests.mustache", "tests/output/dart/pubspec_overrides.yaml"));
5354
}
55+
56+
@Override
57+
public void addMustacheLambdas(Map<String, Lambda> lambdas) {
58+
lambdas.put("identifier", (fragment, writer) -> {
59+
String text = fragment.execute();
60+
if (text.equals("external")) {
61+
writer.write("external_");
62+
} else {
63+
writer.write(text);
64+
}
65+
});
66+
}
5467
}

templates/dart/tests/request_param.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{^isAdditionalProperty}}
2-
{{#lambda.camelcase}}{{{key}}}{{/lambda.camelcase}} : {{> tests/param_value}},
2+
{{#lambda.identifier}}{{{key}}}{{/lambda.identifier}} : {{> tests/param_value}},
33
{{/isAdditionalProperty}}
44
{{#isAdditionalProperty}}
55
additionalProperties : { '{{{key}}}' : '{{{value}}}' },

tests/CTS/requests/composition/multipleBatch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
{
3737
"action": "upsert",
3838
"body": {
39+
"objectID": "foo",
40+
"name": "my first composition",
3941
"behavior": {
4042
"injection": {
4143
"main": {
@@ -46,9 +48,7 @@
4648
}
4749
}
4850
}
49-
},
50-
"name": "my first composition",
51-
"objectID": "foo"
51+
}
5252
}
5353
},
5454
{

0 commit comments

Comments
 (0)