Skip to content

Fix: Allow Organization name and blog to be nullable #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions githubkit/rest/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5419,6 +5419,50 @@ async def async_review_custom_gates_for_run(
headers=exclude_unset(headers),
)

def force_cancel_workflow_run(
self,
owner: str,
repo: str,
run_id: int,
*,
headers: Optional[Dict[str, str]] = None,
) -> "Response[EmptyObject]":
url = f"/repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"

headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}

return self._github.request(
"POST",
url,
headers=exclude_unset(headers),
response_model=EmptyObject,
error_models={
"409": BasicError,
},
)

async def async_force_cancel_workflow_run(
self,
owner: str,
repo: str,
run_id: int,
*,
headers: Optional[Dict[str, str]] = None,
) -> "Response[EmptyObject]":
url = f"/repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"

headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}

return await self._github.arequest(
"POST",
url,
headers=exclude_unset(headers),
response_model=EmptyObject,
error_models={
"409": BasicError,
},
)

def list_jobs_for_workflow_run(
self,
owner: str,
Expand Down
55 changes: 45 additions & 10 deletions githubkit/rest/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2932,9 +2932,9 @@ class OrganizationFull(GitHubRestModel):
public_members_url: str = Field(default=...)
avatar_url: str = Field(default=...)
description: Union[str, None] = Field(default=...)
name: Missing[str] = Field(default=UNSET)
name: Missing[Union[str, None]] = Field(default=UNSET)
company: Missing[Union[str, None]] = Field(default=UNSET)
blog: Missing[str] = Field(default=UNSET)
blog: Missing[Union[str, None]] = Field(default=UNSET)
location: Missing[Union[str, None]] = Field(default=UNSET)
email: Missing[Union[str, None]] = Field(default=UNSET)
twitter_username: Missing[Union[str, None]] = Field(default=UNSET)
Expand Down Expand Up @@ -4459,7 +4459,7 @@ class RepositoryRuleDeletion(GitHubRestModel):
class RepositoryRuleRequiredLinearHistory(GitHubRestModel):
"""required_linear_history

Prevent merge commits from being pushed to matching branches.
Prevent merge commits from being pushed to matching refs.
"""

type: Literal["required_linear_history"] = Field(default=...)
Expand All @@ -4468,8 +4468,8 @@ class RepositoryRuleRequiredLinearHistory(GitHubRestModel):
class RepositoryRuleRequiredDeployments(GitHubRestModel):
"""required_deployments

Choose which environments must be successfully deployed to before branches can
be merged into a branch that matches this rule.
Choose which environments must be successfully deployed to before refs can be
merged into a branch that matches this rule.
"""

type: Literal["required_deployments"] = Field(default=...)
Expand All @@ -4490,7 +4490,7 @@ class RepositoryRuleRequiredDeploymentsPropParameters(GitHubRestModel):
class RepositoryRuleRequiredSignatures(GitHubRestModel):
"""required_signatures

Commits pushed to matching branches must have verified signatures.
Commits pushed to matching refs must have verified signatures.
"""

type: Literal["required_signatures"] = Field(default=...)
Expand Down Expand Up @@ -4554,7 +4554,7 @@ class RepositoryRuleRequiredStatusChecks(GitHubRestModel):

Choose which status checks must pass before branches can be merged into a branch
that matches this rule. When enabled, commits must first be pushed to another
branch, then merged or pushed directly to a branch that matches this rule after
branch, then merged or pushed directly to a ref that matches this rule after
status checks have passed.
"""

Expand All @@ -4579,7 +4579,7 @@ class RepositoryRuleRequiredStatusChecksPropParameters(GitHubRestModel):
class RepositoryRuleNonFastForward(GitHubRestModel):
"""non_fast_forward

Prevent users with push access from force pushing to branches.
Prevent users with push access from force pushing to refs.
"""

type: Literal["non_fast_forward"] = Field(default=...)
Expand Down Expand Up @@ -5147,9 +5147,9 @@ class TeamOrganization(GitHubRestModel):
public_members_url: str = Field(default=...)
avatar_url: str = Field(default=...)
description: Union[str, None] = Field(default=...)
name: Missing[str] = Field(default=UNSET)
name: Missing[Union[str, None]] = Field(default=UNSET)
company: Missing[Union[str, None]] = Field(default=UNSET)
blog: Missing[str] = Field(default=UNSET)
blog: Missing[Union[str, None]] = Field(default=UNSET)
location: Missing[Union[str, None]] = Field(default=UNSET)
email: Missing[Union[str, None]] = Field(default=UNSET)
twitter_username: Missing[Union[str, None]] = Field(default=UNSET)
Expand Down Expand Up @@ -9002,6 +9002,10 @@ class EnvironmentPropProtectionRulesItemsAnyof1(GitHubRestModel):

id: int = Field(default=...)
node_id: str = Field(default=...)
prevent_self_review: Missing[bool] = Field(
description="Whether deployments to this environment can be approved by the user who created the deployment.",
default=UNSET,
)
type: str = Field(default=...)
reviewers: Missing[
List[EnvironmentPropProtectionRulesItemsAnyof1PropReviewersItems]
Expand Down Expand Up @@ -13302,6 +13306,35 @@ class KeySimple(GitHubRestModel):
key: str = Field(default=...)


class EnterpriseWebhooks(GitHubRestModel):
"""Enterprise

An enterprise on GitHub. Webhook payloads contain the `enterprise` property when
the webhook is configured
on an enterprise account or an organization that's part of an enterprise
account. For more information,
see "[About enterprise accounts](https://docs.github.com/admin/overview/about-
enterprise-accounts)."
"""

description: Missing[Union[str, None]] = Field(
description="A short description of the enterprise.", default=UNSET
)
html_url: str = Field(default=...)
website_url: Missing[Union[str, None]] = Field(
description="The enterprise's website URL.", default=UNSET
)
id: int = Field(description="Unique identifier of the enterprise", default=...)
node_id: str = Field(default=...)
name: str = Field(description="The name of the enterprise.", default=...)
slug: str = Field(
description="The slug url identifier for the enterprise.", default=...
)
created_at: Union[datetime, None] = Field(default=...)
updated_at: Union[datetime, None] = Field(default=...)
avatar_url: str = Field(default=...)


class SimpleInstallation(GitHubRestModel):
"""Simple Installation

