|
1 |
| -from sentry.shared_integrations.client import BaseApiClient, BaseInternalApiClient |
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from collections.abc import Mapping |
| 4 | +from typing import Literal, overload |
| 5 | + |
| 6 | +from requests import PreparedRequest, Response |
| 7 | + |
| 8 | +from sentry.shared_integrations.client.base import BaseApiClient, BaseApiResponseX |
| 9 | +from sentry.shared_integrations.client.internal import BaseInternalApiClient |
2 | 10 | from sentry.shared_integrations.exceptions import ApiUnauthorized
|
3 | 11 | from sentry.users.services.usersocialauth.service import usersocialauth_service
|
4 | 12 |
|
@@ -36,6 +44,44 @@ def bind_auth(self, **kwargs):
|
36 | 44 | kwargs["headers"]["Authorization"] = f"Bearer {token}"
|
37 | 45 | return kwargs
|
38 | 46 |
|
| 47 | + @overload |
| 48 | + def _request( |
| 49 | + self, |
| 50 | + method: str, |
| 51 | + path: str, |
| 52 | + headers: Mapping[str, str] | None = None, |
| 53 | + data: Mapping[str, str] | None = None, |
| 54 | + params: Mapping[str, str] | None = None, |
| 55 | + auth: tuple[str, str] | str | None = None, |
| 56 | + json: bool = True, |
| 57 | + allow_text: bool | None = None, |
| 58 | + allow_redirects: bool | None = None, |
| 59 | + timeout: int | None = None, |
| 60 | + ignore_webhook_errors: bool = False, |
| 61 | + prepared_request: PreparedRequest | None = None, |
| 62 | + raw_response: Literal[True] = ..., |
| 63 | + ) -> Response: |
| 64 | + ... |
| 65 | + |
| 66 | + @overload |
| 67 | + def _request( |
| 68 | + self, |
| 69 | + method: str, |
| 70 | + path: str, |
| 71 | + headers: Mapping[str, str] | None = None, |
| 72 | + data: Mapping[str, str] | None = None, |
| 73 | + params: Mapping[str, str] | None = None, |
| 74 | + auth: str | None = None, |
| 75 | + json: bool = True, |
| 76 | + allow_text: bool | None = None, |
| 77 | + allow_redirects: bool | None = None, |
| 78 | + timeout: int | None = None, |
| 79 | + ignore_webhook_errors: bool = False, |
| 80 | + prepared_request: PreparedRequest | None = None, |
| 81 | + raw_response: bool = ..., |
| 82 | + ) -> BaseApiResponseX: |
| 83 | + ... |
| 84 | + |
39 | 85 | def _request(self, method, path, **kwargs):
|
40 | 86 | headers = kwargs.setdefault("headers", {})
|
41 | 87 | headers.setdefault("Accept", "application/json, application/xml")
|
|
0 commit comments