@atproto/api 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/README.md +81 -0
  2. package/definitions/labels.json +212 -0
  3. package/definitions/locale/en/label-groups.json +38 -0
  4. package/definitions/locale/en/labels.json +366 -0
  5. package/definitions/locale/en/proposed-label-groups.json +38 -0
  6. package/definitions/locale/en/proposed-labels.json +632 -0
  7. package/definitions/moderation-behaviors.d.ts +48 -0
  8. package/definitions/post-moderation-behaviors.json +879 -0
  9. package/definitions/profile-moderation-behaviors.json +447 -0
  10. package/definitions/proposed-labels.json +326 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/lexicons.d.ts +41 -1
  13. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +3 -10
  14. package/dist/client/types/app/bsky/{feed/getBookmarkedFeeds.d.ts → graph/getListBlocks.d.ts} +2 -2
  15. package/dist/client/types/app/bsky/graph/listblock.d.ts +8 -0
  16. package/dist/client/types/app/bsky/{feed/unbookmarkFeed.d.ts → graph/subscribeMuteList.d.ts} +1 -1
  17. package/dist/client/types/app/bsky/{feed/bookmarkFeed.d.ts → graph/unsubscribeMuteList.d.ts} +1 -1
  18. package/dist/{src/client/types/app/bsky/notification/updateSeen.d.ts → client/types/app/bsky/unspecced/applyLabels.d.ts} +2 -1
  19. package/dist/client/types/com/atproto/admin/defs.d.ts +2 -0
  20. package/dist/client/types/com/atproto/admin/disableAccountInvites.d.ts +1 -0
  21. package/dist/client/types/com/atproto/admin/enableAccountInvites.d.ts +1 -0
  22. package/dist/helpers/bsky.d.ts +20 -0
  23. package/dist/index.d.ts +4 -0
  24. package/dist/index.js +1417 -14
  25. package/dist/index.js.map +4 -4
  26. package/dist/mixins/bsky.d.ts +23 -0
  27. package/dist/moderation/accumulator.d.ts +14 -0
  28. package/dist/moderation/const/label-groups.d.ts +2 -0
  29. package/dist/moderation/const/labels.d.ts +2 -0
  30. package/dist/moderation/index.d.ts +44 -0
  31. package/dist/moderation/subjects/account.d.ts +3 -0
  32. package/dist/moderation/subjects/feed-generator.d.ts +2 -0
  33. package/dist/moderation/subjects/post.d.ts +2 -0
  34. package/dist/moderation/subjects/profile.d.ts +3 -0
  35. package/dist/moderation/subjects/quoted-post.d.ts +6 -0
  36. package/dist/moderation/subjects/user-list.d.ts +2 -0
  37. package/dist/moderation/types.d.ts +97 -0
  38. package/dist/moderation/util.d.ts +12 -0
  39. package/dist/rich-text/sanitize.d.ts +4 -0
  40. package/docs/labels.md +522 -0
  41. package/docs/moderation-behaviors/posts.md +1919 -0
  42. package/docs/moderation-behaviors/profiles.md +907 -0
  43. package/docs/moderation.md +144 -0
  44. package/package.json +6 -4
  45. package/scripts/code/label-groups.mjs +68 -0
  46. package/scripts/code/labels.mjs +68 -0
  47. package/scripts/docs/labels.mjs +164 -0
  48. package/scripts/docs/post-moderation-behaviors.mjs +122 -0
  49. package/scripts/docs/profile-moderation-behaviors.mjs +122 -0
  50. package/scripts/generate-code.mjs +4 -0
  51. package/scripts/generate-docs.mjs +5 -0
  52. package/src/client/index.ts +13 -0
  53. package/src/client/lexicons.ts +44 -2
  54. package/src/client/types/app/bsky/unspecced/applyLabels.ts +33 -0
  55. package/src/client/types/com/atproto/admin/defs.ts +2 -0
  56. package/src/client/types/com/atproto/admin/disableAccountInvites.ts +2 -0
  57. package/src/client/types/com/atproto/admin/enableAccountInvites.ts +2 -0
  58. package/src/client/types/com/atproto/moderation/defs.ts +1 -1
  59. package/src/index.ts +4 -0
  60. package/src/moderation/accumulator.ts +181 -0
  61. package/src/moderation/const/label-groups.ts +143 -0
  62. package/src/moderation/const/labels.ts +798 -0
  63. package/src/moderation/index.ts +343 -0
  64. package/src/moderation/subjects/account.ts +40 -0
  65. package/src/moderation/subjects/feed-generator.ts +13 -0
  66. package/src/moderation/subjects/post.ts +23 -0
  67. package/src/moderation/subjects/profile.ts +31 -0
  68. package/src/moderation/subjects/quoted-post.ts +62 -0
  69. package/src/moderation/subjects/user-list.ts +13 -0
  70. package/src/moderation/types.ts +141 -0
  71. package/src/moderation/util.ts +98 -0
  72. package/tests/post-moderation.test.ts +46 -0
  73. package/tests/profile-moderation.test.ts +46 -0
  74. package/tests/util/index.ts +176 -0
  75. package/tests/util/moderation-behavior.ts +180 -0
  76. package/dist/client/types/app/bsky/actor/searchActor.d.ts +0 -22
  77. package/dist/client/types/app/bsky/actor/searchActorTypeahead.d.ts +0 -20
  78. package/dist/client/types/com/atproto/admin/getInviteCodeUsage.d.ts +0 -29
  79. package/dist/client/types/com/atproto/repo/importRepo.d.ts +0 -19
  80. package/dist/client/types/com/atproto/repo/uploadRepo.d.ts +0 -19
  81. package/dist/client/types/com/atproto/server/getUserInviteCodes.d.ts +0 -31
  82. package/dist/src/client/index.d.ts +0 -462
  83. package/dist/src/client/lexicons.d.ts +0 -2910
  84. package/dist/src/client/schemas.d.ts +0 -17
  85. package/dist/src/client/types/app/bsky/actor/createScene.d.ts +0 -32
  86. package/dist/src/client/types/app/bsky/actor/getProfile.d.ts +0 -36
  87. package/dist/src/client/types/app/bsky/actor/getSuggestions.d.ts +0 -36
  88. package/dist/src/client/types/app/bsky/actor/profile.d.ts +0 -15
  89. package/dist/src/client/types/app/bsky/actor/ref.d.ts +0 -14
  90. package/dist/src/client/types/app/bsky/actor/search.d.ts +0 -32
  91. package/dist/src/client/types/app/bsky/actor/searchTypeahead.d.ts +0 -28
  92. package/dist/src/client/types/app/bsky/actor/updateProfile.d.ts +0 -48
  93. package/dist/src/client/types/app/bsky/badge.d.ts +0 -22
  94. package/dist/src/client/types/app/bsky/badgeAccept.d.ts +0 -11
  95. package/dist/src/client/types/app/bsky/badgeOffer.d.ts +0 -11
  96. package/dist/src/client/types/app/bsky/declaration.d.ts +0 -6
  97. package/dist/src/client/types/app/bsky/embed/external.d.ts +0 -26
  98. package/dist/src/client/types/app/bsky/embed/images.d.ts +0 -23
  99. package/dist/src/client/types/app/bsky/feed/embed.d.ts +0 -36
  100. package/dist/src/client/types/app/bsky/feed/feedViewPost.d.ts +0 -26
  101. package/dist/src/client/types/app/bsky/feed/getAuthorFeed.d.ts +0 -22
  102. package/dist/src/client/types/app/bsky/feed/getPostThread.d.ts +0 -43
  103. package/dist/src/client/types/app/bsky/feed/getRepostedBy.d.ts +0 -35
  104. package/dist/src/client/types/app/bsky/feed/getTimeline.d.ts +0 -22
  105. package/dist/src/client/types/app/bsky/feed/getVotes.d.ts +0 -33
  106. package/dist/src/client/types/app/bsky/feed/mediaEmbed.d.ts +0 -18
  107. package/dist/src/client/types/app/bsky/feed/post.d.ts +0 -54
  108. package/dist/src/client/types/app/bsky/feed/repost.d.ts +0 -6
  109. package/dist/src/client/types/app/bsky/feed/setVote.d.ts +0 -25
  110. package/dist/src/client/types/app/bsky/feed/trend.d.ts +0 -6
  111. package/dist/src/client/types/app/bsky/feed/vote.d.ts +0 -7
  112. package/dist/src/client/types/app/bsky/follow.d.ts +0 -9
  113. package/dist/src/client/types/app/bsky/getAuthorFeed.d.ts +0 -56
  114. package/dist/src/client/types/app/bsky/getBadgeMembers.d.ts +0 -29
  115. package/dist/src/client/types/app/bsky/getHomeFeed.d.ts +0 -56
  116. package/dist/src/client/types/app/bsky/getLikedBy.d.ts +0 -29
  117. package/dist/src/client/types/app/bsky/getNotificationCount.d.ts +0 -16
  118. package/dist/src/client/types/app/bsky/getNotifications.d.ts +0 -33
  119. package/dist/src/client/types/app/bsky/getPostThread.d.ts +0 -55
  120. package/dist/src/client/types/app/bsky/getProfile.d.ts +0 -26
  121. package/dist/src/client/types/app/bsky/getRepostedBy.d.ts +0 -29
  122. package/dist/src/client/types/app/bsky/getTimeline.d.ts +0 -56
  123. package/dist/src/client/types/app/bsky/getUserFollowers.d.ts +0 -31
  124. package/dist/src/client/types/app/bsky/getUserFollows.d.ts +0 -31
  125. package/dist/src/client/types/app/bsky/getUsersSearch.d.ts +0 -26
  126. package/dist/src/client/types/app/bsky/getUsersTypeahead.d.ts +0 -22
  127. package/dist/src/client/types/app/bsky/graph/assertCreator.d.ts +0 -1
  128. package/dist/src/client/types/app/bsky/graph/assertMember.d.ts +0 -1
  129. package/dist/src/client/types/app/bsky/graph/assertion.d.ts +0 -7
  130. package/dist/src/client/types/app/bsky/graph/confirmation.d.ts +0 -8
  131. package/dist/src/client/types/app/bsky/graph/follow.d.ts +0 -6
  132. package/dist/src/client/types/app/bsky/graph/getAssertions.d.ts +0 -43
  133. package/dist/src/client/types/app/bsky/graph/getFollowers.d.ts +0 -34
  134. package/dist/src/client/types/app/bsky/graph/getFollows.d.ts +0 -33
  135. package/dist/src/client/types/app/bsky/graph/getMembers.d.ts +0 -33
  136. package/dist/src/client/types/app/bsky/graph/getMemberships.d.ts +0 -33
  137. package/dist/src/client/types/app/bsky/invite.d.ts +0 -10
  138. package/dist/src/client/types/app/bsky/inviteAccept.d.ts +0 -14
  139. package/dist/src/client/types/app/bsky/like.d.ts +0 -10
  140. package/dist/src/client/types/app/bsky/mediaEmbed.d.ts +0 -15
  141. package/dist/src/client/types/app/bsky/notification/getCount.d.ts +0 -17
  142. package/dist/src/client/types/app/bsky/notification/list.d.ts +0 -32
  143. package/dist/src/client/types/app/bsky/post.d.ts +0 -23
  144. package/dist/src/client/types/app/bsky/postNotificationsSeen.d.ts +0 -20
  145. package/dist/src/client/types/app/bsky/profile.d.ts +0 -5
  146. package/dist/src/client/types/app/bsky/repost.d.ts +0 -10
  147. package/dist/src/client/types/app/bsky/system/actorScene.d.ts +0 -1
  148. package/dist/src/client/types/app/bsky/system/actorUser.d.ts +0 -1
  149. package/dist/src/client/types/app/bsky/system/declRef.d.ts +0 -5
  150. package/dist/src/client/types/app/bsky/system/declaration.d.ts +0 -4
  151. package/dist/src/client/types/app/bsky/updateProfile.d.ts +0 -23
  152. package/dist/src/client/types/com/atproto/account/create.d.ts +0 -41
  153. package/dist/src/client/types/com/atproto/account/createInviteCode.d.ts +0 -22
  154. package/dist/src/client/types/com/atproto/account/delete.d.ts +0 -13
  155. package/dist/src/client/types/com/atproto/account/get.d.ts +0 -12
  156. package/dist/src/client/types/com/atproto/account/requestPasswordReset.d.ts +0 -17
  157. package/dist/src/client/types/com/atproto/account/resetPassword.d.ts +0 -24
  158. package/dist/src/client/types/com/atproto/blob/upload.d.ts +0 -19
  159. package/dist/src/client/types/com/atproto/createAccount.d.ts +0 -40
  160. package/dist/src/client/types/com/atproto/createInviteCode.d.ts +0 -20
  161. package/dist/src/client/types/com/atproto/createSession.d.ts +0 -24
  162. package/dist/src/client/types/com/atproto/data/uploadFile.d.ts +0 -19
  163. package/dist/src/client/types/com/atproto/deleteAccount.d.ts +0 -20
  164. package/dist/src/client/types/com/atproto/deleteSession.d.ts +0 -17
  165. package/dist/src/client/types/com/atproto/getAccount.d.ts +0 -16
  166. package/dist/src/client/types/com/atproto/getAccountsConfig.d.ts +0 -17
  167. package/dist/src/client/types/com/atproto/getSession.d.ts +0 -17
  168. package/dist/src/client/types/com/atproto/handle/resolve.d.ts +0 -18
  169. package/dist/src/client/types/com/atproto/refreshSession.d.ts +0 -20
  170. package/dist/src/client/types/com/atproto/repo/batchWrite.d.ts +0 -39
  171. package/dist/src/client/types/com/atproto/repo/createRecord.d.ts +0 -26
  172. package/dist/src/client/types/com/atproto/repo/deleteRecord.d.ts +0 -19
  173. package/dist/src/client/types/com/atproto/repo/describe.d.ts +0 -22
  174. package/dist/src/client/types/com/atproto/repo/getRecord.d.ts +0 -23
  175. package/dist/src/client/types/com/atproto/repo/listRecords.d.ts +0 -30
  176. package/dist/src/client/types/com/atproto/repo/putRecord.d.ts +0 -27
  177. package/dist/src/client/types/com/atproto/repo/strongRef.d.ts +0 -5
  178. package/dist/src/client/types/com/atproto/repoBatchWrite.d.ts +0 -36
  179. package/dist/src/client/types/com/atproto/repoCreateRecord.d.ts +0 -24
  180. package/dist/src/client/types/com/atproto/repoDeleteRecord.d.ts +0 -18
  181. package/dist/src/client/types/com/atproto/repoDescribe.d.ts +0 -21
  182. package/dist/src/client/types/com/atproto/repoGetRecord.d.ts +0 -22
  183. package/dist/src/client/types/com/atproto/repoListRecords.d.ts +0 -27
  184. package/dist/src/client/types/com/atproto/repoPutRecord.d.ts +0 -25
  185. package/dist/src/client/types/com/atproto/requestAccountPasswordReset.d.ts +0 -19
  186. package/dist/src/client/types/com/atproto/resetAccountPassword.d.ts +0 -26
  187. package/dist/src/client/types/com/atproto/resolveHandle.d.ts +0 -17
  188. package/dist/src/client/types/com/atproto/resolveName.d.ts +0 -17
  189. package/dist/src/client/types/com/atproto/server/getAccountsConfig.d.ts +0 -24
  190. package/dist/src/client/types/com/atproto/session/create.d.ts +0 -26
  191. package/dist/src/client/types/com/atproto/session/delete.d.ts +0 -13
  192. package/dist/src/client/types/com/atproto/session/get.d.ts +0 -18
  193. package/dist/src/client/types/com/atproto/session/refresh.d.ts +0 -21
  194. package/dist/src/client/types/com/atproto/sync/getRepo.d.ts +0 -15
  195. package/dist/src/client/types/com/atproto/sync/getRoot.d.ts +0 -18
  196. package/dist/src/client/types/com/atproto/sync/updateRepo.d.ts +0 -15
  197. package/dist/src/client/types/com/atproto/syncGetRepo.d.ts +0 -15
  198. package/dist/src/client/types/com/atproto/syncGetRoot.d.ts +0 -17
  199. package/dist/src/client/types/com/atproto/syncUpdateRepo.d.ts +0 -15
  200. package/dist/src/index.d.ts +0 -4
  201. package/dist/src/schemas.d.ts +0 -19
  202. package/dist/src/session.d.ts +0 -42
  203. package/dist/src/types/app/bsky/acceptedBadge.d.ts +0 -10
  204. package/dist/src/types/app/bsky/badge.d.ts +0 -22
  205. package/dist/src/types/app/bsky/badgeAccept.d.ts +0 -11
  206. package/dist/src/types/app/bsky/badgeOffer.d.ts +0 -11
  207. package/dist/src/types/app/bsky/declaration.d.ts +0 -6
  208. package/dist/src/types/app/bsky/follow.d.ts +0 -9
  209. package/dist/src/types/app/bsky/getAuthorFeed.d.ts +0 -56
  210. package/dist/src/types/app/bsky/getBadgeMembers.d.ts +0 -29
  211. package/dist/src/types/app/bsky/getHomeFeed.d.ts +0 -56
  212. package/dist/src/types/app/bsky/getLikedBy.d.ts +0 -29
  213. package/dist/src/types/app/bsky/getNotificationCount.d.ts +0 -16
  214. package/dist/src/types/app/bsky/getNotifications.d.ts +0 -33
  215. package/dist/src/types/app/bsky/getPostThread.d.ts +0 -55
  216. package/dist/src/types/app/bsky/getProfile.d.ts +0 -42
  217. package/dist/src/types/app/bsky/getRepostedBy.d.ts +0 -29
  218. package/dist/src/types/app/bsky/getUserFollowers.d.ts +0 -31
  219. package/dist/src/types/app/bsky/getUserFollows.d.ts +0 -31
  220. package/dist/src/types/app/bsky/getUsersSearch.d.ts +0 -26
  221. package/dist/src/types/app/bsky/getUsersTypeahead.d.ts +0 -22
  222. package/dist/src/types/app/bsky/invite.d.ts +0 -10
  223. package/dist/src/types/app/bsky/inviteAccept.d.ts +0 -14
  224. package/dist/src/types/app/bsky/like.d.ts +0 -10
  225. package/dist/src/types/app/bsky/mediaEmbed.d.ts +0 -15
  226. package/dist/src/types/app/bsky/post.d.ts +0 -23
  227. package/dist/src/types/app/bsky/postNotificationsSeen.d.ts +0 -19
  228. package/dist/src/types/app/bsky/profile.d.ts +0 -11
  229. package/dist/src/types/app/bsky/repost.d.ts +0 -10
  230. package/dist/src/types/app/bsky/updateProfile.d.ts +0 -27
  231. package/dist/src/types/com/atproto/createAccount.d.ts +0 -39
  232. package/dist/src/types/com/atproto/createInviteCode.d.ts +0 -19
  233. package/dist/src/types/com/atproto/createSession.d.ts +0 -23
  234. package/dist/src/types/com/atproto/deleteAccount.d.ts +0 -19
  235. package/dist/src/types/com/atproto/deleteSession.d.ts +0 -16
  236. package/dist/src/types/com/atproto/getAccount.d.ts +0 -19
  237. package/dist/src/types/com/atproto/getAccountsConfig.d.ts +0 -17
  238. package/dist/src/types/com/atproto/getSession.d.ts +0 -17
  239. package/dist/src/types/com/atproto/refreshSession.d.ts +0 -19
  240. package/dist/src/types/com/atproto/repoBatchWrite.d.ts +0 -35
  241. package/dist/src/types/com/atproto/repoCreateRecord.d.ts +0 -23
  242. package/dist/src/types/com/atproto/repoDeleteRecord.d.ts +0 -15
  243. package/dist/src/types/com/atproto/repoDescribe.d.ts +0 -21
  244. package/dist/src/types/com/atproto/repoGetRecord.d.ts +0 -22
  245. package/dist/src/types/com/atproto/repoListRecords.d.ts +0 -27
  246. package/dist/src/types/com/atproto/repoPutRecord.d.ts +0 -24
  247. package/dist/src/types/com/atproto/requestAccountPasswordReset.d.ts +0 -18
  248. package/dist/src/types/com/atproto/resetAccountPassword.d.ts +0 -25
  249. package/dist/src/types/com/atproto/resolveName.d.ts +0 -17
  250. package/dist/src/types/com/atproto/syncGetRepo.d.ts +0 -15
  251. package/dist/src/types/com/atproto/syncGetRoot.d.ts +0 -17
  252. package/dist/src/types/com/atproto/syncUpdateRepo.d.ts +0 -14
  253. package/dist/src/types/todo/adx/createAccount.d.ts +0 -36
  254. package/dist/src/types/todo/adx/createInviteCode.d.ts +0 -19
  255. package/dist/src/types/todo/adx/createSession.d.ts +0 -22
  256. package/dist/src/types/todo/adx/deleteAccount.d.ts +0 -19
  257. package/dist/src/types/todo/adx/deleteSession.d.ts +0 -19
  258. package/dist/src/types/todo/adx/getAccount.d.ts +0 -19
  259. package/dist/src/types/todo/adx/getAccountsConfig.d.ts +0 -17
  260. package/dist/src/types/todo/adx/getSession.d.ts +0 -17
  261. package/dist/src/types/todo/adx/repoBatchWrite.d.ts +0 -34
  262. package/dist/src/types/todo/adx/repoCreateRecord.d.ts +0 -22
  263. package/dist/src/types/todo/adx/repoDeleteRecord.d.ts +0 -15
  264. package/dist/src/types/todo/adx/repoDescribe.d.ts +0 -21
  265. package/dist/src/types/todo/adx/repoGetRecord.d.ts +0 -20
  266. package/dist/src/types/todo/adx/repoListRecords.d.ts +0 -25
  267. package/dist/src/types/todo/adx/repoPutRecord.d.ts +0 -23
  268. package/dist/src/types/todo/adx/requestAccountPasswordReset.d.ts +0 -18
  269. package/dist/src/types/todo/adx/resetAccountPassword.d.ts +0 -25
  270. package/dist/src/types/todo/adx/resolveName.d.ts +0 -17
  271. package/dist/src/types/todo/adx/syncGetRepo.d.ts +0 -15
  272. package/dist/src/types/todo/adx/syncGetRoot.d.ts +0 -17
  273. package/dist/src/types/todo/adx/syncUpdateRepo.d.ts +0 -14
  274. package/dist/src/types/todo/social/badge.d.ts +0 -23
  275. package/dist/src/types/todo/social/follow.d.ts +0 -5
  276. package/dist/src/types/todo/social/getAuthorFeed.d.ts +0 -55
  277. package/dist/src/types/todo/social/getFeed.d.ts +0 -55
  278. package/dist/src/types/todo/social/getHomeFeed.d.ts +0 -55
  279. package/dist/src/types/todo/social/getLikedBy.d.ts +0 -26
  280. package/dist/src/types/todo/social/getNotificationCount.d.ts +0 -16
  281. package/dist/src/types/todo/social/getNotifications.d.ts +0 -31
  282. package/dist/src/types/todo/social/getPostThread.d.ts +0 -54
  283. package/dist/src/types/todo/social/getProfile.d.ts +0 -40
  284. package/dist/src/types/todo/social/getRepostedBy.d.ts +0 -26
  285. package/dist/src/types/todo/social/getUserFollowers.d.ts +0 -30
  286. package/dist/src/types/todo/social/getUserFollows.d.ts +0 -30
  287. package/dist/src/types/todo/social/like.d.ts +0 -5
  288. package/dist/src/types/todo/social/mediaEmbed.d.ts +0 -15
  289. package/dist/src/types/todo/social/post.d.ts +0 -18
  290. package/dist/src/types/todo/social/postNotificationsSeen.d.ts +0 -19
  291. package/dist/src/types/todo/social/profile.d.ts +0 -10
  292. package/dist/src/types/todo/social/repost.d.ts +0 -5
  293. package/dist/tsconfig.build.tsbuildinfo +0 -1
  294. package/tests/_util.ts +0 -26
  295. package/tsconfig.build.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -160,6 +160,87 @@ console.log(rt3.length) // => 25
