ContentAPI Crawler
Something went wrong. Try again.
3.9 kB · 105 lines
Go
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106package contentapi
import "encoding/json"
type SearchRequests struct { Values map[string]any `json:"values"` Requests []SearchRequest `json:"requests"`}type SearchRequest struct { Name string `json:"name,omitempty"` Type string `json:"type"` Fields string `json:"fields"` Query string `json:"query,omitempty"` Order string `json:"order,omitempty"` Limit int `json:"limit,omitempty"` Skip int `json:"skip,omitempty"` Expensive bool `json:"expensive,omitempty"`}
type RequestResponse struct { Search *SearchRequests `json:"search,omitempty"` Objects map[string][]json.RawMessage `json:"objects"` DatabaseTimes map[string]float64 `json:"databaseTimes"` TotalTime float64 `json:"totalTime"` NonDBTime float64 `json:"nonDbTime"` RequestUser *int64 `json:"requestUser"`}type Status struct { Version string `json:"version"` AppName string `json:"appname"` Environment string `json:"environment"` ProcessStart string `json:"processStart"` Runtime string `json:"runtime"` Repo string `json:"repo"` BugReport string `json:"bugreport"` Contact string `json:"contact"`}type TokenStatus struct { UserID *int64 `json:"userId"`}type About struct { About string `json:"about"` Details json.RawMessage `json:"details"`}
// Public provider views. Raw entity bytes remain available in RequestResponse.Objects.type User struct { ID int64 `json:"id"` Username string `json:"username"` Avatar string `json:"avatar"` Special *string `json:"special"` Type int `json:"type"` CreateDate string `json:"createDate"` CreateUserID *int64 `json:"createUserId"` Super bool `json:"super"` Registered bool `json:"registered"` Deleted bool `json:"deleted"` RawJSON []byte `json:"-"`}type Content struct { ID int64 `json:"id"` Deleted bool `json:"deleted"` CreateUserID *int64 `json:"createUserId"` CreateDate string `json:"createDate"` ContentType int `json:"contentType"` Name string `json:"name"` ParentID int64 `json:"parentId"` Text string `json:"text"` LiteralType *string `json:"literalType"` Meta json.RawMessage `json:"meta"` Description *string `json:"description"` Hash string `json:"hash"` Permissions json.RawMessage `json:"permissions"` Values json.RawMessage `json:"values"` Keywords json.RawMessage `json:"keywords"` LastRevisionID int64 `json:"lastRevisionId"` RawJSON []byte `json:"-"`}type Message struct { ID int64 `json:"id"` ContentID int64 `json:"contentId"` CreateUserID *int64 `json:"createUserId"` CreateDate string `json:"createDate"` Text string `json:"text"` Values json.RawMessage `json:"values"` EditDate *string `json:"editDate"` EditUserID *int64 `json:"editUserId"` Edited bool `json:"edited"` Deleted bool `json:"deleted"` Module *string `json:"module"` ReceiveUserID int64 `json:"receiveUserId"` UIDsInText []int64 `json:"uidsInText"` RawJSON []byte `json:"-"`}type Activity struct { ID int64 `json:"id"` ContentID int64 `json:"contentId"` UserID *int64 `json:"userId"` Date string `json:"date"` Message *string `json:"message"` Action int `json:"action"` RawJSON []byte `json:"-"`}
func DecodeEntity(raw json.RawMessage, out any) error { return json.Unmarshal(raw, out) }