Skip to content

Commit 020817d

Browse files
committed
Release: v6.1.0
- Added support for `reqlExpressions` on recommended item segments
1 parent a2e338a commit 020817d

6 files changed

Lines changed: 174 additions & 2 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Documentation of the API can be found at [docs.recombee.com](https://docs.recomb
1010

1111
Run the following command in your Go project:
1212
```
13-
go get github.com/recombee/go-api-client/v6@v6.0.0
13+
go get github.com/recombee/go-api-client/v6@v6.1.0
1414
```
1515

1616
## Examples

recombee/recombee_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (client *RecombeeClient) SendRequestWithContext(ctx context.Context, reques
178178

179179
// Set necessary headers
180180
httpRequest.Header.Set("Content-Type", "application/json")
181-
httpRequest.Header.Set("User-Agent", "recombee-go-api-client/6.0.0")
181+
httpRequest.Header.Set("User-Agent", "recombee-go-api-client/6.1.0")
182182

183183
start := time.Now()
184184
// Send the request

recombee/requests/recommend_item_segments_to_item.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,49 @@ func (r *RecommendItemSegmentsToItem) SetReturnAbGroup(returnAbGroup bool) *Reco
112112
return r
113113
}
114114

115+
// SetReqlExpressions sets the reqlExpressions parameter.
116+
// A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
117+
// This can be used to compute additional properties of the recommended Item Segments.
118+
// The keys are the names of the expressions, and the values are the actual ReQL expressions.
119+
// Example request:
120+
// ```json
121+
//
122+
// {
123+
// "reqlExpressions": {
124+
// "countItems": "size(segment_items(\"categories\", 'segmentId'))"
125+
// }
126+
// }
127+
//
128+
// ```
129+
// Example response:
130+
// ```json
131+
//
132+
// {
133+
// "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
134+
// "recomms":
135+
// [
136+
// {
137+
// "id": "category-fantasy-books",
138+
// "reqlEvaluations": {
139+
// "countItems": 486
140+
// }
141+
// },
142+
// {
143+
// "id": "category-sci-fi-costumes",
144+
// "reqlEvaluations": {
145+
// "countItems": 19
146+
// }
147+
// }
148+
// ],
149+
// "numberNextRecommsCalls": 0
150+
// }
151+
//
152+
// ```
153+
func (r *RecommendItemSegmentsToItem) SetReqlExpressions(reqlExpressions map[string]string) *RecommendItemSegmentsToItem {
154+
r.BodyParameters["reqlExpressions"] = reqlExpressions
155+
return r
156+
}
157+
115158
// Sends the request to the Recombee API using the specified Context
116159
func (r *RecommendItemSegmentsToItem) SendWithContext(ctx context.Context) (bindings.RecommendationResponse, error) {
117160
err := r.client.SendRequestWithContext(ctx, &r.ApiRequest)

recombee/requests/recommend_item_segments_to_item_segment.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,49 @@ func (r *RecommendItemSegmentsToItemSegment) SetReturnAbGroup(returnAbGroup bool
111111
return r
112112
}
113113

114+
// SetReqlExpressions sets the reqlExpressions parameter.
115+
// A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
116+
// This can be used to compute additional properties of the recommended Item Segments.
117+
// The keys are the names of the expressions, and the values are the actual ReQL expressions.
118+
// Example request:
119+
// ```json
120+
//
121+
// {
122+
// "reqlExpressions": {
123+
// "countItems": "size(segment_items(\"categories\", 'segmentId'))"
124+
// }
125+
// }
126+
//
127+
// ```
128+
// Example response:
129+
// ```json
130+
//
131+
// {
132+
// "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
133+
// "recomms":
134+
// [
135+
// {
136+
// "id": "category-fantasy-books",
137+
// "reqlEvaluations": {
138+
// "countItems": 486
139+
// }
140+
// },
141+
// {
142+
// "id": "category-sci-fi-costumes",
143+
// "reqlEvaluations": {
144+
// "countItems": 19
145+
// }
146+
// }
147+
// ],
148+
// "numberNextRecommsCalls": 0
149+
// }
150+
//
151+
// ```
152+
func (r *RecommendItemSegmentsToItemSegment) SetReqlExpressions(reqlExpressions map[string]string) *RecommendItemSegmentsToItemSegment {
153+
r.BodyParameters["reqlExpressions"] = reqlExpressions
154+
return r
155+
}
156+
114157
// Sends the request to the Recombee API using the specified Context
115158
func (r *RecommendItemSegmentsToItemSegment) SendWithContext(ctx context.Context) (bindings.RecommendationResponse, error) {
116159
err := r.client.SendRequestWithContext(ctx, &r.ApiRequest)

recombee/requests/recommend_item_segments_to_user.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,49 @@ func (r *RecommendItemSegmentsToUser) SetReturnAbGroup(returnAbGroup bool) *Reco
111111
return r
112112
}
113113

114+
// SetReqlExpressions sets the reqlExpressions parameter.
115+
// A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
116+
// This can be used to compute additional properties of the recommended Item Segments.
117+
// The keys are the names of the expressions, and the values are the actual ReQL expressions.
118+
// Example request:
119+
// ```json
120+
//
121+
// {
122+
// "reqlExpressions": {
123+
// "countItems": "size(segment_items(\"categories\", 'segmentId'))"
124+
// }
125+
// }
126+
//
127+
// ```
128+
// Example response:
129+
// ```json
130+
//
131+
// {
132+
// "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
133+
// "recomms":
134+
// [
135+
// {
136+
// "id": "category-fantasy-books",
137+
// "reqlEvaluations": {
138+
// "countItems": 486
139+
// }
140+
// },
141+
// {
142+
// "id": "category-sci-fi-costumes",
143+
// "reqlEvaluations": {
144+
// "countItems": 19
145+
// }
146+
// }
147+
// ],
148+
// "numberNextRecommsCalls": 0
149+
// }
150+
//
151+
// ```
152+
func (r *RecommendItemSegmentsToUser) SetReqlExpressions(reqlExpressions map[string]string) *RecommendItemSegmentsToUser {
153+
r.BodyParameters["reqlExpressions"] = reqlExpressions
154+
return r
155+
}
156+
114157
// Sends the request to the Recombee API using the specified Context
115158
func (r *RecommendItemSegmentsToUser) SendWithContext(ctx context.Context) (bindings.RecommendationResponse, error) {
116159
err := r.client.SendRequestWithContext(ctx, &r.ApiRequest)

recombee/requests/search_item_segments.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,49 @@ func (r *SearchItemSegments) SetReturnAbGroup(returnAbGroup bool) *SearchItemSeg
110110
return r
111111
}
112112

113+
// SetReqlExpressions sets the reqlExpressions parameter.
114+
// A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
115+
// This can be used to compute additional properties of the recommended Item Segments.
116+
// The keys are the names of the expressions, and the values are the actual ReQL expressions.
117+
// Example request:
118+
// ```json
119+
//
120+
// {
121+
// "reqlExpressions": {
122+
// "countItems": "size(segment_items(\"categories\", 'segmentId'))"
123+
// }
124+
// }
125+
//
126+
// ```
127+
// Example response:
128+
// ```json
129+
//
130+
// {
131+
// "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
132+
// "recomms":
133+
// [
134+
// {
135+
// "id": "category-fantasy-books",
136+
// "reqlEvaluations": {
137+
// "countItems": 486
138+
// }
139+
// },
140+
// {
141+
// "id": "category-sci-fi-costumes",
142+
// "reqlEvaluations": {
143+
// "countItems": 19
144+
// }
145+
// }
146+
// ],
147+
// "numberNextRecommsCalls": 0
148+
// }
149+
//
150+
// ```
151+
func (r *SearchItemSegments) SetReqlExpressions(reqlExpressions map[string]string) *SearchItemSegments {
152+
r.BodyParameters["reqlExpressions"] = reqlExpressions
153+
return r
154+
}
155+
113156
// Sends the request to the Recombee API using the specified Context
114157
func (r *SearchItemSegments) SendWithContext(ctx context.Context) (bindings.SearchResponse, error) {
115158
err := r.client.SendRequestWithContext(ctx, &r.ApiRequest)

0 commit comments

Comments
 (0)