| 1 | import { createServerClient } from "@/lib/api/server"; |
| 2 | |
| 3 | const CODE_SEARCH_PAGE_SIZE = 20 |
| 4 | |
| 5 | /** One page of code matches, across public repositories or within `repository`. */ |
| 6 | export async function searchCode |
| 7 | query, |
| 8 | cursor, |
| 9 | repository, |
| 10 | }: { |
| 11 | query: string |
| 12 | cursor?: string |
| 13 | repository?: { |
| 14 | }) { |
| 15 | const client = |
| 16 | const page = |
| 17 | return repository |
| 18 | ? client.GET( |
| 19 | params: { |
| 20 | path: { username: repository |
| 21 | query: page, |
| 22 | }, |
| 23 | }) |
| 24 | : client.GET( |
| 25 | } |