Skip to content

Commit 80724c1

Browse files
authored
feat(specs): create new methods (#974)
1 parent 9281022 commit 80724c1

File tree

10 files changed

+366
-137
lines changed

10 files changed

+366
-137
lines changed

specs/predict/common/parameters.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,113 @@ userID:
55
schema:
66
type: string
77
description: User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors).
8+
9+
userProfile:
10+
type: object
11+
required:
12+
- user
13+
properties:
14+
user:
15+
type: string
16+
predictions:
17+
type: object
18+
title: predictions
19+
properties:
20+
funnel_stage:
21+
type: object
22+
description: Prediction for the **funnel_stage** model.
23+
properties:
24+
value:
25+
type: array
26+
items:
27+
title: funnel_stage
28+
type: object
29+
properties:
30+
name:
31+
type: string
32+
probability:
33+
type: number
34+
format: double
35+
minimum: 0
36+
maximum: 1
37+
required:
38+
- name
39+
- probability
40+
lastUpdatedAt:
41+
type: string
42+
required:
43+
- value
44+
- lastUpdatedAt
45+
order_value:
46+
type: object
47+
description: Prediction for the **order_value** model.
48+
properties:
49+
value:
50+
type: number
51+
format: double
52+
minimum: 0
53+
lastUpdatedAt:
54+
type: string
55+
required:
56+
- value
57+
- lastUpdatedAt
58+
affinities:
59+
type: object
60+
description: Prediction for the **affinities** model.
61+
properties:
62+
value:
63+
type: array
64+
items:
65+
title: affinity
66+
type: object
67+
properties:
68+
name:
69+
type: string
70+
value:
71+
type: string
72+
probability:
73+
type: number
74+
format: double
75+
minimum: 0
76+
maximum: 1
77+
required:
78+
- name
79+
- value
80+
- probability
81+
lastUpdatedAt:
82+
type: string
83+
required:
84+
- value
85+
- lastUpdatedAt
86+
properties:
87+
type: object
88+
title: properties
89+
description: Properties for the user profile.
90+
properties:
91+
raw:
92+
type: object
93+
description: Raw user properties (key-value pairs).
94+
computed:
95+
type: object
96+
description: Computed user properties (key-value pairs).
97+
custom:
98+
type: object
99+
description: Custom user properties (key-value pairs).
100+
segments:
101+
type: object
102+
title: segments
103+
required:
104+
- computed
105+
- custom
106+
description: Segments that the user belongs to.
107+
properties:
108+
computed:
109+
type: array
110+
description: List of computed segments IDs.
111+
items:
112+
type: string
113+
custom:
114+
type: array
115+
description: List of custom segments IDs.
116+
items:
117+
type: string

specs/predict/common/schemas/Params.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ allParams:
99
- $ref: '#/modelsToRetrieveParam'
1010
- $ref: '#/typesToRetrieveParam'
1111

12+
fetchAllUserProfilesParams:
13+
oneOf:
14+
- $ref: '#/modelsToRetrieveParam'
15+
- $ref: '#/typesToRetrieveParam'
16+
- $ref: '#/nextPageTokenParam'
17+
- $ref: '#/previousPageTokenParam'
18+
- $ref: '#/limitParam'
19+
1220
modelsToRetrieveParam:
1321
type: object
1422
required:
@@ -29,10 +37,39 @@ typesToRetrieveParam:
2937
items:
3038
$ref: '#/typesToRetrieve'
3139

40+
nextPageTokenParam:
41+
type: object
42+
properties:
43+
nextPageToken:
44+
$ref: '#/nextPageToken'
45+
46+
previousPageTokenParam:
47+
type: object
48+
properties:
49+
previousPageToken:
50+
$ref: '#/previousPageToken'
51+
52+
limitParam:
53+
type: object
54+
properties:
55+
limit:
56+
$ref: '#/limit'
57+
3258
modelsToRetrieve:
3359
type: string
3460
enum: [funnel_stage, order_value, affinities]
3561

3662
typesToRetrieve:
3763
type: string
3864
enum: [properties, segments]
65+
66+
nextPageToken:
67+
type: string
68+
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.'
69+
70+
previousPageToken:
71+
type: string
72+
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.'
73+
74+
limit:
75+
type: integer

specs/predict/paths/fetchUserProfile.yml

Lines changed: 0 additions & 136 deletions
This file was deleted.

specs/predict/paths/users/delete.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
delete:
2+
tags:
3+
- profiles
4+
operationId: deleteUserProfile
5+
description: Delete all data and predictions associated with an authenticated user (userID) or an anonymous user (cookieID, sessionID).
6+
summary: Delete user profile.
7+
parameters:
8+
- $ref: '../../common/parameters.yml#/userID'
9+
responses:
10+
'200':
11+
description: OK
12+
content:
13+
application/json:
14+
schema:
15+
title: deleteUserProfileResponse
16+
type: object
17+
required:
18+
- user
19+
- deletedUntil
20+
properties:
21+
user:
22+
type: string
23+
description: The ID of the user that was deleted.
24+
deletedUntil:
25+
type: string
26+
description: The time the same user ID will be imported again when the data is ingested.
27+
'401':
28+
$ref: '../../responses/InvalidCredentials.yml'
29+
'404':
30+
$ref: '../../responses/UserNotFound.yml'
31+
'422':
32+
description: Invalid user ID or application ID.
33+
content:
34+
application/json:
35+
schema:
36+
$ref: '../../../common/schemas/ErrorBase.yml'
37+
'500':
38+
$ref: '../../../common/responses/InternalError.yml'

specs/predict/paths/users/fetch.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
post:
2+
tags:
3+
- profiles
4+
operationId: fetchUserProfile
5+
description: Get predictions, properties (raw, computed or custom) and segments (computed or custom) for a user profile.
6+
summary: Get user profile.
7+
parameters:
8+
- $ref: '../../common/parameters.yml#/userID'
9+
requestBody:
10+
required: true
11+
content:
12+
application/json:
13+
schema:
14+
$ref: '../../common/schemas/Params.yml#/params'
15+
responses:
16+
'200':
17+
description: OK
18+
content:
19+
application/json:
20+
schema:
21+
title: fetchUserProfileResponse
22+
$ref: '../../common/parameters.yml#/userProfile'
23+
'404':
24+
$ref: '../../responses/UserNotFound.yml'
25+
'405':
26+
$ref: '../../../common/responses/MethodNotAllowed.yml'
27+
'400':
28+
description: ModelsToRetrieve or typesToRetrieve must be set.
29+
content:
30+
application/json:
31+
schema:
32+
$ref: '../../../common/schemas/ErrorBase.yml'

0 commit comments

Comments
 (0)