From 914e27b237ca14c8db245824cffbe32700bb89d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 11 Jan 2022 14:05:05 +0100 Subject: [PATCH 1/6] feat(js): avoid wrapping `bodyParams` --- .../client-abtesting/model/models.ts | 1 - .../model/stopABTestRequest.ts | 6 - .../client-abtesting/src/abtestingApi.ts | 43 ++-- .../client-insights/src/insightsApi.ts | 12 +- .../src/personalizationApi.ts | 17 +- .../client-search/src/searchApi.ts | 197 ++++++------------ .../recommend/src/recommendApi.ts | 16 +- specs/abtesting/paths/stopAbTest.yml | 15 +- templates/javascript/api-single.mustache | 90 +++++++- tests/CTS/clients/abtesting/addABTests.json | 32 ++- tests/CTS/clients/abtesting/listABTests.json | 2 +- tests/CTS/clients/abtesting/stopABTest.json | 4 +- tests/CTS/clients/insights/pushEvents.json | 60 +++--- .../setPersonalizationStrategy.json | 30 ++- .../clients/recommend/getRecommendations.json | 156 +++++++------- tests/CTS/clients/search/addApiKey.json | 12 +- .../clients/search/setDictionarySettings.json | 36 ++-- tests/output/javascript/abtesting.test.ts | 24 +-- tests/output/javascript/insights.test.ts | 60 +++--- .../output/javascript/personalization.test.ts | 8 +- tests/output/javascript/recommend.test.ts | 135 ++++++------ tests/output/javascript/search.test.ts | 26 +-- 22 files changed, 434 insertions(+), 548 deletions(-) delete mode 100644 clients/algoliasearch-client-javascript/client-abtesting/model/stopABTestRequest.ts diff --git a/clients/algoliasearch-client-javascript/client-abtesting/model/models.ts b/clients/algoliasearch-client-javascript/client-abtesting/model/models.ts index 40621830bfa..8f9b5260724 100644 --- a/clients/algoliasearch-client-javascript/client-abtesting/model/models.ts +++ b/clients/algoliasearch-client-javascript/client-abtesting/model/models.ts @@ -10,7 +10,6 @@ export * from './errorBase'; export * from './listABTestsResponse'; export * from './searchParamABTestsVariant'; export * from './searchParamABTestsVariantAllOf'; -export * from './stopABTestRequest'; export * from './variant'; export interface Authentication { diff --git a/clients/algoliasearch-client-javascript/client-abtesting/model/stopABTestRequest.ts b/clients/algoliasearch-client-javascript/client-abtesting/model/stopABTestRequest.ts deleted file mode 100644 index 2c9889ee953..00000000000 --- a/clients/algoliasearch-client-javascript/client-abtesting/model/stopABTestRequest.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type StopABTestRequest = { - /** - * The A/B test ID. - */ - id: number; -}; diff --git a/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts b/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts index 87f79c4c05d..418002de214 100644 --- a/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts +++ b/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts @@ -3,7 +3,6 @@ import type { AddABTestsRequest } from '../model/addABTestsRequest'; import type { AddABTestsResponse } from '../model/addABTestsResponse'; import type { ListABTestsResponse } from '../model/listABTestsResponse'; import { ApiKeyAuth } from '../model/models'; -import type { StopABTestRequest } from '../model/stopABTestRequest'; import { Transporter } from '../utils/Transporter'; import type { Requester } from '../utils/requester/Requester'; import type { Headers, Host, Request, RequestOptions } from '../utils/types'; @@ -86,12 +85,11 @@ export class AbtestingApi { * Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants. * * @summary Creates a new A/B test with provided configuration. - * @param addABTests - The addABTests parameters. - * @param addABTests.addABTestsRequest - The addABTestsRequest. + * @param addABTestsRequest - The addABTestsRequest parameter. */ - addABTests({ - addABTestsRequest, - }: AddABTestsProps): Promise { + addABTests( + addABTestsRequest: AddABTestsRequest + ): Promise { const path = '/2/abtests'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -247,31 +245,25 @@ export class AbtestingApi { * * @summary Marks the A/B test as stopped. * @param stopABTest - The stopABTest parameters. - * @param stopABTest.stopABTestRequest - The stopABTestRequest. + * @param stopABTest.id - The A/B test ID. */ - stopABTest({ - stopABTestRequest, - }: StopABTestProps): Promise> { - const path = '/2/abtests/{id}/stop'; + stopABTest({ id }: StopABTestProps): Promise> { + const path = '/2/abtests/{id}/stop'.replace( + '{id}', + encodeURIComponent(String(id)) + ); const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; - if (stopABTestRequest === null || stopABTestRequest === undefined) { - throw new Error( - 'Required parameter stopABTestRequest was null or undefined when calling stopABTest.' - ); - } - - if (stopABTestRequest.id === null || stopABTestRequest.id === undefined) { + if (id === null || id === undefined) { throw new Error( - 'Required parameter stopABTestRequest.id was null or undefined when calling stopABTest.' + 'Required parameter id was null or undefined when calling stopABTest.' ); } const request: Request = { method: 'POST', path, - data: stopABTestRequest, }; const requestOptions: RequestOptions = { @@ -283,13 +275,6 @@ export class AbtestingApi { } } -export type AddABTestsProps = { - /** - * The addABTestsRequest. - */ - addABTestsRequest: AddABTestsRequest; -}; - export type DeleteABTestProps = { /** * The A/B test ID. @@ -317,7 +302,7 @@ export type ListABTestsProps = { export type StopABTestProps = { /** - * The stopABTestRequest. + * The A/B test ID. */ - stopABTestRequest: StopABTestRequest; + id: number; }; diff --git a/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts b/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts index 293a03f58f6..6b88d914622 100644 --- a/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts +++ b/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts @@ -78,10 +78,9 @@ export class InsightsApi { * This command pushes an array of events. * * @summary Pushes an array of events. - * @param pushEvents - The pushEvents parameters. - * @param pushEvents.insightEvents - The insightEvents. + * @param insightEvents - The insightEvents parameter. */ - pushEvents({ insightEvents }: PushEventsProps): Promise { + pushEvents(insightEvents: InsightEvents): Promise { const path = '/1/events'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -112,10 +111,3 @@ export class InsightsApi { return this.sendRequest(request, requestOptions); } } - -export type PushEventsProps = { - /** - * The insightEvents. - */ - insightEvents: InsightEvents; -}; diff --git a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts index b8658c86551..ab211aba0bd 100644 --- a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts +++ b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts @@ -120,7 +120,6 @@ export class PersonalizationApi { * The strategy contains information on the events and facets that impact user profiles and personalized search results. * * @summary Get the current personalization strategy. - * @param getPersonalizationStrategy - The getPersonalizationStrategy parameters. */ getPersonalizationStrategy(): Promise { const path = '/1/strategies/personalization'; @@ -178,12 +177,11 @@ export class PersonalizationApi { * A strategy defines the events and facets that impact user profiles and personalized search results. * * @summary Set a new personalization strategy. - * @param setPersonalizationStrategy - The setPersonalizationStrategy parameters. - * @param setPersonalizationStrategy.personalizationStrategyObject - The personalizationStrategyObject. + * @param personalizationStrategyObject - The personalizationStrategyObject parameter. */ - setPersonalizationStrategy({ - personalizationStrategyObject, - }: SetPersonalizationStrategyProps): Promise { + setPersonalizationStrategy( + personalizationStrategyObject: PersonalizationStrategyObject + ): Promise { const path = '/1/strategies/personalization'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -250,10 +248,3 @@ export type GetUserTokenProfileProps = { */ userToken: string; }; - -export type SetPersonalizationStrategyProps = { - /** - * The personalizationStrategyObject. - */ - personalizationStrategyObject: PersonalizationStrategyObject; -}; diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index ec1fe7b74e9..6e0b52c32ec 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -153,10 +153,9 @@ export class SearchApi { * Add a new API Key with specific permissions/restrictions. * * @summary Create a new API key. - * @param addApiKey - The addApiKey parameters. - * @param addApiKey.apiKey - The apiKey. + * @param apiKey - The apiKey parameter. */ - addApiKey({ apiKey }: AddApiKeyProps): Promise { + addApiKey(apiKey: ApiKey): Promise { const path = '/1/keys'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -240,10 +239,9 @@ export class SearchApi { /** * Add a single source to the list of allowed sources. * - * @param appendSource - The appendSource parameters. - * @param appendSource.source - The source to add. + * @param source - The source to add. */ - appendSource({ source }: AppendSourceProps): Promise { + appendSource(source: Source): Promise { const path = '/1/security/sources/append'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -273,7 +271,7 @@ export class SearchApi { * @summary Assign or Move userID. * @param assignUserId - The assignUserId parameters. * @param assignUserId.xAlgoliaUserID - UserID to assign. - * @param assignUserId.assignUserIdObject - The assignUserIdObject. + * @param assignUserId.assignUserIdObject - The assignUserIdObject parameter. */ assignUserId({ xAlgoliaUserID, @@ -326,7 +324,7 @@ export class SearchApi { * * @param batch - The batch parameters. * @param batch.indexName - The index in which to perform the request. - * @param batch.batchWriteObject - The batchWriteObject. + * @param batch.batchWriteObject - The batchWriteObject parameter. */ batch({ indexName, batchWriteObject }: BatchProps): Promise { const path = '/1/indexes/{indexName}/batch'.replace( @@ -367,7 +365,7 @@ export class SearchApi { * @summary Batch assign userIDs. * @param batchAssignUserIds - The batchAssignUserIds parameters. * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. - * @param batchAssignUserIds.batchAssignUserIdsObject - The batchAssignUserIdsObject. + * @param batchAssignUserIds.batchAssignUserIdsObject - The batchAssignUserIdsObject parameter. */ batchAssignUserIds({ xAlgoliaUserID, @@ -432,7 +430,7 @@ export class SearchApi { * @summary Send a batch of dictionary entries. * @param batchDictionaryEntries - The batchDictionaryEntries parameters. * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param batchDictionaryEntries.batchDictionaryEntries - The batchDictionaryEntries. + * @param batchDictionaryEntries.batchDictionaryEntries - The batchDictionaryEntries parameter. */ batchDictionaryEntries({ dictionaryName, @@ -488,7 +486,7 @@ export class SearchApi { * @summary Batch Rules. * @param batchRules - The batchRules parameters. * @param batchRules.indexName - The index in which to perform the request. - * @param batchRules.rule - The rule. + * @param batchRules.rule - The rule parameter. * @param batchRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param batchRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. */ @@ -544,7 +542,7 @@ export class SearchApi { * @summary Retrieve all index content. * @param browse - The browse parameters. * @param browse.indexName - The index in which to perform the request. - * @param browse.browseRequest - The browseRequest. + * @param browse.browseRequest - The browseRequest parameter. */ browse({ indexName, browseRequest }: BrowseProps): Promise { const path = '/1/indexes/{indexName}/browse'.replace( @@ -727,7 +725,7 @@ export class SearchApi { * @summary Delete all records matching the query. * @param deleteBy - The deleteBy parameters. * @param deleteBy.indexName - The index in which to perform the request. - * @param deleteBy.searchParams - The searchParams. + * @param deleteBy.searchParams - The searchParams parameter. */ deleteBy({ indexName, @@ -1005,7 +1003,6 @@ export class SearchApi { * List dictionaries supported per language. * * @summary List dictionaries supported per language. - * @param getDictionaryLanguages - The getDictionaryLanguages parameters. */ getDictionaryLanguages(): Promise<{ [key: string]: Languages }> { const path = '/1/dictionaries/*/languages'; @@ -1028,7 +1025,6 @@ export class SearchApi { * Retrieve dictionaries settings. * * @summary Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. - * @param getDictionarySettings - The getDictionarySettings parameters. */ getDictionarySettings(): Promise { const path = '/1/dictionaries/*/settings'; @@ -1101,7 +1097,7 @@ export class SearchApi { * @param getObject - The getObject parameters. * @param getObject.indexName - The index in which to perform the request. * @param getObject.objectID - Unique identifier of an object. - * @param getObject.attributesToRetrieve - The attributesToRetrieve. + * @param getObject.attributesToRetrieve - The attributesToRetrieve parameter. */ getObject({ indexName, @@ -1146,12 +1142,9 @@ export class SearchApi { * Retrieve one or more objects, potentially from different indices, in a single API call. * * @summary Retrieve one or more objects. - * @param getObjects - The getObjects parameters. - * @param getObjects.getObjectsObject - The getObjectsObject. + * @param getObjectsObject - The getObjectsObject parameter. */ - getObjects({ - getObjectsObject, - }: GetObjectsProps): Promise { + getObjects(getObjectsObject: GetObjectsObject): Promise { const path = '/1/indexes/*/objects'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1248,8 +1241,6 @@ export class SearchApi { } /** * List all allowed sources. - * - * @param getSources - The getSources parameters. */ getSources(): Promise { const path = '/1/security/sources'; @@ -1349,7 +1340,6 @@ export class SearchApi { * Get the top 10 userIDs with the highest number of records per cluster. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following array of userIDs and clusters. * * @summary Get top userID. - * @param getTopUserIds - The getTopUserIds parameters. */ getTopUserIds(): Promise { const path = '/1/clusters/mapping/top'; @@ -1406,7 +1396,7 @@ export class SearchApi { * * @summary Has pending mappings. * @param hasPendingMappings - The hasPendingMappings parameters. - * @param hasPendingMappings.getClusters - The getClusters. + * @param hasPendingMappings.getClusters - The getClusters parameter. */ hasPendingMappings({ getClusters, @@ -1435,7 +1425,6 @@ export class SearchApi { * List API keys, along with their associated rights. * * @summary Get the full list of API Keys. - * @param listApiKeys - The listApiKeys parameters. */ listApiKeys(): Promise { const path = '/1/keys'; @@ -1458,7 +1447,6 @@ export class SearchApi { * List the clusters available in a multi-clusters setup for a single appID. Upon success, the response is 200 OK and contains the following clusters. * * @summary List clusters. - * @param listClusters - The listClusters parameters. */ listClusters(): Promise { const path = '/1/clusters'; @@ -1544,12 +1532,9 @@ export class SearchApi { /** * Perform multiple write operations, potentially targeting multiple indices, in a single API call. * - * @param multipleBatch - The multipleBatch parameters. - * @param multipleBatch.batchObject - The batchObject. + * @param batchObject - The batchObject parameter. */ - multipleBatch({ - batchObject, - }: MultipleBatchProps): Promise { + multipleBatch(batchObject: BatchObject): Promise { const path = '/1/indexes/*/batch'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1576,12 +1561,11 @@ export class SearchApi { /** * Get search results for the given requests. * - * @param multipleQueries - The multipleQueries parameters. - * @param multipleQueries.multipleQueriesObject - The multipleQueriesObject. + * @param multipleQueriesObject - The multipleQueriesObject parameter. */ - multipleQueries({ - multipleQueriesObject, - }: MultipleQueriesProps): Promise { + multipleQueries( + multipleQueriesObject: MultipleQueriesObject + ): Promise { const path = '/1/indexes/*/queries'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1620,7 +1604,7 @@ export class SearchApi { * @summary Copy/move index. * @param operationIndex - The operationIndex parameters. * @param operationIndex.indexName - The index in which to perform the request. - * @param operationIndex.operationIndexObject - The operationIndexObject. + * @param operationIndex.operationIndexObject - The operationIndexObject parameter. */ operationIndex({ indexName, @@ -1771,12 +1755,9 @@ export class SearchApi { /** * Replace all allowed sources. * - * @param replaceSources - The replaceSources parameters. - * @param replaceSources.source - The sources to allow. + * @param source - The sources to allow. */ - replaceSources({ - source, - }: ReplaceSourcesProps): Promise { + replaceSources(source: Source[]): Promise { const path = '/1/security/sources'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -1883,7 +1864,7 @@ export class SearchApi { * @param saveRule - The saveRule parameters. * @param saveRule.indexName - The index in which to perform the request. * @param saveRule.objectID - Unique identifier of an object. - * @param saveRule.rule - The rule. + * @param saveRule.rule - The rule parameter. * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ saveRule({ @@ -1951,7 +1932,7 @@ export class SearchApi { * @param saveSynonym - The saveSynonym parameters. * @param saveSynonym.indexName - The index in which to perform the request. * @param saveSynonym.objectID - Unique identifier of an object. - * @param saveSynonym.synonymHit - The synonymHit. + * @param saveSynonym.synonymHit - The synonymHit parameter. * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ saveSynonym({ @@ -2018,7 +1999,7 @@ export class SearchApi { * @summary Save a batch of synonyms. * @param saveSynonyms - The saveSynonyms parameters. * @param saveSynonyms.indexName - The index in which to perform the request. - * @param saveSynonyms.synonymHit - The synonymHit. + * @param saveSynonyms.synonymHit - The synonymHit parameter. * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. */ @@ -2074,7 +2055,7 @@ export class SearchApi { * * @param search - The search parameters. * @param search.indexName - The index in which to perform the request. - * @param search.searchParams - The searchParams. + * @param search.searchParams - The searchParams parameter. */ search({ indexName, searchParams }: SearchProps): Promise { const path = '/1/indexes/{indexName}/query'.replace( @@ -2115,7 +2096,7 @@ export class SearchApi { * @summary Search the dictionary entries. * @param searchDictionaryEntries - The searchDictionaryEntries parameters. * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param searchDictionaryEntries.searchDictionaryEntries - The searchDictionaryEntries. + * @param searchDictionaryEntries.searchDictionaryEntries - The searchDictionaryEntries parameter. */ searchDictionaryEntries({ dictionaryName, @@ -2172,7 +2153,7 @@ export class SearchApi { * @param searchForFacetValues - The searchForFacetValues parameters. * @param searchForFacetValues.indexName - The index in which to perform the request. * @param searchForFacetValues.facetName - The facet name. - * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest. + * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest parameter. */ searchForFacetValues({ indexName, @@ -2216,7 +2197,7 @@ export class SearchApi { * @summary Search for rules. * @param searchRules - The searchRules parameters. * @param searchRules.indexName - The index in which to perform the request. - * @param searchRules.searchRulesParams - The searchRulesParams. + * @param searchRules.searchRulesParams - The searchRulesParams parameter. */ searchRules({ indexName, @@ -2317,12 +2298,11 @@ export class SearchApi { * Search for userIDs. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds propagate to the different clusters. To keep updates moving quickly, the index of userIDs isn\'t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h. Upon success, the response is 200 OK and contains the following userIDs data. * * @summary Search userID. - * @param searchUserIds - The searchUserIds parameters. - * @param searchUserIds.searchUserIdsObject - The searchUserIdsObject. + * @param searchUserIdsObject - The searchUserIdsObject parameter. */ - searchUserIds({ - searchUserIdsObject, - }: SearchUserIdsProps): Promise { + searchUserIds( + searchUserIdsObject: SearchUserIdsObject + ): Promise { const path = '/1/clusters/mapping/search'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -2359,12 +2339,11 @@ export class SearchApi { * Set dictionary settings. * * @summary Set dictionary settings. - * @param setDictionarySettings - The setDictionarySettings parameters. - * @param setDictionarySettings.dictionarySettingsRequest - The dictionarySettingsRequest. + * @param dictionarySettingsRequest - The dictionarySettingsRequest parameter. */ - setDictionarySettings({ - dictionarySettingsRequest, - }: SetDictionarySettingsProps): Promise { + setDictionarySettings( + dictionarySettingsRequest: DictionarySettingsRequest + ): Promise { const path = '/1/dictionaries/*/settings'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -2405,7 +2384,7 @@ export class SearchApi { * * @param setSettings - The setSettings parameters. * @param setSettings.indexName - The index in which to perform the request. - * @param setSettings.indexSettings - The indexSettings. + * @param setSettings.indexSettings - The indexSettings parameter. * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ setSettings({ @@ -2455,7 +2434,7 @@ export class SearchApi { * @summary Update an API key. * @param updateApiKey - The updateApiKey parameters. * @param updateApiKey.key - API Key string. - * @param updateApiKey.apiKey - The apiKey. + * @param updateApiKey.apiKey - The apiKey parameter. */ updateApiKey({ key, @@ -2501,13 +2480,6 @@ export class SearchApi { } } -export type AddApiKeyProps = { - /** - * The apiKey. - */ - apiKey: ApiKey; -}; - export type AddOrUpdateObjectProps = { /** * The index in which to perform the request. @@ -2523,20 +2495,13 @@ export type AddOrUpdateObjectProps = { body: Record; }; -export type AppendSourceProps = { - /** - * The source to add. - */ - source: Source; -}; - export type AssignUserIdProps = { /** * UserID to assign. */ xAlgoliaUserID: string; /** - * The assignUserIdObject. + * The assignUserIdObject parameter. */ assignUserIdObject: AssignUserIdObject; }; @@ -2547,7 +2512,7 @@ export type BatchProps = { */ indexName: string; /** - * The batchWriteObject. + * The batchWriteObject parameter. */ batchWriteObject: BatchWriteObject; }; @@ -2558,7 +2523,7 @@ export type BatchAssignUserIdsProps = { */ xAlgoliaUserID: string; /** - * The batchAssignUserIdsObject. + * The batchAssignUserIdsObject parameter. */ batchAssignUserIdsObject: BatchAssignUserIdsObject; }; @@ -2569,7 +2534,7 @@ export type BatchDictionaryEntriesProps = { */ dictionaryName: 'compounds' | 'plurals' | 'stopwords'; /** - * The batchDictionaryEntries. + * The batchDictionaryEntries parameter. */ batchDictionaryEntries: BatchDictionaryEntries; }; @@ -2580,7 +2545,7 @@ export type BatchRulesProps = { */ indexName: string; /** - * The rule. + * The rule parameter. */ rule: Rule[]; /** @@ -2599,7 +2564,7 @@ export type BrowseProps = { */ indexName: string; /** - * The browseRequest. + * The browseRequest parameter. */ browseRequest?: BrowseRequest; }; @@ -2646,7 +2611,7 @@ export type DeleteByProps = { */ indexName: string; /** - * The searchParams. + * The searchParams parameter. */ searchParams: SearchParams; }; @@ -2742,18 +2707,11 @@ export type GetObjectProps = { */ objectID: string; /** - * The attributesToRetrieve. + * The attributesToRetrieve parameter. */ attributesToRetrieve?: string[]; }; -export type GetObjectsProps = { - /** - * The getObjectsObject. - */ - getObjectsObject: GetObjectsObject; -}; - export type GetRuleProps = { /** * The index in which to perform the request. @@ -2803,7 +2761,7 @@ export type GetUserIdProps = { export type HasPendingMappingsProps = { /** - * The getClusters. + * The getClusters parameter. */ getClusters?: boolean; }; @@ -2826,27 +2784,13 @@ export type ListUserIdsProps = { hitsPerPage?: number; }; -export type MultipleBatchProps = { - /** - * The batchObject. - */ - batchObject: BatchObject; -}; - -export type MultipleQueriesProps = { - /** - * The multipleQueriesObject. - */ - multipleQueriesObject: MultipleQueriesObject; -}; - export type OperationIndexProps = { /** * The index in which to perform the request. */ indexName: string; /** - * The operationIndexObject. + * The operationIndexObject parameter. */ operationIndexObject: OperationIndexObject; }; @@ -2877,13 +2821,6 @@ export type RemoveUserIdProps = { userID: string; }; -export type ReplaceSourcesProps = { - /** - * The sources to allow. - */ - source: Source[]; -}; - export type RestoreApiKeyProps = { /** * API Key string. @@ -2912,7 +2849,7 @@ export type SaveRuleProps = { */ objectID: string; /** - * The rule. + * The rule parameter. */ rule: Rule; /** @@ -2931,7 +2868,7 @@ export type SaveSynonymProps = { */ objectID: string; /** - * The synonymHit. + * The synonymHit parameter. */ synonymHit: SynonymHit; /** @@ -2946,7 +2883,7 @@ export type SaveSynonymsProps = { */ indexName: string; /** - * The synonymHit. + * The synonymHit parameter. */ synonymHit: SynonymHit[]; /** @@ -2965,7 +2902,7 @@ export type SearchProps = { */ indexName: string; /** - * The searchParams. + * The searchParams parameter. */ searchParams: SearchParams; }; @@ -2976,7 +2913,7 @@ export type SearchDictionaryEntriesProps = { */ dictionaryName: 'compounds' | 'plurals' | 'stopwords'; /** - * The searchDictionaryEntries. + * The searchDictionaryEntries parameter. */ searchDictionaryEntries: SearchDictionaryEntries; }; @@ -2991,7 +2928,7 @@ export type SearchForFacetValuesProps = { */ facetName: string; /** - * The searchForFacetValuesRequest. + * The searchForFacetValuesRequest parameter. */ searchForFacetValuesRequest?: SearchForFacetValuesRequest; }; @@ -3002,7 +2939,7 @@ export type SearchRulesProps = { */ indexName: string; /** - * The searchRulesParams. + * The searchRulesParams parameter. */ searchRulesParams: SearchRulesParams; }; @@ -3035,27 +2972,13 @@ export type SearchSynonymsProps = { hitsPerPage?: number; }; -export type SearchUserIdsProps = { - /** - * The searchUserIdsObject. - */ - searchUserIdsObject: SearchUserIdsObject; -}; - -export type SetDictionarySettingsProps = { - /** - * The dictionarySettingsRequest. - */ - dictionarySettingsRequest: DictionarySettingsRequest; -}; - export type SetSettingsProps = { /** * The index in which to perform the request. */ indexName: string; /** - * The indexSettings. + * The indexSettings parameter. */ indexSettings: IndexSettings; /** @@ -3070,7 +2993,7 @@ export type UpdateApiKeyProps = { */ key: string; /** - * The apiKey. + * The apiKey parameter. */ apiKey: ApiKey; }; diff --git a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts index 6cc27c1e2cc..df3b2361636 100644 --- a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts +++ b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts @@ -99,12 +99,11 @@ export class RecommendApi { /** * Returns recommendations for a specific model and objectID. * - * @param getRecommendations - The getRecommendations parameters. - * @param getRecommendations.getRecommendations - The getRecommendations. + * @param getRecommendations - The getRecommendations parameter. */ - getRecommendations({ - getRecommendations, - }: GetRecommendationsProps): Promise { + getRecommendations( + getRecommendations: GetRecommendations + ): Promise { const path = '/1/indexes/*/recommendations'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -138,10 +137,3 @@ export class RecommendApi { return this.sendRequest(request, requestOptions); } } - -export type GetRecommendationsProps = { - /** - * The getRecommendations. - */ - getRecommendations: GetRecommendations; -}; diff --git a/specs/abtesting/paths/stopAbTest.yml b/specs/abtesting/paths/stopAbTest.yml index d311fc85524..9d4d883e348 100644 --- a/specs/abtesting/paths/stopAbTest.yml +++ b/specs/abtesting/paths/stopAbTest.yml @@ -9,19 +9,8 @@ post: As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests. Associated metadata and metrics are still stored. summary: Marks the A/B test as stopped. - requestBody: - required: true - content: - application/json: - schema: - title: stopABTestRequest - type: object - additionalProperties: false - properties: - id: - $ref: ../common/parameters.yml#/abTestID - required: - - id + parameters: + - $ref: ../common/parameters.yml#/ID responses: '200': description: OK diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index aad28652c63..450734276f6 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -139,19 +139,69 @@ export class {{classname}} { {{#summary}} * @summary {{&summary}} {{/summary}} - * @param {{nickname}} - The {{nickname}} parameters. - {{#allParams}} - * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}}{{/description}}{{#description}}{{{description}}}{{/description}} - {{/allParams}} + {{#allParams.0}} + {{^bodyParams.0}} + * @param {{nickname}} - The {{nickname}} parameters. + {{#allParams}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/allParams}} + {{/bodyParams.0}} + {{#bodyParams.0}} + {{^queryParams.0}} + {{^pathParams.0}} + {{#bodyParams}} + * @param {{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/bodyParams}} + {{/pathParams.0}} + {{#pathParams.0}} + * @param {{nickname}} - The {{nickname}} parameters. + {{#allParams}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/allParams}} + {{/pathParams.0}} + {{/queryParams.0}} + {{#queryParams.0}} + * @param {{nickname}} - The {{nickname}} parameters. + {{#allParams}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/allParams}} + {{/queryParams.0}} + {{/bodyParams.0}} + {{/allParams.0}} */ public {{nickname}} ( - {{#allParams.0}} + {{#allParams.0}} + {{^bodyParams.0}} { {{#allParams}} {{paramName}}, {{/allParams}} }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props - {{/allParams.0}} + {{/bodyParams.0}} + {{#bodyParams.0}} + {{^queryParams.0}} + {{^pathParams.0}} + {{#bodyParams}} + {{paramName}}: {{{dataType}}}, + {{/bodyParams}} + {{/pathParams.0}} + {{#pathParams.0}} + { + {{#allParams}} + {{paramName}}, + {{/allParams}} + }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props + {{/pathParams.0}} + {{/queryParams.0}} + {{#queryParams.0}} + { + {{#allParams}} + {{paramName}}, + {{/allParams}} + }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props + {{/queryParams.0}} + {{/bodyParams.0}} + {{/allParams.0}} ) : Promise<{{{returnType}}}> { const path = '{{{path}}}'{{#pathParams}}.replace( {{=<% %>=}} @@ -208,14 +258,40 @@ export class {{classname}} { {{#operation}} {{#allParams.0}} + {{^bodyParams.0}} +export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { + {{#allParams}} + /** + * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + */ + {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; + {{/allParams}} +} + {{/bodyParams.0}} + {{#bodyParams.0}} + {{^queryParams.0}} + {{#pathParams.0}} +export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { + {{#allParams}} + /** + * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + */ + {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; + {{/allParams}} +} + {{/pathParams.0}} + {{/queryParams.0}} + {{#queryParams.0}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} /** - * {{^description}}The {{paramName}}{{/description}}{{#description}}{{{description}}}{{/description}} + * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} */ {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } + {{/queryParams.0}} + {{/bodyParams.0}} {{/allParams.0}} {{/operation}} diff --git a/tests/CTS/clients/abtesting/addABTests.json b/tests/CTS/clients/abtesting/addABTests.json index df8de45c8e7..091c50d59f7 100644 --- a/tests/CTS/clients/abtesting/addABTests.json +++ b/tests/CTS/clients/abtesting/addABTests.json @@ -3,35 +3,33 @@ "method": "addABTests", "testName": "addABTests with minimal parameters", "parameters": { - "addABTestsRequest": { - "endAt": "2022-12-31", - "name": "myABTest", - "variant": [ - { - "index": "AB_TEST_1", - "trafficPercentage": 30 - }, - { - "index": "AB_TEST_2", - "trafficPercentage": 50 - } - ] - } + "endAt": "2022-12-31", + "name": "myABTest", + "variant": [ + { + "index": "AB_TEST_1", + "trafficPercentage": 30 + }, + { + "index": "AB_TEST_2", + "trafficPercentage": 50 + } + ] }, "request": { "path": "/2/abtests", "method": "POST", "data": { - "endAt": "2022-12-31", + "endAt": "2022-12-31T00:00:00.000Z", "name": "myABTest", "variant": [ { "index": "AB_TEST_1", - "trafficPercentage": "30" + "trafficPercentage": 30 }, { "index": "AB_TEST_2", - "trafficPercentage": "50" + "trafficPercentage": 50 } ] } diff --git a/tests/CTS/clients/abtesting/listABTests.json b/tests/CTS/clients/abtesting/listABTests.json index 2326104e135..31fc5160ff6 100644 --- a/tests/CTS/clients/abtesting/listABTests.json +++ b/tests/CTS/clients/abtesting/listABTests.json @@ -8,7 +8,7 @@ }, "request": { "path": "/2/abtests", - "method": "POST", + "method": "GET", "searchParams": { "offset": "42", "limit": "21" diff --git a/tests/CTS/clients/abtesting/stopABTest.json b/tests/CTS/clients/abtesting/stopABTest.json index 500cef51e09..1c9cd09bd8e 100644 --- a/tests/CTS/clients/abtesting/stopABTest.json +++ b/tests/CTS/clients/abtesting/stopABTest.json @@ -3,9 +3,7 @@ "method": "stopABTest", "testName": "stopABTest", "parameters": { - "stopABTestRequest": { - "id": 42 - } + "id": 42 }, "request": { "path": "/2/abtests/42/stop", diff --git a/tests/CTS/clients/insights/pushEvents.json b/tests/CTS/clients/insights/pushEvents.json index c6f184f0225..6ad7acc22f0 100644 --- a/tests/CTS/clients/insights/pushEvents.json +++ b/tests/CTS/clients/insights/pushEvents.json @@ -2,37 +2,35 @@ { "method": "pushEvents", "parameters": { - "insightEvents": { - "events": [ - { - "eventType": "click", - "eventName": "Product Clicked", - "index": "products", - "userToken": "user-123456", - "timestamp": 1641290601962, - "objectIDs": ["9780545139700", "9780439784542"], - "queryID": "43b15df305339e827f0ac0bdc5ebcaa7", - "positions": [7, 6] - }, - { - "eventType": "view", - "eventName": "Product Detail Page Viewed", - "index": "products", - "userToken": "user-123456", - "timestamp": 1641290601962, - "objectIDs": ["9780545139700", "9780439784542"] - }, - { - "eventType": "conversion", - "eventName": "Product Purchased", - "index": "products", - "userToken": "user-123456", - "timestamp": 1641290601962, - "objectIDs": ["9780545139700", "9780439784542"], - "queryID": "43b15df305339e827f0ac0bdc5ebcaa7" - } - ] - } + "events": [ + { + "eventType": "click", + "eventName": "Product Clicked", + "index": "products", + "userToken": "user-123456", + "timestamp": 1641290601962, + "objectIDs": ["9780545139700", "9780439784542"], + "queryID": "43b15df305339e827f0ac0bdc5ebcaa7", + "positions": [7, 6] + }, + { + "eventType": "view", + "eventName": "Product Detail Page Viewed", + "index": "products", + "userToken": "user-123456", + "timestamp": 1641290601962, + "objectIDs": ["9780545139700", "9780439784542"] + }, + { + "eventType": "conversion", + "eventName": "Product Purchased", + "index": "products", + "userToken": "user-123456", + "timestamp": 1641290601962, + "objectIDs": ["9780545139700", "9780439784542"], + "queryID": "43b15df305339e827f0ac0bdc5ebcaa7" + } + ] }, "request": { "path": "/1/events", diff --git a/tests/CTS/clients/personalization/setPersonalizationStrategy.json b/tests/CTS/clients/personalization/setPersonalizationStrategy.json index 36935430098..7c1e3ef7fec 100644 --- a/tests/CTS/clients/personalization/setPersonalizationStrategy.json +++ b/tests/CTS/clients/personalization/setPersonalizationStrategy.json @@ -3,22 +3,20 @@ "method": "setPersonalizationStrategy", "testName": "set setPersonalizationStrategy", "parameters": { - "personalizationStrategyObject": { - "eventScoring": [ - { - "score": 42, - "eventName": "Algolia", - "eventType": "Event" - } - ], - "facetScoring": [ - { - "score": 42, - "facetName": "Event" - } - ], - "personalizationImpact": 42 - } + "eventScoring": [ + { + "score": 42, + "eventName": "Algolia", + "eventType": "Event" + } + ], + "facetScoring": [ + { + "score": 42, + "facetName": "Event" + } + ], + "personalizationImpact": 42 }, "request": { "path": "/1/strategies/personalization", diff --git a/tests/CTS/clients/recommend/getRecommendations.json b/tests/CTS/clients/recommend/getRecommendations.json index ddab8c7c773..ae68ccbb77b 100644 --- a/tests/CTS/clients/recommend/getRecommendations.json +++ b/tests/CTS/clients/recommend/getRecommendations.json @@ -3,16 +3,14 @@ "method": "getRecommendations", "testName": "get recommendations with minimal parameters", "parameters": { - "getRecommendations": { - "requests": [ - { - "indexName": "indexName", - "objectID": "objectID", - "model": "related-products", - "threshold": 42 - } - ] - } + "requests": [ + { + "indexName": "indexName", + "objectID": "objectID", + "model": "related-products", + "threshold": 42 + } + ] }, "request": { "path": "/1/indexes/*/recommendations", @@ -33,24 +31,22 @@ "method": "getRecommendations", "testName": "get recommendations with all parameters", "parameters": { - "getRecommendations": { - "requests": [ - { - "indexName": "indexName", - "objectID": "objectID", - "model": "related-products", - "threshold": 42, - "queryParameters": { - "query": "myQuery", - "facetFilters": ["query"] - }, - "fallbackParameters": { - "query": "myQuery", - "facetFilters": ["fallback"] - } + "requests": [ + { + "indexName": "indexName", + "objectID": "objectID", + "model": "related-products", + "threshold": 42, + "queryParameters": { + "query": "myQuery", + "facetFilters": ["query"] + }, + "fallbackParameters": { + "query": "myQuery", + "facetFilters": ["fallback"] } - ] - } + } + ] }, "request": { "path": "/1/indexes/*/recommendations", @@ -79,22 +75,20 @@ "method": "getRecommendations", "testName": "get multiple recommendations with minimal parameters", "parameters": { - "getRecommendations": { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "related-products", - "threshold": 21 - }, - { - "indexName": "indexName2", - "objectID": "objectID2", - "model": "related-products", - "threshold": 21 - } - ] - } + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "related-products", + "threshold": 21 + }, + { + "indexName": "indexName2", + "objectID": "objectID2", + "model": "related-products", + "threshold": 21 + } + ] }, "request": { "path": "/1/indexes/*/recommendations", @@ -121,38 +115,36 @@ "method": "getRecommendations", "testName": "get multiple recommendations with all parameters", "parameters": { - "getRecommendations": { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "related-products", - "threshold": 21, - "queryParameters": { - "query": "myQuery", - "facetFilters": ["query1"] - }, - "fallbackParameters": { - "query": "myQuery", - "facetFilters": ["fallback1"] - } + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "related-products", + "threshold": 21, + "queryParameters": { + "query": "myQuery", + "facetFilters": ["query1"] }, - { - "indexName": "indexName2", - "objectID": "objectID2", - "model": "related-products", - "threshold": 21, - "queryParameters": { - "query": "myQuery", - "facetFilters": ["query2"] - }, - "fallbackParameters": { - "query": "myQuery", - "facetFilters": ["fallback2"] - } + "fallbackParameters": { + "query": "myQuery", + "facetFilters": ["fallback1"] } - ] - } + }, + { + "indexName": "indexName2", + "objectID": "objectID2", + "model": "related-products", + "threshold": 21, + "queryParameters": { + "query": "myQuery", + "facetFilters": ["query2"] + }, + "fallbackParameters": { + "query": "myQuery", + "facetFilters": ["fallback2"] + } + } + ] }, "request": { "path": "/1/indexes/*/recommendations", @@ -195,16 +187,14 @@ "method": "getRecommendations", "testName": "get frequently bought together recommendations", "parameters": { - "getRecommendations": { - "requests": [ - { - "indexName": "indexName1", - "objectID": "objectID1", - "model": "bought-together", - "threshold": 42 - } - ] - } + "requests": [ + { + "indexName": "indexName1", + "objectID": "objectID1", + "model": "bought-together", + "threshold": 42 + } + ] }, "request": { "path": "/1/indexes/*/recommendations", diff --git a/tests/CTS/clients/search/addApiKey.json b/tests/CTS/clients/search/addApiKey.json index 2d5e30d7cb6..312bb1828c6 100644 --- a/tests/CTS/clients/search/addApiKey.json +++ b/tests/CTS/clients/search/addApiKey.json @@ -2,13 +2,11 @@ { "method": "addApiKey", "parameters": { - "apiKey": { - "acl": ["search", "addObject"], - "description": "my new api key", - "validity": 300, - "maxQueriesPerIPPerHour": 100, - "maxHitsPerQuery": 20 - } + "acl": ["search", "addObject"], + "description": "my new api key", + "validity": 300, + "maxQueriesPerIPPerHour": 100, + "maxHitsPerQuery": 20 }, "request": { "path": "/1/keys", diff --git a/tests/CTS/clients/search/setDictionarySettings.json b/tests/CTS/clients/search/setDictionarySettings.json index d438327a4b6..af1148b5c06 100644 --- a/tests/CTS/clients/search/setDictionarySettings.json +++ b/tests/CTS/clients/search/setDictionarySettings.json @@ -3,13 +3,11 @@ "method": "setDictionarySettings", "testName": "get setDictionarySettings results with minimal parameters", "parameters": { - "dictionarySettingsRequest": { - "disableStandardEntries": { - "plurals": { - "fr": false, - "en": false, - "ru": true - } + "disableStandardEntries": { + "plurals": { + "fr": false, + "en": false, + "ru": true } } }, @@ -31,19 +29,17 @@ "method": "setDictionarySettings", "testName": "get setDictionarySettings results with all parameters", "parameters": { - "dictionarySettingsRequest": { - "disableStandardEntries": { - "plurals": { - "fr": false, - "en": false, - "ru": true - }, - "stopwords": { - "fr": false - }, - "compounds": { - "ru": true - } + "disableStandardEntries": { + "plurals": { + "fr": false, + "en": false, + "ru": true + }, + "stopwords": { + "fr": false + }, + "compounds": { + "ru": true } } }, diff --git a/tests/output/javascript/abtesting.test.ts b/tests/output/javascript/abtesting.test.ts index 7ac97cc7680..d22032420ae 100644 --- a/tests/output/javascript/abtesting.test.ts +++ b/tests/output/javascript/abtesting.test.ts @@ -10,24 +10,22 @@ const client = new AbtestingApi(appId, apiKey, 'de', { describe('addABTests', () => { test('addABTests with minimal parameters', async () => { const req = await client.addABTests({ - addABTestsRequest: { - endAt: '2022-12-31', - name: 'myABTest', - variant: [ - { index: 'AB_TEST_1', trafficPercentage: 30 }, - { index: 'AB_TEST_2', trafficPercentage: 50 }, - ], - }, + endAt: new Date('2022-12-31'), + name: 'myABTest', + variant: [ + { index: 'AB_TEST_1', trafficPercentage: 30 }, + { index: 'AB_TEST_2', trafficPercentage: 50 }, + ], }); expect((req as any).path).toEqual('/2/abtests'); expect((req as any).method).toEqual('POST'); expect((req as any).data).toEqual({ - endAt: '2022-12-31', + endAt: '2022-12-31T00:00:00.000Z', name: 'myABTest', variant: [ - { index: 'AB_TEST_1', trafficPercentage: '30' }, - { index: 'AB_TEST_2', trafficPercentage: '50' }, + { index: 'AB_TEST_1', trafficPercentage: 30 }, + { index: 'AB_TEST_2', trafficPercentage: 50 }, ], }); expect((req as any).searchParams).toEqual(undefined); @@ -68,7 +66,7 @@ describe('listABTests', () => { }); expect((req as any).path).toEqual('/2/abtests'); - expect((req as any).method).toEqual('POST'); + expect((req as any).method).toEqual('GET'); expect((req as any).data).toEqual(undefined); expect((req as any).searchParams).toEqual({ offset: '42', limit: '21' }); }); @@ -77,7 +75,7 @@ describe('listABTests', () => { describe('stopABTest', () => { test('stopABTest', async () => { const req = await client.stopABTest({ - stopABTestRequest: { id: 42 }, + id: 42, }); expect((req as any).path).toEqual('/2/abtests/42/stop'); diff --git a/tests/output/javascript/insights.test.ts b/tests/output/javascript/insights.test.ts index ffd4004e59e..56ba5036c59 100644 --- a/tests/output/javascript/insights.test.ts +++ b/tests/output/javascript/insights.test.ts @@ -10,37 +10,35 @@ const client = new InsightsApi(appId, apiKey, { describe('pushEvents', () => { test('pushEvents', async () => { const req = await client.pushEvents({ - insightEvents: { - events: [ - { - eventType: 'click', - eventName: 'Product Clicked', - index: 'products', - userToken: 'user-123456', - timestamp: 1641290601962, - objectIDs: ['9780545139700', '9780439784542'], - queryID: '43b15df305339e827f0ac0bdc5ebcaa7', - positions: [7, 6], - }, - { - eventType: 'view', - eventName: 'Product Detail Page Viewed', - index: 'products', - userToken: 'user-123456', - timestamp: 1641290601962, - objectIDs: ['9780545139700', '9780439784542'], - }, - { - eventType: 'conversion', - eventName: 'Product Purchased', - index: 'products', - userToken: 'user-123456', - timestamp: 1641290601962, - objectIDs: ['9780545139700', '9780439784542'], - queryID: '43b15df305339e827f0ac0bdc5ebcaa7', - }, - ], - }, + events: [ + { + eventType: 'click', + eventName: 'Product Clicked', + index: 'products', + userToken: 'user-123456', + timestamp: 1641290601962, + objectIDs: ['9780545139700', '9780439784542'], + queryID: '43b15df305339e827f0ac0bdc5ebcaa7', + positions: [7, 6], + }, + { + eventType: 'view', + eventName: 'Product Detail Page Viewed', + index: 'products', + userToken: 'user-123456', + timestamp: 1641290601962, + objectIDs: ['9780545139700', '9780439784542'], + }, + { + eventType: 'conversion', + eventName: 'Product Purchased', + index: 'products', + userToken: 'user-123456', + timestamp: 1641290601962, + objectIDs: ['9780545139700', '9780439784542'], + queryID: '43b15df305339e827f0ac0bdc5ebcaa7', + }, + ], }); expect((req as any).path).toEqual('/1/events'); diff --git a/tests/output/javascript/personalization.test.ts b/tests/output/javascript/personalization.test.ts index 50b67d94055..1fa2f11ceb5 100644 --- a/tests/output/javascript/personalization.test.ts +++ b/tests/output/javascript/personalization.test.ts @@ -50,11 +50,9 @@ describe('getUserTokenProfile', () => { describe('setPersonalizationStrategy', () => { test('set setPersonalizationStrategy', async () => { const req = await client.setPersonalizationStrategy({ - personalizationStrategyObject: { - eventScoring: [{ score: 42, eventName: 'Algolia', eventType: 'Event' }], - facetScoring: [{ score: 42, facetName: 'Event' }], - personalizationImpact: 42, - }, + eventScoring: [{ score: 42, eventName: 'Algolia', eventType: 'Event' }], + facetScoring: [{ score: 42, facetName: 'Event' }], + personalizationImpact: 42, }); expect((req as any).path).toEqual('/1/strategies/personalization'); diff --git a/tests/output/javascript/recommend.test.ts b/tests/output/javascript/recommend.test.ts index e9fda025983..d3f92cbeedd 100644 --- a/tests/output/javascript/recommend.test.ts +++ b/tests/output/javascript/recommend.test.ts @@ -10,16 +10,14 @@ const client = new RecommendApi(appId, apiKey, { describe('getRecommendations', () => { test('get recommendations with minimal parameters', async () => { const req = await client.getRecommendations({ - getRecommendations: { - requests: [ - { - indexName: 'indexName', - objectID: 'objectID', - model: 'related-products', - threshold: 42, - }, - ], - }, + requests: [ + { + indexName: 'indexName', + objectID: 'objectID', + model: 'related-products', + threshold: 42, + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/recommendations'); @@ -39,21 +37,16 @@ describe('getRecommendations', () => { test('get recommendations with all parameters', async () => { const req = await client.getRecommendations({ - getRecommendations: { - requests: [ - { - indexName: 'indexName', - objectID: 'objectID', - model: 'related-products', - threshold: 42, - queryParameters: { query: 'myQuery', facetFilters: ['query'] }, - fallbackParameters: { - query: 'myQuery', - facetFilters: ['fallback'], - }, - }, - ], - }, + requests: [ + { + indexName: 'indexName', + objectID: 'objectID', + model: 'related-products', + threshold: 42, + queryParameters: { query: 'myQuery', facetFilters: ['query'] }, + fallbackParameters: { query: 'myQuery', facetFilters: ['fallback'] }, + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/recommendations'); @@ -75,22 +68,20 @@ describe('getRecommendations', () => { test('get multiple recommendations with minimal parameters', async () => { const req = await client.getRecommendations({ - getRecommendations: { - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'related-products', - threshold: 21, - }, - { - indexName: 'indexName2', - objectID: 'objectID2', - model: 'related-products', - threshold: 21, - }, - ], - }, + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'related-products', + threshold: 21, + }, + { + indexName: 'indexName2', + objectID: 'objectID2', + model: 'related-products', + threshold: 21, + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/recommendations'); @@ -116,32 +107,24 @@ describe('getRecommendations', () => { test('get multiple recommendations with all parameters', async () => { const req = await client.getRecommendations({ - getRecommendations: { - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'related-products', - threshold: 21, - queryParameters: { query: 'myQuery', facetFilters: ['query1'] }, - fallbackParameters: { - query: 'myQuery', - facetFilters: ['fallback1'], - }, - }, - { - indexName: 'indexName2', - objectID: 'objectID2', - model: 'related-products', - threshold: 21, - queryParameters: { query: 'myQuery', facetFilters: ['query2'] }, - fallbackParameters: { - query: 'myQuery', - facetFilters: ['fallback2'], - }, - }, - ], - }, + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'related-products', + threshold: 21, + queryParameters: { query: 'myQuery', facetFilters: ['query1'] }, + fallbackParameters: { query: 'myQuery', facetFilters: ['fallback1'] }, + }, + { + indexName: 'indexName2', + objectID: 'objectID2', + model: 'related-products', + threshold: 21, + queryParameters: { query: 'myQuery', facetFilters: ['query2'] }, + fallbackParameters: { query: 'myQuery', facetFilters: ['fallback2'] }, + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/recommendations'); @@ -171,16 +154,14 @@ describe('getRecommendations', () => { test('get frequently bought together recommendations', async () => { const req = await client.getRecommendations({ - getRecommendations: { - requests: [ - { - indexName: 'indexName1', - objectID: 'objectID1', - model: 'bought-together', - threshold: 42, - }, - ], - }, + requests: [ + { + indexName: 'indexName1', + objectID: 'objectID1', + model: 'bought-together', + threshold: 42, + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/recommendations'); diff --git a/tests/output/javascript/search.test.ts b/tests/output/javascript/search.test.ts index fecaf4682c3..929d397fd54 100644 --- a/tests/output/javascript/search.test.ts +++ b/tests/output/javascript/search.test.ts @@ -8,13 +8,11 @@ const client = new SearchApi(appId, apiKey, { requester: new EchoRequester() }); describe('addApiKey', () => { test('addApiKey', async () => { const req = await client.addApiKey({ - apiKey: { - acl: ['search', 'addObject'], - description: 'my new api key', - validity: 300, - maxQueriesPerIPPerHour: 100, - maxHitsPerQuery: 20, - }, + acl: ['search', 'addObject'], + description: 'my new api key', + validity: 300, + maxQueriesPerIPPerHour: 100, + maxHitsPerQuery: 20, }); expect((req as any).path).toEqual('/1/keys'); @@ -1062,9 +1060,7 @@ describe('searchUserIds', () => { describe('setDictionarySettings', () => { test('get setDictionarySettings results with minimal parameters', async () => { const req = await client.setDictionarySettings({ - dictionarySettingsRequest: { - disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, - }, + disableStandardEntries: { plurals: { fr: false, en: false, ru: true } }, }); expect((req as any).path).toEqual('/1/dictionaries/*/settings'); @@ -1077,12 +1073,10 @@ describe('setDictionarySettings', () => { test('get setDictionarySettings results with all parameters', async () => { const req = await client.setDictionarySettings({ - dictionarySettingsRequest: { - disableStandardEntries: { - plurals: { fr: false, en: false, ru: true }, - stopwords: { fr: false }, - compounds: { ru: true }, - }, + disableStandardEntries: { + plurals: { fr: false, en: false, ru: true }, + stopwords: { fr: false }, + compounds: { ru: true }, }, }); From 4af71cfe8583360a40aa97e5dbb31423c4147684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 11 Jan 2022 14:15:13 +0100 Subject: [PATCH 2/6] fix: case --- specs/abtesting/paths/{stopAbTest.yml => stopABTest.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename specs/abtesting/paths/{stopAbTest.yml => stopABTest.yml} (100%) diff --git a/specs/abtesting/paths/stopAbTest.yml b/specs/abtesting/paths/stopABTest.yml similarity index 100% rename from specs/abtesting/paths/stopAbTest.yml rename to specs/abtesting/paths/stopABTest.yml From 5c256e578231c73065b80269b0c8b80b664bbdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 11 Jan 2022 16:50:23 +0100 Subject: [PATCH 3/6] fix search tests --- .../client-search/src/searchApi.ts | 13 ++- specs/search/paths/vault/common/schemas.yml | 1 + templates/javascript/api-single.mustache | 39 ++++++- tests/CTS/clients/search/appendSource.json | 6 +- tests/CTS/clients/search/getObjects.json | 24 ++-- tests/CTS/clients/search/multipleBatch.json | 20 ++-- tests/CTS/clients/search/multipleQueries.json | 22 ++-- tests/CTS/clients/search/searchUserIds.json | 10 +- tests/output/javascript/search.test.ts | 104 ++++++++++-------- 9 files changed, 140 insertions(+), 99 deletions(-) diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 6e0b52c32ec..7b072468a6b 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -1755,9 +1755,13 @@ export class SearchApi { /** * Replace all allowed sources. * + * @param replaceSources - The replaceSources parameters. + * @param replaceSources.source - The sources to allow. * @param source - The sources to allow. */ - replaceSources(source: Source[]): Promise { + replaceSources({ + source, + }: ReplaceSourcesProps): Promise { const path = '/1/security/sources'; const headers: Headers = { Accept: 'application/json' }; const queryParameters: Record = {}; @@ -2821,6 +2825,13 @@ export type RemoveUserIdProps = { userID: string; }; +export type ReplaceSourcesProps = { + /** + * The sources to allow. + */ + source: Source[]; +}; + export type RestoreApiKeyProps = { /** * API Key string. diff --git a/specs/search/paths/vault/common/schemas.yml b/specs/search/paths/vault/common/schemas.yml index 39fa7754a55..b82c37a5f94 100644 --- a/specs/search/paths/vault/common/schemas.yml +++ b/specs/search/paths/vault/common/schemas.yml @@ -1,5 +1,6 @@ sources: description: A list of sources. + type: array items: $ref: '#/source' diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 450734276f6..43ea1d33488 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -149,6 +149,14 @@ export class {{classname}} { {{#bodyParams.0}} {{^queryParams.0}} {{^pathParams.0}} + {{#bodyParams.0.isArray}} + {{^bodyParams.1}} + * @param {{nickname}} - The {{nickname}} parameters. + {{#allParams}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/allParams}} + {{/bodyParams.1}} + {{/bodyParams.0.isArray}} {{#bodyParams}} * @param {{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} {{/bodyParams}} @@ -181,9 +189,20 @@ export class {{classname}} { {{#bodyParams.0}} {{^queryParams.0}} {{^pathParams.0}} - {{#bodyParams}} - {{paramName}}: {{{dataType}}}, - {{/bodyParams}} + {{#bodyParams.0.isArray}} + {{^bodyParams.1}} + { + {{#allParams}} + {{paramName}}, + {{/allParams}} + }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props + {{/bodyParams.1}} + {{/bodyParams.0.isArray}} + {{^bodyParams.0.isArray}} + {{#bodyParams}} + {{paramName}}: {{{dataType}}}, + {{/bodyParams}} + {{/bodyParams.0.isArray}} {{/pathParams.0}} {{#pathParams.0}} { @@ -270,6 +289,20 @@ export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{/bodyParams.0}} {{#bodyParams.0}} {{^queryParams.0}} + {{^pathParams.0}} + {{#bodyParams.0.isArray}} + {{^bodyParams.1}} +export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { + {{#allParams}} + /** + * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + */ + {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; + {{/allParams}} +} + {{/bodyParams.1}} + {{/bodyParams.0.isArray}} + {{/pathParams.0}} {{#pathParams.0}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} diff --git a/tests/CTS/clients/search/appendSource.json b/tests/CTS/clients/search/appendSource.json index b912f82c836..53b7a7940a7 100644 --- a/tests/CTS/clients/search/appendSource.json +++ b/tests/CTS/clients/search/appendSource.json @@ -2,10 +2,8 @@ { "method": "appendSource", "parameters": { - "source": { - "source": "theSource", - "description": "theDescription" - } + "source": "theSource", + "description": "theDescription" }, "request": { "path": "/1/security/sources/append", diff --git a/tests/CTS/clients/search/getObjects.json b/tests/CTS/clients/search/getObjects.json index e8c51ab3a06..8474428c0cf 100644 --- a/tests/CTS/clients/search/getObjects.json +++ b/tests/CTS/clients/search/getObjects.json @@ -2,18 +2,13 @@ { "method": "getObjects", "parameters": { - "getObjectsObject": { - "requests": [ - { - "attributesToRetrieve": [ - "attr1", - "attr2" - ], - "objectID": "uniqueID", - "indexName": "theIndexName" - } - ] - } + "requests": [ + { + "attributesToRetrieve": ["attr1", "attr2"], + "objectID": "uniqueID", + "indexName": "theIndexName" + } + ] }, "request": { "path": "/1/indexes/*/objects", @@ -21,10 +16,7 @@ "data": { "requests": [ { - "attributesToRetrieve": [ - "attr1", - "attr2" - ], + "attributesToRetrieve": ["attr1", "attr2"], "objectID": "uniqueID", "indexName": "theIndexName" } diff --git a/tests/CTS/clients/search/multipleBatch.json b/tests/CTS/clients/search/multipleBatch.json index 832fc2952be..71326b56695 100644 --- a/tests/CTS/clients/search/multipleBatch.json +++ b/tests/CTS/clients/search/multipleBatch.json @@ -2,17 +2,15 @@ { "method": "multipleBatch", "parameters": { - "batchObject": { - "requests": [ - { - "action": "addObject", - "body": { - "key": "value" - }, - "indexName": "theIndexName" - } - ] - } + "requests": [ + { + "action": "addObject", + "body": { + "key": "value" + }, + "indexName": "theIndexName" + } + ] }, "request": { "path": "/1/indexes/*/batch", diff --git a/tests/CTS/clients/search/multipleQueries.json b/tests/CTS/clients/search/multipleQueries.json index 848e78c3757..d994520843c 100644 --- a/tests/CTS/clients/search/multipleQueries.json +++ b/tests/CTS/clients/search/multipleQueries.json @@ -2,18 +2,16 @@ { "method": "multipleQueries", "parameters": { - "multipleQueriesObject": { - "requests": [ - { - "indexName": "theIndexName", - "query": "test", - "type": "facet", - "facet": "theFacet", - "params": "testParam" - } - ], - "strategy": "stopIfEnoughMatches" - } + "requests": [ + { + "indexName": "theIndexName", + "query": "test", + "type": "facet", + "facet": "theFacet", + "params": "testParam" + } + ], + "strategy": "stopIfEnoughMatches" }, "request": { "path": "/1/indexes/*/queries", diff --git a/tests/CTS/clients/search/searchUserIds.json b/tests/CTS/clients/search/searchUserIds.json index c6edb4c2b5e..48f9ead386a 100644 --- a/tests/CTS/clients/search/searchUserIds.json +++ b/tests/CTS/clients/search/searchUserIds.json @@ -2,12 +2,10 @@ { "method": "searchUserIds", "parameters": { - "searchUserIdsObject": { - "query": "test", - "clusterName": "theClusterName", - "page": 5, - "hitsPerPage": 10 - } + "query": "test", + "clusterName": "theClusterName", + "page": 5, + "hitsPerPage": 10 }, "request": { "path": "/1/clusters/mapping/search", diff --git a/tests/output/javascript/search.test.ts b/tests/output/javascript/search.test.ts index 929d397fd54..21c26008146 100644 --- a/tests/output/javascript/search.test.ts +++ b/tests/output/javascript/search.test.ts @@ -46,7 +46,8 @@ describe('addOrUpdateObject', () => { describe('appendSource', () => { test('appendSource', async () => { const req = await client.appendSource({ - source: { source: 'theSource', description: 'theDescription' }, + source: 'theSource', + description: 'theDescription', }); expect((req as any).path).toEqual('/1/security/sources/append'); @@ -302,7 +303,9 @@ describe('clearAllSynonyms', () => { describe('clearObjects', () => { test('clearObjects', async () => { - const req = await client.clearObjects({ indexName: 'theIndexName' }); + const req = await client.clearObjects({ + indexName: 'theIndexName', + }); expect((req as any).path).toEqual('/1/indexes/theIndexName/clear'); expect((req as any).method).toEqual('POST'); @@ -353,7 +356,9 @@ describe('deleteBy', () => { describe('deleteIndex', () => { test('deleteIndex', async () => { - const req = await client.deleteIndex({ indexName: 'theIndexName' }); + const req = await client.deleteIndex({ + indexName: 'theIndexName', + }); expect((req as any).path).toEqual('/1/indexes/theIndexName'); expect((req as any).method).toEqual('DELETE'); @@ -392,7 +397,9 @@ describe('deleteRule', () => { describe('deleteSource', () => { test('deleteSource', async () => { - const req = await client.deleteSource({ source: 'theSource' }); + const req = await client.deleteSource({ + source: 'theSource', + }); expect((req as any).path).toEqual('/1/security/sources/theSource'); expect((req as any).method).toEqual('DELETE'); @@ -491,15 +498,13 @@ describe('getObject', () => { describe('getObjects', () => { test('getObjects', async () => { const req = await client.getObjects({ - getObjectsObject: { - requests: [ - { - attributesToRetrieve: ['attr1', 'attr2'], - objectID: 'uniqueID', - indexName: 'theIndexName', - }, - ], - }, + requests: [ + { + attributesToRetrieve: ['attr1', 'attr2'], + objectID: 'uniqueID', + indexName: 'theIndexName', + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/objects'); @@ -533,7 +538,9 @@ describe('getRule', () => { describe('getSettings', () => { test('getSettings', async () => { - const req = await client.getSettings({ indexName: 'theIndexName' }); + const req = await client.getSettings({ + indexName: 'theIndexName', + }); expect((req as any).path).toEqual('/1/indexes/theIndexName/settings'); expect((req as any).method).toEqual('GET'); @@ -594,7 +601,9 @@ describe('getTopUserIds', () => { describe('getUserId', () => { test('getUserId', async () => { - const req = await client.getUserId({ userID: 'uniqueID' }); + const req = await client.getUserId({ + userID: 'uniqueID', + }); expect((req as any).path).toEqual('/1/clusters/mapping/uniqueID'); expect((req as any).method).toEqual('GET'); @@ -605,7 +614,9 @@ describe('getUserId', () => { describe('hasPendingMappings', () => { test('hasPendingMappings', async () => { - const req = await client.hasPendingMappings({ getClusters: true }); + const req = await client.hasPendingMappings({ + getClusters: true, + }); expect((req as any).path).toEqual('/1/clusters/mapping/pending'); expect((req as any).method).toEqual('GET'); @@ -638,7 +649,9 @@ describe('listClusters', () => { describe('listIndices', () => { test('listIndices', async () => { - const req = await client.listIndices({ page: 8 }); + const req = await client.listIndices({ + page: 8, + }); expect((req as any).path).toEqual('/1/indexes'); expect((req as any).method).toEqual('GET'); @@ -649,7 +662,10 @@ describe('listIndices', () => { describe('listUserIds', () => { test('listUserIds', async () => { - const req = await client.listUserIds({ page: 8, hitsPerPage: 100 }); + const req = await client.listUserIds({ + page: 8, + hitsPerPage: 100, + }); expect((req as any).path).toEqual('/1/clusters/mapping'); expect((req as any).method).toEqual('GET'); @@ -664,15 +680,13 @@ describe('listUserIds', () => { describe('multipleBatch', () => { test('multipleBatch', async () => { const req = await client.multipleBatch({ - batchObject: { - requests: [ - { - action: 'addObject', - body: { key: 'value' }, - indexName: 'theIndexName', - }, - ], - }, + requests: [ + { + action: 'addObject', + body: { key: 'value' }, + indexName: 'theIndexName', + }, + ], }); expect((req as any).path).toEqual('/1/indexes/*/batch'); @@ -693,18 +707,16 @@ describe('multipleBatch', () => { describe('multipleQueries', () => { test('multipleQueries', async () => { const req = await client.multipleQueries({ - multipleQueriesObject: { - requests: [ - { - indexName: 'theIndexName', - query: 'test', - type: 'facet', - facet: 'theFacet', - params: 'testParam', - }, - ], - strategy: 'stopIfEnoughMatches', - }, + requests: [ + { + indexName: 'theIndexName', + query: 'test', + type: 'facet', + facet: 'theFacet', + params: 'testParam', + }, + ], + strategy: 'stopIfEnoughMatches', }); expect((req as any).path).toEqual('/1/indexes/*/queries'); @@ -771,7 +783,9 @@ describe('partialUpdateObject', () => { describe('removeUserId', () => { test('removeUserId', async () => { - const req = await client.removeUserId({ userID: 'uniqueID' }); + const req = await client.removeUserId({ + userID: 'uniqueID', + }); expect((req as any).path).toEqual('/1/clusters/mapping/uniqueID'); expect((req as any).method).toEqual('DELETE'); @@ -1037,12 +1051,10 @@ describe('searchSynonyms', () => { describe('searchUserIds', () => { test('searchUserIds', async () => { const req = await client.searchUserIds({ - searchUserIdsObject: { - query: 'test', - clusterName: 'theClusterName', - page: 5, - hitsPerPage: 10, - }, + query: 'test', + clusterName: 'theClusterName', + page: 5, + hitsPerPage: 10, }); expect((req as any).path).toEqual('/1/clusters/mapping/search'); From f431c49acd0293fdf379d0f87c46706d32e1f4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 11 Jan 2022 17:42:03 +0100 Subject: [PATCH 4/6] fix duplicate param description --- .../client-search/src/searchApi.ts | 1 - templates/javascript/api-single.mustache | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 7b072468a6b..282579e8b3e 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -1757,7 +1757,6 @@ export class SearchApi { * * @param replaceSources - The replaceSources parameters. * @param replaceSources.source - The sources to allow. - * @param source - The sources to allow. */ replaceSources({ source, diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 43ea1d33488..8fb1b2b191c 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -157,9 +157,9 @@ export class {{classname}} { {{/allParams}} {{/bodyParams.1}} {{/bodyParams.0.isArray}} - {{#bodyParams}} + {{^bodyParams.0.isArray}} * @param {{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/bodyParams}} + {{/bodyParams.0.isArray}} {{/pathParams.0}} {{#pathParams.0}} * @param {{nickname}} - The {{nickname}} parameters. From 920dc8367b420a00d2e13f6a3eeeeedc383458cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 12 Jan 2022 10:26:02 +0100 Subject: [PATCH 5/6] better wording, fix missing description, remove useless comment in typedef --- .eslintrc.js | 3 - .../com/algolia/model/BatchResponse.java | 2 +- .../com/algolia/model/DeletedAtResponse.java | 2 +- .../com/algolia/model/SaveObjectResponse.java | 2 +- .../algolia/model/SaveSynonymResponse.java | 2 +- .../com/algolia/model/UpdatedAtResponse.java | 2 +- .../model/UpdatedAtWithObjectIdResponse.java | 2 +- .../algolia/model/UpdatedRuleResponse.java | 2 +- .../com/algolia/search/SearchApi.java | 15 +- .../client-abtesting/src/abtestingApi.ts | 10 +- .../client-analytics/src/analyticsApi.ts | 34 +-- .../client-insights/src/insightsApi.ts | 2 +- .../src/personalizationApi.ts | 6 +- .../client-search/src/searchApi.ts | 193 +++++++----------- .../recommend/src/recommendApi.ts | 2 +- .../multiclusters/hasPendingMappings.yml | 1 + specs/search/paths/objects/object.yml | 1 + templates/javascript/api-single.mustache | 34 +-- 18 files changed, 137 insertions(+), 178 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 728902eaae9..1c753ed834f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -63,9 +63,6 @@ module.exports = { 'max-classes-per-file': 0, 'no-continue': 0, '@typescript-eslint/prefer-enum-initializers': 0, - // there's a conflict when declaring `type` and `namespaces`, even with `ignoreDeclarationMerge` - 'no-redeclare': 0, - '@typescript-eslint/no-redeclare': 0, '@typescript-eslint/no-unused-vars': 2, 'unused-imports/no-unused-imports-ts': 2, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index 892212171fb..80cc720c27c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -20,7 +20,7 @@ public BatchResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java index 40cf4807321..75284d1c380 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeletedAtResponse.java @@ -19,7 +19,7 @@ public DeletedAtResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index 5070869c0de..815d42c278f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -40,7 +40,7 @@ public SaveObjectResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java index ac3082256eb..0563f85da20 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java @@ -22,7 +22,7 @@ public SaveSynonymResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java index b9ba635edbc..c0f5835a62f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtResponse.java @@ -19,7 +19,7 @@ public UpdatedAtResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java index cbaeb72ad6a..b058f27880e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedAtWithObjectIdResponse.java @@ -22,7 +22,7 @@ public UpdatedAtWithObjectIdResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java index 2e6e2c706e8..b45fb4d9c1e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/UpdatedRuleResponse.java @@ -60,7 +60,7 @@ public UpdatedRuleResponse taskID(Integer taskID) { } /** - * taskID of the indexing task to wait for. + * taskID of the task to wait for. * * @return taskID */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 288b560e37d..cd23f19d42f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -2471,7 +2471,8 @@ public Call getLogsAsync( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve (optional) + * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable + * attributes are returned. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2546,7 +2547,8 @@ private Call getObjectValidateBeforeCall( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve (optional) + * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable + * attributes are returned. (optional) * @return Map<String, String> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body @@ -2572,7 +2574,8 @@ public Map getObject( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve (optional) + * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable + * attributes are returned. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -3297,7 +3300,7 @@ public Call getUserIdAsync( /** * Build call for hasPendingMappings * - * @param getClusters (optional) + * @param getClusters Whether to get clusters or not. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3346,7 +3349,7 @@ private Call hasPendingMappingsValidateBeforeCall( * response is 200 OK. A successful response indicates that the operation has been taken into * account, and the userIDs are directly usable. * - * @param getClusters (optional) + * @param getClusters Whether to get clusters or not. (optional) * @return CreatedAtResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body @@ -3366,7 +3369,7 @@ public CreatedAtResponse hasPendingMappings(Boolean getClusters) * done. Upon success, the response is 200 OK. A successful response indicates that the operation * has been taken into account, and the userIDs are directly usable. * - * @param getClusters (optional) + * @param getClusters Whether to get clusters or not. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts b/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts index 418002de214..0ae14282551 100644 --- a/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts +++ b/clients/algoliasearch-client-javascript/client-abtesting/src/abtestingApi.ts @@ -85,7 +85,7 @@ export class AbtestingApi { * Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants. * * @summary Creates a new A/B test with provided configuration. - * @param addABTestsRequest - The addABTestsRequest parameter. + * @param addABTestsRequest - The addABTestsRequest object. */ addABTests( addABTestsRequest: AddABTestsRequest @@ -142,7 +142,7 @@ export class AbtestingApi { * Deletes the A/B Test and removes all associated metadata & metrics. * * @summary Deletes the A/B Test. - * @param deleteABTest - The deleteABTest parameters. + * @param deleteABTest - The deleteABTest object. * @param deleteABTest.id - The A/B test ID. */ deleteABTest({ id }: DeleteABTestProps): Promise> { @@ -175,7 +175,7 @@ export class AbtestingApi { * Returns metadata and metrics for A/B test id. Behaves in the same way as GET /2/abtests however the endpoint will return 403. * * @summary Returns metadata and metrics for A/B test id. - * @param getABTest - The getABTest parameters. + * @param getABTest - The getABTest object. * @param getABTest.id - The A/B test ID. */ getABTest({ id }: GetABTestProps): Promise { @@ -208,7 +208,7 @@ export class AbtestingApi { * Fetch all existing A/B tests for App that are available for the current API Key. Returns an array of metadata and metrics. When no data has been processed, the metrics will be returned as null. * * @summary Fetch all existing A/B tests for App that are available for the current API Key. - * @param listABTests - The listABTests parameters. + * @param listABTests - The listABTests object. * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record. * @param listABTests.limit - Number of records to return. Limit is the size of the page. */ @@ -244,7 +244,7 @@ export class AbtestingApi { * Marks the A/B test as stopped. At this point, the test is over and cannot be restarted. As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests. Associated metadata and metrics are still stored. * * @summary Marks the A/B test as stopped. - * @param stopABTest - The stopABTest parameters. + * @param stopABTest - The stopABTest object. * @param stopABTest.id - The A/B test ID. */ stopABTest({ id }: StopABTestProps): Promise> { diff --git a/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts b/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts index 1323afd5e80..f0a2fe7ccbd 100644 --- a/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts +++ b/clients/algoliasearch-client-javascript/client-analytics/src/analyticsApi.ts @@ -100,7 +100,7 @@ export class AnalyticsApi { * Returns the average click position. The endpoint returns a value for the complete given time range, as well as a value per day. * * @summary Returns the average click position. - * @param getAverageClickPosition - The getAverageClickPosition parameters. + * @param getAverageClickPosition - The getAverageClickPosition object. * @param getAverageClickPosition.index - The index name to target. * @param getAverageClickPosition.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getAverageClickPosition.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -154,7 +154,7 @@ export class AnalyticsApi { * Returns the distribution of clicks per range of positions. * * @summary Returns the distribution of clicks per range of positions. - * @param getClickPositions - The getClickPositions parameters. + * @param getClickPositions - The getClickPositions object. * @param getClickPositions.index - The index name to target. * @param getClickPositions.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickPositions.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -208,7 +208,7 @@ export class AnalyticsApi { * Returns a click-through rate (CTR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of clicks and searches used to compute the rates. * * @summary Returns a click-through rate (CTR). - * @param getClickThroughRate - The getClickThroughRate parameters. + * @param getClickThroughRate - The getClickThroughRate object. * @param getClickThroughRate.index - The index name to target. * @param getClickThroughRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickThroughRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -262,7 +262,7 @@ export class AnalyticsApi { * Returns a conversion rate (CR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of conversion and searches used to compute the rates. * * @summary Returns a conversion rate (CR). - * @param getConversationRate - The getConversationRate parameters. + * @param getConversationRate - The getConversationRate object. * @param getConversationRate.index - The index name to target. * @param getConversationRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getConversationRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -316,7 +316,7 @@ export class AnalyticsApi { * Returns the rate at which searches didn\'t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. * * @summary Returns the rate at which searches didn\'t lead to any clicks. - * @param getNoClickRate - The getNoClickRate parameters. + * @param getNoClickRate - The getNoClickRate object. * @param getNoClickRate.index - The index name to target. * @param getNoClickRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoClickRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -370,7 +370,7 @@ export class AnalyticsApi { * Returns the rate at which searches didn\'t return any results. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without results used to compute the rates. * * @summary Returns the rate at which searches didn\'t return any results. - * @param getNoResultsRate - The getNoResultsRate parameters. + * @param getNoResultsRate - The getNoResultsRate object. * @param getNoResultsRate.index - The index name to target. * @param getNoResultsRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoResultsRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -424,7 +424,7 @@ export class AnalyticsApi { * Returns the number of searches across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. * * @summary Returns the number of searches across the given time range. - * @param getSearchesCount - The getSearchesCount parameters. + * @param getSearchesCount - The getSearchesCount object. * @param getSearchesCount.index - The index name to target. * @param getSearchesCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getSearchesCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -478,7 +478,7 @@ export class AnalyticsApi { * Returns top searches that didn\'t lead to any clicks. Limited to the 1000 most frequent ones. For each search, also returns the average number of found hits. * * @summary Returns top searches that didn\'t lead to any clicks. - * @param getSearchesNoClicks - The getSearchesNoClicks parameters. + * @param getSearchesNoClicks - The getSearchesNoClicks object. * @param getSearchesNoClicks.index - The index name to target. * @param getSearchesNoClicks.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getSearchesNoClicks.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -544,7 +544,7 @@ export class AnalyticsApi { * Returns top searches that didn\'t return any results. Limited to the 1000 most frequent ones. * * @summary Returns top searches that didn\'t return any results. - * @param getSearchesNoResults - The getSearchesNoResults parameters. + * @param getSearchesNoResults - The getSearchesNoResults object. * @param getSearchesNoResults.index - The index name to target. * @param getSearchesNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getSearchesNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -610,7 +610,7 @@ export class AnalyticsApi { * Returns the latest update time of the analytics API for a given index. If the index has been recently created and/or no search has been performed yet the updated time will be null. * * @summary Get latest update time of the analytics API. - * @param getStatus - The getStatus parameters. + * @param getStatus - The getStatus object. * @param getStatus.index - The index name to target. */ getStatus({ index }: GetStatusProps): Promise { @@ -644,7 +644,7 @@ export class AnalyticsApi { * Returns top countries. Limited to the 1000 most frequent ones. * * @summary Returns top countries. - * @param getTopCountries - The getTopCountries parameters. + * @param getTopCountries - The getTopCountries object. * @param getTopCountries.index - The index name to target. * @param getTopCountries.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getTopCountries.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -710,7 +710,7 @@ export class AnalyticsApi { * Returns top filter attributes. Limited to the 1000 most used filters. * * @summary Returns top filter attributes. - * @param getTopFilterAttributes - The getTopFilterAttributes parameters. + * @param getTopFilterAttributes - The getTopFilterAttributes object. * @param getTopFilterAttributes.index - The index name to target. * @param getTopFilterAttributes.search - The query term to search for. Must match the exact user input. * @param getTopFilterAttributes.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -782,7 +782,7 @@ export class AnalyticsApi { * Returns top filters for the given attribute. Limited to the 1000 most used filters. * * @summary Returns top filters for the given attribute. - * @param getTopFilterForAttribute - The getTopFilterForAttribute parameters. + * @param getTopFilterForAttribute - The getTopFilterForAttribute object. * @param getTopFilterForAttribute.attribute - The exact name of the attribute. * @param getTopFilterForAttribute.index - The index name to target. * @param getTopFilterForAttribute.search - The query term to search for. Must match the exact user input. @@ -865,7 +865,7 @@ export class AnalyticsApi { * Returns top filters with no results. Limited to the 1000 most used filters. * * @summary Returns top filters with no results. - * @param getTopFiltersNoResults - The getTopFiltersNoResults parameters. + * @param getTopFiltersNoResults - The getTopFiltersNoResults object. * @param getTopFiltersNoResults.index - The index name to target. * @param getTopFiltersNoResults.search - The query term to search for. Must match the exact user input. * @param getTopFiltersNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -937,7 +937,7 @@ export class AnalyticsApi { * Returns top hits. Limited to the 1000 most frequent ones. * * @summary Returns top hits. - * @param getTopHits - The getTopHits parameters. + * @param getTopHits - The getTopHits object. * @param getTopHits.index - The index name to target. * @param getTopHits.search - The query term to search for. Must match the exact user input. * @param getTopHits.clickAnalytics - Whether to include the click-through and conversion rates for a search. @@ -1017,7 +1017,7 @@ export class AnalyticsApi { * Returns top searches. Limited to the 1000 most frequent ones. For each search, also returns the average number of hits returned. * * @summary Returns top searches. - * @param getTopSearches - The getTopSearches parameters. + * @param getTopSearches - The getTopSearches object. * @param getTopSearches.index - The index name to target. * @param getTopSearches.clickAnalytics - Whether to include the click-through and conversion rates for a search. * @param getTopSearches.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. @@ -1103,7 +1103,7 @@ export class AnalyticsApi { * Returns the distinct count of users across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day. * * @summary Returns the distinct count of users across the given time range. - * @param getUsersCount - The getUsersCount parameters. + * @param getUsersCount - The getUsersCount object. * @param getUsersCount.index - The index name to target. * @param getUsersCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getUsersCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. diff --git a/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts b/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts index 6b88d914622..b96dec95c05 100644 --- a/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts +++ b/clients/algoliasearch-client-javascript/client-insights/src/insightsApi.ts @@ -78,7 +78,7 @@ export class InsightsApi { * This command pushes an array of events. * * @summary Pushes an array of events. - * @param insightEvents - The insightEvents parameter. + * @param insightEvents - The insightEvents object. */ pushEvents(insightEvents: InsightEvents): Promise { const path = '/1/events'; diff --git a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts index ab211aba0bd..06e03552f64 100644 --- a/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts +++ b/clients/algoliasearch-client-javascript/client-personalization/src/personalizationApi.ts @@ -85,7 +85,7 @@ export class PersonalizationApi { * Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours before for the deletion request to be fully processed. * * @summary Delete the user profile and all its associated data. - * @param deleteUserProfile - The deleteUserProfile parameters. + * @param deleteUserProfile - The deleteUserProfile object. * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. */ deleteUserProfile({ @@ -142,7 +142,7 @@ export class PersonalizationApi { * The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. * * @summary Get the user profile built from Personalization strategy. - * @param getUserTokenProfile - The getUserTokenProfile parameters. + * @param getUserTokenProfile - The getUserTokenProfile object. * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. */ getUserTokenProfile({ @@ -177,7 +177,7 @@ export class PersonalizationApi { * A strategy defines the events and facets that impact user profiles and personalized search results. * * @summary Set a new personalization strategy. - * @param personalizationStrategyObject - The personalizationStrategyObject parameter. + * @param personalizationStrategyObject - The personalizationStrategyObject object. */ setPersonalizationStrategy( personalizationStrategyObject: PersonalizationStrategyObject diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 282579e8b3e..423a51dde0e 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -153,7 +153,7 @@ export class SearchApi { * Add a new API Key with specific permissions/restrictions. * * @summary Create a new API key. - * @param apiKey - The apiKey parameter. + * @param apiKey - The apiKey object. */ addApiKey(apiKey: ApiKey): Promise { const path = '/1/keys'; @@ -189,7 +189,7 @@ export class SearchApi { * Add or replace an object with a given object ID. If the object does not exist, it will be created. If it already exists, it will be replaced. * * @summary Add or replace an object with a given object ID. - * @param addOrUpdateObject - The addOrUpdateObject parameters. + * @param addOrUpdateObject - The addOrUpdateObject object. * @param addOrUpdateObject.indexName - The index in which to perform the request. * @param addOrUpdateObject.objectID - Unique identifier of an object. * @param addOrUpdateObject.body - The Algolia object. @@ -269,9 +269,9 @@ export class SearchApi { * Assign or Move a userID to a cluster. The time it takes to migrate (move) a user is proportional to the amount of data linked to the userID. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userID is directly usable. * * @summary Assign or Move userID. - * @param assignUserId - The assignUserId parameters. + * @param assignUserId - The assignUserId object. * @param assignUserId.xAlgoliaUserID - UserID to assign. - * @param assignUserId.assignUserIdObject - The assignUserIdObject parameter. + * @param assignUserId.assignUserIdObject - The assignUserIdObject object. */ assignUserId({ xAlgoliaUserID, @@ -322,9 +322,9 @@ export class SearchApi { /** * Performs multiple write operations in a single API call. * - * @param batch - The batch parameters. + * @param batch - The batch object. * @param batch.indexName - The index in which to perform the request. - * @param batch.batchWriteObject - The batchWriteObject parameter. + * @param batch.batchWriteObject - The batchWriteObject object. */ batch({ indexName, batchWriteObject }: BatchProps): Promise { const path = '/1/indexes/{indexName}/batch'.replace( @@ -363,9 +363,9 @@ export class SearchApi { * Assign multiple userIDs to a cluster. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. * * @summary Batch assign userIDs. - * @param batchAssignUserIds - The batchAssignUserIds parameters. + * @param batchAssignUserIds - The batchAssignUserIds object. * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. - * @param batchAssignUserIds.batchAssignUserIdsObject - The batchAssignUserIdsObject parameter. + * @param batchAssignUserIds.batchAssignUserIdsObject - The batchAssignUserIdsObject object. */ batchAssignUserIds({ xAlgoliaUserID, @@ -428,9 +428,9 @@ export class SearchApi { * Send a batch of dictionary entries. * * @summary Send a batch of dictionary entries. - * @param batchDictionaryEntries - The batchDictionaryEntries parameters. + * @param batchDictionaryEntries - The batchDictionaryEntries object. * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param batchDictionaryEntries.batchDictionaryEntries - The batchDictionaryEntries parameter. + * @param batchDictionaryEntries.batchDictionaryEntries - The batchDictionaryEntries object. */ batchDictionaryEntries({ dictionaryName, @@ -484,9 +484,9 @@ export class SearchApi { * Create or update a batch of Rules. * * @summary Batch Rules. - * @param batchRules - The batchRules parameters. + * @param batchRules - The batchRules object. * @param batchRules.indexName - The index in which to perform the request. - * @param batchRules.rule - The rule parameter. + * @param batchRules.rule - The rule object. * @param batchRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param batchRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. */ @@ -540,9 +540,9 @@ export class SearchApi { * This method allows you to retrieve all index content. It can retrieve up to 1,000 records per call and supports full text search and filters. For performance reasons, some features are not supported, including `distinct`, sorting by `typos`, `words` or `geo distance`. When there is more content to be browsed, the response contains a cursor field. This cursor has to be passed to the subsequent call to browse in order to get the next page of results. When the end of the index has been reached, the cursor field is absent from the response. * * @summary Retrieve all index content. - * @param browse - The browse parameters. + * @param browse - The browse object. * @param browse.indexName - The index in which to perform the request. - * @param browse.browseRequest - The browseRequest parameter. + * @param browse.browseRequest - The browseRequest object. */ browse({ indexName, browseRequest }: BrowseProps): Promise { const path = '/1/indexes/{indexName}/browse'.replace( @@ -575,7 +575,7 @@ export class SearchApi { * Remove all synonyms from an index. * * @summary Clear all synonyms. - * @param clearAllSynonyms - The clearAllSynonyms parameters. + * @param clearAllSynonyms - The clearAllSynonyms object. * @param clearAllSynonyms.indexName - The index in which to perform the request. * @param clearAllSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ @@ -616,7 +616,7 @@ export class SearchApi { * Delete an index\'s content, but leave settings and index-specific API keys untouched. * * @summary Clear all objects from an index. - * @param clearObjects - The clearObjects parameters. + * @param clearObjects - The clearObjects object. * @param clearObjects.indexName - The index in which to perform the request. */ clearObjects({ indexName }: ClearObjectsProps): Promise { @@ -649,7 +649,7 @@ export class SearchApi { * Delete all Rules in the index. * * @summary Clear Rules. - * @param clearRules - The clearRules parameters. + * @param clearRules - The clearRules object. * @param clearRules.indexName - The index in which to perform the request. * @param clearRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ @@ -690,7 +690,7 @@ export class SearchApi { * Delete an existing API Key. * * @summary Delete an API key. - * @param deleteApiKey - The deleteApiKey parameters. + * @param deleteApiKey - The deleteApiKey object. * @param deleteApiKey.key - API Key string. */ deleteApiKey({ key }: DeleteApiKeyProps): Promise { @@ -723,9 +723,9 @@ export class SearchApi { * Remove all objects matching a filter (including geo filters). This method enables you to delete one or more objects based on filters (numeric, facet, tag or geo queries). It doesn\'t accept empty filters or a query. * * @summary Delete all records matching the query. - * @param deleteBy - The deleteBy parameters. + * @param deleteBy - The deleteBy object. * @param deleteBy.indexName - The index in which to perform the request. - * @param deleteBy.searchParams - The searchParams parameter. + * @param deleteBy.searchParams - The searchParams object. */ deleteBy({ indexName, @@ -767,7 +767,7 @@ export class SearchApi { * Delete an existing index. * * @summary Delete index. - * @param deleteIndex - The deleteIndex parameters. + * @param deleteIndex - The deleteIndex object. * @param deleteIndex.indexName - The index in which to perform the request. */ deleteIndex({ indexName }: DeleteIndexProps): Promise { @@ -800,7 +800,7 @@ export class SearchApi { * Delete an existing object. * * @summary Delete object. - * @param deleteObject - The deleteObject parameters. + * @param deleteObject - The deleteObject object. * @param deleteObject.indexName - The index in which to perform the request. * @param deleteObject.objectID - Unique identifier of an object. */ @@ -842,7 +842,7 @@ export class SearchApi { * Delete the Rule with the specified objectID. * * @summary Delete a rule. - * @param deleteRule - The deleteRule parameters. + * @param deleteRule - The deleteRule object. * @param deleteRule.indexName - The index in which to perform the request. * @param deleteRule.objectID - Unique identifier of an object. * @param deleteRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. @@ -889,7 +889,7 @@ export class SearchApi { /** * Remove a single source from the list of allowed sources. * - * @param deleteSource - The deleteSource parameters. + * @param deleteSource - The deleteSource object. * @param deleteSource.source - The IP range of the source. */ deleteSource({ source }: DeleteSourceProps): Promise { @@ -922,7 +922,7 @@ export class SearchApi { * Delete a single synonyms set, identified by the given objectID. * * @summary Delete synonym. - * @param deleteSynonym - The deleteSynonym parameters. + * @param deleteSynonym - The deleteSynonym object. * @param deleteSynonym.indexName - The index in which to perform the request. * @param deleteSynonym.objectID - Unique identifier of an object. * @param deleteSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. @@ -970,7 +970,7 @@ export class SearchApi { * Get the permissions of an API key. * * @summary Get an API key. - * @param getApiKey - The getApiKey parameters. + * @param getApiKey - The getApiKey object. * @param getApiKey.key - API Key string. */ getApiKey({ key }: GetApiKeyProps): Promise { @@ -1046,7 +1046,7 @@ export class SearchApi { /** * Return the lastest log entries. * - * @param getLogs - The getLogs parameters. + * @param getLogs - The getLogs object. * @param getLogs.offset - First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. * @param getLogs.length - Maximum number of entries to retrieve. The maximum allowed value is 1000. * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. @@ -1094,10 +1094,10 @@ export class SearchApi { * Retrieve one object from the index. * * @summary Retrieve one object from the index. - * @param getObject - The getObject parameters. + * @param getObject - The getObject object. * @param getObject.indexName - The index in which to perform the request. * @param getObject.objectID - Unique identifier of an object. - * @param getObject.attributesToRetrieve - The attributesToRetrieve parameter. + * @param getObject.attributesToRetrieve - List of attributes to retrieve. If not specified, all retrievable attributes are returned. */ getObject({ indexName, @@ -1142,7 +1142,7 @@ export class SearchApi { * Retrieve one or more objects, potentially from different indices, in a single API call. * * @summary Retrieve one or more objects. - * @param getObjectsObject - The getObjectsObject parameter. + * @param getObjectsObject - The getObjectsObject object. */ getObjects(getObjectsObject: GetObjectsObject): Promise { const path = '/1/indexes/*/objects'; @@ -1172,7 +1172,7 @@ export class SearchApi { * Retrieve the Rule with the specified objectID. * * @summary Get a rule. - * @param getRule - The getRule parameters. + * @param getRule - The getRule object. * @param getRule.indexName - The index in which to perform the request. * @param getRule.objectID - Unique identifier of an object. */ @@ -1210,7 +1210,7 @@ export class SearchApi { /** * Retrieve settings of a given indexName. * - * @param getSettings - The getSettings parameters. + * @param getSettings - The getSettings object. * @param getSettings.indexName - The index in which to perform the request. */ getSettings({ indexName }: GetSettingsProps): Promise { @@ -1263,7 +1263,7 @@ export class SearchApi { * Fetch a synonym object identified by its objectID. * * @summary Get synonym. - * @param getSynonym - The getSynonym parameters. + * @param getSynonym - The getSynonym object. * @param getSynonym.indexName - The index in which to perform the request. * @param getSynonym.objectID - Unique identifier of an object. */ @@ -1301,7 +1301,7 @@ export class SearchApi { /** * Check the current status of a given task. * - * @param getTask - The getTask parameters. + * @param getTask - The getTask object. * @param getTask.indexName - The index in which to perform the request. * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits). */ @@ -1362,7 +1362,7 @@ export class SearchApi { * Returns the userID data stored in the mapping. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userID data. * * @summary Get userID. - * @param getUserId - The getUserId parameters. + * @param getUserId - The getUserId object. * @param getUserId.userID - UserID to assign. */ getUserId({ userID }: GetUserIdProps): Promise { @@ -1395,8 +1395,8 @@ export class SearchApi { * Get the status of your clusters\' migrations or user creations. Creating a large batch of users or migrating your multi-cluster may take quite some time. This method lets you retrieve the status of the migration, so you can know when it\'s done. Upon success, the response is 200 OK. A successful response indicates that the operation has been taken into account, and the userIDs are directly usable. * * @summary Has pending mappings. - * @param hasPendingMappings - The hasPendingMappings parameters. - * @param hasPendingMappings.getClusters - The getClusters parameter. + * @param hasPendingMappings - The hasPendingMappings object. + * @param hasPendingMappings.getClusters - Whether to get clusters or not. */ hasPendingMappings({ getClusters, @@ -1469,7 +1469,7 @@ export class SearchApi { * List existing indexes from an application. * * @summary List existing indexes. - * @param listIndices - The listIndices parameters. + * @param listIndices - The listIndices object. * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). */ listIndices({ page }: ListIndicesProps): Promise { @@ -1497,7 +1497,7 @@ export class SearchApi { * List the userIDs assigned to a multi-clusters appID. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following userIDs data. * * @summary List userIDs. - * @param listUserIds - The listUserIds parameters. + * @param listUserIds - The listUserIds object. * @param listUserIds.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve. */ @@ -1532,7 +1532,7 @@ export class SearchApi { /** * Perform multiple write operations, potentially targeting multiple indices, in a single API call. * - * @param batchObject - The batchObject parameter. + * @param batchObject - The batchObject object. */ multipleBatch(batchObject: BatchObject): Promise { const path = '/1/indexes/*/batch'; @@ -1561,7 +1561,7 @@ export class SearchApi { /** * Get search results for the given requests. * - * @param multipleQueriesObject - The multipleQueriesObject parameter. + * @param multipleQueriesObject - The multipleQueriesObject object. */ multipleQueries( multipleQueriesObject: MultipleQueriesObject @@ -1602,9 +1602,9 @@ export class SearchApi { * Peforms a copy or a move operation on a index. * * @summary Copy/move index. - * @param operationIndex - The operationIndex parameters. + * @param operationIndex - The operationIndex object. * @param operationIndex.indexName - The index in which to perform the request. - * @param operationIndex.operationIndexObject - The operationIndexObject parameter. + * @param operationIndex.operationIndexObject - The operationIndexObject object. */ operationIndex({ indexName, @@ -1663,7 +1663,7 @@ export class SearchApi { * Update one or more attributes of an existing object. This method lets you update only a part of an existing object, either by adding new attributes or updating existing ones. You can partially update several objects in a single method call. If the index targeted by this operation doesn\'t exist yet, it\'s automatically created. * * @summary Partially update an object. - * @param partialUpdateObject - The partialUpdateObject parameters. + * @param partialUpdateObject - The partialUpdateObject object. * @param partialUpdateObject.indexName - The index in which to perform the request. * @param partialUpdateObject.objectID - Unique identifier of an object. * @param partialUpdateObject.stringBuildInOperation - The Algolia object. @@ -1723,7 +1723,7 @@ export class SearchApi { * Remove a userID and its associated data from the multi-clusters. Upon success, the response is 200 OK and a task is created to remove the userID data and mapping. * * @summary Remove userID. - * @param removeUserId - The removeUserId parameters. + * @param removeUserId - The removeUserId object. * @param removeUserId.userID - UserID to assign. */ removeUserId({ userID }: RemoveUserIdProps): Promise { @@ -1755,7 +1755,7 @@ export class SearchApi { /** * Replace all allowed sources. * - * @param replaceSources - The replaceSources parameters. + * @param replaceSources - The replaceSources object. * @param replaceSources.source - The sources to allow. */ replaceSources({ @@ -1788,7 +1788,7 @@ export class SearchApi { * Restore a deleted API key, along with its associated rights. * * @summary Restore an API key. - * @param restoreApiKey - The restoreApiKey parameters. + * @param restoreApiKey - The restoreApiKey object. * @param restoreApiKey.key - API Key string. */ restoreApiKey({ key }: RestoreApiKeyProps): Promise { @@ -1820,7 +1820,7 @@ export class SearchApi { /** * Add an object to the index, automatically assigning it an object ID. * - * @param saveObject - The saveObject parameters. + * @param saveObject - The saveObject object. * @param saveObject.indexName - The index in which to perform the request. * @param saveObject.body - The Algolia object. */ @@ -1864,10 +1864,10 @@ export class SearchApi { * Create or update the Rule with the specified objectID. * * @summary Save/Update a rule. - * @param saveRule - The saveRule parameters. + * @param saveRule - The saveRule object. * @param saveRule.indexName - The index in which to perform the request. * @param saveRule.objectID - Unique identifier of an object. - * @param saveRule.rule - The rule parameter. + * @param saveRule.rule - The rule object. * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ saveRule({ @@ -1932,10 +1932,10 @@ export class SearchApi { * Create a new synonym object or update the existing synonym object with the given object ID. * * @summary Save synonym. - * @param saveSynonym - The saveSynonym parameters. + * @param saveSynonym - The saveSynonym object. * @param saveSynonym.indexName - The index in which to perform the request. * @param saveSynonym.objectID - Unique identifier of an object. - * @param saveSynonym.synonymHit - The synonymHit parameter. + * @param saveSynonym.synonymHit - The synonymHit object. * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ saveSynonym({ @@ -2000,9 +2000,9 @@ export class SearchApi { * Create/update multiple synonym objects at once, potentially replacing the entire list of synonyms if replaceExistingSynonyms is true. * * @summary Save a batch of synonyms. - * @param saveSynonyms - The saveSynonyms parameters. + * @param saveSynonyms - The saveSynonyms object. * @param saveSynonyms.indexName - The index in which to perform the request. - * @param saveSynonyms.synonymHit - The synonymHit parameter. + * @param saveSynonyms.synonymHit - The synonymHit object. * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. */ @@ -2056,9 +2056,9 @@ export class SearchApi { /** * Get search results. * - * @param search - The search parameters. + * @param search - The search object. * @param search.indexName - The index in which to perform the request. - * @param search.searchParams - The searchParams parameter. + * @param search.searchParams - The searchParams object. */ search({ indexName, searchParams }: SearchProps): Promise { const path = '/1/indexes/{indexName}/query'.replace( @@ -2097,9 +2097,9 @@ export class SearchApi { * Search the dictionary entries. * * @summary Search the dictionary entries. - * @param searchDictionaryEntries - The searchDictionaryEntries parameters. + * @param searchDictionaryEntries - The searchDictionaryEntries object. * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. - * @param searchDictionaryEntries.searchDictionaryEntries - The searchDictionaryEntries parameter. + * @param searchDictionaryEntries.searchDictionaryEntries - The searchDictionaryEntries object. */ searchDictionaryEntries({ dictionaryName, @@ -2153,10 +2153,10 @@ export class SearchApi { * Search for values of a given facet, optionally restricting the returned values to those contained in objects matching other search criteria. * * @summary Search for values of a given facet. - * @param searchForFacetValues - The searchForFacetValues parameters. + * @param searchForFacetValues - The searchForFacetValues object. * @param searchForFacetValues.indexName - The index in which to perform the request. * @param searchForFacetValues.facetName - The facet name. - * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest parameter. + * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. */ searchForFacetValues({ indexName, @@ -2198,9 +2198,9 @@ export class SearchApi { * Search for rules matching various criteria. * * @summary Search for rules. - * @param searchRules - The searchRules parameters. + * @param searchRules - The searchRules object. * @param searchRules.indexName - The index in which to perform the request. - * @param searchRules.searchRulesParams - The searchRulesParams parameter. + * @param searchRules.searchRulesParams - The searchRulesParams object. */ searchRules({ indexName, @@ -2242,7 +2242,7 @@ export class SearchApi { * Search or browse all synonyms, optionally filtering them by type. * * @summary Get all synonyms that match a query. - * @param searchSynonyms - The searchSynonyms parameters. + * @param searchSynonyms - The searchSynonyms object. * @param searchSynonyms.indexName - The index in which to perform the request. * @param searchSynonyms.query - Search for specific synonyms matching this string. * @param searchSynonyms.type - Only search for specific types of synonyms. @@ -2301,7 +2301,7 @@ export class SearchApi { * Search for userIDs. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds propagate to the different clusters. To keep updates moving quickly, the index of userIDs isn\'t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h. Upon success, the response is 200 OK and contains the following userIDs data. * * @summary Search userID. - * @param searchUserIdsObject - The searchUserIdsObject parameter. + * @param searchUserIdsObject - The searchUserIdsObject object. */ searchUserIds( searchUserIdsObject: SearchUserIdsObject @@ -2342,7 +2342,7 @@ export class SearchApi { * Set dictionary settings. * * @summary Set dictionary settings. - * @param dictionarySettingsRequest - The dictionarySettingsRequest parameter. + * @param dictionarySettingsRequest - The dictionarySettingsRequest object. */ setDictionarySettings( dictionarySettingsRequest: DictionarySettingsRequest @@ -2385,9 +2385,9 @@ export class SearchApi { /** * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * - * @param setSettings - The setSettings parameters. + * @param setSettings - The setSettings object. * @param setSettings.indexName - The index in which to perform the request. - * @param setSettings.indexSettings - The indexSettings parameter. + * @param setSettings.indexSettings - The indexSettings object. * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. */ setSettings({ @@ -2435,9 +2435,9 @@ export class SearchApi { * Replace every permission of an existing API key. * * @summary Update an API key. - * @param updateApiKey - The updateApiKey parameters. + * @param updateApiKey - The updateApiKey object. * @param updateApiKey.key - API Key string. - * @param updateApiKey.apiKey - The apiKey parameter. + * @param updateApiKey.apiKey - The apiKey object. */ updateApiKey({ key, @@ -2503,9 +2503,6 @@ export type AssignUserIdProps = { * UserID to assign. */ xAlgoliaUserID: string; - /** - * The assignUserIdObject parameter. - */ assignUserIdObject: AssignUserIdObject; }; @@ -2514,9 +2511,6 @@ export type BatchProps = { * The index in which to perform the request. */ indexName: string; - /** - * The batchWriteObject parameter. - */ batchWriteObject: BatchWriteObject; }; @@ -2525,9 +2519,6 @@ export type BatchAssignUserIdsProps = { * UserID to assign. */ xAlgoliaUserID: string; - /** - * The batchAssignUserIdsObject parameter. - */ batchAssignUserIdsObject: BatchAssignUserIdsObject; }; @@ -2536,9 +2527,6 @@ export type BatchDictionaryEntriesProps = { * The dictionary to search in. */ dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - /** - * The batchDictionaryEntries parameter. - */ batchDictionaryEntries: BatchDictionaryEntries; }; @@ -2547,9 +2535,6 @@ export type BatchRulesProps = { * The index in which to perform the request. */ indexName: string; - /** - * The rule parameter. - */ rule: Rule[]; /** * When true, changes are also propagated to replicas of the given indexName. @@ -2566,9 +2551,6 @@ export type BrowseProps = { * The index in which to perform the request. */ indexName: string; - /** - * The browseRequest parameter. - */ browseRequest?: BrowseRequest; }; @@ -2613,9 +2595,6 @@ export type DeleteByProps = { * The index in which to perform the request. */ indexName: string; - /** - * The searchParams parameter. - */ searchParams: SearchParams; }; @@ -2710,7 +2689,7 @@ export type GetObjectProps = { */ objectID: string; /** - * The attributesToRetrieve parameter. + * List of attributes to retrieve. If not specified, all retrievable attributes are returned. */ attributesToRetrieve?: string[]; }; @@ -2764,7 +2743,7 @@ export type GetUserIdProps = { export type HasPendingMappingsProps = { /** - * The getClusters parameter. + * Whether to get clusters or not. */ getClusters?: boolean; }; @@ -2792,9 +2771,6 @@ export type OperationIndexProps = { * The index in which to perform the request. */ indexName: string; - /** - * The operationIndexObject parameter. - */ operationIndexObject: OperationIndexObject; }; @@ -2858,9 +2834,6 @@ export type SaveRuleProps = { * Unique identifier of an object. */ objectID: string; - /** - * The rule parameter. - */ rule: Rule; /** * When true, changes are also propagated to replicas of the given indexName. @@ -2877,9 +2850,6 @@ export type SaveSynonymProps = { * Unique identifier of an object. */ objectID: string; - /** - * The synonymHit parameter. - */ synonymHit: SynonymHit; /** * When true, changes are also propagated to replicas of the given indexName. @@ -2892,9 +2862,6 @@ export type SaveSynonymsProps = { * The index in which to perform the request. */ indexName: string; - /** - * The synonymHit parameter. - */ synonymHit: SynonymHit[]; /** * When true, changes are also propagated to replicas of the given indexName. @@ -2911,9 +2878,6 @@ export type SearchProps = { * The index in which to perform the request. */ indexName: string; - /** - * The searchParams parameter. - */ searchParams: SearchParams; }; @@ -2922,9 +2886,6 @@ export type SearchDictionaryEntriesProps = { * The dictionary to search in. */ dictionaryName: 'compounds' | 'plurals' | 'stopwords'; - /** - * The searchDictionaryEntries parameter. - */ searchDictionaryEntries: SearchDictionaryEntries; }; @@ -2937,9 +2898,6 @@ export type SearchForFacetValuesProps = { * The facet name. */ facetName: string; - /** - * The searchForFacetValuesRequest parameter. - */ searchForFacetValuesRequest?: SearchForFacetValuesRequest; }; @@ -2948,9 +2906,6 @@ export type SearchRulesProps = { * The index in which to perform the request. */ indexName: string; - /** - * The searchRulesParams parameter. - */ searchRulesParams: SearchRulesParams; }; @@ -2987,9 +2942,6 @@ export type SetSettingsProps = { * The index in which to perform the request. */ indexName: string; - /** - * The indexSettings parameter. - */ indexSettings: IndexSettings; /** * When true, changes are also propagated to replicas of the given indexName. @@ -3002,8 +2954,5 @@ export type UpdateApiKeyProps = { * API Key string. */ key: string; - /** - * The apiKey parameter. - */ apiKey: ApiKey; }; diff --git a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts index df3b2361636..05f0a90d474 100644 --- a/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts +++ b/clients/algoliasearch-client-javascript/recommend/src/recommendApi.ts @@ -99,7 +99,7 @@ export class RecommendApi { /** * Returns recommendations for a specific model and objectID. * - * @param getRecommendations - The getRecommendations parameter. + * @param getRecommendations - The getRecommendations object. */ getRecommendations( getRecommendations: GetRecommendations diff --git a/specs/search/paths/multiclusters/hasPendingMappings.yml b/specs/search/paths/multiclusters/hasPendingMappings.yml index b073c8e80c5..12d8bc4ac02 100644 --- a/specs/search/paths/multiclusters/hasPendingMappings.yml +++ b/specs/search/paths/multiclusters/hasPendingMappings.yml @@ -14,6 +14,7 @@ get: parameters: - in: query name: getClusters + description: Whether to get clusters or not. schema: type: boolean responses: diff --git a/specs/search/paths/objects/object.yml b/specs/search/paths/objects/object.yml index 6c68d8abc96..a5eda8394f0 100644 --- a/specs/search/paths/objects/object.yml +++ b/specs/search/paths/objects/object.yml @@ -37,6 +37,7 @@ get: - $ref: ../../../common/parameters.yml#/ObjectID - name: attributesToRetrieve in: query + description: List of attributes to retrieve. If not specified, all retrievable attributes are returned. schema: type: array items: diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 8fb1b2b191c..c78d3985ff7 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -141,9 +141,9 @@ export class {{classname}} { {{/summary}} {{#allParams.0}} {{^bodyParams.0}} - * @param {{nickname}} - The {{nickname}} parameters. + * @param {{nickname}} - The {{nickname}} object. {{#allParams}} - * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} {{/bodyParams.0}} {{#bodyParams.0}} @@ -151,27 +151,27 @@ export class {{classname}} { {{^pathParams.0}} {{#bodyParams.0.isArray}} {{^bodyParams.1}} - * @param {{nickname}} - The {{nickname}} parameters. + * @param {{nickname}} - The {{nickname}} object. {{#allParams}} - * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} {{/bodyParams.1}} {{/bodyParams.0.isArray}} {{^bodyParams.0.isArray}} - * @param {{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{paramName}} {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} {{/bodyParams.0.isArray}} {{/pathParams.0}} {{#pathParams.0}} - * @param {{nickname}} - The {{nickname}} parameters. + * @param {{nickname}} - The {{nickname}} object. {{#allParams}} - * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} {{/pathParams.0}} {{/queryParams.0}} {{#queryParams.0}} - * @param {{nickname}} - The {{nickname}} parameters. + * @param {{nickname}} - The {{nickname}} object. {{#allParams}} - * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * @param {{nickname}}.{{paramName}} {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} {{/queryParams.0}} {{/bodyParams.0}} @@ -280,9 +280,11 @@ export class {{classname}} { {{^bodyParams.0}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} + {{#description}} /** - * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * {{{description}}} */ + {{/description}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } @@ -294,9 +296,11 @@ export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{^bodyParams.1}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} + {{#description}} /** - * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * {{{description}}} */ + {{/description}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } @@ -306,9 +310,11 @@ export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#pathParams.0}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} + {{#description}} /** - * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * {{{description}}} */ + {{/description}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } @@ -317,9 +323,11 @@ export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#queryParams.0}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} + {{#description}} /** - * {{^description}}The {{paramName}} parameter.{{/description}}{{#description}}{{{description}}}{{/description}} + * {{{description}}} */ + {{/description}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } From 8f891f697a8626e2cdf6106fd4e76ba60f52f772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 12 Jan 2022 11:46:03 +0100 Subject: [PATCH 6/6] fix description --- .../algoliasearch-core/com/algolia/search/SearchApi.java | 6 +++--- .../client-search/src/searchApi.ts | 4 ++-- specs/search/paths/objects/partialUpdate.yml | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index cd23f19d42f..c9d7474ac96 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -3988,7 +3988,7 @@ public Call operationIndexAsync( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param buildInOperation The Algolia object. (required) + * @param buildInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback Callback for upload/download progress @@ -4084,7 +4084,7 @@ private Call partialUpdateObjectValidateBeforeCall( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param buildInOperation The Algolia object. (required) + * @param buildInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @return UpdatedAtWithObjectIdResponse @@ -4120,7 +4120,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param buildInOperation The Algolia object. (required) + * @param buildInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback The callback to be executed when the API call finishes diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 423a51dde0e..1314cb7f82d 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -1666,7 +1666,7 @@ export class SearchApi { * @param partialUpdateObject - The partialUpdateObject object. * @param partialUpdateObject.indexName - The index in which to perform the request. * @param partialUpdateObject.objectID - Unique identifier of an object. - * @param partialUpdateObject.stringBuildInOperation - The Algolia object. + * @param partialUpdateObject.stringBuildInOperation - List of attributes to update. * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet. */ partialUpdateObject({ @@ -2784,7 +2784,7 @@ export type PartialUpdateObjectProps = { */ objectID: string; /** - * The Algolia object. + * List of attributes to update. */ stringBuildInOperation: Array<{ [key: string]: BuildInOperation | string }>; /** diff --git a/specs/search/paths/objects/partialUpdate.yml b/specs/search/paths/objects/partialUpdate.yml index 81f822b7f1b..23e790e8af9 100644 --- a/specs/search/paths/objects/partialUpdate.yml +++ b/specs/search/paths/objects/partialUpdate.yml @@ -22,12 +22,11 @@ post: default: true requestBody: required: true - description: The Algolia object. + description: List of attributes to update. content: application/json: schema: type: array - description: List of attributes to update. additionalProperties: false items: type: object