Skip to content

Commit

Permalink
codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbsky committed Dec 1, 2024
1 parent f02a916 commit 54acc75
Show file tree
Hide file tree
Showing 12 changed files with 375 additions and 8 deletions.
24 changes: 24 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ import * as AppBskyNotificationPutPreferences from './types/app/bsky/notificatio
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
Expand Down Expand Up @@ -389,6 +390,7 @@ export * as AppBskyNotificationPutPreferences from './types/app/bsky/notificatio
export * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
export * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
export * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
Expand Down Expand Up @@ -1487,6 +1489,7 @@ export class AppBskyNS {
labeler: AppBskyLabelerNS
notification: AppBskyNotificationNS
richtext: AppBskyRichtextNS
subscription: AppBskySubscriptionNS
unspecced: AppBskyUnspeccedNS
video: AppBskyVideoNS

Expand All @@ -1499,6 +1502,7 @@ export class AppBskyNS {
this.labeler = new AppBskyLabelerNS(client)
this.notification = new AppBskyNotificationNS(client)
this.richtext = new AppBskyRichtextNS(client)
this.subscription = new AppBskySubscriptionNS(client)
this.unspecced = new AppBskyUnspeccedNS(client)
this.video = new AppBskyVideoNS(client)
}
Expand Down Expand Up @@ -3034,6 +3038,26 @@ export class AppBskyRichtextNS {
}
}

export class AppBskySubscriptionNS {
_client: XrpcClient

constructor(client: XrpcClient) {
this._client = client
}

getSubscriptionFeatures(
params?: AppBskySubscriptionGetSubscriptionFeatures.QueryParams,
opts?: AppBskySubscriptionGetSubscriptionFeatures.CallOptions,
): Promise<AppBskySubscriptionGetSubscriptionFeatures.Response> {
return this._client.call(
'app.bsky.subscription.getSubscriptionFeatures',
params,
undefined,
opts,
)
}
}

export class AppBskyUnspeccedNS {
_client: XrpcClient

Expand Down
32 changes: 30 additions & 2 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9214,6 +9214,31 @@ export const schemaDict = {
},
},
},
AppBskySubscriptionGetSubscriptionFeatures: {
lexicon: 1,
id: 'app.bsky.subscription.getSubscriptionFeatures',
defs: {
main: {
type: 'query',
description:
'Enumerate feature flags related to subscriptions for the requesting account. Requires auth.',
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['customProfileColor'],
properties: {
customProfileColor: {
type: 'boolean',
description:
'Indicates to client apps to allow the requesting account to customize the profile color.',
},
},
},
},
},
},
},
AppBskyUnspeccedDefs: {
lexicon: 1,
id: 'app.bsky.unspecced.defs',
Expand Down Expand Up @@ -13489,8 +13514,9 @@ export const schemaDict = {
},
},
},
}
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
} as const satisfies Record<string, LexiconDoc>

export const schemas = Object.values(schemaDict)
export const lexicons: Lexicons = new Lexicons(schemas)
export const ids = {
ComAtprotoAdminDefs: 'com.atproto.admin.defs',
Expand Down Expand Up @@ -13663,6 +13689,8 @@ export const ids = {
AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
AppBskySubscriptionGetSubscriptionFeatures:
'app.bsky.subscription.getSubscriptionFeatures',
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
AppBskyUnspeccedGetConfig: 'app.bsky.unspecced.getConfig',
AppBskyUnspeccedGetPopularFeedGenerators:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import { HeadersMap, 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 {
/** Indicates to client apps to allow the requesting account to customize the profile color. */
customProfileColor: boolean
[k: string]: unknown
}

export interface CallOptions {
signal?: AbortSignal
headers?: HeadersMap
}

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

export function toKnownErr(e: any) {
return e
}
22 changes: 22 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences'
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
Expand Down Expand Up @@ -1157,6 +1158,7 @@ export class AppBskyNS {
labeler: AppBskyLabelerNS
notification: AppBskyNotificationNS
richtext: AppBskyRichtextNS
subscription: AppBskySubscriptionNS
unspecced: AppBskyUnspeccedNS
video: AppBskyVideoNS

Expand All @@ -1169,6 +1171,7 @@ export class AppBskyNS {
this.labeler = new AppBskyLabelerNS(server)
this.notification = new AppBskyNotificationNS(server)
this.richtext = new AppBskyRichtextNS(server)
this.subscription = new AppBskySubscriptionNS(server)
this.unspecced = new AppBskyUnspeccedNS(server)
this.video = new AppBskyVideoNS(server)
}
Expand Down Expand Up @@ -1802,6 +1805,25 @@ export class AppBskyRichtextNS {
}
}

export class AppBskySubscriptionNS {
_server: Server

constructor(server: Server) {
this._server = server
}

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

export class AppBskyUnspeccedNS {
_server: Server

Expand Down
32 changes: 30 additions & 2 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9214,6 +9214,31 @@ export const schemaDict = {
},
},
},
AppBskySubscriptionGetSubscriptionFeatures: {
lexicon: 1,
id: 'app.bsky.subscription.getSubscriptionFeatures',
defs: {
main: {
type: 'query',
description:
'Enumerate feature flags related to subscriptions for the requesting account. Requires auth.',
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['customProfileColor'],
properties: {
customProfileColor: {
type: 'boolean',
description:
'Indicates to client apps to allow the requesting account to customize the profile color.',
},
},
},
},
},
},
},
AppBskyUnspeccedDefs: {
lexicon: 1,
id: 'app.bsky.unspecced.defs',
Expand Down Expand Up @@ -10728,8 +10753,9 @@ export const schemaDict = {
},
},
},
}
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
} as const satisfies Record<string, LexiconDoc>

