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

CreateIssueComment.ts

43 lines1.3 KB

1import type * as Issues from "@distilled.cloud/github/issues";
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​
7export interface CreateIssueCommentRequest extends Omit<
8 Issues.CreateCommentRequest,
9 "owner" | "repo"
10> {}
11​
12export type CreateIssueCommentResponse = Issues.IssueComment;
13​
14/**
15 * Comment on an issue or pull request (`issues.createComment`). Pass a pull
16 * request's number as `issue_number`.
17 *
18 * Provide `GitHub.CreateIssueCommentHttp` on a Worker or Function, or
19 * `GitHub.CreateIssueCommentLocal` on an Action.
20 *
21 * ### Commenting at Runtime
22 * **Example:** Reply on an issue
23 * ```typescript
24 * const createComment = yield* GitHub.CreateIssueComment(yield* Repo);
25 * yield* createComment({ issue_number: 7, body: "On it." });
26 * ```
27 *
28 * @binding
29 * @product Issue
30 */
31export interface CreateIssueComment extends Binding.Service<
32 CreateIssueComment,
33 "GitHub.CreateIssueComment",
34 (
35 repo: Repository,
36 ) => Effect.Effect<
37 (
38 request: CreateIssueCommentRequest,
39 ) => Effect.Effect<CreateIssueCommentResponse, Issues.CreateCommentError, RuntimeContext>
40 >
41> {}
42​
43export const CreateIssueComment = Binding.Service<CreateIssueComment>("GitHub.CreateIssueComment");