Report user activity that occurs on indexed documents such as viewing or editing. This signal improves search quality.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"github.com/gleanwork/api-client-go/models/components"
"github.com/gleanwork/api-client-go/types"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Activity.Report(ctx, components.Activity{
Events: []components.ActivityEvent{
components.ActivityEvent{
Action: components.ActivityEventActionHistoricalView,
Timestamp: types.MustTimeFromString("2000-01-23T04:56:07.000Z"),
URL: "https://example.com/",
},
components.ActivityEvent{
Action: components.ActivityEventActionSearch,
Params: &components.ActivityEventParams{
Query: apiclientgo.Pointer("query"),
},
Timestamp: types.MustTimeFromString("2000-01-23T04:56:07.000Z"),
URL: "https://example.com/search?q=query",
},
components.ActivityEvent{
Action: components.ActivityEventActionView,
Params: &components.ActivityEventParams{
Duration: apiclientgo.Pointer[int64](20),
Referrer: apiclientgo.Pointer("https://example.com/document"),
},
Timestamp: types.MustTimeFromString("2000-01-23T04:56:07.000Z"),
URL: "https://example.com/",
},
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.Activity | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ActivityResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Report events that happen to results within a Glean client UI, such as search result views and clicks. This signal improves search quality.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"github.com/gleanwork/api-client-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Activity.Feedback(ctx, nil, &components.Feedback{
TrackingTokens: []string{
"trackingTokens",
},
Event: components.FeedbackEventView,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
feedbackQueryParameter |
*string |
➖ | A URL encoded versions of Feedback. This is useful for requests. | |
feedback1 |
*components.Feedback | ➖ | N/A | { "trackingTokens": [ "trackingTokens" ], "event": "VIEW" } |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FeedbackResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |