mattermost-community-enterp.../public/pluginapi/oauth.go
Claude ec1f89217a Merge: Complete Mattermost Server with Community Enterprise
Full Mattermost server source with integrated Community Enterprise features.
Includes vendor directory for offline/air-gapped builds.

Structure:
- enterprise-impl/: Enterprise feature implementations
- enterprise-community/: Init files that register implementations
- enterprise/: Bridge imports (community_imports.go)
- vendor/: All dependencies for offline builds

Build (online):
  go build ./cmd/mattermost

Build (offline/air-gapped):
  go build -mod=vendor ./cmd/mattermost

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 23:59:07 +09:00

56 lines
1.2 KiB
Go

package pluginapi
import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/plugin"
)
// UserService exposes methods to manipulate OAuth Apps.
type OAuthService struct {
api plugin.API
}
// Create creates a new OAuth App.
//
// Minimum server version: 5.38
func (o *OAuthService) Create(app *model.OAuthApp) error {
createdApp, appErr := o.api.CreateOAuthApp(app)
if appErr != nil {
return normalizeAppErr(appErr)
}
*app = *createdApp
return nil
}
// Get gets an existing OAuth App by id.
//
// Minimum server version: 5.38
func (o *OAuthService) Get(appID string) (*model.OAuthApp, error) {
app, appErr := o.api.GetOAuthApp(appID)
return app, normalizeAppErr(appErr)
}
// Update updates an existing OAuth App.
//
// Minimum server version: 5.38
func (o *OAuthService) Update(app *model.OAuthApp) error {
updatedApp, appErr := o.api.UpdateOAuthApp(app)
if appErr != nil {
return normalizeAppErr(appErr)
}
*app = *updatedApp
return nil
}
// Delete deletes an existing OAuth App by id.
//
// Minimum server version: 5.38
func (o *OAuthService) Delete(appID string) error {
return normalizeAppErr(o.api.DeleteOAuthApp(appID))
}