← Public packages
@cameronpak/box
Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.
src/list-repos.ts
41 lines · 1.1 KB · TypeScriptimport { boxRequest, type Result } from './client.ts'
import type { PageInfo, RepositoryInstallation, SelectedRepository } from './types.ts'
export type ListReposInput = {
/** When true, sync from GitHub before returning repository groups. */
sync?: boolean
limit?: number
cursor?: string | null
sort?: 'asc' | 'desc'
/** Case-insensitive repository name/fullName filter. */
q?: string
/** Filter to selected or unselected repositories. */
selected?: boolean
}
export type ListReposOutput = {
installations: Array<RepositoryInstallation>
environmentId?: string
selectedRepositories?: Array<SelectedRepository>
pageInfo?: PageInfo
}
/**
* List GitHub repositories available to Box, grouped by installation,
* plus the current selected repositories for new Boxes.
*/
export default async function listRepos(
input: ListReposInput = {},
): Promise<Result<ListReposOutput>> {
return boxRequest<ListReposOutput>({
path: '/repos',
query: {
sync: input.sync,
limit: input.limit,
cursor: input.cursor,
sort: input.sort,
q: input.q,
selected: input.selected,
},
})
}