Skip to content

Commit

Permalink
feat(specs): create new methods (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
bengreenbank authored Sep 1, 2022
1 parent 9281022 commit 80724c1
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 137 deletions.
110 changes: 110 additions & 0 deletions specs/predict/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,113 @@ userID:
schema:
type: string
description: User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors).

userProfile:
type: object
required:
- user
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
required:
- computed
- custom
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
37 changes: 37 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'

fetchAllUserProfilesParams:
oneOf:
- $ref: '#/modelsToRetrieveParam'
- $ref: '#/typesToRetrieveParam'
- $ref: '#/nextPageTokenParam'
- $ref: '#/previousPageTokenParam'
- $ref: '#/limitParam'

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

nextPageTokenParam:
type: object
properties:
nextPageToken:
$ref: '#/nextPageToken'

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

limitParam:
type: object
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.

38 changes: 38 additions & 0 deletions specs/predict/paths/users/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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
- deletedUntil
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'
32 changes: 32 additions & 0 deletions specs/predict/paths/users/fetch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
$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

0 comments on commit 80724c1

Please sign in to comment.