Skip to content

Commit

Permalink
getSuggestionsSkeleton lexicon (#2399)
Browse files Browse the repository at this point in the history
* schema

* codegen

* add skeletonActor def

* add optional viewer param

* codegen

* make move route to unspecced

* use unspecced skeleton actor
  • Loading branch information
dholms authored Apr 16, 2024
1 parent 1074f43 commit 45981de
Show file tree
Hide file tree
Showing 13 changed files with 496 additions and 0 deletions.
44 changes: 44 additions & 0 deletions lexicons/app/bsky/unspecced/getSuggestionsSkeleton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"lexicon": 1,
"id": "app.bsky.unspecced.getSuggestionsSkeleton",
"defs": {
"main": {
"type": "query",
"description": "Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions",
"parameters": {
"type": "params",
"properties": {
"viewer": {
"type": "string",
"format": "did",
"description": "DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking."
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 50
},
"cursor": { "type": "string" }
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["actors"],
"properties": {
"cursor": { "type": "string" },
"actors": {
"type": "array",
"items": {
"type": "ref",
"ref": "app.bsky.unspecced.defs#skeletonSearchActor"
}
}
}
}
}
}
}
}
18 changes: 18 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/up
import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -310,6 +311,7 @@ export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/up
export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
export * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
export * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
export * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
export * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -2635,6 +2637,22 @@ export class AppBskyUnspeccedNS {
})
}

getSuggestionsSkeleton(
params?: AppBskyUnspeccedGetSuggestionsSkeleton.QueryParams,
opts?: AppBskyUnspeccedGetSuggestionsSkeleton.CallOptions,
): Promise<AppBskyUnspeccedGetSuggestionsSkeleton.Response> {
return this._service.xrpc
.call(
'app.bsky.unspecced.getSuggestionsSkeleton',
params,
undefined,
opts,
)
.catch((e) => {
throw AppBskyUnspeccedGetSuggestionsSkeleton.toKnownErr(e)
})
}

getTaggedSuggestions(
params?: AppBskyUnspeccedGetTaggedSuggestions.QueryParams,
opts?: AppBskyUnspeccedGetTaggedSuggestions.CallOptions,
Expand Down
52 changes: 52 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7843,6 +7843,56 @@ export const schemaDict = {
},
},
},
AppBskyUnspeccedGetSuggestionsSkeleton: {
lexicon: 1,
id: 'app.bsky.unspecced.getSuggestionsSkeleton',
defs: {
main: {
type: 'query',
description:
'Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions',
parameters: {
type: 'params',
properties: {
viewer: {
type: 'string',
format: 'did',
description:
'DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking.',
},
limit: {
type: 'integer',
minimum: 1,
maximum: 100,
default: 50,
},
cursor: {
type: 'string',
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['actors'],
properties: {
cursor: {
type: 'string',
},
actors: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
},
},
},
},
},
},
},
},
AppBskyUnspeccedGetTaggedSuggestions: {
lexicon: 1,
id: 'app.bsky.unspecced.getTaggedSuggestions',
Expand Down Expand Up @@ -9621,6 +9671,8 @@ export const ids = {
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
AppBskyUnspeccedGetPopularFeedGenerators:
'app.bsky.unspecced.getPopularFeedGenerators',
AppBskyUnspeccedGetSuggestionsSkeleton:
'app.bsky.unspecced.getSuggestionsSkeleton',
AppBskyUnspeccedGetTaggedSuggestions:
'app.bsky.unspecced.getTaggedSuggestions',
AppBskyUnspeccedSearchActorsSkeleton:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import { Headers, XRPCError } from '@atproto/xrpc'
import { ValidationResult, BlobRef } from '@atproto/lexicon'
import { isObj, hasProp } from '../../../../util'
import { lexicons } from '../../../../lexicons'
import { CID } from 'multiformats/cid'
import * as AppBskyUnspeccedDefs from './defs'

export interface QueryParams {
/** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */
viewer?: string
limit?: number
cursor?: string
}

export type InputSchema = undefined

export interface OutputSchema {
cursor?: string
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
[k: string]: unknown
}

export interface CallOptions {
headers?: Headers
}

export interface Response {
success: boolean
headers: Headers
data: OutputSchema
}

export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
}
return e
}
12 changes: 12 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -1648,6 +1649,17 @@ export class AppBskyUnspeccedNS {
return this._server.xrpc.method(nsid, cfg)
}

