diff --git a/clients/algoliasearch-client-dart/packages/client_abtesting_v3/build.yaml b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/build.yaml new file mode 100644 index 00000000000..153746466be --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/build.yaml @@ -0,0 +1,14 @@ +targets: + $default: + builders: + json_serializable: + options: + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: false + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false \ No newline at end of file diff --git a/clients/algoliasearch-client-dart/packages/client_abtesting_v3/example/example.dart b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/example/example.dart new file mode 100644 index 00000000000..4fa0a21c435 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/example/example.dart @@ -0,0 +1,17 @@ +import 'package:algolia_client_abtesting_v3/algolia_client_abtesting_v3.dart'; + +void main() async { + // Creating an instance of the Abtesting V3 client with the provided App ID and API key. + final abtesting = AbtestingV3Client( + appId: 'latency', + apiKey: '6be0576ff61c053d5f9a3225e2a90f76', + region: 'us', + ); + + await abtesting.getABTest( + id: 123, + ); + + // Close the client and dispose of all underlying resources. + abtesting.dispose(); +} diff --git a/clients/algoliasearch-client-dart/packages/client_abtesting_v3/lib/src/extension.dart b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/lib/src/extension.dart new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/lib/src/extension.dart @@ -0,0 +1 @@ + diff --git a/clients/algoliasearch-client-dart/packages/client_abtesting_v3/test/version_test.dart b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/test/version_test.dart new file mode 100644 index 00000000000..31facae4d18 --- /dev/null +++ b/clients/algoliasearch-client-dart/packages/client_abtesting_v3/test/version_test.dart @@ -0,0 +1,18 @@ +import 'dart:io'; + +import 'package:algolia_client_abtesting_v3/src/version.dart'; +import 'package:test/test.dart'; + +void main() { + if (Directory.current.path.endsWith('/test')) { + Directory.current = Directory.current.parent; + } + test('package version matches pubspec', () { + final pubspecPath = '${Directory.current.path}/pubspec.yaml'; + final pubspec = File(pubspecPath).readAsStringSync(); + final regex = RegExp('version:s*(.*)'); + final match = regex.firstMatch(pubspec); + expect(match, isNotNull); + expect(packageVersion, match?.group(1)?.trim()); + }); +} diff --git a/clients/algoliasearch-client-javascript/package.json b/clients/algoliasearch-client-javascript/package.json index aa4247b2863..1498ba40e05 100644 --- a/clients/algoliasearch-client-javascript/package.json +++ b/clients/algoliasearch-client-javascript/package.json @@ -7,7 +7,7 @@ "packages/*" ], "scripts": { - "build": "lerna run build --skip-nx-cache --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --scope '@algolia/client-composition' --scope '@algolia/composition' --scope '@algolia/advanced-personalization' --scope '@algolia/abtesting' --include-dependencies ", + "build": "lerna run build --skip-nx-cache --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --scope '@algolia/client-composition' --scope '@algolia/composition' --scope '@algolia/advanced-personalization' --include-dependencies ", "clean": "lerna run clean", "release:publish": "tsc --project scripts/tsconfig.json && node scripts/dist/publish.js", "test": "lerna run test $*", diff --git a/clients/algoliasearch-client-javascript/packages/abtesting/package.json b/clients/algoliasearch-client-javascript/packages/abtesting/package.json index 852bbc6146a..2cd35ccdb72 100644 --- a/clients/algoliasearch-client-javascript/packages/abtesting/package.json +++ b/clients/algoliasearch-client-javascript/packages/abtesting/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.1-alpha.6", + "version": "1.0.0", "repository": { "type": "git", "url": "git+https://github.com/algolia/algoliasearch-client-javascript.git" @@ -51,8 +51,8 @@ "dependencies": { "@algolia/client-common": "5.34.1", "@algolia/requester-browser-xhr": "5.34.1", - "@algolia/requester-fetch": "5.34.1", - "@algolia/requester-node-http": "5.34.1" + "@algolia/requester-node-http": "5.34.1", + "@algolia/requester-fetch": "5.34.1" }, "devDependencies": { "@arethetypeswrong/cli": "0.18.2", diff --git a/clients/algoliasearch-client-javascript/yarn.lock b/clients/algoliasearch-client-javascript/yarn.lock index accdf688d74..62805aec8b4 100644 --- a/clients/algoliasearch-client-javascript/yarn.lock +++ b/clients/algoliasearch-client-javascript/yarn.lock @@ -5,7 +5,7 @@ __metadata: version: 8 cacheKey: 10 -"@algolia/abtesting@workspace:packages/abtesting": +"@algolia/abtesting@npm:1.0.0, @algolia/abtesting@workspace:packages/abtesting": version: 0.0.0-use.local resolution: "@algolia/abtesting@workspace:packages/abtesting" dependencies: @@ -2523,6 +2523,7 @@ __metadata: version: 0.0.0-use.local resolution: "algoliasearch@workspace:packages/algoliasearch" dependencies: + "@algolia/abtesting": "npm:1.0.0" "@algolia/client-abtesting": "npm:5.34.1" "@algolia/client-analytics": "npm:5.34.1" "@algolia/client-common": "npm:5.34.1" diff --git a/config/clients.config.json b/config/clients.config.json index 8cf035f9776..105201d0242 100644 --- a/config/clients.config.json +++ b/config/clients.config.json @@ -3,6 +3,7 @@ "csharp": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -34,6 +35,10 @@ "name": "algoliasearch", "output": "clients/algoliasearch-client-dart/packages/algoliasearch" }, + { + "name": "abtesting-v3", + "output": "clients/algoliasearch-client-dart/packages/client_abtesting_v3" + }, { "name": "composition", "output": "clients/algoliasearch-client-dart/packages/client_composition" @@ -69,6 +74,7 @@ "go": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -97,6 +103,7 @@ "java": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -140,9 +147,7 @@ }, { "name": "abtesting-v3", - "output": "clients/algoliasearch-client-javascript/packages/abtesting", - "isStandaloneClient": true, - "clientName": "abtesting" + "output": "clients/algoliasearch-client-javascript/packages/abtesting" }, { "name": "analytics", @@ -211,6 +216,7 @@ "kotlin": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -239,6 +245,7 @@ "php": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -267,6 +274,7 @@ "python": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -302,6 +310,7 @@ "ruby": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -330,6 +339,7 @@ "scala": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", @@ -358,6 +368,7 @@ "swift": { "clients": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", diff --git a/config/clients.schema.json b/config/clients.schema.json index 801b6b1da58..9ee26837dde 100644 --- a/config/clients.schema.json +++ b/config/clients.schema.json @@ -12,6 +12,7 @@ "type": "string", "enum": [ "abtesting", + "abtesting-v3", "analytics", "composition", "ingestion", diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index 2465bf2343a..0911834c52a 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -30,7 +30,14 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { private static final List reservedModelNames = List.of( + "abtest", + "abtestconfiguration", + "abtestresponse", + "abtestsvariant", + "abtestsvariantsearchparams", "action", + "addabtestsrequest", + "addabtestsvariant", "advancedsyntaxfeatures", "alternativesasexact", "anchoring", @@ -58,11 +65,18 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "consequenceparams", "consequencequery", "consequencequeryobject", + "customsearchparams", "deletedatresponse", + "direction", "distinct", "edit", "edittype", + "effectmetric", + "emptysearchfilter", "errorbase", + "estimateabtestrequest", + "estimateabtestresponse", + "estimateconfiguration", "event", "eventstatus", "eventtype", @@ -72,6 +86,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "facetordering", "facets", "facetstats", + "filtereffects", "forbidden", "highlightresult", "highlightresultoption", @@ -79,13 +94,16 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "indexsettingsassearchparams", "insideboundingbox", "languages", + "listabtestsresponse", "loglevel", "matchedgeolocation", "matchlevel", + "minimumdetectableeffect", "mode", "numericfilters", "optionalfilters", "optionalwords", + "outliersfilter", "params", "personalization", "promote", @@ -104,6 +122,8 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "removewordsifnoresults", "renderingcontent", "rerankingapplyfilter", + "scheduleabtestresponse", + "scheduleabtestsrequest", "searchpagination", "searchparams", "searchparamsobject", @@ -122,6 +142,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "typotolerance", "typotoleranceenum", "value", + "variant", "watchresponse", "widgets" ); diff --git a/generators/src/main/java/com/algolia/codegen/cts/manager/DartCTSManager.java b/generators/src/main/java/com/algolia/codegen/cts/manager/DartCTSManager.java index 8f6cb7f39fe..1cad188a024 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/manager/DartCTSManager.java +++ b/generators/src/main/java/com/algolia/codegen/cts/manager/DartCTSManager.java @@ -40,8 +40,15 @@ public void addDataToBundle(Map bundle) throws GeneratorExceptio @Override public void addSnippetsSupportingFiles(List supportingFiles, String output) { supportingFiles.add(new SupportingFile("snippets/.gitignore.mustache", output + "/dart/.gitignore")); - supportingFiles.add(new SupportingFile("snippets/analysis_options.mustache", output + "/dart/analysis_options.yaml")); - supportingFiles.add(new SupportingFile("snippets/pubspec.mustache", output + "/dart/pubspec.yaml")); - supportingFiles.add(new SupportingFile("snippets/pubspec_overrides.mustache", output + "/dart/pubspec_overrides.yaml")); + supportingFiles.add(new SupportingFile("analysis_options.tests.mustache", output + "/dart/analysis_options.yaml")); + supportingFiles.add(new SupportingFile("pubspec.tests.mustache", output + "/dart/pubspec.yaml")); + supportingFiles.add(new SupportingFile("pubspec_overrides.tests.mustache", output + "/dart/pubspec_overrides.yaml")); + } + + @Override + public void addTestsSupportingFiles(List supportingFiles) { + supportingFiles.add(new SupportingFile("analysis_options.tests.mustache", "tests/output/dart/analysis_options.yaml")); + supportingFiles.add(new SupportingFile("pubspec.tests.mustache", "tests/output/dart/pubspec.yaml")); + supportingFiles.add(new SupportingFile("pubspec_overrides.tests.mustache", "tests/output/dart/pubspec_overrides.yaml")); } } diff --git a/generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java b/generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java index 59422e098ee..391826c26e3 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java @@ -93,6 +93,8 @@ private Map loadSnippets(Map operat public void run(Map models, Map operations, Map bundle) throws Exception { Map snippets = loadSnippets(operations); + bundle.put("isSnippet", true); + if (this.client.equals("search")) { bundle.put("isSearchClient", true); } diff --git a/playground/javascript/node/abtestingV3.ts b/playground/javascript/node/abtestingV3.ts index cd214db0dad..e7176d4f1c2 100644 --- a/playground/javascript/node/abtestingV3.ts +++ b/playground/javascript/node/abtestingV3.ts @@ -1,11 +1,11 @@ -import { abtestingClient } from '@algolia/abtesting'; +import { abtestingV3Client } from '@algolia/abtesting'; import { ApiError } from '@algolia/client-common'; const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****'; const apiKey = process.env.ALGOLIA_ANALYTICS_KEY || '**** ANALYTICS_API_KEY *****'; // Init client with appId and apiKey -const client = abtestingClient(appId, apiKey, 'de'); +const client = abtestingV3Client(appId, apiKey, 'de'); async function testABTesting() { try { diff --git a/specs/abtesting-v3/common/schemas/Timeseries.yml b/specs/abtesting-v3/common/schemas/Timeseries.yml index 7707c40d6af..4dbcc151942 100644 --- a/specs/abtesting-v3/common/schemas/Timeseries.yml +++ b/specs/abtesting-v3/common/schemas/Timeseries.yml @@ -37,7 +37,6 @@ metricDate: date: type: string description: Date where the metric was updated, in RFC 3339 format. - format: date example: 2025-06-15 metrics: $ref: 'Variant.yml#/metrics' diff --git a/templates/dart/snippets/analysis_options.mustache b/templates/dart/analysis_options.tests.mustache similarity index 100% rename from templates/dart/snippets/analysis_options.mustache rename to templates/dart/analysis_options.tests.mustache diff --git a/templates/dart/snippets/pubspec.mustache b/templates/dart/pubspec.tests.mustache similarity index 58% rename from templates/dart/snippets/pubspec.mustache rename to templates/dart/pubspec.tests.mustache index aad4fad2003..419fb3820e5 100644 --- a/templates/dart/snippets/pubspec.mustache +++ b/templates/dart/pubspec.tests.mustache @@ -1,17 +1,23 @@ -name: algolia_snippets +name: algolia_{{#isSnippet}}snippets{{/isSnippet}}{{^isSnippet}}test{{/isSnippet}} version: 1.0.0 environment: sdk: ^3.0.0 dependencies: - algoliasearch: ^1.0.0 - algolia_client_search: ^1.0.0 + algolia_client_abtesting_v3: ^1.0.0 + algolia_client_composition: ^1.0.0 algolia_client_insights: ^1.0.0 algolia_client_recommend: ^1.0.0 - algolia_client_composition: ^1.0.0 + algolia_client_search: ^1.0.0 + algoliasearch: ^1.0.0 + collection: ^1.17.2 dotenv: ^4.1.0 http: ^1.2.2 + test: ^1.25.8 + test_api: ^0.7.3 + + algolia_client_core: any dev_dependencies: lints: ^6.0.0 \ No newline at end of file diff --git a/templates/dart/snippets/pubspec_overrides.mustache b/templates/dart/pubspec_overrides.tests.mustache similarity index 82% rename from templates/dart/snippets/pubspec_overrides.mustache rename to templates/dart/pubspec_overrides.tests.mustache index cd0eba1efa4..5b2a15fb576 100644 --- a/templates/dart/snippets/pubspec_overrides.mustache +++ b/templates/dart/pubspec_overrides.tests.mustache @@ -10,4 +10,6 @@ dependency_overrides: algolia_client_recommend: path: ../../../clients/algoliasearch-client-dart/packages/client_recommend algolia_client_composition: - path: ../../../clients/algoliasearch-client-dart/packages/client_composition \ No newline at end of file + path: ../../../clients/algoliasearch-client-dart/packages/client_composition + algolia_client_abtesting_v3: + path: ../../../clients/algoliasearch-client-dart/packages/client_abtesting_v3 \ No newline at end of file diff --git a/templates/javascript/clients/algoliasearch/builds/models.mustache b/templates/javascript/clients/algoliasearch/builds/models.mustache index 9a5479a41ff..b8027eda8c4 100644 --- a/templates/javascript/clients/algoliasearch/builds/models.mustache +++ b/templates/javascript/clients/algoliasearch/builds/models.mustache @@ -10,7 +10,9 @@ import type { } from '{{{dependencyPackage}}}'; {{/dependencies}} +import type { Direction } from '@algolia/client-analytics'; import type { ClientOptions } from '@algolia/client-common'; +import type { EventType } from '@algolia/client-personalization'; import type { Action, AdvancedSyntaxFeatures, @@ -107,17 +109,35 @@ import type { Widgets, } from '@algolia/client-search'; import { apiClientVersion } from '@algolia/client-search'; +import type { Event, EventStatus, WatchResponse } from '@algolia/ingestion'; + import type { + ABTest, + ABTestConfiguration, + ABTestResponse, + AbTestsVariant, + AbTestsVariantSearchParams, + AddABTestsRequest, + AddABTestsVariant, + CustomSearchParams, + DeleteABTestProps, + EffectMetric, + EmptySearchFilter, + EstimateABTestRequest, + EstimateABTestResponse, + EstimateConfiguration, + FilterEffects, + GetABTestProps, + ListABTestsProps, + ListABTestsResponse, + MinimumDetectableEffect, + OutliersFilter, + ScheduleABTestResponse, + ScheduleABTestsRequest, Status, + StopABTestProps, + Variant, } from '@algolia/client-abtesting'; -import type { - EventType, -} from '@algolia/client-personalization'; -import type { - Event, - EventStatus, - WatchResponse, -} from '@algolia/ingestion'; {{#dependencies}} export * from '{{{dependencyPackage}}}'; @@ -139,7 +159,14 @@ export type { }; export type { + ABTest, + ABTestConfiguration, + ABTestResponse, + AbTestsVariant, + AbTestsVariantSearchParams, Action, + AddABTestsRequest, + AddABTestsVariant, AdvancedSyntaxFeatures, AlternativesAsExact, Anchoring, @@ -167,12 +194,20 @@ export type { CustomGetProps, CustomPostProps, CustomPutProps, + CustomSearchParams, + DeleteABTestProps, DeleteSourceProps, DeletedAtResponse, + Direction, Distinct, Edit, EditType, + EffectMetric, + EmptySearchFilter, ErrorBase, + EstimateABTestRequest, + EstimateABTestResponse, + EstimateConfiguration, Event, EventStatus, ExactOnSingleWordQuery, @@ -182,6 +217,8 @@ export type { FacetOrdering, FacetStats, Facets, + FilterEffects, + GetABTestProps, GetTaskProps, HighlightResult, HighlightResultOption, @@ -190,12 +227,16 @@ export type { IndexSettingsAsSearchParams, InsideBoundingBox, Languages, + ListABTestsProps, + ListABTestsResponse, MatchLevel, MatchedGeoLocation, + MinimumDetectableEffect, Mode, NumericFilters, OptionalFilters, OptionalWords, + OutliersFilter, Params, Personalization, Promote, @@ -212,6 +253,8 @@ export type { RemoveStopWords, RemoveWordsIfNoResults, RenderingContent, + ScheduleABTestResponse, + ScheduleABTestsRequest, SearchForFacetValuesProps, SearchForFacetValuesRequest, SearchForFacetValuesResponse, @@ -226,6 +269,7 @@ export type { SnippetResultOption, SortRemainingBy, Source, + StopABTestProps, SupportedLanguage, TagFilters, TaskStatus, @@ -233,6 +277,7 @@ export type { TypoTolerance, TypoToleranceEnum, Value, + Variant, WatchResponse, Widgets, }; diff --git a/tests/CTS/requests/abtesting-v3/listABTests.json b/tests/CTS/requests/abtesting-v3/listABTests.json index ff27cfeb87b..3ed8d8a745f 100644 --- a/tests/CTS/requests/abtesting-v3/listABTests.json +++ b/tests/CTS/requests/abtesting-v3/listABTests.json @@ -13,7 +13,8 @@ "offset": 0, "limit": 21, "indexPrefix": "cts_e2e ab", - "indexSuffix": "t" + "indexSuffix": "t", + "direction": "asc" }, "request": { "path": "/3/abtests", @@ -22,7 +23,8 @@ "offset": "0", "limit": "21", "indexPrefix": "cts_e2e%20ab", - "indexSuffix": "t" + "indexSuffix": "t", + "direction": "asc" } } } diff --git a/tests/output/dart/pubspec.yaml b/tests/output/dart/pubspec.yaml index 972e10921e7..910e241de52 100644 --- a/tests/output/dart/pubspec.yaml +++ b/tests/output/dart/pubspec.yaml @@ -5,15 +5,19 @@ environment: sdk: ^3.0.0 dependencies: - algoliasearch: ^1.0.0 - algolia_client_search: ^1.0.0 + algolia_client_abtesting_v3: ^1.0.0 + algolia_client_composition: ^1.0.0 algolia_client_insights: ^1.0.0 algolia_client_recommend: ^1.0.0 - algolia_client_composition: ^1.0.0 - test: ^1.25.8 + algolia_client_search: ^1.0.0 + algoliasearch: ^1.0.0 collection: ^1.17.2 + dotenv: ^4.1.0 + http: ^1.2.2 + test: ^1.25.8 test_api: ^0.7.3 algolia_client_core: any + dev_dependencies: - lints: ^6.0.0 + lints: ^6.0.0 \ No newline at end of file diff --git a/tests/output/dart/pubspec_overrides.yaml b/tests/output/dart/pubspec_overrides.yaml index 8d82f4fd7a0..5b2a15fb576 100644 --- a/tests/output/dart/pubspec_overrides.yaml +++ b/tests/output/dart/pubspec_overrides.yaml @@ -11,3 +11,5 @@ dependency_overrides: path: ../../../clients/algoliasearch-client-dart/packages/client_recommend algolia_client_composition: path: ../../../clients/algoliasearch-client-dart/packages/client_composition + algolia_client_abtesting_v3: + path: ../../../clients/algoliasearch-client-dart/packages/client_abtesting_v3 \ No newline at end of file diff --git a/website/docs/testing/common-test-suite.md b/website/docs/testing/common-test-suite.md index 28e8e9b0d7a..3eee346be8e 100644 --- a/website/docs/testing/common-test-suite.md +++ b/website/docs/testing/common-test-suite.md @@ -42,10 +42,6 @@ The list of `queryParameters` must match exactly the actual value, the CTS has t "type": "string", "description": "The name of the test, defaults to the name of the `operation` (file name). The testName is also used for the documentation snippets as a key to access it inside the snippet JSON object: with a testName equal to `foo` on the `operationIndex` of the `search` client, you can access it from the `search.operationIndex.foo` key." }, - "isSnippet": { - "type": "boolean", - "description": "Whether this test case should also be a documentation code snippet." - }, "parameters": { "type": "object", "description": "A free form object that must correspond to the parameters that the method expects."