## SearchRepositories `client.Runners.SearchRepositories(ctx, body) (*RunnerSearchRepositoriesResponse, error)` **post** `/gitpod.v1.RunnerService/SearchRepositories` Searches for repositories across all authenticated SCM hosts. Use this method to: - List available repositories - Search repositories by name or content - Discover repositories for environment creation Returns repositories from all authenticated SCM hosts in natural sort order. If no repositories are found, returns an empty list. ### Examples - List all repositories: Returns up to 25 repositories from all authenticated hosts. ```yaml runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` - Search repositories: Searches for repositories matching the query across all hosts. ```yaml runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" searchString: "my-project" limit: 10 ``` ### Parameters - `body RunnerSearchRepositoriesParams` - `Limit param.Field[int64]` Maximum number of repositories to return. Default: 25, Maximum: 100 Deprecated: Use pagination.page_size instead - `Pagination param.Field[RunnerSearchRepositoriesParamsPagination]` Pagination parameters for repository search - `Token string` Token for the next set of results that was returned as next_token of a PaginationResponse - `PageSize int64` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. - `RunnerID param.Field[string]` - `ScmHost param.Field[string]` The SCM's host to retrieve repositories from - `SearchMode param.Field[SearchMode]` Search mode determines how search_string is interpreted - `SearchString param.Field[string]` Search query - interpretation depends on search_mode ### Returns - `type RunnerSearchRepositoriesResponse struct{…}` - `LastPage int64` Deprecated: Use pagination token instead. Total pages can be extracted from token. - `Pagination RunnerSearchRepositoriesResponsePagination` Pagination information for the response. Token format: "NEXT_PAGE/TOTAL_PAGES/TOTAL_COUNT" (e.g., "2/40/1000"). Use -1 for unknown values (e.g., "2/-1/-1" when totals unavailable). Empty token means no more pages. - `NextToken string` Token passed for retrieving the next set of results. Empty if there are no more results - `Repositories []RunnerSearchRepositoriesResponseRepository` List of repositories matching the search criteria - `Name string` Repository name (e.g., "my-project") - `URL string` Repository URL (e.g., "https://github.com/owner/my-project") ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Runners.SearchRepositories(context.TODO(), gitpod.RunnerSearchRepositoriesParams{ RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.LastPage) } ``` #### Response ```json { "lastPage": 0, "pagination": { "nextToken": "nextToken" }, "repositories": [ { "name": "name", "url": "url" } ] } ```