export const schemas = Object.values(schemaDict)
export const lexicons: Lexicons = new Lexicons(schemas)
export const ids = {
ComAtprotoAdminDefs: 'com.atproto.admin.defs',
Expand Down Expand Up @@ -10902,6 +10928,8 @@ export const ids = {
AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
AppBskySubscriptionGetSubscriptionFeatures:
'app.bsky.subscription.getSubscriptionFeatures',
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
AppBskyUnspeccedGetConfig: 'app.bsky.unspecced.getConfig',
AppBskyUnspeccedGetPopularFeedGenerators:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* 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'

export interface QueryParams {}

export type InputSchema = undefined

export interface OutputSchema {
/** Indicates to client apps to allow the requesting account to customize the profile color. */
customProfileColor: boolean
[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
22 changes: 22 additions & 0 deletions packages/ozone/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import * as AppBskyNotificationListNotifications from './types/app/bsky/notifica
import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences'
import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
import * as AppBskyUnspeccedGetSuggestionsSkeleton from './types/app/bsky/unspecced/getSuggestionsSkeleton'
Expand Down Expand Up @@ -1200,6 +1201,7 @@ export class AppBskyNS {
labeler: AppBskyLabelerNS
notification: AppBskyNotificationNS
richtext: AppBskyRichtextNS
subscription: AppBskySubscriptionNS
unspecced: AppBskyUnspeccedNS
video: AppBskyVideoNS

Expand All @@ -1212,6 +1214,7 @@ export class AppBskyNS {
this.labeler = new AppBskyLabelerNS(server)
this.notification = new AppBskyNotificationNS(server)
this.richtext = new AppBskyRichtextNS(server)
this.subscription = new AppBskySubscriptionNS(server)
this.unspecced = new AppBskyUnspeccedNS(server)
this.video = new AppBskyVideoNS(server)
}
Expand Down Expand Up @@ -1845,6 +1848,25 @@ export class AppBskyRichtextNS {
}
}

export class AppBskySubscriptionNS {
_server: Server

constructor(server: Server) {
this._server = server
}

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

export class AppBskyUnspeccedNS {
_server: Server

Expand Down
32 changes: 30 additions & 2 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9214,6 +9214,31 @@ export const schemaDict = {
},
},
},
AppBskySubscriptionGetSubscriptionFeatures: {
lexicon: 1,
id: 'app.bsky.subscription.getSubscriptionFeatures',
defs: {
main: {
type: 'query',
description:
'Enumerate feature flags related to subscriptions for the requesting account. Requires auth.',
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['customProfileColor'],
properties: {
customProfileColor: {
type: 'boolean',
description:
'Indicates to client apps to allow the requesting account to customize the profile color.',
},
},
},
},
},
},
},
AppBskyUnspeccedDefs: {
lexicon: 1,
id: 'app.bsky.unspecced.defs',
Expand Down Expand Up @@ -13489,8 +13514,9 @@ export const schemaDict = {
},
},
},
}
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
} as const satisfies Record<string, LexiconDoc>

export const schemas = Object.values(schemaDict)
export const lexicons: Lexicons = new Lexicons(schemas)
export const ids = {
ComAtprotoAdminDefs: 'com.atproto.admin.defs',
Expand Down Expand Up @@ -13663,6 +13689,8 @@ export const ids = {
AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
AppBskySubscriptionGetSubscriptionFeatures:
'app.bsky.subscription.getSubscriptionFeatures',
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
AppBskyUnspeccedGetConfig: 'app.bsky.unspecced.getConfig',
AppBskyUnspeccedGetPopularFeedGenerators:
Expand Down
Loading

0 comments on commit 54acc75

Please sign in to comment.