diff --git a/specs/advanced-personalization/common/responses/FeatureNotEnabled.yml b/specs/advanced-personalization/common/responses/FeatureNotEnabled.yml new file mode 100644 index 0000000000..04fcd8dab3 --- /dev/null +++ b/specs/advanced-personalization/common/responses/FeatureNotEnabled.yml @@ -0,0 +1,5 @@ +description: Feature not enabled. +content: + application/json: + schema: + $ref: '../schemas/ErrorResponses.yml#/featureNotEnabled' diff --git a/specs/advanced-personalization/common/schemas/ConfigurationObject.yml b/specs/advanced-personalization/common/schemas/ConfigurationObject.yml index 12a0420616..84cf9aa053 100644 --- a/specs/advanced-personalization/common/schemas/ConfigurationObject.yml +++ b/specs/advanced-personalization/common/schemas/ConfigurationObject.yml @@ -38,4 +38,6 @@ configurationObject: $ref: './Configuration.yml#/profileType' status: $ref: './Configuration.yml#/status' - required: [indices, personalzationReRanking, profileType, status] + features: + $ref: './Configuration.yml#/features' + required: [indices, personalzationReRanking, profileType, status, features] diff --git a/specs/advanced-personalization/common/schemas/ErrorCodes.yml b/specs/advanced-personalization/common/schemas/ErrorCodes.yml index 379faf1db2..bb2530db38 100644 --- a/specs/advanced-personalization/common/schemas/ErrorCodes.yml +++ b/specs/advanced-personalization/common/schemas/ErrorCodes.yml @@ -8,6 +8,11 @@ unauthorized: description: HTTP status code for an authorization error. enum: [401] +paymentRequired: + type: integer + description: HTTP status code for a payment required error. + enum: [402] + notFound: type: integer description: HTTP status code for a not found error. diff --git a/specs/advanced-personalization/common/schemas/ErrorMessages.yml b/specs/advanced-personalization/common/schemas/ErrorMessages.yml index 960b883bde..63876df49b 100644 --- a/specs/advanced-personalization/common/schemas/ErrorMessages.yml +++ b/specs/advanced-personalization/common/schemas/ErrorMessages.yml @@ -13,6 +13,13 @@ unauthorized: description: Details about the response, such as error messages. enum: [Unauthorized] +featureNotEnabled: + type: string + description: Details about the response, such as error messages. + enum: + - "Predictive profiles are not allowed for this app. Please contact support to upgrade your plan: https://support.algolia.com/" + - "Realtime Personalization is not allowed for this app. Please contact support to upgrade your plan: https://support.algolia.com/" + genericNotFound: type: string description: Details about the response, such as error messages. diff --git a/specs/advanced-personalization/common/schemas/ErrorResponses.yml b/specs/advanced-personalization/common/schemas/ErrorResponses.yml index 01891ad741..5262271579 100644 --- a/specs/advanced-personalization/common/schemas/ErrorResponses.yml +++ b/specs/advanced-personalization/common/schemas/ErrorResponses.yml @@ -53,3 +53,11 @@ internalServerError: $ref: './ErrorCodes.yml#/internalServerError' message: $ref: './ErrorMessages.yml#/internalServerError' + +featureNotEnabled: + type: object + properties: + status: + $ref: './ErrorCodes.yml#/paymentRequired' + message: + $ref: './ErrorMessages.yml#/featureNotEnabled' diff --git a/specs/advanced-personalization/common/schemas/Features.yml b/specs/advanced-personalization/common/schemas/Features.yml new file mode 100644 index 0000000000..ca79e9e856 --- /dev/null +++ b/specs/advanced-personalization/common/schemas/Features.yml @@ -0,0 +1,12 @@ +features: + type: object + properties: + realtime: + $ref: '#/realtime' + +realtime: + type: object + properties: + enabled: + type: bool + description: Whether the realtime personalization feature is enabled. diff --git a/specs/advanced-personalization/paths/config.yml b/specs/advanced-personalization/paths/config.yml index a180575768..00d8ff3948 100644 --- a/specs/advanced-personalization/paths/config.yml +++ b/specs/advanced-personalization/paths/config.yml @@ -67,7 +67,9 @@ put: $ref: '../common/schemas/Configuration.yml#/personalizationReRanking' profileType: $ref: '../common/schemas/Configuration.yml#/profileType' - required: [indices, personalizationReRanking, profileType] + features: + $ref: '../common/schemas/Features.yml#/features' + required: [indices, personalizationReRanking, profileType, features] responses: '200': description: OK @@ -94,5 +96,7 @@ put: $ref: '../common/responses/BadRequest.yml' '401': $ref: '../common/responses/Unauthorized.yml' + '402': + $ref: '../common/responses/FeatureNotEnabled.yml' '500': $ref: '../common/responses/InternalServerError.yml'