Expand Down Expand Up @@ -20793,6 +20826,7 @@ class UserSshSigningKeysPostBody(GitHubRestModel):
Hovercard.update_forward_refs()
HovercardPropContextsItems.update_forward_refs()
KeySimple.update_forward_refs()
EnterpriseWebhooks.update_forward_refs()
SimpleInstallation.update_forward_refs()
OrganizationSimpleWebhooks.update_forward_refs()
RepositoryWebhooks.update_forward_refs()
Expand Down Expand Up @@ -21852,6 +21886,7 @@ class UserSshSigningKeysPostBody(GitHubRestModel):
"Hovercard",
"HovercardPropContextsItems",
"KeySimple",
"EnterpriseWebhooks",
"SimpleInstallation",
"OrganizationSimpleWebhooks",
"RepositoryWebhooks",
Expand Down
45 changes: 35 additions & 10 deletions githubkit/rest/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,9 +2021,9 @@ class OrganizationFullType(TypedDict):
public_members_url: str
avatar_url: str
description: Union[str, None]
name: NotRequired[str]
name: NotRequired[Union[str, None]]
company: NotRequired[Union[str, None]]
blog: NotRequired[str]
blog: NotRequired[Union[str, None]]
location: NotRequired[Union[str, None]]
email: NotRequired[Union[str, None]]
twitter_username: NotRequired[Union[str, None]]
Expand Down Expand Up @@ -3027,7 +3027,7 @@ class RepositoryRuleDeletionType(TypedDict):
class RepositoryRuleRequiredLinearHistoryType(TypedDict):
"""required_linear_history

Prevent merge commits from being pushed to matching branches.
Prevent merge commits from being pushed to matching refs.
"""

type: Literal["required_linear_history"]
Expand All @@ -3036,8 +3036,8 @@ class RepositoryRuleRequiredLinearHistoryType(TypedDict):
class RepositoryRuleRequiredDeploymentsType(TypedDict):
"""required_deployments

Choose which environments must be successfully deployed to before branches can
be merged into a branch that matches this rule.
Choose which environments must be successfully deployed to before refs can be
merged into a branch that matches this rule.
"""

