-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
com.atproto.sync.listReposByCollection Lexicon, for collections direc…
…tory (#3524) * com.atproto.sync.listReposByCollection, for collections directory * bump listReposByCollection limit * update max+default to align more with listRepos * codegen * changeset for listReposByCollection
- Loading branch information
Showing
14 changed files
with
609 additions
and
0 deletions.
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,5 @@ | ||
--- | ||
"@atproto/api": patch | ||
--- | ||
|
||
add com.atproto.sync.listReposByCollection Lexicon |
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,46 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.sync.listReposByCollection", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Enumerates all the DIDs which have records with the given collection NSID.", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["collection"], | ||
"properties": { | ||
"collection": { "type": "string", "format": "nsid" }, | ||
"limit": { | ||
"type": "integer", | ||
"description": "Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.", | ||
"minimum": 1, | ||
"maximum": 2000, | ||
"default": 500 | ||
}, | ||
"cursor": { "type": "string" } | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["repos"], | ||
"properties": { | ||
"cursor": { "type": "string" }, | ||
"repos": { | ||
"type": "array", | ||
"items": { "type": "ref", "ref": "#repo" } | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"repo": { | ||
"type": "object", | ||
"required": ["did"], | ||
"properties": { | ||
"did": { "type": "string", "format": "did" } | ||
} | ||
} | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
packages/api/src/client/types/com/atproto/sync/listReposByCollection.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,56 @@ | ||
/** | ||
* GENERATED CODE - DO NOT MODIFY | ||
*/ | ||
import { HeadersMap, XRPCError } from '@atproto/xrpc' | ||
import { ValidationResult, BlobRef } from '@atproto/lexicon' | ||
import { CID } from 'multiformats/cid' | ||
import { validate as _validate } from '../../../../lexicons' | ||
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' | ||
|
||
const is$typed = _is$typed, | ||
validate = _validate | ||
const id = 'com.atproto.sync.listReposByCollection' | ||
|
||
export interface QueryParams { | ||
collection: string | ||
/** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ | ||
limit?: number | ||
cursor?: string | ||
} | ||
|
||
export type InputSchema = undefined | ||
|
||
export interface OutputSchema { | ||
cursor?: string | ||
repos: Repo[] | ||
} | ||
|
||
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 Repo { | ||
$type?: 'com.atproto.sync.listReposByCollection#repo' | ||
did: string | ||
} | ||
|
||
const hashRepo = 'repo' | ||
|
||
export function isRepo<V>(v: V) { | ||
return is$typed(v, id, hashRepo) | ||
} | ||
|
||
export function validateRepo<V>(v: V) { | ||
return validate<Repo & V>(v, id, hashRepo) | ||
} |
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
68 changes: 68 additions & 0 deletions
68
packages/bsky/src/lexicon/types/com/atproto/sync/listReposByCollection.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,68 @@ | ||
/** | ||
* GENERATED CODE - DO NOT MODIFY | ||
*/ | ||
import express from 'express' | ||
import { ValidationResult, BlobRef } from '@atproto/lexicon' | ||
import { CID } from 'multiformats/cid' | ||
import { validate as _validate } from '../../../../lexicons' | ||
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util' | ||
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server' | ||
|
||
const is$typed = _is$typed, | ||
validate = _validate | ||
const id = 'com.atproto.sync.listReposByCollection' | ||
|
||
export interface QueryParams { | ||
collection: string | ||
/** Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists. */ | ||
limit: number | ||
cursor?: string | ||
} | ||
|
||
export type InputSchema = undefined | ||
|
||
export interface OutputSchema { | ||
cursor?: string | ||
repos: Repo[] | ||
} | ||
|
||
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 | ||
resetRouteRateLimits: () => Promise<void> | ||
} | ||
export type Handler<HA extends HandlerAuth = never> = ( | ||
ctx: HandlerReqCtx<HA>, | ||
) => Promise<HandlerOutput> | HandlerOutput | ||
|
||
export interface Repo { | ||
$type?: 'com.atproto.sync.listReposByCollection#repo' | ||
did: string | ||
} | ||
|
||
const hashRepo = 'repo' | ||
|
||
export function isRepo<V>(v: V) { | ||
return is$typed(v, id, hashRepo) | ||
} | ||
|
||
export function validateRepo<V>(v: V) { | ||
return validate<Repo & V>(v, id, hashRepo) | ||
} |
Oops, something went wrong.