package changes import ( "context" "encoding/json" "time" "git.aiterp.net/rpdata/logbot3/internal/api" "git.aiterp.net/rpdata/logbot3/internal/models" ) // The Filter for List. type Filter struct { Keys []models.ChangeKey `json:"keys,omitempty"` EarliestDate *time.Time `json:"earliestDate,omitempty"` Limit int `json:"limit,omitempty"` } // List lists all changes according to the filter. func List(ctx context.Context, filter *Filter) ([]models.Change, error) { data, err := api.Global().Query(ctx, listGQL, map[string]interface{}{"filter": filter}, nil) if err != nil { return nil, err } res := listResult{} err = json.Unmarshal(data, &res) return res.Changes, err } type listResult struct { Changes []models.Change `json:"changes"` } var listGQL = ` query ListChanges($filter:ChangesFilter) { changes(filter:$filter) { id model op author listed date keys { model id } objects { __typename ...on Channel { name logged hub eventName locationName } } } } `