@atproto/api
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -102,2 +102,3 @@ import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc'; | ||
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'; | ||
import * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLabels'; | ||
import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular'; | ||
@@ -221,2 +222,3 @@ import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'; | ||
export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'; | ||
export * as AppBskyUnspeccedApplyLabels from './types/app/bsky/unspecced/applyLabels'; | ||
export * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular'; | ||
@@ -631,2 +633,3 @@ export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'; | ||
constructor(service: AtpServiceClient); | ||
applyLabels(data?: AppBskyUnspeccedApplyLabels.InputSchema, opts?: AppBskyUnspeccedApplyLabels.CallOptions): Promise<AppBskyUnspeccedApplyLabels.Response>; | ||
getPopular(params?: AppBskyUnspeccedGetPopular.QueryParams, opts?: AppBskyUnspeccedGetPopular.CallOptions): Promise<AppBskyUnspeccedGetPopular.Response>; | ||
@@ -633,0 +636,0 @@ getPopularFeedGenerators(params?: AppBskyUnspeccedGetPopularFeedGenerators.QueryParams, opts?: AppBskyUnspeccedGetPopularFeedGenerators.CallOptions): Promise<AppBskyUnspeccedGetPopularFeedGenerators.Response>; |
import { Headers, XRPCError } from '@atproto/xrpc'; | ||
import { BlobRef } from '@atproto/lexicon'; | ||
export interface QueryParams { | ||
@@ -7,12 +8,4 @@ } | ||
description?: string | null; | ||
avatar?: { | ||
cid: string; | ||
mimeType: string; | ||
[k: string]: unknown; | ||
} | null; | ||
banner?: { | ||
cid: string; | ||
mimeType: string; | ||
[k: string]: unknown; | ||
} | null; | ||
avatar?: BlobRef | null; | ||
banner?: BlobRef | null; | ||
[k: string]: unknown; | ||
@@ -19,0 +12,0 @@ } |
@@ -10,3 +10,7 @@ export { AtUri } from '@atproto/uri'; | ||
export * from './rich-text/unicode'; | ||
export * from './moderation'; | ||
export * from './moderation/types'; | ||
export { LABELS } from './moderation/const/labels'; | ||
export { LABEL_GROUPS } from './moderation/const/label-groups'; | ||
export { BskyAgent } from './bsky-agent'; | ||
export { AtpAgent as default } from './agent'; |
{ | ||
"name": "@atproto/api", | ||
"version": "0.4.4", | ||
"main": "dist/index.js", | ||
"version": "0.5.0", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"codegen": "lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*", | ||
"codegen": "yarn docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*", | ||
"docgen": "node ./scripts/generate-docs.mjs", | ||
"build": "node ./build.js", | ||
@@ -32,4 +33,5 @@ "postbuild": "tsc --build tsconfig.build.json", | ||
"@atproto/lex-cli": "*", | ||
"@atproto/pds": "*" | ||
"@atproto/pds": "*", | ||
"common-tags": "^1.8.2" | ||
} | ||
} |
@@ -163,2 +163,83 @@ # ATP API | ||
### Moderation | ||
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: | ||
- User muting (including mutelists) | ||
- User blocking | ||
- Moderator labeling | ||
For more information, see the [Moderation Documentation](./docs/moderation.md) or the associated [Labels Reference](./docs/labels.md). | ||
```typescript | ||
import {moderatePost, moderateProfile} from '@atproto/api' | ||
// We call the appropriate moderation function for the content | ||
// = | ||
const postMod = moderatePost(postView, getOpts()) | ||
const profileMod = moderateProfile(profileView, getOpts()) | ||
// We then use the output to decide how to affect rendering | ||
// = | ||
if (postMod.content.filter) { | ||
// dont render in feeds or similar | ||
// in contexts where this is disruptive (eg threads) you should ignore this and instead check blur | ||
} | ||
if (postMod.content.blur) { | ||
// render the whole object behind a cover (use postMod.content.cause to explain) | ||
if (postMod.content.noOverride) { | ||
// do not allow the cover the be removed | ||
} | ||
} | ||
if (postMod.content.alert) { | ||
// render a warning on the content (use postMod.content.cause to explain) | ||
} | ||
if (postMod.embed.blur) { | ||
// render the embedded media behind a cover (use postMod.embed.cause to explain) | ||
if (postMod.embed.noOverride) { | ||
// do not allow the cover the be removed | ||
} | ||
} | ||
if (postMod.embed.alert) { | ||
// render a warning on the embedded media (use postMod.embed.cause to explain) | ||
} | ||
if (postMod.avatar.blur) { | ||
// render the avatar behind a cover | ||
} | ||
if (postMod.avatar.alert) { | ||
// render an alert on the avatar | ||
} | ||
// The options passed into `apply()` supply the user's preferences | ||
// = | ||
function getOpts() { | ||
return { | ||
// the logged-in user's DID | ||
userDid: 'did:plc:1234...', | ||
// is adult content allowed? | ||
adultContentEnabled: true, | ||
// the user's labeler settings | ||
labelerSettings: [ | ||
{ | ||
labeler: { | ||
did: '...', | ||
displayName: 'My mod service' | ||
}, | ||
settings: { | ||
porn: 'hide', | ||
sexual: 'warn', | ||
nudity: 'ignore', | ||
// ... | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
## Advanced | ||
@@ -165,0 +246,0 @@ |
@@ -14,3 +14,3 @@ /** | ||
account: string | ||
/** Additionally add a note describing why the invites were disabled */ | ||
/** Additionally add a note describing why the invites were enabled */ | ||
note?: string | ||
@@ -17,0 +17,0 @@ [k: string]: unknown |
@@ -24,3 +24,3 @@ /** | ||
export const REASONMISLEADING = 'com.atproto.moderation.defs#reasonMisleading' | ||
/** Unwanted or mis-labeled sexual content */ | ||
/** Unwanted or mislabeled sexual content */ | ||
export const REASONSEXUAL = 'com.atproto.moderation.defs#reasonSexual' | ||
@@ -27,0 +27,0 @@ /** Rude, harassing, explicit, or otherwise unwelcoming behavior */ |
@@ -16,3 +16,7 @@ export { AtUri } from '@atproto/uri' | ||
export * from './rich-text/unicode' | ||
export * from './moderation' | ||
export * from './moderation/types' | ||
export { LABELS } from './moderation/const/labels' | ||
export { LABEL_GROUPS } from './moderation/const/label-groups' | ||
export { BskyAgent } from './bsky-agent' | ||
export { AtpAgent as default } from './agent' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310
4086909
3
393
62536
6