mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 17:56:00 -04:00
bace3bfb58
* feat(oauth): implement refresh credentials functionality - Added RefreshCredentials endpoint to handle OAuth credential refresh requests. - Introduced RequestOAuthRefreshCredentials structure for request validation. - Updated access types and actions to include refresh credentials. - Enhanced server routing and controller logic to support the new functionality. - Updated OAuth entities to include expiration handling for refreshed credentials. * feat(oauth): add metadata field to OAuthGetCredentialsResult --------- Co-authored-by: Harry <xh001x@hotmail.com>
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
// Code generated by controller generator. DO NOT EDIT.
|
|
|
|
package controllers
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/service"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/types/app"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/requests"
|
|
)
|
|
|
|
func GetAuthorizationURL(config *app.Config) gin.HandlerFunc {
|
|
type request = plugin_entities.InvokePluginRequest[requests.RequestOAuthGetAuthorizationURL]
|
|
|
|
return func(c *gin.Context) {
|
|
BindPluginDispatchRequest(
|
|
c,
|
|
func(itr request) {
|
|
service.GetAuthorizationURL(&itr, c, config.PluginMaxExecutionTimeout)
|
|
},
|
|
)
|
|
}
|
|
}
|
|
|
|
func GetCredentials(config *app.Config) gin.HandlerFunc {
|
|
type request = plugin_entities.InvokePluginRequest[requests.RequestOAuthGetCredentials]
|
|
|
|
return func(c *gin.Context) {
|
|
BindPluginDispatchRequest(
|
|
c,
|
|
func(itr request) {
|
|
service.GetCredentials(&itr, c, config.PluginMaxExecutionTimeout)
|
|
},
|
|
)
|
|
}
|
|
}
|
|
|
|
func RefreshCredentials(config *app.Config) gin.HandlerFunc {
|
|
type request = plugin_entities.InvokePluginRequest[requests.RequestOAuthRefreshCredentials]
|
|
|
|
return func(c *gin.Context) {
|
|
BindPluginDispatchRequest(
|
|
c,
|
|
func(itr request) {
|
|
service.RefreshCredentials(&itr, c, config.PluginMaxExecutionTimeout)
|
|
},
|
|
)
|
|
}
|
|
}
|