getSuggestionsSkeleton<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
AppBskyUnspeccedGetSuggestionsSkeleton.Handler<ExtractAuth<AV>>,
AppBskyUnspeccedGetSuggestionsSkeleton.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'app.bsky.unspecced.getSuggestionsSkeleton' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

getTaggedSuggestions<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
52 changes: 52 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7843,6 +7843,56 @@ export const schemaDict = {
},
},
},
AppBskyUnspeccedGetSuggestionsSkeleton: {
lexicon: 1,
id: 'app.bsky.unspecced.getSuggestionsSkeleton',
defs: {
main: {
type: 'query',
description:
'Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions',
parameters: {
type: 'params',
properties: {
viewer: {
type: 'string',
format: 'did',
description:
'DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking.',
},
limit: {
type: 'integer',
minimum: 1,
maximum: 100,
default: 50,
},
cursor: {
type: 'string',
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['actors'],
properties: {
cursor: {
type: 'string',
},
actors: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.unspecced.defs#skeletonSearchActor',
},
},
},
},
},
},
},
},
AppBskyUnspeccedGetTaggedSuggestions: {
lexicon: 1,
id: 'app.bsky.unspecced.getTaggedSuggestions',
Expand Down Expand Up @@ -8244,6 +8294,8 @@ export const ids = {
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
AppBskyUnspeccedGetPopularFeedGenerators:
'app.bsky.unspecced.getPopularFeedGenerators',
AppBskyUnspeccedGetSuggestionsSkeleton:
'app.bsky.unspecced.getSuggestionsSkeleton',
AppBskyUnspeccedGetTaggedSuggestions:
'app.bsky.unspecced.getTaggedSuggestions',
AppBskyUnspeccedSearchActorsSkeleton:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import express from 'express'
import { ValidationResult, BlobRef } from '@atproto/lexicon'
import { lexicons } from '../../../../lexicons'
import { isObj, hasProp } from '../../../../util'
import { CID } from 'multiformats/cid'
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
import * as AppBskyUnspeccedDefs from './defs'

export interface QueryParams {
/** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */
viewer?: string
limit: number
cursor?: string
}

export type InputSchema = undefined

export interface OutputSchema {
cursor?: string
actors: AppBskyUnspeccedDefs.SkeletonSearchActor[]
[k: string]: unknown
}

export type HandlerInput = undefined

export interface HandlerSuccess {
encoding: 'application/json'
body: OutputSchema
headers?: { [key: string]: string }
}

export interface HandlerError {
status: number
message?: string
}

export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
auth: HA
params: QueryParams
input: HandlerInput
req: express.Request
res: express.Response
}
export type Handler<HA extends HandlerAuth = never> = (
ctx: HandlerReqCtx<HA>,
) => Promise<HandlerOutput> | HandlerOutput
12 changes: 12 additions & 0 deletions packages/ozone/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -1667,6 +1668,17 @@ export class AppBskyUnspeccedNS {
return this._server.xrpc.method(nsid, cfg)
}

getSuggestionsSkeleton<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
AppBskyUnspeccedGetSuggestionsSkeleton.Handler<ExtractAuth<AV>>,
AppBskyUnspeccedGetSuggestionsSkeleton.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'app.bsky.unspecced.getSuggestionsSkeleton' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

getTaggedSuggestions<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
Loading

0 comments on commit 45981de

Please sign in to comment.