forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Search accounts by normalized email (bluesky-social#2426)
* ✨ Search accounts by email domain works * ✨ Add Search against normalized email column * 🐛 Fix pagination * ✨ Make email field optional in the response * 🧹 Cleanup implementation * 🧹 More cleanup * 🧹 Cleanup and reuse accountView for searchAccounts response * 📝 Add changeset * ✨ Add min max and default to limit
- Loading branch information
Showing
15 changed files
with
475 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@atproto/ozone": patch | ||
"@atproto/bsky": patch | ||
"@atproto/api": patch | ||
"@atproto/pds": patch | ||
--- | ||
|
||
Add com.atproto.admin.searchAccounts lexicon to allow searching for accounts using email address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.searchAccounts", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Get list of accounts that matches your search query.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"email": { "type": "string" }, | ||
"cursor": { "type": "string" }, | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 100, | ||
"default": 50 | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["accounts"], | ||
"properties": { | ||
"cursor": { "type": "string" }, | ||
"accounts": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "com.atproto.admin.defs#accountView" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/api/src/client/types/com/atproto/admin/searchAccounts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* 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 ComAtprotoAdminDefs from './defs' | ||
|
||
export interface QueryParams { | ||
email?: string | ||
cursor?: string | ||
limit?: number | ||
} | ||
|
||
export type InputSchema = undefined | ||
|
||
export interface OutputSchema { | ||
cursor?: string | ||
accounts: ComAtprotoAdminDefs.AccountView[] | ||
[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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/bsky/src/lexicon/types/com/atproto/admin/searchAccounts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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 ComAtprotoAdminDefs from './defs' | ||
|
||
export interface QueryParams { | ||
email?: string | ||
cursor?: string | ||
limit: number | ||
} | ||
|
||
export type InputSchema = undefined | ||
|
||
export interface OutputSchema { | ||
cursor?: string | ||
accounts: ComAtprotoAdminDefs.AccountView[] | ||
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.