Skip to content

Commit

Permalink
addReservedHandle lexicon (bluesky-social#3056)
Browse files Browse the repository at this point in the history
* addReservedHandle lexicon

* addReservedHandle codegen

* changeset

* Add empty object output

* Empty object output codegen
  • Loading branch information
rafaelbsky authored Nov 21, 2024
1 parent 21fd024 commit 2e7aa21
Show file tree
Hide file tree
Showing 14 changed files with 382 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-eels-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/api": patch
---

Add com.atproto.temp.addReservedHandle lexicon
27 changes: 27 additions & 0 deletions lexicons/com/atproto/temp/addReservedHandle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"lexicon": 1,
"id": "com.atproto.temp.addReservedHandle",
"defs": {
"main": {
"type": "procedure",
"description": "Add a handle to the set of reserved handles.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["handle"],
"properties": {
"handle": { "type": "string" }
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"properties": {}
}
}
}
}
}
14 changes: 14 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
import * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle'
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
import * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification'
Expand Down Expand Up @@ -307,6 +308,7 @@ export * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
export * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
export * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
export * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
export * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle'
export * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
export * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
export * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification'
Expand Down Expand Up @@ -1417,6 +1419,18 @@ export class ComAtprotoTempNS {
this._client = client
}

addReservedHandle(
data?: ComAtprotoTempAddReservedHandle.InputSchema,
opts?: ComAtprotoTempAddReservedHandle.CallOptions,
): Promise<ComAtprotoTempAddReservedHandle.Response> {
return this._client.call(
'com.atproto.temp.addReservedHandle',
opts?.qp,
data,
opts,
)
}

checkSignupQueue(
params?: ComAtprotoTempCheckSignupQueue.QueryParams,
opts?: ComAtprotoTempCheckSignupQueue.CallOptions,
Expand Down
30 changes: 30 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3959,6 +3959,35 @@ export const schemaDict = {
},
},
},
ComAtprotoTempAddReservedHandle: {
lexicon: 1,
id: 'com.atproto.temp.addReservedHandle',
defs: {
main: {
type: 'procedure',
description: 'Add a handle to the set of reserved handles.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['handle'],
properties: {
handle: {
type: 'string',
},
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
properties: {},
},
},
},
},
},
ComAtprotoTempCheckSignupQueue: {
lexicon: 1,
id: 'com.atproto.temp.checkSignupQueue',
Expand Down Expand Up @@ -13545,6 +13574,7 @@ export const ids = {
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
ComAtprotoTempAddReservedHandle: 'com.atproto.temp.addReservedHandle',
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
ComAtprotoTempRequestPhoneVerification:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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 interface InputSchema {
handle: string
[k: string]: unknown
}

export interface OutputSchema {
[k: string]: unknown
}

export interface CallOptions {
signal?: AbortSignal
headers?: HeadersMap
qp?: QueryParams
encoding?: 'application/json'
}

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

export function toKnownErr(e: any) {
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 @@ -80,6 +80,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
import * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle'
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
import * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification'
Expand Down Expand Up @@ -1092,6 +1093,17 @@ export class ComAtprotoTempNS {
this._server = server
}

addReservedHandle<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
ComAtprotoTempAddReservedHandle.Handler<ExtractAuth<AV>>,
ComAtprotoTempAddReservedHandle.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'com.atproto.temp.addReservedHandle' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

checkSignupQueue<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
30 changes: 30 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3959,6 +3959,35 @@ export const schemaDict = {
},
},
},
ComAtprotoTempAddReservedHandle: {
lexicon: 1,
id: 'com.atproto.temp.addReservedHandle',
defs: {
main: {
type: 'procedure',
description: 'Add a handle to the set of reserved handles.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['handle'],
properties: {
handle: {
type: 'string',
},
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
properties: {},
},
},
},
},
},
ComAtprotoTempCheckSignupQueue: {
lexicon: 1,
id: 'com.atproto.temp.checkSignupQueue',
Expand Down Expand Up @@ -10784,6 +10813,7 @@ export const ids = {
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
ComAtprotoTempAddReservedHandle: 'com.atproto.temp.addReservedHandle',
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
ComAtprotoTempRequestPhoneVerification:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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 interface InputSchema {
handle: string
[k: string]: unknown
}

export interface OutputSchema {
[k: string]: unknown
}

export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

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 @@ -80,6 +80,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
import * as ComAtprotoTempAddReservedHandle from './types/com/atproto/temp/addReservedHandle'
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
import * as ComAtprotoTempRequestPhoneVerification from './types/com/atproto/temp/requestPhoneVerification'
Expand Down Expand Up @@ -1135,6 +1136,17 @@ export class ComAtprotoTempNS {
this._server = server
}

addReservedHandle<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
ComAtprotoTempAddReservedHandle.Handler<ExtractAuth<AV>>,
ComAtprotoTempAddReservedHandle.HandlerReqCtx<ExtractAuth<AV>>
>,
) {
const nsid = 'com.atproto.temp.addReservedHandle' // @ts-ignore
return this._server.xrpc.method(nsid, cfg)
}

checkSignupQueue<AV extends AuthVerifier>(
cfg: ConfigOf<
AV,
Expand Down
30 changes: 30 additions & 0 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3959,6 +3959,35 @@ export const schemaDict = {
},
},
},
ComAtprotoTempAddReservedHandle: {
lexicon: 1,
id: 'com.atproto.temp.addReservedHandle',
defs: {
main: {
type: 'procedure',
description: 'Add a handle to the set of reserved handles.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['handle'],
properties: {
handle: {
type: 'string',
},
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
properties: {},
},
},
},
},
},
ComAtprotoTempCheckSignupQueue: {
lexicon: 1,
id: 'com.atproto.temp.checkSignupQueue',
Expand Down Expand Up @@ -13545,6 +13574,7 @@ export const ids = {
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
ComAtprotoTempAddReservedHandle: 'com.atproto.temp.addReservedHandle',
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
ComAtprotoTempRequestPhoneVerification:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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 interface InputSchema {
handle: string
[k: string]: unknown
}

export interface OutputSchema {
[k: string]: unknown
}

export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

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
Loading

0 comments on commit 2e7aa21

Please sign in to comment.