-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_context.go
55 lines (42 loc) · 1.66 KB
/
data_context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// go-mirage-api
//
// Copyright 2023, Valerian Saliou
// Author: Valerian Saliou <[email protected]>
package mirage
// IngestContextDataRequest mapping
type IngestContextDataRequest struct {
Items []IngestContextDataRequestItem `json:"items"`
}
// IngestContextDataRequestItem mapping
type IngestContextDataRequestItem struct {
Operation string `json:"operation"`
PrimaryID string `json:"primary_id"`
SecondaryID *string `json:"secondary_id,omitempty"`
TertiaryID *string `json:"tertiary_id,omitempty"`
Text *string `json:"text,omitempty"`
Timestamp *uint64 `json:"timestamp,omitempty"`
Source *string `json:"source,omitempty"`
Metadata *map[string]string `json:"metadata,omitempty"`
}
// IngestContextDataResponseData mapping
type IngestContextDataResponseData struct {
Data *IngestContextDataResponse `json:"data"`
}
// IngestContextDataResponse mapping
type IngestContextDataResponse struct {
Imported bool `json:"imported"`
}
// String returns the string representation of IngestContextDataResponse
func (instance IngestContextDataResponse) String() string {
return Stringify(instance)
}
// IngestContextData ingest context data into account.
func (service *TaskService) IngestContextData(ctx RequestContext, data IngestContextDataRequest) (*IngestContextDataResponse, error) {
req, _ := service.client.NewRequest("POST", "data/context/ingest", data, ctx)
result := new(IngestContextDataResponseData)
_, err := service.client.Do(req, result)
if err != nil {
return nil, err
}
return result.Data, err
}