Open History to see the last commit
1import type * as Search from "@distilled.cloud/github/search";
2import * as Binding from "alchemy/Binding";
3import type { RuntimeContext } from "alchemy/RuntimeContext";
4import type * as Effect from "effect/Effect";
5import type { Repository } from "./Repository.ts";
6
7/**
8 * GitHub search syntax without the repository qualifier; the binding adds
9 * `repo:{owner}/{name}`.
10 */
11export interface SearchIssuesRequest extends Search.IssuesAndPullRequestsRequest {}
12
13export type SearchIssuesResponse = Search.IssuesAndPullRequestsResponse;
14
15/**
16 * Search issues and pull requests in the bound repository
17 * (`search.issuesAndPullRequests`). The binding prefixes `q` with
18 * `repo:{owner}/{name}`. GitHub's search index lags writes by a few seconds.
19 *
20 * Provide `GitHub.SearchIssuesHttp` on a Worker or Function, or
21 * `GitHub.SearchIssuesLocal` on an Action.
22 *
23 * ### Searching Issues at Runtime
24 * **Example:** Find open bugs by title
25 * ```typescript
26 * const searchIssues = yield* GitHub.SearchIssues(yield* Repo);
27 * const { items } = yield* searchIssues({ q: "is:open label:bug crash in:title" });
28 * ```
29 *
30 * @binding
31 * @product Issue
32 */
33export interface SearchIssues extends Binding.Service<
34 SearchIssues,
35 "GitHub.SearchIssues",
36 (
37 repo: Repository,
38 ) => Effect.Effect<
39 (
40 request: SearchIssuesRequest,
41 ) => Effect.Effect<SearchIssuesResponse, Search.IssuesAndPullRequestsError, RuntimeContext>
42 >
43> {}
44
45export const SearchIssues = Binding.Service<SearchIssues>("GitHub.SearchIssues");