使用 ActivityPub,导出带有发件箱的人员的有效且首选的方法是什么?

问题描述 投票:0回答:1

我想创建一个 JSON-LD 文件来表示人员及其状态列表的导出。目前没有可供导入的目标系统,但我希望它符合当前的 ActivityPub 最佳实践。以下内容在 JSON-LD Playground 中有效,但它是最合乎逻辑的形式吗?另外,发件箱应该将最旧的项目放在最前面还是最后?

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "@type": "Person",
  "@id": "https://example.com/user1",
  "name": "user1",
  "outbox": [
    {
      "@type": "Create",
      "object": {
        "@type": "Note",
        "content": "This is the oldest note"
      },
      "published": "2024-01-01T12:00:00Z"
    },
    {
      "@type": "Create",
      "object": {
        "@type": "Note",
        "content": "This is the youngest note"
      },
      "published": "2024-01-02T12:00:00Z"
    }
  ]
}
json-ld activitypub
1个回答
0
投票
{
 "@context": "https://www.w3.org/ns/activitystreams",
 "@type": "Person",
 "@id": "https://example.com/user1",
 "name": "user1",
 "outbox": {
   "@type": "OrderedCollection",
   "orderedItems": [
  {
    "@type": "Create",
    "object": {
      "@type": "Note",
      "content": "This is the oldest note",
      "published": "2024-01-01T12:00:00Z"
    }
  },
  {
    "@type": "Create",
    "object": {
      "@type": "Note",
      "content": "This is the newest note",
      "published": "2024-01-02T12:00:00Z"
    }
  }
]
}
}

此结构确保发件箱中的项目通过使用 OrderedCollection 以有序方式保存。这通常以最新项目出现在顶部的形式为首选,因为社交媒体时间线通常以这种方式组织。

© www.soinside.com 2019 - 2024. All rights reserved.