Core components of the web application. https://write.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 line
941 B

  1. package activitystreams
  2. type (
  3. BaseObject struct {
  4. Context []string `json:"@context"`
  5. Type string `json:"type"`
  6. ID string `json:"id"`
  7. }
  8. PublicKey struct {
  9. ID string `json:"id"`
  10. Owner string `json:"owner"`
  11. PublicKeyPEM string `json:"publicKeyPem"`
  12. }
  13. Image struct {
  14. Type string `json:"type"`
  15. MediaType string `json:"mediaType"`
  16. URL string `json:"url"`
  17. }
  18. )
  19. type OrderedCollection struct {
  20. BaseObject
  21. TotalItems int `json:"totalItems"`
  22. First string `json:"first"`
  23. Last string `json:"last,omitempty"`
  24. }
  25. func NewOrderedCollection(accountRoot string, items int) *OrderedCollection {
  26. oc := OrderedCollection{
  27. BaseObject: BaseObject{
  28. Context: []string{
  29. "https://www.w3.org/ns/activitystreams",
  30. },
  31. ID: accountRoot + "/outbox",
  32. Type: "OrderedCollection",
  33. },
  34. First: accountRoot + "/outbox?page=1",
  35. TotalItems: items,
  36. }
  37. return &oc
  38. }