Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SearchIssuesHttp.ts

24 lines866 Bytes

1import * as Search from "@distilled.cloud/github/search";
2import * as Layer from "effect/Layer";
3import * as BindingHttp from "./BindingHttp.ts";
4import { SearchIssues, type SearchIssuesRequest } from "./SearchIssues.ts";
5​
6export const searchIssuesOperation = BindingHttp.operation(
7 "search.issuesAndPullRequests",
8 (repo) => (request: SearchIssuesRequest) =>
9 Search.issuesAndPullRequests({
10 ...request,
11 q: `repo:${repo.owner}/${repo.repository} ${request.q}`,
12 }),
13);
14​
15/**
16 * Token-backed implementation of {@link SearchIssues}. Provide it on a Worker or
17 * Function: it captures a `GitHub.PersonalAccessToken` for the host and binds
18 * the token and the repository into it.
19 *
20 * @layer
21 * @product Issue
22 * @provides GitHub.SearchIssues
23 */
24export const SearchIssuesHttp = Layer.effect(SearchIssues, BindingHttp.make(searchIssuesOperation));