Skip to content

Commit 348fa20

Browse files
jecluisyanyongyu
andauthored
🐛 Fix: copilot seat details schema fixed (#68)
Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
1 parent 620e08f commit 348fa20

File tree

11 files changed

+3706
-930
lines changed

11 files changed

+3706
-930
lines changed

githubkit/rest/code_scanning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ def update_default_setup(
839839
*,
840840
data: Literal[UNSET] = UNSET,
841841
headers: Optional[Dict[str, str]] = None,
842-
state: Literal["configured", "not-configured"],
842+
state: Missing[Literal["configured", "not-configured"]] = UNSET,
843843
query_suite: Missing[Literal["default", "extended"]] = UNSET,
844844
languages: Missing[
845845
List[
@@ -911,7 +911,7 @@ async def async_update_default_setup(
911911
*,
912912
data: Literal[UNSET] = UNSET,
913913
headers: Optional[Dict[str, str]] = None,
914-
state: Literal["configured", "not-configured"],
914+
state: Missing[Literal["configured", "not-configured"]] = UNSET,
915915
query_suite: Missing[Literal["default", "extended"]] = UNSET,
916916
languages: Missing[
917917
List[

githubkit/rest/codespaces.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
OrgsOrgCodespacesSecretsGetResponse200,
5555
ReposOwnerRepoCodespacesGetResponse200,
5656
UserCodespacesSecretsSecretNamePutBody,
57+
CodespacesPermissionsCheckForDevcontainer,
5758
OrgsOrgCodespacesSecretsSecretNamePutBody,
5859
ReposOwnerRepoCodespacesNewGetResponse200,
5960
UserCodespacesCodespaceNamePublishPostBody,
@@ -1595,6 +1596,72 @@ async def async_pre_flight_with_repo_for_authenticated_user(
15951596
},
15961597
)
15971598

1599+
def check_permissions_for_devcontainer(
1600+
self,
1601+
owner: str,
1602+
repo: str,
1603+
ref: str,
1604+
devcontainer_path: str,
1605+
*,
1606+
headers: Optional[Dict[str, str]] = None,
1607+
) -> "Response[CodespacesPermissionsCheckForDevcontainer]":
1608+
url = f"/repos/{owner}/{repo}/codespaces/permissions_check"
1609+
1610+
params = {
1611+
"ref": ref,
1612+
"devcontainer_path": devcontainer_path,
1613+
}
1614+
1615+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
1616+
1617+
return self._github.request(
1618+
"GET",
1619+
url,
1620+
params=exclude_unset(params),
1621+
headers=exclude_unset(headers),
1622+
response_model=CodespacesPermissionsCheckForDevcontainer,
1623+
error_models={
1624+
"401": BasicError,
1625+
"403": BasicError,
1626+
"404": BasicError,
1627+
"422": ValidationError,
1628+
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
1629+
},
1630+
)
1631+
1632+
async def async_check_permissions_for_devcontainer(
1633+
self,
1634+
owner: str,
1635+
repo: str,
1636+
ref: str,
1637+
devcontainer_path: str,
1638+
*,
1639+
headers: Optional[Dict[str, str]] = None,
1640+
) -> "Response[CodespacesPermissionsCheckForDevcontainer]":
1641+
url = f"/repos/{owner}/{repo}/codespaces/permissions_check"
1642+
1643+
params = {
1644+
"ref": ref,
1645+
"devcontainer_path": devcontainer_path,
1646+
}
1647+
1648+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
1649+
1650+
return await self._github.arequest(
1651+
"GET",
1652+
url,
1653+
params=exclude_unset(params),
1654+
headers=exclude_unset(headers),
1655+
response_model=CodespacesPermissionsCheckForDevcontainer,
1656+
error_models={
1657+
"401": BasicError,
1658+
"403": BasicError,
1659+
"404": BasicError,
1660+
"422": ValidationError,
1661+
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
1662+
},
1663+
)
1664+
15981665
def list_repo_secrets(
15991666
self,
16001667
owner: str,

githubkit/rest/copilot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ async def async_cancel_copilot_seat_assignment_for_users(
602602
},
603603
)
604604

605-
def get_copilot_seat_assignment_details_for_user(
605+
def get_copilot_seat_details_for_user(
606606
self,
607607
org: str,
608608
username: str,
@@ -626,7 +626,7 @@ def get_copilot_seat_assignment_details_for_user(
626626
},
627627
)
628628

629-
async def async_get_copilot_seat_assignment_details_for_user(
629+
async def async_get_copilot_seat_details_for_user(
630630
self,
631631
org: str,
632632
username: str,

githubkit/rest/licenses.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ def get_for_repo(
137137
url,
138138
headers=exclude_unset(headers),
139139
response_model=LicenseContent,
140+
error_models={
141+
"404": BasicError,
142+
},
140143
)
141144

142145
async def async_get_for_repo(
@@ -155,4 +158,7 @@ async def async_get_for_repo(
155158
url,
156159
headers=exclude_unset(headers),
157160
response_model=LicenseContent,
161+
error_models={
162+
"404": BasicError,
163+
},
158164
)

0 commit comments

Comments
 (0)