Skip to content

feat: add full clients architecture init #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
nvm use && yarn
```

## Generate clients based on the [`spec.yml` file](./specs/spec.yml)
## Generate clients based on the [`spec.yml` file](./search/specs.yml)

```bash
yarn generate
yarn generate:search
```

## Build generated clients
Expand Down
2 changes: 1 addition & 1 deletion openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"config": "#{cwd}/openapitools.json",
"apiPackage": "client-search",
"output": "#{cwd}/clients/algoliasearch-client-javascript",
"glob": "specs/spec.yml",
"glob": "specs/search/spec.yml",
"gitHost": "algolia",
"gitUserId": "algolia",
"gitRepoId": "algoliasearch-client-javascript",
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
"playground/javascript/"
],
"scripts": {
"build:spec": "yarn swagger-cli bundle specs/spec.yml --outfile dist/openapi.yml --type yaml",
"build:spec:json": "yarn swagger-cli bundle specs/spec.yml --outfile dist/openapi.json --type json",
"build:spec": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/openapi.yml --type yaml",
"build:spec:json": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/openapi.json --type json",
"clean": "rm -rf **/dist **/build **/node_modules",
"client:build-js": "cd clients/algoliasearch-client-javascript/ && yarn install && yarn build && cd ../../",
"client:build": "yarn client:build-js",
"lint:js": "yarn prettier --write clients/algoliasearch-client-javascript clients/utils/javascript",
"lint:specs": "yarn prettier --write specs",
"lint": "yarn lint:specs && yarn lint:js",
"generate:js": "PACKAGE_VERSION='4.11.0' yarn openapi-generator-cli generate --generator-key javascript-client && yarn install && yarn utils:import-js",
"generate:js:search": "PACKAGE_VERSION='4.11.0' yarn openapi-generator-cli generate -i specs/search/spec.yml --generator-key javascript-client && yarn install && yarn utils:import-js",
"generate": "yarn generate:js && yarn lint",
"generate:search": "yarn generate:js:search && yarn lint",
"playground:js": "yarn workspace algoliasearch-client-javascript-playground start",
"utils:import-js": "mkdir -p -- clients/algoliasearch-client-javascript/utils && cp -R clients/utils/javascript/ clients/algoliasearch-client-javascript/utils"
},
Expand Down
2 changes: 2 additions & 0 deletions specs/abtesting/paths/abtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get:
delete:
2 changes: 2 additions & 0 deletions specs/abtesting/paths/abtests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post:
get:
1 change: 1 addition & 0 deletions specs/abtesting/paths/stopAbTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
21 changes: 21 additions & 0 deletions specs/abtesting/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
openapi: 3.0.2
info:
title: A/B Testing API
description: API powering the A/B Testing feature of Algolia.
version: 0.0.1
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
/2/abtests:
$ref: './paths/abtests.yml'
# /2/abtests/{id}:
# $ref: './paths/abtest.yml'
# /2/abtests/{id}/stop:
# $ref: './paths/stopAbTest.yml'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/click/getClickPositions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/click/getClickThroughRate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/click/getConversionRate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getAttributeTopFilters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getNoClickRate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getNoResultTopFilters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getNoResultsRate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getSearchesCount.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getSearchesNoClicks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getSearchesNoResults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getTopCountries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
2 changes: 2 additions & 0 deletions specs/analytics/paths/search/getTopFilterAttributes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get:
# handle /2/filters?search= as well
2 changes: 2 additions & 0 deletions specs/analytics/paths/search/getTopHits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get:
# handle /2/hits?search= as well
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getTopSearches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/search/getUsersCount.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/analytics/paths/status/getStatus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
62 changes: 62 additions & 0 deletions specs/analytics/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
openapi: 3.0.2
info:
title: Analytics API
description: API powering the Analytics feature of Algolia.
version: 0.1.0
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
# ########################
# ### Status Endpoints ###
# ########################
/2/status:
$ref: './paths/status/getStatus.yml'
#
# ##################################
# ### Search Analytics Endpoints ###
# ##################################
# /2/searches:
# $ref: './paths/search/getTopSearches.yml'
# /2/searches/count:
# $ref: './paths/search/getSearchesCount.yml'
# /2/searches/noResults:
# $ref: './paths/search/getSearchesNoResults.yml'
# /2/searches/noClicks:
# $ref: './paths/search/getSearchesNoClicks.yml'
# /2/searches/noResultRate:
# $ref: './paths/search/getNoResultsRate.yml'
# /2/searches/noClickRate:
# $ref: './paths/search/getNoClickRate.yml'
# /2/hits:
# $ref: './paths/search/getTopHits.yml'
# /2/users/count:
# $ref: './paths/search/getUsersCount.yml'
# /2/filters:
# $ref: './paths/search/getTopFilterAttributes.yml'
# /2/filters/noResults?search=:
# $ref: './paths/search/getNoResultTopFilters.yml'
# /2/filters/{attribute list}?search=:
# $ref: './paths/search/getSearchAttributesTopFilters.yml'
# /2/filters/{attribute}:
# $ref: './paths/search/getAttributeTopFilters.yml'
# /2/countries:
# $ref: './paths/search/getTopCountries.yml'
#
# #################################
# ### Click Analytics Endpoints ###
# #################################
# /2/clicks/averageClickPosition:
# $ref: './paths/click/getAverageTopClickPosition.yml'
# /2/clicks/positions:
# $ref: './paths/click/getClickPositions.yml'
# /2/clicks/clickThroughRate:
# $ref: './paths/click/getClickThroughRate.yml'
# /2/conversions/conversionRate:
# $ref: './paths/click/getConversionRate.yml'
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions specs/common/securitySchemes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
appId:
type: apiKey
in: header
name: X-Algolia-Application-Id
apiKey:
type: apiKey
in: header
name: X-Algolia-API-Key
1 change: 1 addition & 0 deletions specs/insights/paths/pushEvents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
17 changes: 17 additions & 0 deletions specs/insights/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
openapi: 3.0.2
info:
title: Insights API
description: API powering the Insights feature of Algolia.
version: 0.0.1
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
/1/events:
$ref: './paths/pushEvents.yml'
27 changes: 0 additions & 27 deletions specs/paths/indexes/search.yml

This file was deleted.

1 change: 1 addition & 0 deletions specs/personalization/paths/deleteUserProfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delete:
1 change: 1 addition & 0 deletions specs/personalization/paths/getUserTokenProfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
2 changes: 2 additions & 0 deletions specs/personalization/paths/personalizationStrategy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post:
get:
21 changes: 21 additions & 0 deletions specs/personalization/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
openapi: 3.0.2
info:
title: Personalization API
description: API powering the Personalization feature of Algolia.
version: 0.0.1
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
/1/profiles/personalization/{userToken}:
$ref: './paths/getUserTokenProfile.yml'
# /1/profiles/{userToken}:
# $ref: './paths/deleteUserProfile.yml'
# /1/strategies/personalization:
# $ref: './paths/personalizationStrategy.yml'
1 change: 1 addition & 0 deletions specs/query_suggestions/paths/getConfigurationStatus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/query_suggestions/paths/getLogFile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
3 changes: 3 additions & 0 deletions specs/query_suggestions/paths/qsConfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
put:
delete:
get:
2 changes: 2 additions & 0 deletions specs/query_suggestions/paths/qsConfigs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post:
get:
23 changes: 23 additions & 0 deletions specs/query_suggestions/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
openapi: 3.0.2
info:
title: Query Suggestions API
description: API powering the Query Suggestions feature of Algolia.
version: 0.0.1
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
/1/configs:
$ref: './paths/qsConfigs.yml'
# /1/configs/{indexName}:
# $ref: './paths/qsConfig.yml'
# /1/configs/{indexName}/status:
# $ref: './paths/getConfigurationStatus.yml'
# /1/logs/{indexName}:
# $ref: './paths/getLogFile.yml'
1 change: 1 addition & 0 deletions specs/recommend/paths/getRecommendations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
17 changes: 17 additions & 0 deletions specs/recommend/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
openapi: 3.0.2
info:
title: Recommend API
description: API powering the Recommend feature of Algolia.
version: 0.0.1
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
security:
- appId: []
apiKey: []
paths:
/1/indexes/*/recommendations:
$ref: './paths/getRecommendations.yml'
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ description: Bad request or request arguments
content:
application/json:
schema:
$ref: '../schemas/ErrorBase.yml'
$ref: '../../../common/schemas/ErrorBase.yml'
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ description: Index not found
content:
application/json:
schema:
$ref: '../schemas/ErrorBase.yml'
$ref: '../../../common/schemas/ErrorBase.yml'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ record:
- objectID
properties:
objectID:
$ref: '../responses/common.yml#/objectID'
$ref: '../../../common/responses/common.yml#/objectID'
_highlightResult:
$ref: '#/highlightResult'
_snippetResult:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ searchResponse:
- params
properties:
abTestID:
$ref: ../responses/common.yml#/abTestID
$ref: ../../../common/responses/common.yml#/abTestID
abTestVariantID:
$ref: ../responses/common.yml#/abTestVariantID
$ref: ../../../common/responses/common.yml#/abTestVariantID
aroundLatLng:
type: string
description: The computed geo location.
Expand Down
1 change: 1 addition & 0 deletions specs/search/paths/advanced/getLogs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/advanced/getTask.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/advanced/isAlive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
2 changes: 2 additions & 0 deletions specs/search/paths/dictionaries/dictionarySettings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
put:
get:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
3 changes: 3 additions & 0 deletions specs/search/paths/keys/key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
put:
get:
delete:
2 changes: 2 additions & 0 deletions specs/search/paths/keys/keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post:
get:
1 change: 1 addition & 0 deletions specs/search/paths/keys/restoreApiKey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
1 change: 1 addition & 0 deletions specs/search/paths/manage_indices/copyIndex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
1 change: 1 addition & 0 deletions specs/search/paths/manage_indices/listIndices.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/multiclusters/batchAssignUserIds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
1 change: 1 addition & 0 deletions specs/search/paths/multiclusters/getTopUserIds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/multiclusters/hasPendingMappings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/multiclusters/listClusters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get:
1 change: 1 addition & 0 deletions specs/search/paths/multiclusters/searchUserIds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
post:
2 changes: 2 additions & 0 deletions specs/search/paths/multiclusters/userId.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
get:
delete:
2 changes: 2 additions & 0 deletions specs/search/paths/multiclusters/userIds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post:
get:
Loading