@theholocron/github-client 1.58.0-alpha.15 → 1.58.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +29 -1
- package/dist/index.mjs +14 -0
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -318,6 +318,15 @@ interface GitHubIssue {
|
|
|
318
318
|
updated_at: string;
|
|
319
319
|
/** The URL of the issue's page on GitHub. */
|
|
320
320
|
html_url: string;
|
|
321
|
+
/** When the issue was created, as an ISO 8601 timestamp. */
|
|
322
|
+
created_at?: string;
|
|
323
|
+
/** The milestone the issue belongs to, or `null` when none. */
|
|
324
|
+
milestone?: {
|
|
325
|
+
number: number;
|
|
326
|
+
title: string;
|
|
327
|
+
} | null;
|
|
328
|
+
/** The issue's GraphQL node id. */
|
|
329
|
+
node_id?: string;
|
|
321
330
|
/** Set when the item is a pull request; GitHub's issues API returns pull requests too. */
|
|
322
331
|
pull_request?: unknown;
|
|
323
332
|
}
|
|
@@ -328,8 +337,23 @@ interface GitHubMilestone {
|
|
|
328
337
|
/** The milestone's title. */
|
|
329
338
|
title: string;
|
|
330
339
|
}
|
|
340
|
+
/** A comment on an issue, with only the fields this client reads. */
|
|
341
|
+
interface GitHubIssueComment {
|
|
342
|
+
/** The comment's text. */
|
|
343
|
+
body: string;
|
|
344
|
+
/** When it was written, as an ISO 8601 timestamp. */
|
|
345
|
+
created_at: string;
|
|
346
|
+
/** Who wrote it. */
|
|
347
|
+
user: {
|
|
348
|
+
login: string;
|
|
349
|
+
} | null;
|
|
350
|
+
}
|
|
331
351
|
/** Filters for listing issues. */
|
|
332
352
|
interface IssueSearchParams {
|
|
353
|
+
/** The page to read, from 1. */
|
|
354
|
+
page?: number;
|
|
355
|
+
/** A milestone number, `*` for any or `none`. */
|
|
356
|
+
milestone?: string;
|
|
333
357
|
/** Which issues to list by state; GitHub defaults to `open`. */
|
|
334
358
|
state?: "open" | "closed" | "all";
|
|
335
359
|
/** The field to sort by, passed through to GitHub. */
|
|
@@ -432,6 +456,8 @@ interface GitHubPullRequest {
|
|
|
432
456
|
number: number;
|
|
433
457
|
/** The pull request's title. */
|
|
434
458
|
title: string;
|
|
459
|
+
/** The pull request's description, as written (markdown); `null` when it has none. */
|
|
460
|
+
body?: string | null;
|
|
435
461
|
/** Whether the pull request is open or closed. */
|
|
436
462
|
state: "open" | "closed";
|
|
437
463
|
/** When the pull request was merged as an ISO 8601 timestamp, or `null` if it was not merged. */
|
|
@@ -982,6 +1008,8 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
982
1008
|
addLabels: (repo: string, number: number, labels: string[]) => Promise<void>;
|
|
983
1009
|
removeLabel: (repo: string, number: number, label: string) => Promise<void>;
|
|
984
1010
|
createComment: (repo: string, number: number, body: string) => Promise<void>;
|
|
1011
|
+
listComments: (repo: string, number: number) => Promise<GitHubIssueComment[]>;
|
|
1012
|
+
createMilestone: (repo: string, title: string) => Promise<GitHubMilestone>;
|
|
985
1013
|
listMilestones: (repo: string, params?: {
|
|
986
1014
|
state?: "open" | "closed" | "all";
|
|
987
1015
|
}) => Promise<GitHubMilestone[]>;
|
|
@@ -1077,4 +1105,4 @@ export declare function createGitHubClient(opts: GitHubClientOptions): {
|
|
|
1077
1105
|
};
|
|
1078
1106
|
/** The client returned by `createGitHubClient()`: one group of methods per GitHub API area. */
|
|
1079
1107
|
export type GitHubClient = ReturnType<typeof createGitHubClient>;
|
|
1080
|
-
export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitDirectoryEntry, GitHubApp, GitHubAppAccount, GitHubAppCredentials, GitHubAppInstallation, GitHubCheckRun, GitHubClientOptions, GitHubContents, GitHubEnvironment, GitHubInstallationWebhookPayload, GitHubIssue, GitHubLabel, GitHubMilestone, GitHubPages, GitHubPublicKey, GitHubPullRequest, GitHubPullRequestCommit, GitHubPullRequestFile, GitHubPullRequestReview, GitHubPullRequestWebhookPayload, GitHubPushWebhookPayload, GitHubRepo, GitHubRuleset, GitHubRulesetDetail, GitHubUser, GitHubUserWithExpiry, GitHubVariable, GitHubWebhookHeaders, GitHubWorkflowRun, GitPull, GitRef, GitTree, GitTreeItem, GraphQLClient, InstallationAccessToken, IssueSearchParams, ListDirectoryOptions, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
|
|
1108
|
+
export type { CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunOutput, CheckRunStatus, CodeScanningSetupResult, CreateCheckRunInput, CreatePagesPayload, CreatePullInput, CreateReviewComment, CreateReviewInput, GitBlob, GitCommit, GitContents, GitDirectoryEntry, GitHubApp, GitHubAppAccount, GitHubAppCredentials, GitHubAppInstallation, GitHubCheckRun, GitHubClientOptions, GitHubContents, GitHubEnvironment, GitHubInstallationWebhookPayload, GitHubIssue, GitHubIssueComment, GitHubLabel, GitHubMilestone, GitHubPages, GitHubPublicKey, GitHubPullRequest, GitHubPullRequestCommit, GitHubPullRequestFile, GitHubPullRequestReview, GitHubPullRequestWebhookPayload, GitHubPushWebhookPayload, GitHubRepo, GitHubRuleset, GitHubRulesetDetail, GitHubUser, GitHubUserWithExpiry, GitHubVariable, GitHubWebhookHeaders, GitHubWorkflowRun, GitPull, GitRef, GitTree, GitTreeItem, GraphQLClient, InstallationAccessToken, IssueSearchParams, ListDirectoryOptions, OrgProperty, PagesBuildStatus, PagesBuildType, PutContentsInput, PutContentsResult, RepoPropertyValue, RepoTeam, ReviewThread, SecretScope, TeamMember, TeamPermission, UpdateCheckRunInput, UpdatePagesPayload, VariableScope, VariableVisibility, WorkflowRunFilter };
|
package/dist/index.mjs
CHANGED
|
@@ -259,6 +259,8 @@ function issues(rest) {
|
|
|
259
259
|
if (params.per_page) qs.set("per_page", String(params.per_page));
|
|
260
260
|
if (params.filter) qs.set("filter", params.filter);
|
|
261
261
|
if (params.assignee) qs.set("assignee", params.assignee);
|
|
262
|
+
if (params.page) qs.set("page", String(params.page));
|
|
263
|
+
if (params.milestone) qs.set("milestone", params.milestone);
|
|
262
264
|
const q = qs.toString();
|
|
263
265
|
const path = q ? `${repoBase(repo)}/issues?${q}` : `${repoBase(repo)}/issues`;
|
|
264
266
|
return rest.request(path);
|
|
@@ -281,6 +283,18 @@ function issues(rest) {
|
|
|
281
283
|
method: "POST",
|
|
282
284
|
body: { body }
|
|
283
285
|
}),
|
|
286
|
+
listComments: async (repo, number) => {
|
|
287
|
+
const all = [];
|
|
288
|
+
for (let page = 1;; page++) {
|
|
289
|
+
const batch = await rest.request(`${repoBase(repo)}/issues/${number}/comments?per_page=100&page=${page}`);
|
|
290
|
+
all.push(...batch);
|
|
291
|
+
if (batch.length < 100) return all;
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
createMilestone: (repo, title) => rest.request(`${repoBase(repo)}/milestones`, {
|
|
295
|
+
method: "POST",
|
|
296
|
+
body: { title }
|
|
297
|
+
}),
|
|
284
298
|
listMilestones: (repo, params = {}) => {
|
|
285
299
|
const qs = new URLSearchParams({ per_page: "100" });
|
|
286
300
|
if (params.state) qs.set("state", params.state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/github-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.17",
|
|
4
4
|
"description": "A TypeScript client for the GitHub REST API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/http-client": "^1.58.0-alpha.
|
|
36
|
-
"@theholocron/observability": "^0.7.0-alpha.
|
|
35
|
+
"@theholocron/http-client": "^1.58.0-alpha.17",
|
|
36
|
+
"@theholocron/observability": "^0.7.0-alpha.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"tsdown": "^0.23.4",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^5.0.5",
|
|
48
|
-
"@theholocron/tsconfig": "^8.9.0-alpha.
|
|
49
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
50
|
-
"@theholocron/
|
|
51
|
-
"@theholocron/
|
|
48
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.11",
|
|
49
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.11",
|
|
50
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.11",
|
|
51
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.11"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|