Skip to content

Commit

Permalink
🐛 Fix: not supported discriminators and repo check run status (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Oct 9, 2024
1 parent 5558799 commit 7f9a5c2
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 108 deletions.
6 changes: 5 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/models/group_0051.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from __future__ import annotations

from typing import Union
from typing import Union, Literal
from datetime import date, datetime

from pydantic import Field
Expand Down Expand Up @@ -55,6 +55,10 @@ class CopilotSeatDetails(GitHubModel):
default=UNSET,
description="Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.",
)
plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field(
default=UNSET,
description="The Copilot plan of the organization, or the parent enterprise, when applicable.",
)


class EnterpriseTeam(GitHubModel):
Expand Down
4 changes: 4 additions & 0 deletions githubkit/versions/ghec_v2022_11_28/models/group_0098.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class CopilotOrganizationDetails(ExtraGitHubModel):
seat_management_setting: Literal[
"assign_all", "assign_selected", "disabled", "unconfigured"
] = Field(description="The mode of assigning new seats.")
plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field(
default=UNSET,
description="The Copilot plan of the organization, or the parent enterprise, when applicable.",
)


class CopilotSeatBreakdown(GitHubModel):
Expand Down
4 changes: 3 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/models/group_1010.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1(ExtraGitHubModel):
external_id: Missing[str] = Field(
default=UNSET, description="A reference for the run on the integrator's system."
)
status: Missing[Literal["queued", "in_progress"]] = Field(default=UNSET)
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = Field(default=UNSET)
started_at: Missing[datetime] = Field(
default=UNSET,
description="The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.",
Expand Down
29 changes: 13 additions & 16 deletions githubkit/versions/ghec_v2022_11_28/rest/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from __future__ import annotations

from weakref import ref
from typing_extensions import Annotated
from typing import TYPE_CHECKING, Dict, Literal, Optional, overload

from pydantic import Field, BaseModel
from pydantic import BaseModel

from githubkit.typing import Missing, UnsetType
from githubkit.utils import UNSET, exclude_unset
Expand Down Expand Up @@ -124,7 +123,9 @@ def create(
head_sha: str,
details_url: Missing[str] = UNSET,
external_id: Missing[str] = UNSET,
status: Missing[Literal["queued", "in_progress"]] = UNSET,
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = UNSET,
started_at: Missing[datetime] = UNSET,
conclusion: Missing[
Literal[
Expand Down Expand Up @@ -178,12 +179,9 @@ def create(

json = kwargs if data is UNSET else data
json = type_validate_python(
Annotated[
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
Field(discriminator="status"),
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
json,
)
Expand Down Expand Up @@ -253,7 +251,9 @@ async def async_create(
head_sha: str,
details_url: Missing[str] = UNSET,
external_id: Missing[str] = UNSET,
status: Missing[Literal["queued", "in_progress"]] = UNSET,
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = UNSET,
started_at: Missing[datetime] = UNSET,
conclusion: Missing[
Literal[
Expand Down Expand Up @@ -307,12 +307,9 @@ async def async_create(

json = kwargs if data is UNSET else data
json = type_validate_python(
Annotated[
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
Field(discriminator="status"),
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
json,
)
Expand Down
49 changes: 15 additions & 34 deletions githubkit/versions/ghec_v2022_11_28/rest/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from __future__ import annotations

from weakref import ref
from typing_extensions import Annotated
from typing import TYPE_CHECKING, Dict, Literal, Optional, overload

from pydantic import Field, BaseModel
from pydantic import BaseModel

from githubkit.typing import Missing, UnsetType
from githubkit.utils import UNSET, exclude_unset
Expand Down Expand Up @@ -7142,14 +7141,8 @@ def get_content(
*,
headers: Optional[Dict[str, str]] = None,
) -> Response[
Annotated[
Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
Field(discriminator="type"),
Union[
List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule
]
]:
"""See also: https://docs.github.com/enterprise-cloud@latest//rest/repos/contents#get-repository-content"""
Expand Down Expand Up @@ -7177,14 +7170,11 @@ def get_content(
url,
params=exclude_unset(params),
headers=exclude_unset(headers),
response_model=Annotated[
Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
Field(discriminator="type"),
response_model=Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
error_models={
"404": BasicError,
Expand All @@ -7201,14 +7191,8 @@ async def async_get_content(
*,
headers: Optional[Dict[str, str]] = None,
) -> Response[
Annotated[
Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
Field(discriminator="type"),
Union[
List[ContentDirectoryItems], ContentFile, ContentSymlink, ContentSubmodule
]
]:
"""See also: https://docs.github.com/enterprise-cloud@latest//rest/repos/contents#get-repository-content"""
Expand Down Expand Up @@ -7236,14 +7220,11 @@ async def async_get_content(
url,
params=exclude_unset(params),
headers=exclude_unset(headers),
response_model=Annotated[
Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
Field(discriminator="type"),
response_model=Union[
List[ContentDirectoryItems],
ContentFile,
ContentSymlink,
ContentSubmodule,
],
error_models={
"404": BasicError,
Expand Down
3 changes: 2 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/types/group_0051.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from __future__ import annotations

from typing import Union
from typing import Union, Literal
from datetime import date, datetime
from typing_extensions import TypedDict, NotRequired

Expand All @@ -33,6 +33,7 @@ class CopilotSeatDetailsType(TypedDict):
last_activity_editor: NotRequired[Union[str, None]]
created_at: datetime
updated_at: NotRequired[datetime]
plan_type: NotRequired[Literal["business", "enterprise", "unknown"]]


class EnterpriseTeamType(TypedDict):
Expand Down
1 change: 1 addition & 0 deletions githubkit/versions/ghec_v2022_11_28/types/group_0098.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CopilotOrganizationDetailsType(TypedDict):
seat_management_setting: Literal[
"assign_all", "assign_selected", "disabled", "unconfigured"
]
plan_type: NotRequired[Literal["business", "enterprise", "unknown"]]


class CopilotSeatBreakdownType(TypedDict):
Expand Down
4 changes: 3 additions & 1 deletion githubkit/versions/ghec_v2022_11_28/types/group_1010.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1Type(TypedDict):
head_sha: str
details_url: NotRequired[str]
external_id: NotRequired[str]
status: NotRequired[Literal["queued", "in_progress"]]
status: NotRequired[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
]
started_at: NotRequired[datetime]
conclusion: NotRequired[
Literal[
Expand Down
6 changes: 5 additions & 1 deletion githubkit/versions/v2022_11_28/models/group_0030.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from __future__ import annotations

from typing import Union
from typing import Union, Literal
from datetime import date, datetime

from pydantic import Field
Expand Down Expand Up @@ -55,6 +55,10 @@ class CopilotSeatDetails(GitHubModel):
default=UNSET,
description="Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.",
)
plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field(
default=UNSET,
description="The Copilot plan of the organization, or the parent enterprise, when applicable.",
)


class EnterpriseTeam(GitHubModel):
Expand Down
4 changes: 4 additions & 0 deletions githubkit/versions/v2022_11_28/models/group_0082.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class CopilotOrganizationDetails(ExtraGitHubModel):
seat_management_setting: Literal[
"assign_all", "assign_selected", "disabled", "unconfigured"
] = Field(description="The mode of assigning new seats.")
plan_type: Missing[Literal["business", "enterprise", "unknown"]] = Field(
default=UNSET,
description="The Copilot plan of the organization, or the parent enterprise, when applicable.",
)


class CopilotSeatBreakdown(GitHubModel):
Expand Down
4 changes: 3 additions & 1 deletion githubkit/versions/v2022_11_28/models/group_0936.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class ReposOwnerRepoCheckRunsPostBodyOneof1(ExtraGitHubModel):
external_id: Missing[str] = Field(
default=UNSET, description="A reference for the run on the integrator's system."
)
status: Missing[Literal["queued", "in_progress"]] = Field(default=UNSET)
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = Field(default=UNSET)
started_at: Missing[datetime] = Field(
default=UNSET,
description="The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.",
Expand Down
29 changes: 13 additions & 16 deletions githubkit/versions/v2022_11_28/rest/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from __future__ import annotations

from weakref import ref
from typing_extensions import Annotated
from typing import TYPE_CHECKING, Dict, Literal, Optional, overload

from pydantic import Field, BaseModel
from pydantic import BaseModel

from githubkit.typing import Missing, UnsetType
from githubkit.utils import UNSET, exclude_unset
Expand Down Expand Up @@ -124,7 +123,9 @@ def create(
head_sha: str,
details_url: Missing[str] = UNSET,
external_id: Missing[str] = UNSET,
status: Missing[Literal["queued", "in_progress"]] = UNSET,
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = UNSET,
started_at: Missing[datetime] = UNSET,
conclusion: Missing[
Literal[
Expand Down Expand Up @@ -178,12 +179,9 @@ def create(

json = kwargs if data is UNSET else data
json = type_validate_python(
Annotated[
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
Field(discriminator="status"),
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
json,
)
Expand Down Expand Up @@ -253,7 +251,9 @@ async def async_create(
head_sha: str,
details_url: Missing[str] = UNSET,
external_id: Missing[str] = UNSET,
status: Missing[Literal["queued", "in_progress"]] = UNSET,
status: Missing[
Literal["queued", "in_progress", "waiting", "requested", "pending"]
] = UNSET,
started_at: Missing[datetime] = UNSET,
conclusion: Missing[
Literal[
Expand Down Expand Up @@ -307,12 +307,9 @@ async def async_create(

json = kwargs if data is UNSET else data
json = type_validate_python(
Annotated[
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
Field(discriminator="status"),
Union[
ReposOwnerRepoCheckRunsPostBodyOneof0,
ReposOwnerRepoCheckRunsPostBodyOneof1,
],
json,
)
Expand Down
Loading

0 comments on commit 7f9a5c2

Please sign in to comment.