Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat(realtime-perso): add new realtime-perso api
  • Loading branch information
Bilel Benamira committed Mar 17, 2025
commit 75fdf1313ffcdef198bd4248d282893d1f7369d2
8 changes: 8 additions & 0 deletions specs/realtime-personalization/common/parameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# path
UserToken:
name: userToken
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We call this userID in all the personalization APIs.

in: path
required: true
description: Unique identifier representing a user for which to fetch the personalization profile.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Unique identifier representing a user for which to fetch the personalization profile.
description: Unique identifier used to retrieve the personalization profile of a specific user.

schema:
$ref: '../../common/schemas/SearchParams.yml#/userToken'
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
personalizationFilters:
type: object
additionalProperties: false
required:
- version
- userID
- search
properties:
version:
type: string
description: Version of the response format.
userID:
type: string
description: User ID of the user.
search:
type: object
description: |
Index personalization filters by index name.
additionalProperties:
$ref: '#/searchFilters'
30 changes: 30 additions & 0 deletions specs/realtime-personalization/common/schemas/searchFilters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
searchFilters:
type: object
additionalProperties: false
properties:
indices:
type: array
items:
type: string
example: ['storefront', 'storefront_price_asc', 'storefront_price_desc']
strategy:
$ref: '#/strategy'
filters:
$ref: '#/searchFilter'

searchFilter:
type: object
additionalProperties: false
properties:
session:
type: array
items:
type: string
example: ['brand:Dyson<score=12>']

strategy:
type: string
enum:
- session
- hybrid
example: 'session'
25 changes: 25 additions & 0 deletions specs/realtime-personalization/paths/getPersonalizationFilters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
get:
tags:
- filters
operationId: getIndexPersonalizationFilters
x-acl:
- recommendation
summary: Retrieve the index personalization filters
description: Retrieves the current index personalization filters.
parameters:
- $ref: '../common/parameters.yml#/UserToken'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../common/schemas/personalizationFilters.yml#/personalizationFilters'
'400':
$ref: '../../common/responses/BadRequest.yml'
'402':
$ref: '../../common/responses/FeatureNotEnabled.yml'
'403':
$ref: '../../common/responses/MethodNotAllowed.yml'
'404':
$ref: '../../common/responses/IndexNotFound.yml'
45 changes: 45 additions & 0 deletions specs/realtime-personalization/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
openapi: 3.1.0
info:
title: Realtime Personalization API
description: TODO
version: 0.0.1
externalDocs:
# TODO: Update the URL
url: https://www.algolia.com/doc/guides/personalization/what-is-personalization/
description: |
Related guide: Algolia Realtime Personalization.
components:
securitySchemes:
appId:
$ref: '../common/securitySchemes.yml#/appId'
apiKey:
$ref: '../common/securitySchemes.yml#/apiKey'
servers:
# TODO: Update the URL
- url: https://personalization.{region}.algolia.com
variables:
region:
enum:
- us
- eu
default: us
security:
- appId: []
apiKey: []
tags:
- name: filters
x-displayName: Filters
description: |
Filters are used to personalize the search results for a user.
They are used to filter the search results based on the user's preferences.
x-tagGroups:
- name: General
tags:
- filters
paths:
# ######################
# ### Custom request ###
# ######################

/1/filters/{userToken}:
$ref: 'paths/getPersonalizationFilters.yml'
Loading