Add isFallback
to getSuggestedFollowsByActor
method (#2805)
* Add isFallback to `getSuggestedFollowsByActor` Inferred based on returned `relativeToDid` from the suggestions response. * Integrate new params * Fix logic
This commit is contained in:
parent
a06634ae57
commit
319aa7cf6d
lexicons/app/bsky
packages
api/src/client
bsky/src
api/app/bsky/graph
lexicon
ozone/src/lexicon
pds/src/lexicon
@ -24,6 +24,11 @@
|
||||
"type": "ref",
|
||||
"ref": "app.bsky.actor.defs#profileView"
|
||||
}
|
||||
},
|
||||
"isFallback": {
|
||||
"type": "boolean",
|
||||
"description": "If true, response has fallen-back to generic results, and is not scoped using relativeToDid",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,11 @@
|
||||
"type": "ref",
|
||||
"ref": "app.bsky.unspecced.defs#skeletonSearchActor"
|
||||
}
|
||||
},
|
||||
"relativeToDid": {
|
||||
"type": "string",
|
||||
"format": "did",
|
||||
"description": "DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8236,6 +8236,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.actor.defs#profileView',
|
||||
},
|
||||
},
|
||||
isFallback: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -9192,6 +9198,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
|
||||
},
|
||||
},
|
||||
relativeToDid: {
|
||||
type: 'string',
|
||||
format: 'did',
|
||||
description:
|
||||
'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -16,6 +16,8 @@ export type InputSchema = undefined
|
||||
|
||||
export interface OutputSchema {
|
||||
suggestions: AppBskyActorDefs.ProfileView[]
|
||||
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
||||
isFallback: boolean
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ export type InputSchema = undefined
|
||||
export interface OutputSchema {
|
||||
cursor?: string
|
||||
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
||||
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
||||
relativeToDid?: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
||||
{ headers: params.headers },
|
||||
)
|
||||
return {
|
||||
isFallback: !res.data.relativeToDid,
|
||||
suggestedDids: res.data.actors.map((a) => a.did),
|
||||
headers: res.headers,
|
||||
}
|
||||
@ -80,6 +81,7 @@ const skeleton = async (input: SkeletonFnInput<Context, Params>) => {
|
||||
relativeToDid,
|
||||
})
|
||||
return {
|
||||
isFallback: true,
|
||||
suggestedDids: dids,
|
||||
}
|
||||
}
|
||||
@ -113,7 +115,7 @@ const presentation = (
|
||||
const suggestions = mapDefined(suggestedDids, (did) =>
|
||||
ctx.views.profileDetailed(did, hydration),
|
||||
)
|
||||
return { suggestions, headers }
|
||||
return { isFallback: skeleton.isFallback, suggestions, headers }
|
||||
}
|
||||
|
||||
type Context = {
|
||||
@ -129,6 +131,7 @@ type Params = QueryParams & {
|
||||
}
|
||||
|
||||
type SkeletonState = {
|
||||
isFallback: boolean
|
||||
suggestedDids: string[]
|
||||
headers?: Record<string, string>
|
||||
}
|
||||
|
@ -8236,6 +8236,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.actor.defs#profileView',
|
||||
},
|
||||
},
|
||||
isFallback: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -9192,6 +9198,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
|
||||
},
|
||||
},
|
||||
relativeToDid: {
|
||||
type: 'string',
|
||||
format: 'did',
|
||||
description:
|
||||
'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -17,6 +17,8 @@ export type InputSchema = undefined
|
||||
|
||||
export interface OutputSchema {
|
||||
suggestions: AppBskyActorDefs.ProfileView[]
|
||||
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
||||
isFallback?: boolean
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ export type InputSchema = undefined
|
||||
export interface OutputSchema {
|
||||
cursor?: string
|
||||
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
||||
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
||||
relativeToDid?: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -8236,6 +8236,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.actor.defs#profileView',
|
||||
},
|
||||
},
|
||||
isFallback: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -9192,6 +9198,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
|
||||
},
|
||||
},
|
||||
relativeToDid: {
|
||||
type: 'string',
|
||||
format: 'did',
|
||||
description:
|
||||
'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -17,6 +17,8 @@ export type InputSchema = undefined
|
||||
|
||||
export interface OutputSchema {
|
||||
suggestions: AppBskyActorDefs.ProfileView[]
|
||||
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
||||
isFallback?: boolean
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ export type InputSchema = undefined
|
||||
export interface OutputSchema {
|
||||
cursor?: string
|
||||
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
||||
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
||||
relativeToDid?: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -8236,6 +8236,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.actor.defs#profileView',
|
||||
},
|
||||
},
|
||||
isFallback: {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'If true, response has fallen-back to generic results, and is not scoped using relativeToDid',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -9192,6 +9198,12 @@ export const schemaDict = {
|
||||
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
|
||||
},
|
||||
},
|
||||
relativeToDid: {
|
||||
type: 'string',
|
||||
format: 'did',
|
||||
description:
|
||||
'DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -17,6 +17,8 @@ export type InputSchema = undefined
|
||||
|
||||
export interface OutputSchema {
|
||||
suggestions: AppBskyActorDefs.ProfileView[]
|
||||
/** If true, response has fallen-back to generic results, and is not scoped using relativeToDid */
|
||||
isFallback?: boolean
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ export type InputSchema = undefined
|
||||
export interface OutputSchema {
|
||||
cursor?: string
|
||||
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
|
||||
/** DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. */
|
||||
relativeToDid?: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user