Skip to content

Commit

Permalink
🐛 fix temp clone token none
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Mar 29, 2023
1 parent e195d41 commit 26c7a51
Show file tree
Hide file tree
Showing 8 changed files with 1,840 additions and 67 deletions.
8 changes: 4 additions & 4 deletions githubkit/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def code_scanning(self) -> CodeScanningClient:
def codespaces(self) -> CodespacesClient:
return CodespacesClient(self._github)

@cached_property
def packages(self) -> PackagesClient:
return PackagesClient(self._github)

@cached_property
def interactions(self) -> InteractionsClient:
return InteractionsClient(self._github)
Expand All @@ -125,10 +129,6 @@ def interactions(self) -> InteractionsClient:
def migrations(self) -> MigrationsClient:
return MigrationsClient(self._github)

@cached_property
def packages(self) -> PackagesClient:
return PackagesClient(self._github)

@cached_property
def projects(self) -> ProjectsClient:
return ProjectsClient(self._github)
Expand Down
136 changes: 136 additions & 0 deletions githubkit/rest/code_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@
from githubkit.utils import UNSET, Unset, exclude_unset

from .types import (
CodeScanningDefaultSetupUpdateType,
ReposOwnerRepoCodeScanningSarifsPostBodyType,
ReposOwnerRepoCodeScanningAlertsAlertNumberPatchBodyType,
)
from .models import (
BasicError,
EmptyObject,
CodeScanningAlert,
CodeScanningAnalysis,
CodeScanningAlertItems,
CodeScanningDefaultSetup,
CodeScanningSarifsStatus,
CodeScanningAlertInstance,
CodeScanningSarifsReceipt,
CodeScanningCodeqlDatabase,
CodeScanningAnalysisDeletion,
CodeScanningDefaultSetupUpdate,
CodeScanningOrganizationAlertItems,
ReposOwnerRepoCodeScanningSarifsPostBody,
ReposOwnerRepoCodeScanningAlertsAlertNumberPatchBody,
Expand Down Expand Up @@ -667,6 +671,138 @@ async def async_get_codeql_database(
},
)

def get_default_setup(
self,
owner: str,
repo: str,
) -> "Response[CodeScanningDefaultSetup]":
url = f"/repos/{owner}/{repo}/code-scanning/default-setup"

return self._github.request(
"GET",
url,
response_model=CodeScanningDefaultSetup,
error_models={
"403": BasicError,
"404": BasicError,
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
},
)

async def async_get_default_setup(
self,
owner: str,
repo: str,
) -> "Response[CodeScanningDefaultSetup]":
url = f"/repos/{owner}/{repo}/code-scanning/default-setup"

return await self._github.arequest(
"GET",
url,
response_model=CodeScanningDefaultSetup,
error_models={
"403": BasicError,
"404": BasicError,
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
},
)

@overload
def update_default_setup(
self, owner: str, repo: str, *, data: CodeScanningDefaultSetupUpdateType
) -> "Response[EmptyObject]":
...

@overload
def update_default_setup(
self,
owner: str,
repo: str,
*,
data: Unset = UNSET,
state: Literal["configured", "not-configured"],
query_suite: Union[Unset, Literal["default", "extended"]] = UNSET,
) -> "Response[EmptyObject]":
...

def update_default_setup(
self,
owner: str,
repo: str,
*,
data: Union[Unset, CodeScanningDefaultSetupUpdateType] = UNSET,
**kwargs,
) -> "Response[EmptyObject]":
url = f"/repos/{owner}/{repo}/code-scanning/default-setup"

if not kwargs:
kwargs = UNSET

json = kwargs if data is UNSET else data
json = parse_obj_as(CodeScanningDefaultSetupUpdate, json)
json = json.dict(by_alias=True) if isinstance(json, BaseModel) else json

return self._github.request(
"PATCH",
url,
json=exclude_unset(json),
response_model=EmptyObject,
error_models={
"403": BasicError,
"404": BasicError,
"409": BasicError,
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
},
)

@overload
async def async_update_default_setup(
self, owner: str, repo: str, *, data: CodeScanningDefaultSetupUpdateType
) -> "Response[EmptyObject]":
...

@overload
async def async_update_default_setup(
self,
owner: str,
repo: str,
*,
data: Unset = UNSET,
state: Literal["configured", "not-configured"],
query_suite: Union[Unset, Literal["default", "extended"]] = UNSET,
) -> "Response[EmptyObject]":
...

async def async_update_default_setup(
self,
owner: str,
repo: str,
*,
data: Union[Unset, CodeScanningDefaultSetupUpdateType] = UNSET,
**kwargs,
) -> "Response[EmptyObject]":
url = f"/repos/{owner}/{repo}/code-scanning/default-setup"

if not kwargs:
kwargs = UNSET

json = kwargs if data is UNSET else data
json = parse_obj_as(CodeScanningDefaultSetupUpdate, json)
json = json.dict(by_alias=True) if isinstance(json, BaseModel) else json

return await self._github.arequest(
"PATCH",
url,
json=exclude_unset(json),
response_model=EmptyObject,
error_models={
"403": BasicError,
"404": BasicError,
"409": BasicError,
"503": EnterprisesEnterpriseSecretScanningAlertsGetResponse503,
},
)

@overload
def upload_sarif(
self,
Expand Down
Loading

0 comments on commit 26c7a51

Please sign in to comment.