Skip to content

Commit

Permalink
actor type in profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed May 8, 2023
1 parent aabbf43 commit 7941e1e
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lexicons/app/bsky/actor/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"maxLength": 640
},
"avatar": { "type": "string" },
"actorType": {"type": "ref", "ref": "#actorType"},
"viewer": {"type": "ref", "ref": "#viewerState"},
"labels": {
"type": "array",
Expand All @@ -39,6 +40,7 @@
"maxLength": 2560
},
"avatar": { "type": "string" },
"actorType": {"type": "ref", "ref": "#actorType"},
"indexedAt": {"type": "string", "format": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"},
"labels": {
Expand All @@ -64,6 +66,7 @@
"maxLength": 2560
},
"avatar": { "type": "string" },
"actorType": {"type": "ref", "ref": "#actorType"},
"banner": { "type": "string" },
"followersCount": {"type": "integer"},
"followsCount": {"type": "integer"},
Expand All @@ -85,6 +88,21 @@
"following": {"type": "string", "format": "at-uri"},
"followedBy": {"type": "string", "format": "at-uri"}
}
},
"actorType": {
"type": "string",
"knownValues":[
"app.bsky.actor.defs#user",
"app.bsky.actor.defs#feedGenerator"
]
},
"user": {
"type": "token",
"description": "Actor type: User. This is the default option and an actor is assumed to be a user unless suggested otherwise."
},
"feedGenerator": {
"type": "token",
"description": "Actor type: Feed Generator. A service that provides a custom feed."
}
}
}
4 changes: 4 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export const COM_ATPROTO_MODERATION = {
DefsReasonRude: 'com.atproto.moderation.defs#reasonRude',
DefsReasonOther: 'com.atproto.moderation.defs#reasonOther',
}
export const APP_BSKY_ACTOR = {
DefsUser: 'app.bsky.actor.defs#user',
DefsFeedGenerator: 'app.bsky.actor.defs#feedGenerator',
}

export class AtpBaseClient {
xrpc: XrpcClient = new XrpcClient()
Expand Down
29 changes: 29 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3285,6 +3285,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
viewer: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#viewerState',
Expand Down Expand Up @@ -3323,6 +3327,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down Expand Up @@ -3365,6 +3373,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
banner: {
type: 'string',
},
Expand Down Expand Up @@ -3417,6 +3429,23 @@ export const schemaDict = {
},
},
},
actorType: {
type: 'string',
knownValues: [
'app.bsky.actor.defs#user',
'app.bsky.actor.defs#feedGenerator',
],
},
user: {
type: 'token',
description:
'Actor type: User. This is the default option and an actor is assumed to be a user unless suggested otherwise.',
},
feedGenerator: {
type: 'token',
description:
'Actor type: Feed Generator. A service that provides a custom feed.',
},
},
},
AppBskyActorGetProfile: {
Expand Down
13 changes: 13 additions & 0 deletions packages/api/src/client/types/app/bsky/actor/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ProfileViewBasic {
handle: string
displayName?: string
avatar?: string
actorType?: ActorType
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
[k: string]: unknown
Expand All @@ -35,6 +36,7 @@ export interface ProfileView {
displayName?: string
description?: string
avatar?: string
actorType?: ActorType
indexedAt?: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand All @@ -59,6 +61,7 @@ export interface ProfileViewDetailed {
displayName?: string
description?: string
avatar?: string
actorType?: ActorType
banner?: string
followersCount?: number
followsCount?: number
Expand Down Expand Up @@ -101,3 +104,13 @@ export function isViewerState(v: unknown): v is ViewerState {
export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.actor.defs#viewerState', v)
}

export type ActorType =
| 'app.bsky.actor.defs#user'
| 'app.bsky.actor.defs#feedGenerator'
| (string & {})

/** Actor type: User. This is the default option and an actor is assumed to be a user unless suggested otherwise. */
export const USER = 'app.bsky.actor.defs#user'
/** Actor type: Feed Generator. A service that provides a custom feed. */
export const FEEDGENERATOR = 'app.bsky.actor.defs#feedGenerator'
4 changes: 4 additions & 0 deletions packages/pds/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const COM_ATPROTO_MODERATION = {
DefsReasonRude: 'com.atproto.moderation.defs#reasonRude',
DefsReasonOther: 'com.atproto.moderation.defs#reasonOther',
}
export const APP_BSKY_ACTOR = {
DefsUser: 'app.bsky.actor.defs#user',
DefsFeedGenerator: 'app.bsky.actor.defs#feedGenerator',
}

export function createServer(options?: XrpcOptions): Server {
return new Server(options)
Expand Down
29 changes: 29 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3285,6 +3285,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
viewer: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#viewerState',
Expand Down Expand Up @@ -3323,6 +3327,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down Expand Up @@ -3365,6 +3373,10 @@ export const schemaDict = {
avatar: {
type: 'string',
},
actorType: {
type: 'ref',
ref: 'lex:app.bsky.actor.defs#actorType',
},
banner: {
type: 'string',
},
Expand Down Expand Up @@ -3417,6 +3429,23 @@ export const schemaDict = {
},
},
},
actorType: {
type: 'string',
knownValues: [
'app.bsky.actor.defs#user',
'app.bsky.actor.defs#feedGenerator',
],
},
user: {
type: 'token',
description:
'Actor type: User. This is the default option and an actor is assumed to be a user unless suggested otherwise.',
},
feedGenerator: {
type: 'token',
description:
'Actor type: Feed Generator. A service that provides a custom feed.',
},
},
},
AppBskyActorGetProfile: {
Expand Down
13 changes: 13 additions & 0 deletions packages/pds/src/lexicon/types/app/bsky/actor/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ProfileViewBasic {
handle: string
displayName?: string
avatar?: string
actorType?: ActorType
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
[k: string]: unknown
Expand All @@ -35,6 +36,7 @@ export interface ProfileView {
displayName?: string
description?: string
avatar?: string
actorType?: ActorType
indexedAt?: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand All @@ -59,6 +61,7 @@ export interface ProfileViewDetailed {
displayName?: string
description?: string
avatar?: string
actorType?: ActorType
banner?: string
followersCount?: number
followsCount?: number
Expand Down Expand Up @@ -101,3 +104,13 @@ export function isViewerState(v: unknown): v is ViewerState {
export function validateViewerState(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.actor.defs#viewerState', v)
}

export type ActorType =
| 'app.bsky.actor.defs#user'
| 'app.bsky.actor.defs#feedGenerator'
| (string & {})

/** Actor type: User. This is the default option and an actor is assumed to be a user unless suggested otherwise. */
export const USER = 'app.bsky.actor.defs#user'
/** Actor type: Feed Generator. A service that provides a custom feed. */
export const FEEDGENERATOR = 'app.bsky.actor.defs#feedGenerator'

0 comments on commit 7941e1e

Please sign in to comment.