Skip to content
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

feat(specs): create new methods #974

Merged
merged 20 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c7057af
feat(predict): create predict user profile endpoints
bengreenbank Aug 30, 2022
9728fb4
feat(predict): delete user profile method
bengreenbank Aug 30, 2022
4a669c2
Merge branch 'main' into feat/predict
bengreenbank Aug 30, 2022
def5558
chore(predict): rename user profiles directory
bengreenbank Aug 30, 2022
6964554
chore(predict): create fetch all user profiles method
bengreenbank Aug 30, 2022
840b76f
chore(specs): move parameter descriptions
bengreenbank Aug 30, 2022
72d1082
Merge branch 'main' into feat/predict
bengreenbank Aug 30, 2022
320da29
Merge branch 'main' into feat/predict
bengreenbank Aug 30, 2022
1bf4740
chore(tests): add predict tests
bengreenbank Aug 30, 2022
8681dd6
Merge branch 'main' into feat/predict
bengreenbank Aug 30, 2022
4eba161
chore(tests): amend predict tests
bengreenbank Aug 31, 2022
8a52722
Merge branch 'main' into feat/predict
bengreenbank Aug 31, 2022
fc6d509
fix(tests): fix predict tests body
bengreenbank Sep 1, 2022
5b080c6
Merge branch 'main' into feat/predict
bengreenbank Sep 1, 2022
3784248
fix(tests): remove unnecessary param requirements
bengreenbank Sep 1, 2022
fc0c4cb
chore(specs): update userprofile requirements
bengreenbank Sep 1, 2022
c1cfe7e
chore(specs): update predict fetchall params name
bengreenbank Sep 1, 2022
b57ee9e
chore(specs): require predict deleteduntil param
bengreenbank Sep 1, 2022
1a3ca77
chore(specs): require predict user profile segments
bengreenbank Sep 1, 2022
b0a5eff
Merge branch 'main' into feat/predict
shortcuts Sep 1, 2022
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
105 changes: 105 additions & 0 deletions specs/predict/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,108 @@ userID:
schema:
type: string
description: User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors).

userProfile:
type: object
properties:
user:
type: string
predictions:
type: object
title: predictions
properties:
funnel_stage:
type: object
description: Prediction for the **funnel_stage** model.
properties:
value:
type: array
items:
title: funnel_stage
type: object
properties:
name:
type: string
probability:
type: number
format: double
minimum: 0
maximum: 1
required:
- name
- probability
lastUpdatedAt:
type: string
required:
- value
- lastUpdatedAt
order_value:
type: object
description: Prediction for the **order_value** model.
properties:
value:
type: number
format: double
minimum: 0
lastUpdatedAt:
type: string
required:
- value
- lastUpdatedAt
affinities:
type: object
description: Prediction for the **affinities** model.
properties:
value:
type: array
items:
title: affinity
type: object
properties:
name:
type: string
value:
type: string
probability:
type: number
format: double
minimum: 0
maximum: 1
required:
- name
- value
- probability
lastUpdatedAt:
type: string
required:
- value
- lastUpdatedAt
properties:
type: object
title: properties
description: Properties for the user profile.
properties:
raw:
type: object
description: Raw user properties (key-value pairs).
computed:
type: object
description: Computed user properties (key-value pairs).
custom:
type: object
description: Custom user properties (key-value pairs).
segments:
type: object
title: segments
description: Segments that the user belongs to.
properties:
computed:
type: array
description: List of computed segments IDs.
items:
type: string
custom:
type: array
description: List of custom segments IDs.
items:
type: string
bengreenbank marked this conversation as resolved.
Show resolved Hide resolved
43 changes: 43 additions & 0 deletions specs/predict/common/schemas/Params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ allParams:
- $ref: '#/modelsToRetrieveParam'
- $ref: '#/typesToRetrieveParam'

fetchAllUsersParams:
millotp marked this conversation as resolved.
Show resolved Hide resolved
oneOf:
- $ref: '#/modelsToRetrieveParam'
- $ref: '#/typesToRetrieveParam'
- $ref: '#/nextPageTokenParam'
- $ref: '#/previousPageTokenParam'
- $ref: '#/limitParam'

modelsToRetrieveParam:
type: object
required:
Expand All @@ -29,10 +37,45 @@ typesToRetrieveParam:
items:
$ref: '#/typesToRetrieve'

nextPageTokenParam:
type: object
required:
- nextPageTokenParam
shortcuts marked this conversation as resolved.
Show resolved Hide resolved
properties:
nextPageToken:
$ref: '#/nextPageToken'

previousPageTokenParam:
type: object
required:
- previousPageTokenParam
properties:
previousPageToken:
$ref: '#/previousPageToken'

limitParam:
type: object
required:
- limitParam
properties:
limit:
$ref: '#/limit'

modelsToRetrieve:
type: string
enum: [funnel_stage, order_value, affinities]

typesToRetrieve:
type: string
enum: [properties, segments]

nextPageToken:
type: string
description: 'The token is used to navigate forward in the user list. To navigate from the current user list to the next page, the API generates the next page token and it sends the token in the response, beside the current user list. NOTE: This body param cannot be used with `previousPageToken` at the same time.'

previousPageToken:
type: string
description: 'The token is used to navigate backward in the user list. To navigate from the current user list to the previous page, the API generates the previous page token and it sends the token in the response, beside the current user list. NOTE: This body param cannot be used with `nextPageToken` at the same time.'

limit:
type: integer
136 changes: 0 additions & 136 deletions specs/predict/paths/fetchUserProfile.yml

This file was deleted.

37 changes: 37 additions & 0 deletions specs/predict/paths/users/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
delete:
tags:
- profiles
operationId: deleteUserProfile
description: Delete all data and predictions associated with an authenticated user (userID) or an anonymous user (cookieID, sessionID).
summary: Delete user profile.
parameters:
- $ref: '../../common/parameters.yml#/userID'
responses:
'200':
description: OK
content:
application/json:
schema:
title: deleteUserProfileResponse
type: object
required:
- user
bengreenbank marked this conversation as resolved.
Show resolved Hide resolved
properties:
user:
type: string
description: The ID of the user that was deleted.
deletedUntil:
type: string
description: The time the same user ID will be imported again when the data is ingested.
'401':
$ref: '../../responses/InvalidCredentials.yml'
'404':
$ref: '../../responses/UserNotFound.yml'
'422':
description: Invalid user ID or application ID.
content:
application/json:
schema:
$ref: '../../../common/schemas/ErrorBase.yml'
'500':
$ref: '../../../common/responses/InternalError.yml'
34 changes: 34 additions & 0 deletions specs/predict/paths/users/fetch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
post:
tags:
- profiles
operationId: fetchUserProfile
description: Get predictions, properties (raw, computed or custom) and segments (computed or custom) for a user profile.
summary: Get user profile.
parameters:
- $ref: '../../common/parameters.yml#/userID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../common/schemas/Params.yml#/params'
responses:
'200':
description: OK
content:
application/json:
schema:
title: fetchUserProfileResponse
required:
- user
shortcuts marked this conversation as resolved.
Show resolved Hide resolved
$ref: '../../common/parameters.yml#/userProfile'
'404':
$ref: '../../responses/UserNotFound.yml'
'405':
$ref: '../../../common/responses/MethodNotAllowed.yml'
'400':
description: ModelsToRetrieve or typesToRetrieve must be set.
content:
application/json:
schema:
$ref: '../../../common/schemas/ErrorBase.yml'
Loading