Skip to content

Commit

Permalink
Merge branch 'multi-pds-auth' into signup-queueing-take2
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Jan 29, 2024
2 parents 48b0731 + c7d95e9 commit 07daf5f
Show file tree
Hide file tree
Showing 18 changed files with 513 additions and 23 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-and-push-pds-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- entryway-twilio
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
42 changes: 42 additions & 0 deletions lexicons/app/bsky/unspecced/getTaggedSuggestions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"lexicon": 1,
"id": "app.bsky.unspecced.getTaggedSuggestions",
"defs": {
"main": {
"type": "query",
"description": "Get a list of suggestions (feeds and users) tagged with categories",
"parameters": {
"type": "params",
"properties": {}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["suggestions"],
"properties": {
"suggestions": {
"type": "array",
"items": {
"type": "ref",
"ref": "#suggestion"
}
}
}
}
}
},
"suggestion": {
"type": "object",
"required": ["tag", "subjectType", "subject"],
"properties": {
"tag": { "type": "string" },
"subjectType": {
"type": "string",
"knownValues": ["actor", "feed"]
},
"subject": { "type": "string", "format": "uri" }
}
}
}
}
13 changes: 13 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -295,6 +296,7 @@ export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
export * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular'
export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
export * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
export * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
export * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
export * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -2534,6 +2536,17 @@ export class UnspeccedNS {
})
}

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

getTimelineSkeleton(
params?: AppBskyUnspeccedGetTimelineSkeleton.QueryParams,
opts?: AppBskyUnspeccedGetTimelineSkeleton.CallOptions,
Expand Down
50 changes: 50 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7984,6 +7984,54 @@ export const schemaDict = {
},
},
},
AppBskyUnspeccedGetTaggedSuggestions: {
lexicon: 1,
id: 'app.bsky.unspecced.getTaggedSuggestions',
defs: {
main: {
type: 'query',
description:
'Get a list of suggestions (feeds and users) tagged with categories',
parameters: {
type: 'params',
properties: {},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['suggestions'],
properties: {
suggestions: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.unspecced.getTaggedSuggestions#suggestion',
},
},
},
},
},
},
suggestion: {
type: 'object',
required: ['tag', 'subjectType', 'subject'],
properties: {
tag: {
type: 'string',
},
subjectType: {
type: 'string',
knownValues: ['actor', 'feed'],
},
subject: {
type: 'string',
format: 'uri',
},
},
},
},
},
AppBskyUnspeccedGetTimelineSkeleton: {
lexicon: 1,
id: 'app.bsky.unspecced.getTimelineSkeleton',
Expand Down Expand Up @@ -8320,6 +8368,8 @@ export const ids = {
AppBskyUnspeccedGetPopular: 'app.bsky.unspecced.getPopular',
AppBskyUnspeccedGetPopularFeedGenerators:
'app.bsky.unspecced.getPopularFeedGenerators',
AppBskyUnspeccedGetTaggedSuggestions:
'app.bsky.unspecced.getTaggedSuggestions',
AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton',
AppBskyUnspeccedSearchActorsSkeleton:
'app.bsky.unspecced.searchActorsSkeleton',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* 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'

export interface QueryParams {}

export type InputSchema = undefined

export interface OutputSchema {
suggestions: Suggestion[]
[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
}

export interface Suggestion {
tag: string
subjectType: 'actor' | 'feed' | (string & {})
subject: string
[k: string]: unknown
}

export function isSuggestion(v: unknown): v is Suggestion {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.unspecced.getTaggedSuggestions#suggestion'
)
}

export function validateSuggestion(v: unknown): ValidationResult {
return lexicons.validate(
'app.bsky.unspecced.getTaggedSuggestions#suggestion',
v,
)
}
12 changes: 12 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskyUnspeccedGetPopular from './types/app/bsky/unspecced/getPopular'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
Expand Down Expand Up @@ -1637,6 +1638,17 @@ export class UnspeccedNS {
return this._server.xrpc.method(nsid, cfg)
}

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

getTimelineSkeleton<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
50 changes: 50 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7984,6 +7984,54 @@ export const schemaDict = {
},
},
},
AppBskyUnspeccedGetTaggedSuggestions: {
lexicon: 1,
id: 'app.bsky.unspecced.getTaggedSuggestions',
defs: {
main: {
type: 'query',
description:
'Get a list of suggestions (feeds and users) tagged with categories',
parameters: {
type: 'params',
properties: {},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['suggestions'],
properties: {
suggestions: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.unspecced.getTaggedSuggestions#suggestion',
},
},
},
},
},
},
suggestion: {
type: 'object',
required: ['tag', 'subjectType', 'subject'],
properties: {
tag: {
type: 'string',
},
subjectType: {
type: 'string',
knownValues: ['actor', 'feed'],
},
subject: {
type: 'string',
format: 'uri',
},
},
},
},
},
AppBskyUnspeccedGetTimelineSkeleton: {
lexicon: 1,
id: 'app.bsky.unspecced.getTimelineSkeleton',
Expand Down Expand Up @@ -8320,6 +8368,8 @@ export const ids = {
AppBskyUnspeccedGetPopular: 'app.bsky.unspecced.getPopular',
AppBskyUnspeccedGetPopularFeedGenerators:
'app.bsky.unspecced.getPopularFeedGenerators',
AppBskyUnspeccedGetTaggedSuggestions:
'app.bsky.unspecced.getTaggedSuggestions',
AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton',
AppBskyUnspeccedSearchActorsSkeleton:
'app.bsky.unspecced.searchActorsSkeleton',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* 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 } from '@atproto/xrpc-server'

export interface QueryParams {}

export type InputSchema = undefined

export interface OutputSchema {
suggestions: Suggestion[]
[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
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

export interface Suggestion {
tag: string
subjectType: 'actor' | 'feed' | (string & {})
subject: string
[k: string]: unknown
}

export function isSuggestion(v: unknown): v is Suggestion {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.unspecced.getTaggedSuggestions#suggestion'
)
}

export function validateSuggestion(v: unknown): ValidationResult {
return lexicons.validate(
'app.bsky.unspecced.getTaggedSuggestions#suggestion',
v,
)
}
Loading

0 comments on commit 07daf5f

Please sign in to comment.