mirror of https://github.com/zulip/zulip.git
webhooks: Strengthen format_pull_request_event type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
d001676728
commit
1212083218
|
@ -1,7 +1,8 @@
|
|||
# vim:fenc=utf-8
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||
|
@ -147,10 +148,15 @@ def api_gogs_webhook(
|
|||
)
|
||||
|
||||
|
||||
class FormatPullRequestEvent(Protocol):
|
||||
def __call__(self, payload: Dict[str, Any], include_title: bool) -> str:
|
||||
...
|
||||
|
||||
|
||||
def gogs_webhook_main(
|
||||
integration_name: str,
|
||||
http_header_name: str,
|
||||
format_pull_request_event: Callable[..., Any],
|
||||
format_pull_request_event: FormatPullRequestEvent,
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
payload: Dict[str, Any],
|
||||
|
|
Loading…
Reference in New Issue