160
160
  console.log(rt3.graphemeLength) // => 1
161
161
  ```
162
162
 
163
+ ### Moderation
164
+
165
+ Applying the moderation system is a challenging task, but we've done our best to simplify it for you. The Moderation API helps handle a wide range of tasks, including:
166
+
167
+ - User muting (including mutelists)
168
+ - User blocking
169
+ - Moderator labeling
170
+
171
+ For more information, see the [Moderation Documentation](./docs/moderation.md) or the associated [Labels Reference](./docs/labels.md).
172
+
173
+ ```typescript
174
+ import {moderatePost, moderateProfile} from '@atproto/api'
175
+
176
+ // We call the appropriate moderation function for the content
177
+ // =
178
+
179
+ const postMod = moderatePost(postView, getOpts())
180
+ const profileMod = moderateProfile(profileView, getOpts())
181
+
182
+ // We then use the output to decide how to affect rendering
183
+ // =
184
+
185
+ if (postMod.content.filter) {
186
+ // dont render in feeds or similar
187
+ // in contexts where this is disruptive (eg threads) you should ignore this and instead check blur
188
+ }
189
+ if (postMod.content.blur) {
190
+ // render the whole object behind a cover (use postMod.content.cause to explain)
191
+ if (postMod.content.noOverride) {
192
+ // do not allow the cover the be removed
193
+ }
194
+ }
195
+ if (postMod.content.alert) {
196
+ // render a warning on the content (use postMod.content.cause to explain)
197
+ }
198
+ if (postMod.embed.blur) {
199
+ // render the embedded media behind a cover (use postMod.embed.cause to explain)
200
+ if (postMod.embed.noOverride) {
201
+ // do not allow the cover the be removed
202
+ }
203
+ }
204
+ if (postMod.embed.alert) {
205
+ // render a warning on the embedded media (use postMod.embed.cause to explain)
206
+ }
207
+ if (postMod.avatar.blur) {
208
+ // render the avatar behind a cover
209
+ }
210
+ if (postMod.avatar.alert) {
211
+ // render an alert on the avatar
212
+ }
213
+
214
+ // The options passed into `apply()` supply the user's preferences
215
+ // =
216
+
217
+ function getOpts() {
218
+ return {
219
+ // the logged-in user's DID
220
+ userDid: 'did:plc:1234...',
221
+
222
+ // is adult content allowed?
223
+ adultContentEnabled: true,
224
+
225
+ // the user's labeler settings
226
+ labelerSettings: [
227
+ {
228
+ labeler: {
229
+ did: '...',
230
+ displayName: 'My mod service'
231
+ },
232
+ settings: {
233
+ porn: 'hide',
234
+ sexual: 'warn',
235
+ nudity: 'ignore',
236
+ // ...
237
+ }
238
+ }
239
+ ]
240
+ }
241
+ }
242
+ ```
243
+
163
244
  ## Advanced
164
245
 
165
246
  ### Advanced API calls
@@ -0,0 +1,212 @@
1
+ [
2
+ {
3
+ "id": "system",
4
+ "configurable": false,
5
+ "labels": [
6
+ {
7
+ "id": "!hide",
8
+ "preferences": ["hide"],
9
+ "flags": ["no-override"],
10
+ "onwarn": "blur"
11
+ },
12
+ {
13
+ "id": "!no-promote",
14
+ "preferences": ["hide"],
15
+ "flags": [],
16
+ "onwarn": null
17
+ },
18
+ {
19
+ "id": "!warn",
20
+ "preferences": ["warn"],
21
+ "flags": [],
22
+ "onwarn": "blur"
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "id": "legal",
28
+ "configurable": false,
29
+ "labels": [
30
+ {
31
+ "id": "dmca-violation",
32
+ "preferences": ["hide"],
33
+ "flags": ["no-override"],
34
+ "onwarn": "blur"
35
+ },
36
+ {
37
+ "id": "doxxing",
38
+ "preferences": ["hide"],
39
+ "flags": ["no-override"],
40
+ "onwarn": "blur"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "id": "sexual",
46
+ "configurable": true,
47
+ "labels": [
48
+ {
49
+ "id": "porn",
50
+ "preferences": ["ignore", "warn", "hide"],
51
+ "flags": ["adult"],
52
+ "onwarn": "blur-media"
53
+ },
54
+ {
55
+ "id": "sexual",
56
+ "preferences": ["ignore", "warn", "hide"],
57
+ "flags": ["adult"],
58
+ "onwarn": "blur-media"
59
+ },
60
+ {
61
+ "id": "nudity",
62
+ "preferences": ["ignore", "warn", "hide"],
63
+ "flags": ["adult"],
64
+ "onwarn": "blur-media"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "id": "violence",
70
+ "configurable": true,
71
+ "labels": [
72
+ {
73
+ "id": "nsfl",
74
+ "preferences": ["ignore", "warn", "hide"],
75
+ "flags": ["adult"],
76
+ "onwarn": "blur-media"
77
+ },
78
+ {
79
+ "id": "corpse",
80
+ "preferences": ["ignore", "warn", "hide"],
81
+ "flags": ["adult"],
82
+ "onwarn": "blur-media"
83
+ },
84
+ {
85
+ "id": "gore",
86
+ "preferences": ["ignore", "warn", "hide"],
87
+ "flags": ["adult"],
88
+ "onwarn": "blur-media"
89
+ },
90
+ {
91
+ "id": "torture",
92
+ "preferences": ["ignore", "warn", "hide"],
93
+ "flags": ["adult"],
94
+ "onwarn": "blur"
95
+ },
96
+ {
97
+ "id": "self-harm",
98
+ "preferences": ["ignore", "warn", "hide"],
99
+ "flags": ["adult"],
100
+ "onwarn": "blur-media"
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "id": "intolerance",
106
+ "configurable": true,
107
+ "labels": [
108
+ {
109
+ "id": "intolerant-race",
110
+ "preferences": ["ignore", "warn", "hide"],
111
+ "flags": [],
112
+ "onwarn": "blur"
113
+ },
114
+ {
115
+ "id": "intolerant-gender",
116
+ "preferences": ["ignore", "warn", "hide"],
117
+ "flags": [],
118
+ "onwarn": "blur"
119
+ },
120
+ {
121
+ "id": "intolerant-sexual-orientation",
122
+ "preferences": ["ignore", "warn", "hide"],
123
+ "flags": [],
124
+ "onwarn": "blur"
125
+ },
126
+ {
127
+ "id": "intolerant-religion",
128
+ "preferences": ["ignore", "warn", "hide"],
129
+ "flags": [],
130
+ "onwarn": "blur"
131
+ },
132
+ {
133
+ "id": "intolerant",
134
+ "preferences": ["ignore", "warn", "hide"],
135
+ "flags": [],
136
+ "onwarn": "blur"
137
+ },
138
+ {
139
+ "id": "icon-intolerant",
140
+ "preferences": ["ignore", "warn", "hide"],
141
+ "flags": [],
142
+ "onwarn": "blur-media"
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ "id": "rude",
148
+ "configurable": true,
149
+ "labels": [
150
+ {
151
+ "id": "threat",
152
+ "preferences": ["ignore", "warn", "hide"],
153
+ "flags": [],
154
+ "onwarn": "blur"
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "id": "curation",
160
+ "configurable": true,
161
+ "labels": [
162
+ {
163
+ "id": "spoiler",
164
+ "preferences": ["ignore", "warn", "hide"],
165
+ "flags": [],
166
+ "onwarn": "blur"
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ "id": "spam",
172
+ "configurable": true,
173
+ "labels": [
174
+ {
175
+ "id": "spam",
176
+ "preferences": ["ignore", "warn", "hide"],
177
+ "flags": [],
178
+ "onwarn": "blur"
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "id": "misinfo",
184
+ "configurable": true,
185
+ "labels": [
186
+ {
187
+ "id": "account-security",
188
+ "preferences": ["ignore", "warn", "hide"],
189
+ "flags": [],
190
+ "onwarn": "blur"
191
+ },
192
+ {
193
+ "id": "net-abuse",
194
+ "preferences": ["ignore", "warn", "hide"],
195
+ "flags": [],
196
+ "onwarn": "blur"
197
+ },
198
+ {
199
+ "id": "impersonation",
200
+ "preferences": ["ignore", "warn", "hide"],
201
+ "flags": [],
202
+ "onwarn": "alert"
203
+ },
204
+ {
205
+ "id": "scam",
206
+ "preferences": ["ignore", "warn", "hide"],
207
+ "flags": [],
208
+ "onwarn": "alert"
209
+ }
210
+ ]
211
+ }
212
+ ]
@@ -0,0 +1,38 @@
1
+ {
2
+ "system": {
3
+ "name": "System",
4
+ "description": "Moderator overrides for special cases."
5
+ },
6
+ "legal": {
7
+ "name": "Legal",
8
+ "description": "Content removed for legal reasons."
9
+ },
10
+ "sexual": {
11
+ "name": "Adult Content",
12
+ "description": "Content which is sexual in nature."
13
+ },
14
+ "violence": {
15
+ "name": "Violence",
16
+ "description": "Content which is violent or deeply disturbing."
17
+ },
18
+ "intolerance": {
19
+ "name": "Intolerance",
20
+ "description": "Content or behavior which is hateful or intolerant toward a group of people."
21
+ },
22
+ "rude": {
23
+ "name": "Rude",
24
+ "description": "Behavior which is rude toward other users."
25
+ },
26
+ "curation": {
27
+ "name": "Curational",
28
+ "description": "Subjective moderation geared towards curating a more positive environment."
29
+ },
30
+ "spam": {
31
+ "name": "Spam",
32
+ "description": "Content which doesn't add to the conversation."
33
+ },
34
+ "misinfo": {
35
+ "name": "Misinformation",
36
+ "description": "Content which misleads or defrauds users."
37
+ }
38
+ }