mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
6d5d601804
* feat(oauth): implement OAuth authorization URL and credentials retrieval - Added OAuthGetAuthorizationUrlRequest and OAuthGetCredentialsRequest models for handling OAuth requests. - Introduced methods in PluginExecutor for generating OAuth authorization URLs and retrieving OAuth credentials. - Updated ToolProvider interface to include OAuth methods for authorization URL and credentials handling. - Refactored PluginInvokeType and related action enums to support OAuth actions.
28 lines
714 B
Python
28 lines
714 B
Python
from collections.abc import Mapping
|
|
from typing import Any, Protocol
|
|
|
|
from werkzeug import Request
|
|
|
|
|
|
class OAuthProviderProtocol(Protocol):
|
|
def oauth_get_authorization_url(self, system_credentials: Mapping[str, Any]) -> str:
|
|
"""
|
|
Get the authorization url
|
|
:param system_credentials: system credentials
|
|
:return: authorization url
|
|
"""
|
|
...
|
|
|
|
def oauth_get_credentials(
|
|
self,
|
|
system_credentials: Mapping[str, Any],
|
|
request: Request,
|
|
) -> Mapping[str, Any]:
|
|
"""
|
|
Get the credentials
|
|
:param request: request
|
|
:param system_credentials: system credentials
|
|
:return: credentials
|
|
"""
|
|
...
|