Skip to content

Commit

Permalink
codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbsky committed Dec 3, 2024
1 parent 6bc3301 commit c00498c
Show file tree
Hide file tree
Showing 12 changed files with 603 additions and 0 deletions.
14 changes: 14 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 AppBskySubscriptionGetActiveSubscriptions from './types/app/bsky/subscription/getActiveSubscriptions'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskySubscriptionRefreshSubscriptionCache from './types/app/bsky/subscription/refreshSubscriptionCache'
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
Expand Down Expand Up @@ -391,6 +392,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 AppBskySubscriptionGetActiveSubscriptions from './types/app/bsky/subscription/getActiveSubscriptions'
export * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
export * as AppBskySubscriptionRefreshSubscriptionCache from './types/app/bsky/subscription/refreshSubscriptionCache'
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
Expand Down Expand Up @@ -3047,6 +3049,18 @@ export class AppBskySubscriptionNS {
this._client = client
}

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

getSubscriptionFeatures(
params?: AppBskySubscriptionGetSubscriptionFeatures.QueryParams,
opts?: AppBskySubscriptionGetSubscriptionFeatures.CallOptions,
Expand Down
71 changes: 71 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9214,6 +9214,75 @@ export const schemaDict = {
},
},
},
AppBskySubscriptionGetActiveSubscriptions: {
lexicon: 1,
id: 'app.bsky.subscription.getActiveSubscriptions',
defs: {
main: {
type: 'query',
description:
'Enumerate active subscriptions for the requesting account. Requires auth.',
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['subscriptions'],
properties: {
subscriptions: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.subscription.getActiveSubscriptions#subscription',
},
},
},
},
},
},
subscription: {
type: 'object',
required: [
'status',
'renewalStatus',
'group',
'platform',
'offering',
'periodEndsAt',
'periodStartsAt',
'purchasedAt',
],
properties: {
status: {
type: 'string',
},
renewalStatus: {
type: 'string',
},
group: {
type: 'string',
},
platform: {
type: 'string',
},
offering: {
type: 'string',
},
periodEndsAt: {
type: 'string',
format: 'datetime',
},
periodStartsAt: {
type: 'string',
format: 'datetime',
},
purchasedAt: {
type: 'string',
format: 'datetime',
},
},
},
},
},
AppBskySubscriptionGetSubscriptionFeatures: {
lexicon: 1,
id: 'app.bsky.subscription.getSubscriptionFeatures',
Expand Down Expand Up @@ -13735,6 +13804,8 @@ export const ids = {
AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
AppBskySubscriptionGetActiveSubscriptions:
'app.bsky.subscription.getActiveSubscriptions',
AppBskySubscriptionGetSubscriptionFeatures:
'app.bsky.subscription.getSubscriptionFeatures',
AppBskySubscriptionRefreshSubscriptionCache:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* 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 {
subscriptions: Subscription[]
[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
}

export interface Subscription {
status: string
renewalStatus: string
group: string
platform: string
offering: string
periodEndsAt: string
periodStartsAt: string
purchasedAt: string
[k: string]: unknown
}

export function isSubscription(v: unknown): v is Subscription {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.subscription.getActiveSubscriptions#subscription'
)
}

export function validateSubscription(v: unknown): ValidationResult {
return lexicons.validate(
'app.bsky.subscription.getActiveSubscriptions#subscription',
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 @@ -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 AppBskySubscriptionGetActiveSubscriptions from './types/app/bsky/subscription/getActiveSubscriptions'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskySubscriptionRefreshSubscriptionCache from './types/app/bsky/subscription/refreshSubscriptionCache'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
Expand Down Expand Up @@ -1813,6 +1814,17 @@ export class AppBskySubscriptionNS {
this._server = server
}

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

getSubscriptionFeatures<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
71 changes: 71 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9214,6 +9214,75 @@ export const schemaDict = {
},
},
},
AppBskySubscriptionGetActiveSubscriptions: {
lexicon: 1,
id: 'app.bsky.subscription.getActiveSubscriptions',
defs: {
main: {
type: 'query',
description:
'Enumerate active subscriptions for the requesting account. Requires auth.',
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['subscriptions'],
properties: {
subscriptions: {
type: 'array',
items: {
type: 'ref',
ref: 'lex:app.bsky.subscription.getActiveSubscriptions#subscription',
},
},
},
},
},
},
subscription: {
type: 'object',
required: [
'status',
'renewalStatus',
'group',
'platform',
'offering',
'periodEndsAt',
'periodStartsAt',
'purchasedAt',
],
properties: {
status: {
type: 'string',
},
renewalStatus: {
type: 'string',
},
group: {
type: 'string',
},
platform: {
type: 'string',
},
offering: {
type: 'string',
},
periodEndsAt: {
type: 'string',
format: 'datetime',
},
periodStartsAt: {
type: 'string',
format: 'datetime',
},
purchasedAt: {
type: 'string',
format: 'datetime',
},
},
},
},
},
AppBskySubscriptionGetSubscriptionFeatures: {
lexicon: 1,
id: 'app.bsky.subscription.getSubscriptionFeatures',
Expand Down Expand Up @@ -10974,6 +11043,8 @@ export const ids = {
AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
AppBskyRichtextFacet: 'app.bsky.richtext.facet',
AppBskySubscriptionGetActiveSubscriptions:
'app.bsky.subscription.getActiveSubscriptions',
AppBskySubscriptionGetSubscriptionFeatures:
'app.bsky.subscription.getSubscriptionFeatures',
AppBskySubscriptionRefreshSubscriptionCache:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* 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 {
subscriptions: Subscription[]
[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

export interface Subscription {
status: string
renewalStatus: string
group: string
platform: string
offering: string
periodEndsAt: string
periodStartsAt: string
purchasedAt: string
[k: string]: unknown
}

export function isSubscription(v: unknown): v is Subscription {
return (
isObj(v) &&
hasProp(v, '$type') &&
v.$type === 'app.bsky.subscription.getActiveSubscriptions#subscription'
)
}

export function validateSubscription(v: unknown): ValidationResult {
return lexicons.validate(
'app.bsky.subscription.getActiveSubscriptions#subscription',
v,
)
}
12 changes: 12 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 AppBskySubscriptionGetActiveSubscriptions from './types/app/bsky/subscription/getActiveSubscriptions'
import * as AppBskySubscriptionGetSubscriptionFeatures from './types/app/bsky/subscription/getSubscriptionFeatures'
import * as AppBskySubscriptionRefreshSubscriptionCache from './types/app/bsky/subscription/refreshSubscriptionCache'
import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig'
Expand Down Expand Up @@ -1856,6 +1857,17 @@ export class AppBskySubscriptionNS {
this._server = server
}

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

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

0 comments on commit c00498c

Please sign in to comment.