Skip to content

Commit 93c24c5

Browse files
authored
🐛 fix pull request head label and user (#72)
1 parent 1a60204 commit 93c24c5

File tree

4 files changed

+53
-6
lines changed

4 files changed

+53
-6
lines changed

githubkit/rest/activity.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,38 @@ async def async_get_thread(
418418
},
419419
)
420420

421+
def mark_thread_as_done(
422+
self,
423+
thread_id: int,
424+
*,
425+
headers: Optional[Dict[str, str]] = None,
426+
) -> "Response":
427+
url = f"/notifications/threads/{thread_id}"
428+
429+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
430+
431+
return self._github.request(
432+
"DELETE",
433+
url,
434+
headers=exclude_unset(headers),
435+
)
436+
437+
async def async_mark_thread_as_done(
438+
self,
439+
thread_id: int,
440+
*,
441+
headers: Optional[Dict[str, str]] = None,
442+
) -> "Response":
443+
url = f"/notifications/threads/{thread_id}"
444+
445+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
446+
447+
return await self._github.arequest(
448+
"DELETE",
449+
url,
450+
headers=exclude_unset(headers),
451+
)
452+
421453
def mark_thread_as_read(
422454
self,
423455
thread_id: int,

githubkit/rest/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11221,11 +11221,11 @@ class PullRequestPropLabelsItems(GitHubRestModel):
1122111221
class PullRequestPropHead(GitHubRestModel):
1122211222
"""PullRequestPropHead"""
1122311223

11224-
label: str = Field(default=...)
11224+
label: Union[str, None] = Field(default=...)
1122511225
ref: str = Field(default=...)
1122611226
repo: Union[PullRequestPropHeadPropRepo, None] = Field(default=...)
1122711227
sha: str = Field(default=...)
11228-
user: PullRequestPropHeadPropUser = Field(default=...)
11228+
user: Union[PullRequestPropHeadPropUser, None] = Field(default=...)
1122911229

1123011230

1123111231
class PullRequestPropHeadPropRepoPropOwner(GitHubRestModel):

githubkit/rest/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8008,11 +8008,11 @@ class PullRequestPropLabelsItemsType(TypedDict):
80088008
class PullRequestPropHeadType(TypedDict):
80098009
"""PullRequestPropHead"""
80108010

8011-
label: str
8011+
label: Union[str, None]
80128012
ref: str
80138013
repo: Union[PullRequestPropHeadPropRepoType, None]
80148014
sha: str
8015-
user: PullRequestPropHeadPropUserType
8015+
user: Union[PullRequestPropHeadPropUserType, None]
80168016

80178017

80188018
class PullRequestPropHeadPropRepoPropOwnerType(TypedDict):

pyproject.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ output_dir = "githubkit/rest/"
127127

128128

129129
# https://github.com/github/rest-api-description/issues/1811
130-
# https://github.com/yanyongyu/githubkit/issues/56
131130
# https://github.com/yanyongyu/githubkit/issues/64
132131
"/components/schemas/pull-request-simple/properties/head/properties/label" = { type = [
133132
"string",
@@ -137,6 +136,15 @@ output_dir = "githubkit/rest/"
137136
{ type = "null" },
138137
{ "$ref" = "#/components/schemas/repository" },
139138
], "$ref" = "<unset>" }
139+
# https://github.com/yanyongyu/githubkit/issues/56
140+
"/components/schemas/pull-request/properties/head/properties/label" = { type = [
141+
"string",
142+
"null",
143+
] }
144+
"/components/schemas/pull-request/properties/head/properties/user" = { type = [
145+
"object",
146+
"null",
147+
] }
140148

141149
# https://github.com/github/rest-api-description/issues/1812
142150
"/components/schemas/pull-request-simple/properties/labels/items/properties/description" = { type = [
@@ -265,7 +273,14 @@ types_output = "githubkit/webhooks/types.py"
265273
# "/definitions/secret_scanning_alert$resolved/properties/alert/allOf/1/properties/resolution" = { enum = ["false_positive", "wont_fix", "revoked", "used_in_tests"] }
266274

267275
# https://github.com/yanyongyu/githubkit/pull/69
268-
"/definitions/projects_v2_item$edited/properties/changes/properties/field_value/properties/field_type" = { enum = [ "single_select", "date", "number", "text", "iteration", "labels" ] }
276+
"/definitions/projects_v2_item$edited/properties/changes/properties/field_value/properties/field_type" = { enum = [
277+
"single_select",
278+
"date",
279+
"number",
280+
"text",
281+
"iteration",
282+
"labels",
283+
] }
269284

270285
[tool.codegen.field_overrides]
271286
"+1" = "plus_one"

0 commit comments

Comments
 (0)