Skip to content
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
6 changes: 6 additions & 0 deletions codegen/templates/rest/_request.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,9 @@ error_models={
},
{% endif %}
{% endmacro %}

{% macro build_request_deprecated_decorator(endpoint) %}
{% if endpoint.deprecated -%}
@deprecated("Deprecated API endpoint. See the docstring for more details.")
{% endif %}
{% endmacro%}
9 changes: 8 additions & 1 deletion codegen/templates/rest/client.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

{% from "rest/_param.py.jinja" import endpoint_params, endpoint_raw_params, endpoint_model_params %}
{% from "rest/_response.py.jinja" import build_response_type %}
{% from "rest/_request.py.jinja" import build_request, build_request_params %}
{% from "rest/_request.py.jinja" import build_request, build_request_params, build_request_deprecated_decorator %}
{% from "rest/_docstring.py.jinja" import build_docstring %}

from __future__ import annotations

from collections.abc import Mapping
from weakref import ref
from typing import TYPE_CHECKING, Literal, Optional, Annotated, overload
from typing_extensions import deprecated

from pydantic import BaseModel, Field

Expand Down Expand Up @@ -78,6 +79,7 @@ class {{ pascal_case(tag) }}Client:
{% if endpoint.request_body and endpoint.request_body.allowed_models %}
{# generate raw data overload #}
@overload
{{ build_request_deprecated_decorator(endpoint) }}
def {{ endpoint.name }}(
self,
{{ endpoint_raw_params(endpoint) | indent(8) }}
Expand All @@ -87,6 +89,7 @@ class {{ pascal_case(tag) }}Client:
{# generate model data overload #}
{% for model in endpoint.request_body.allowed_models %}
@overload
{{ build_request_deprecated_decorator(endpoint) }}
def {{ endpoint.name }}(
self,
{{ endpoint_model_params(endpoint, model) | indent(8) }}
Expand All @@ -95,6 +98,7 @@ class {{ pascal_case(tag) }}Client:

{% endfor %}
{% endif %}
{{ build_request_deprecated_decorator(endpoint) }}
def {{ endpoint.name }}(
self,
{{ endpoint_params(endpoint) | indent(8) }}
Expand All @@ -109,6 +113,7 @@ class {{ pascal_case(tag) }}Client:
{% if endpoint.request_body and endpoint.request_body.allowed_models %}
{# generate raw data overload #}
@overload
{{ build_request_deprecated_decorator(endpoint) }}
async def async_{{ endpoint.name }}(
self,
{{ endpoint_raw_params(endpoint) | indent(8) }}
Expand All @@ -118,6 +123,7 @@ class {{ pascal_case(tag) }}Client:
{# generate model data overload #}
{% for model in endpoint.request_body.allowed_models %}
@overload
{{ build_request_deprecated_decorator(endpoint) }}
async def async_{{ endpoint.name }}(
self,
{{ endpoint_model_params(endpoint, model) | indent(8) }}
Expand All @@ -126,6 +132,7 @@ class {{ pascal_case(tag) }}Client:

{% endfor %}
{% endif %}
{{ build_request_deprecated_decorator(endpoint) }}
async def async_{{ endpoint.name }}(
self,
{{ endpoint_params(endpoint) | indent(8) }}
Expand Down
19 changes: 19 additions & 0 deletions githubkit/versions/ghec_v2022_11_28/rest/codespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from collections.abc import Mapping
from typing import TYPE_CHECKING, Literal, Optional, overload
from typing_extensions import deprecated
from weakref import ref

from pydantic import BaseModel
Expand Down Expand Up @@ -208,6 +209,7 @@ async def async_list_in_organization(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access(
self,
org: str,
Expand All @@ -218,6 +220,7 @@ def set_codespaces_access(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access(
self,
org: str,
Expand All @@ -234,6 +237,7 @@ def set_codespaces_access(
selected_usernames: Missing[list[str]] = UNSET,
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access(
self,
org: str,
Expand Down Expand Up @@ -282,6 +286,7 @@ def set_codespaces_access(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access(
self,
org: str,
Expand All @@ -292,6 +297,7 @@ async def async_set_codespaces_access(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access(
self,
org: str,
Expand All @@ -308,6 +314,7 @@ async def async_set_codespaces_access(
selected_usernames: Missing[list[str]] = UNSET,
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access(
self,
org: str,
Expand Down Expand Up @@ -356,6 +363,7 @@ async def async_set_codespaces_access(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access_users(
self,
org: str,
Expand All @@ -366,6 +374,7 @@ def set_codespaces_access_users(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access_users(
self,
org: str,
Expand All @@ -376,6 +385,7 @@ def set_codespaces_access_users(
selected_usernames: list[str],
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def set_codespaces_access_users(
self,
org: str,
Expand Down Expand Up @@ -434,6 +444,7 @@ def set_codespaces_access_users(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access_users(
self,
org: str,
Expand All @@ -444,6 +455,7 @@ async def async_set_codespaces_access_users(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access_users(
self,
org: str,
Expand All @@ -454,6 +466,7 @@ async def async_set_codespaces_access_users(
selected_usernames: list[str],
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_set_codespaces_access_users(
self,
org: str,
Expand Down Expand Up @@ -512,6 +525,7 @@ async def async_set_codespaces_access_users(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def delete_codespaces_access_users(
self,
org: str,
Expand All @@ -522,6 +536,7 @@ def delete_codespaces_access_users(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def delete_codespaces_access_users(
self,
org: str,
Expand All @@ -532,6 +547,7 @@ def delete_codespaces_access_users(
selected_usernames: list[str],
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def delete_codespaces_access_users(
self,
org: str,
Expand Down Expand Up @@ -590,6 +606,7 @@ def delete_codespaces_access_users(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_delete_codespaces_access_users(
self,
org: str,
Expand All @@ -600,6 +617,7 @@ async def async_delete_codespaces_access_users(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_delete_codespaces_access_users(
self,
org: str,
Expand All @@ -610,6 +628,7 @@ async def async_delete_codespaces_access_users(
selected_usernames: list[str],
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_delete_codespaces_access_users(
self,
org: str,
Expand Down
11 changes: 11 additions & 0 deletions githubkit/versions/ghec_v2022_11_28/rest/enterprise_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from collections.abc import Mapping
from typing import TYPE_CHECKING, Literal, Optional, overload
from typing_extensions import deprecated
from weakref import ref

from pydantic import BaseModel
Expand Down Expand Up @@ -5418,6 +5419,7 @@ async def async_list_push_bypass_requests(
},
)

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def get_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand Down Expand Up @@ -5461,6 +5463,7 @@ def get_security_analysis_settings_for_enterprise(
},
)

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_get_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand Down Expand Up @@ -5505,6 +5508,7 @@ async def async_get_security_analysis_settings_for_enterprise(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand All @@ -5517,6 +5521,7 @@ def patch_security_analysis_settings_for_enterprise(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
def patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand All @@ -5537,6 +5542,7 @@ def patch_security_analysis_settings_for_enterprise(
] = UNSET,
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand Down Expand Up @@ -5596,6 +5602,7 @@ def patch_security_analysis_settings_for_enterprise(
)

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand All @@ -5608,6 +5615,7 @@ async def async_patch_security_analysis_settings_for_enterprise(
) -> Response: ...

@overload
@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand All @@ -5628,6 +5636,7 @@ async def async_patch_security_analysis_settings_for_enterprise(
] = UNSET,
) -> Response: ...

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_patch_security_analysis_settings_for_enterprise(
self,
enterprise: str,
Expand Down Expand Up @@ -8928,6 +8937,7 @@ async def async_get_enterprise_ruleset_version(
},
)

@deprecated("Deprecated API endpoint. See the docstring for more details.")
def post_security_product_enablement_for_enterprise(
self,
enterprise: str,
Expand Down Expand Up @@ -8976,6 +8986,7 @@ def post_security_product_enablement_for_enterprise(
},
)

@deprecated("Deprecated API endpoint. See the docstring for more details.")
async def async_post_security_product_enablement_for_enterprise(
self,
enterprise: str,
Expand Down
Loading
Loading