type: Literal["required_deployments"]
Expand All @@ -3053,7 +3053,7 @@ class RepositoryRuleRequiredDeploymentsPropParametersType(TypedDict):
class RepositoryRuleRequiredSignaturesType(TypedDict):
"""required_signatures

Commits pushed to matching branches must have verified signatures.
Commits pushed to matching refs must have verified signatures.
"""

type: Literal["required_signatures"]
Expand Down Expand Up @@ -3095,7 +3095,7 @@ class RepositoryRuleRequiredStatusChecksType(TypedDict):

Choose which status checks must pass before branches can be merged into a branch
that matches this rule. When enabled, commits must first be pushed to another
branch, then merged or pushed directly to a branch that matches this rule after
branch, then merged or pushed directly to a ref that matches this rule after
status checks have passed.
"""

Expand All @@ -3113,7 +3113,7 @@ class RepositoryRuleRequiredStatusChecksPropParametersType(TypedDict):
class RepositoryRuleNonFastForwardType(TypedDict):
"""non_fast_forward

Prevent users with push access from force pushing to branches.
Prevent users with push access from force pushing to refs.
"""

type: Literal["non_fast_forward"]
Expand Down Expand Up @@ -3485,9 +3485,9 @@ class TeamOrganizationType(TypedDict):
public_members_url: str
avatar_url: str
description: Union[str, None]
name: NotRequired[str]
name: NotRequired[Union[str, None]]
company: NotRequired[Union[str, None]]
blog: NotRequired[str]
blog: NotRequired[Union[str, None]]
location: NotRequired[Union[str, None]]
email: NotRequired[Union[str, None]]
twitter_username: NotRequired[Union[str, None]]
Expand Down Expand Up @@ -6368,6 +6368,7 @@ class EnvironmentPropProtectionRulesItemsAnyof1Type(TypedDict):

id: int
node_id: str
prevent_self_review: NotRequired[bool]
type: str
reviewers: NotRequired[
List[EnvironmentPropProtectionRulesItemsAnyof1PropReviewersItemsType]
Expand Down Expand Up @@ -9653,6 +9654,29 @@ class KeySimpleType(TypedDict):
key: str


class EnterpriseWebhooksType(TypedDict):
"""Enterprise

An enterprise on GitHub. Webhook payloads contain the `enterprise` property when
the webhook is configured
on an enterprise account or an organization that's part of an enterprise
account. For more information,
see "[About enterprise accounts](https://docs.github.com/admin/overview/about-
enterprise-accounts)."
"""

description: NotRequired[Union[str, None]]
html_url: str
website_url: NotRequired[Union[str, None]]
id: int
node_id: str
name: str
slug: str
created_at: Union[datetime, None]
updated_at: Union[datetime, None]
avatar_url: str


class SimpleInstallationType(TypedDict):
"""Simple Installation

Expand Down Expand Up @@ -14649,6 +14673,7 @@ class UserSshSigningKeysPostBodyType(TypedDict):
"HovercardType",
"HovercardPropContextsItemsType",
"KeySimpleType",
"EnterpriseWebhooksType",
"SimpleInstallationType",
"OrganizationSimpleWebhooksType",
"RepositoryWebhooksType",
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ output_dir = "githubkit/rest/"
"string",
"null",
] }
"/components/schemas/organization-full/properties/name" = { type = [
"string",
"null",
] }
"/components/schemas/organization-full/properties/blog" = { type = [
"string",
"null",
] }
"/components/schemas/team-organization/properties/company" = { type = [
"string",
"null",
Expand All @@ -203,6 +211,14 @@ output_dir = "githubkit/rest/"
"string",
"null",
] }
"/components/schemas/team-organization/properties/name" = { type = [
"string",
"null",
] }
"/components/schemas/team-organization/properties/blog" = { type = [
"string",
"null",
] }

# copilot-seat-details/assignee is not valid
"/components/schemas/copilot-seat-details/properties/assignee" = { enum = "<unset>", oneOf = [
Expand Down